branch develop updated (17a58d5 -> 2aa851d)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository faxtomail. See http://git.codelutin.com/faxtomail.git from 17a58d5 [jgitflow-maven-plugin]Updating develop poms back to pre merge state new a4e927e - ajout des marques par domaine dans le modele - ajout d'une liste de clients qui matchent lors de la réception - interface admin bien avancée new 8730ee6 - fin de l'interface d'admin des marques par nom de domaine - ajout d'un bouton pour choisir parmi les clients détectés lors de la réception new 67d677b fix migration scripts new 2aa851d fixes #7060 Authentification des clients des éléments (noms de domaines par marque) The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 2aa851dd8ab318d8e65fc859ba0b0a183e8ecd88 Merge: 17a58d5 67d677b Author: Kevin Morin <morin@codelutin.com> Date: Wed May 6 11:48:44 2015 +0200 fixes #7060 Authentification des clients des éléments (noms de domaines par marque) commit 67d677b38c60acd24d62126292c9fe8ea16bf264 Author: Kevin Morin <morin@codelutin.com> Date: Wed May 6 11:47:55 2015 +0200 fix migration scripts commit 8730ee6a2c2baea3c4ebe15f430df7797cf6947f Author: Kevin Morin <morin@codelutin.com> Date: Tue May 5 18:26:31 2015 +0200 - fin de l'interface d'admin des marques par nom de domaine - ajout d'un bouton pour choisir parmi les clients détectés lors de la réception commit a4e927e2b05966e4e4563ce6b31a4247f049c4af Author: Kevin Morin <morin@codelutin.com> Date: Mon May 4 18:31:23 2015 +0200 - ajout des marques par domaine dans le modele - ajout d'une liste de clients qui matchent lors de la réception - interface admin bien avancée Summary of changes: .gitignore | 1 + .../persistence/entities/BrandsForDomainImpl.java | 35 +- .../src/main/resources/faxToMail.properties | 2 +- .../src/main/xmi/faxtomail.properties | 10 +- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 30153 -> 31055 bytes .../faxtomail/services/DecoratorServiceImpl.java | 2 + .../services/FaxToMailServiceSupport.java | 1 + .../faxtomail/services/service/ClientService.java | 4 +- .../services/service/ClientServiceImpl.java | 34 +- .../services/service/ConfigurationService.java | 8 +- .../services/service/ConfigurationServiceImpl.java | 48 +- .../services/service/EmailServiceImpl.java | 1 + .../services/service/InitFaxToMailServiceImpl.java | 25 +- ...s_for_domain_and_matching_clients_in_emails.sql | 29 + ...s_for_domain_and_matching_clients_in_emails.sql | 32 + .../services/service/ClientServiceTest.java | 37 +- .../ui/swing/content/demande/DemandeUI.css | 5 + .../ui/swing/content/demande/DemandeUI.jaxx | 25 +- .../ui/swing/content/demande/DemandeUIHandler.java | 25 +- .../ui/swing/content/demande/DemandeUIModel.java | 14 +- .../src/main/resources/icons/action-warning.png | Bin 0 -> 666 bytes .../web/action/admin/ConfigurationAction.java | 17 +- .../faxtomail/web/job/MailFilterJob.java | 17 +- .../WEB-INF/content/admin/configuration-input.jsp | 53 + .../src/main/webapp/js/configuration.js | 32 + pom.xml | 2 +- trunk/LICENSE.txt | 674 --------- trunk/README.txt | 0 trunk/faxtomail-persistence/LICENSE.txt | 674 --------- trunk/faxtomail-persistence/README.txt | 0 trunk/faxtomail-persistence/pom.xml | 165 --- .../src/license/THIRD-PARTY.properties | 53 - .../faxtomail/FaxToMailConfiguration.java | 426 ------ .../faxtomail/FaxToMailConfigurationOption.java | 385 ----- .../faxtomail/FaxToMailConfigurationProvider.java | 62 - .../faxtomail/persistence/ProgressionModel.java | 48 - .../persistence/RessourceClassLoader.java | 189 --- .../entities/AbstractFaxToMailTopiaDao.java | 61 - .../persistence/entities/AttachmentFileImpl.java | 115 -- .../faxtomail/persistence/entities/ClientImpl.java | 65 - .../persistence/entities/ClientTopiaDao.java | 58 - .../persistence/entities/DemandStatus.java | 62 - .../faxtomail/persistence/entities/EdiReturn.java | 38 - .../persistence/entities/EmailFilter.java | 303 ---- .../faxtomail/persistence/entities/EmailImpl.java | 201 --- .../persistence/entities/EmailProtocol.java | 44 - .../persistence/entities/EmailTopiaDao.java | 1027 ------------- .../entities/ExtensionCommandTopiaDao.java | 42 - .../persistence/entities/HistoryImpl.java | 52 - .../persistence/entities/HistoryType.java | 63 - .../faxtomail/persistence/entities/MailAction.java | 37 - .../faxtomail/persistence/entities/MailField.java | 100 -- .../persistence/entities/MailFilterTopiaDao.java | 50 - .../persistence/entities/MailFolderImpl.java | 66 - .../persistence/entities/MailFolderTopiaDao.java | 75 - .../faxtomail/persistence/entities/NewClient.java | 45 - .../persistence/entities/SearchFilter.java | 461 ------ .../persistence/entities/WaitingStateTopiaDao.java | 87 -- .../persistence/hibernate/EnumListUserType.java | 155 -- .../persistence/hibernate/EnumSetUserType.java | 161 -- .../hibernate/MailActionEnumSetUserType.java | 35 - .../hibernate/MailFieldEnumListUserType.java | 35 - .../hibernate/MailFieldEnumSetUserType.java | 35 - .../org.nuiton.config.ApplicationConfigProvider | 1 - .../src/main/resources/faxToMail.properties | 43 - .../i18n/faxtomail-persistence_fr_FR.properties | 46 - .../src/main/xmi/faxtomail.properties | 130 -- .../src/main/xmi/faxtomail.zargo | Bin 29652 -> 0 bytes trunk/faxtomail-service/LICENSE.txt | 674 --------- trunk/faxtomail-service/README.txt | 0 trunk/faxtomail-service/pom.xml | 234 --- .../src/license/THIRD-PARTY.properties | 37 - .../faxtomail/services/DecoratorService.java | 46 - .../faxtomail/services/DecoratorServiceImpl.java | 143 -- .../faxtomail/services/FaxToMailDecorator.java | 285 ---- .../faxtomail/services/FaxToMailService.java | 30 - .../services/FaxToMailServiceContext.java | 260 ---- .../services/FaxToMailServiceFactory.java | 36 - .../FaxToMailServiceInvocationHandler.java | 58 - .../services/FaxToMailServiceSupport.java | 85 -- .../faxtomail/services/FaxToMailServiceUtils.java | 77 - .../faxtomail/services/service/ClientService.java | 40 - .../services/service/ClientServiceImpl.java | 284 ---- .../services/service/ConfigurationService.java | 71 - .../services/service/ConfigurationServiceImpl.java | 606 -------- .../faxtomail/services/service/EmailService.java | 139 -- .../services/service/EmailServiceImpl.java | 1532 -------------------- .../services/service/InitFaxToMailService.java | 34 - .../services/service/InitFaxToMailServiceImpl.java | 465 ------ .../faxtomail/services/service/LdapService.java | 42 - .../services/service/LdapServiceImpl.java | 395 ----- .../services/service/MailFolderService.java | 65 - .../services/service/MailFolderServiceImpl.java | 328 ----- .../services/service/ReferentielService.java | 68 - .../services/service/ReferentielServiceImpl.java | 373 ----- .../faxtomail/services/service/UserService.java | 56 - .../services/service/UserServiceImpl.java | 95 -- .../services/service/ValidationService.java | 36 - .../services/service/ValidationServiceImpl.java | 48 - .../exceptions/AlreadyLockedMailException.java | 49 - .../exceptions/FolderNotReadableException.java | 44 - .../service/exceptions/InvalidClientException.java | 41 - .../service/imports/ArchiveImportBean.java | 73 - .../service/imports/ArchiveImportModel.java | 129 -- .../services/service/imports/ClientImportBean.java | 56 - .../service/imports/ClientImportModel.java | 92 -- .../service/imports/DemandTypeImportModel.java | 47 - .../service/imports/EmailAccountImportModel.java | 72 - .../service/imports/EmailFilterImportModel.java | 64 - .../service/imports/PriorityImportModel.java | 47 - .../services/service/imports/RangeImportModel.java | 47 - .../service/imports/WaitingStateImportModel.java | 47 - .../service/ldap/AuthenticationException.java | 36 - .../services/service/ldap/LdapServiceMock.java | 115 -- .../migration/FaxtomailFlywayMigrationService.java | 57 - .../validators/FaxToMailEmailValidator.java | 42 - .../entities/Email-error-validation.xml | 51 - ..._0_442__move_object_to_folder_configuration.sql | 60 - ..._0_448__add_mail_folder_level_configuration.sql | 6 - .../migration/h2/V1_0_0_454__add_ldap_config.sql | 6 - ...omailusergroup_loop_association_and_add_idx.sql | 39 - .../h2/V1_0_0_520__add_performance_indexes.sql | 18 - .../h2/V1_0_0_580__transform_enum_set_to_lists.sql | 25 - .../V1_0_0_583__readd_editranfer_on_demandtype.sql | 4 - .../h2/V1_0_0_597__mise_a_jour_performances.sql | 81 -- ...1_0_0_620__modification_newclient_edireturn.sql | 43 - .../h2/V1_0_0_662__add_company_in_mailfolder.sql | 5 - ..._0_442__move_object_to_folder_configuration.sql | 60 - ..._0_448__add_mail_folder_level_configuration.sql | 6 - .../postgres/V1_0_0_454__add_ldap_config.sql | 6 - ...omailusergroup_loop_association_and_add_idx.sql | 39 - .../V1_0_0_520__add_performance_indexes.sql | 18 - .../V1_0_0_580__transform_enum_set_to_lists.sql | 25 - .../V1_0_0_583__readd_editranfer_on_demandtype.sql | 4 - .../V1_0_0_597__mise_a_jour_performances.sql | 81 -- ...1_0_0_620__modification_newclient_edireturn.sql | 43 - .../V1_0_0_662__add_company_in_mailfolder.sql | 5 - ..._0_442__move_object_to_folder_configuration.sql | 66 - ..._0_448__add_mail_folder_level_configuration.sql | 7 - .../sqlserver/V1_0_0_454__add_ldap_config.sql | 7 - ...omailusergroup_loop_association_and_add_idx.sql | 47 - .../V1_0_0_520__add_performance_indexes.sql | 18 - .../V1_0_0_580__transform_enum_set_to_lists.sql | 33 - .../V1_0_0_583__readd_editranfer_on_demandtype.sql | 5 - .../V1_0_0_597__mise_a_jour_performances.sql | 90 -- ...1_0_0_620__modification_newclient_edireturn.sql | 50 - .../V1_0_0_662__add_company_in_mailfolder.sql | 6 - .../i18n/faxtomail-service_fr_FR.properties | 6 - .../src/main/resources/pdf/demande.mustache | 124 -- .../src/main/resources/validators.xml | 51 - .../service/AbstractFaxToMailServiceTest.java | 253 ---- .../services/service/ClientServiceTest.java | 123 -- .../services/service/EmailServiceTest.java | 217 --- .../faxtomail/services/service/InitTestData.java | 38 - .../services/service/InitTestDataImpl.java | 354 ----- .../services/service/MailFolderServiceTest.java | 82 -- .../faxtomail/services/service/MiscTest.java | 83 -- .../service/migration/FlywayMigrationTest.java | 117 -- .../src/test/resources/archives/archives.csv | 2 - .../src/test/resources/archives/att1.txt | 1 - .../src/test/resources/archives/att2.txt | 1 - .../src/test/resources/csv/clients.csv | 5 - .../src/test/resources/csv/demandtypes.csv | 4 - .../src/test/resources/csv/email_accounts.csv | 2 - .../src/test/resources/csv/email_filters.csv | 8 - .../src/test/resources/csv/etatattentes.csv | 6 - .../src/test/resources/csv/fx_clients.csv | 5 - .../src/test/resources/csv/priorities.csv | 5 - .../src/test/resources/csv/ranges.csv | 6 - .../src/test/resources/db/h2data-1_0_0_rc2.h2.db | Bin 509952 -> 0 bytes .../src/test/resources/log4j2.xml | 42 - trunk/faxtomail-ui-swing/LICENSE.txt | 674 --------- trunk/faxtomail-ui-swing/README.txt | 0 trunk/faxtomail-ui-swing/pom.xml | 764 ---------- .../src/license/THIRD-PARTY.properties | 69 - .../src/main/assembly/faxtomail-full-component.xml | 108 -- .../src/main/assembly/full-linux-i586.xml | 53 - .../src/main/assembly/full-linux-x64.xml | 53 - .../src/main/assembly/full-windows-i586.xml | 53 - .../src/main/assembly/full-windows-x64.xml | 52 - .../src/main/assembly/full/faxtomail.bat | 27 - .../src/main/assembly/full/faxtomail.sh | 51 - .../faxtomail-ui-swing/src/main/assembly/i18n.xml | 53 - .../src/main/assembly/min/README.txt | 0 .../src/main/assembly/min/launch.bat | 10 - .../src/main/assembly/min/launch.sh | 35 - .../src/main/assembly/standalone.xml | 74 - .../main/filtered-resources/faxToMail.properties | 25 - .../faxtomail/ui/swing/FaxToMailActionFactory.java | 58 - .../faxtomail/ui/swing/FaxToMailScreen.java | 37 - .../faxtomail/ui/swing/FaxToMailUIContext.java | 768 ---------- .../faxtomail/ui/swing/RunFaxToMail.java | 181 --- .../swing/actions/AbstractChangeScreenAction.java | 121 -- .../ui/swing/actions/AbstractFaxToMailAction.java | 80 - .../actions/AbstractMainUIFaxToMailAction.java | 38 - .../ui/swing/actions/AddAttachmentAction.java | 72 - .../swing/actions/AddAttachmentToReplyAction.java | 70 - .../faxtomail/ui/swing/actions/ArchiveAction.java | 106 -- .../ui/swing/actions/ArchiveFromListAction.java | 152 -- .../ui/swing/actions/CloseApplicationAction.java | 55 - .../actions/ComputeQuantitiesByRangeAction.java | 94 -- .../ui/swing/actions/EditAttachmentAction.java | 99 -- .../actions/GenerateAnnotatedAttachmentAction.java | 337 ----- .../ui/swing/actions/GoToPreviousScreenAction.java | 43 - .../faxtomail/ui/swing/actions/GroupAction.java | 94 -- .../ui/swing/actions/LoadFolderEmailsAction.java | 187 --- .../ui/swing/actions/OpenAttachmentAction.java | 61 - .../ui/swing/actions/OpenGroupedDemandAction.java | 176 --- .../OpenMailFolderChooserFromListAction.java | 109 -- .../swing/actions/PrintOnDefaultPrinterAction.java | 187 --- .../ui/swing/actions/ReloadFaxToMailAction.java | 49 - .../faxtomail/ui/swing/actions/ReplyAction.java | 92 -- .../SaveAndOpenChooseAttachmentToPrintAction.java | 68 - .../SaveAndOpenMailFolderChooserAction.java | 68 - .../swing/actions/SaveAndOpenModalFrameAction.java | 66 - .../swing/actions/SaveAndOpenReplyFormAction.java | 76 - .../actions/SaveAndOpenSearchToGroupAction.java | 59 - .../ui/swing/actions/SaveDemandeAction.java | 151 -- .../ui/swing/actions/SaveDemandeAndExitAction.java | 44 - .../swing/actions/SaveDemandeFromListAction.java | 72 - .../faxtomail/ui/swing/actions/SearchAction.java | 109 -- .../ui/swing/actions/SearchToGroupAction.java | 120 -- .../ui/swing/actions/ShowAboutAction.java | 91 -- .../ui/swing/actions/ShowDemandeAction.java | 170 --- .../ui/swing/actions/ShowDemandeListAction.java | 52 - .../ui/swing/actions/ShowRechercheAction.java | 47 - .../faxtomail/ui/swing/actions/TransmitAction.java | 140 -- .../faxtomail/ui/swing/content/Common.css | 26 - .../faxtomail/ui/swing/content/MainUI.css | 86 -- .../faxtomail/ui/swing/content/MainUI.jaxx | 68 - .../faxtomail/ui/swing/content/MainUIHandler.java | 391 ----- .../content/attachment/AttachmentCellEditor.java | 190 --- .../content/attachment/AttachmentCellRenderer.java | 120 -- .../content/attachment/AttachmentEditorUI.css | 59 - .../content/attachment/AttachmentEditorUI.jaxx | 72 - .../attachment/AttachmentEditorUIHandler.java | 262 ---- .../attachment/AttachmentEditorUIModel.java | 135 -- .../ui/swing/content/attachment/AttachmentItem.css | 61 - .../swing/content/attachment/AttachmentItem.jaxx | 51 - .../content/attachment/AttachmentModelAware.java | 49 - .../swing/content/attachment/ButtonAttachment.java | 112 -- .../content/demande/DemandeListTableFilter.java | 302 ---- .../ui/swing/content/demande/DemandeListUI.css | 156 -- .../ui/swing/content/demande/DemandeListUI.jaxx | 120 -- .../content/demande/DemandeListUIHandler.java | 636 -------- .../swing/content/demande/DemandeListUIModel.java | 290 ---- .../ui/swing/content/demande/DemandeUI.css | 342 ----- .../ui/swing/content/demande/DemandeUI.jaxx | 336 ----- .../ui/swing/content/demande/DemandeUIHandler.java | 535 ------- .../ui/swing/content/demande/DemandeUIModel.java | 969 ------------- .../ui/swing/content/demande/DemandesUI.css | 71 - .../ui/swing/content/demande/DemandesUI.jaxx | 66 - .../swing/content/demande/DemandesUIHandler.java | 346 ----- .../ui/swing/content/demande/DemandesUIModel.java | 176 --- .../swing/content/demande/QuantitiesByRangeUI.css | 30 - .../swing/content/demande/QuantitiesByRangeUI.jaxx | 53 - .../demande/QuantitiesByRangeUIHandler.java | 119 -- .../content/demande/QuantitiesByRangeUIModel.java | 66 - .../ui/swing/content/demande/RangeRowModel.java | 127 -- .../ui/swing/content/demande/RangeTableModel.java | 79 - .../demande/demandgroup/ButtonEmailGroup.java | 71 - .../demandgroup/DemandGroupCellRenderer.java | 106 -- .../demande/demandgroup/DemandGroupItem.css | 40 - .../demande/demandgroup/DemandGroupItem.jaxx | 50 - .../content/demande/demandgroup/DemandGroupUI.css | 34 - .../content/demande/demandgroup/DemandGroupUI.jaxx | 46 - .../demande/demandgroup/DemandGroupUIHandler.java | 181 --- .../content/demande/history/ButtonHistory.java | 86 -- .../swing/content/demande/history/HistoryItem.css | 63 - .../swing/content/demande/history/HistoryItem.jaxx | 60 - .../content/demande/history/HistoryItemModel.java | 103 -- .../content/demande/history/HistoryListUI.css | 30 - .../content/demande/history/HistoryListUI.jaxx | 44 - .../demande/history/HistoryListUIHandler.java | 233 --- .../demande/replies/ButtonDemandReplies.java | 102 -- .../content/demande/replies/DemandRepliesUI.css | 42 - .../content/demande/replies/DemandRepliesUI.jaxx | 49 - .../demande/replies/DemandRepliesUIHandler.java | 373 ----- .../content/demande/replies/DemandReplyItem.css | 51 - .../content/demande/replies/DemandReplyItem.jaxx | 58 - .../content/demande/replies/RepliesCellEditor.java | 133 -- .../demande/replies/RepliesCellRenderer.java | 108 -- .../swing/content/pdfeditor/PDFEditorCrossUI.css | 39 - .../swing/content/pdfeditor/PDFEditorCrossUI.jaxx | 63 - .../content/pdfeditor/PDFEditorHighlighterUI.css | 38 - .../content/pdfeditor/PDFEditorHighlighterUI.jaxx | 51 - .../ui/swing/content/pdfeditor/PDFEditorLineUI.css | 38 - .../swing/content/pdfeditor/PDFEditorLineUI.jaxx | 69 - .../ui/swing/content/pdfeditor/PDFEditorNoteUI.css | 56 - .../swing/content/pdfeditor/PDFEditorNoteUI.jaxx | 84 -- .../ui/swing/content/pdfeditor/PDFEditorUI.css | 128 -- .../ui/swing/content/pdfeditor/PDFEditorUI.jaxx | 104 -- .../content/pdfeditor/PDFEditorUIHandler.java | 584 -------- .../swing/content/pdfeditor/PDFEditorUIModel.java | 273 ---- .../content/print/AttachmentToPrintChooserUI.css | 40 - .../content/print/AttachmentToPrintChooserUI.jaxx | 62 - .../print/AttachmentToPrintChooserUIHandler.java | 177 --- .../print/AttachmentToPrintChooserUIModel.java | 76 - .../ui/swing/content/reply/AttachmentItem.css | 49 - .../ui/swing/content/reply/AttachmentItem.jaxx | 50 - .../swing/content/reply/ReplyAttachmentModel.java | 82 -- .../ui/swing/content/reply/ReplyFormUI.css | 150 -- .../ui/swing/content/reply/ReplyFormUI.jaxx | 171 --- .../ui/swing/content/reply/ReplyFormUIHandler.java | 440 ------ .../ui/swing/content/reply/ReplyFormUIModel.java | 357 ----- .../ui/swing/content/search/SearchToGroupUI.css | 333 ----- .../ui/swing/content/search/SearchToGroupUI.jaxx | 399 ----- .../content/search/SearchToGroupUIHandler.java | 383 ----- .../faxtomail/ui/swing/content/search/SearchUI.css | 332 ----- .../ui/swing/content/search/SearchUI.jaxx | 413 ------ .../ui/swing/content/search/SearchUIHandler.java | 354 ----- .../ui/swing/content/search/SearchUIModel.java | 471 ------ .../swing/content/transmit/MailFolderChooserUI.css | 47 - .../content/transmit/MailFolderChooserUI.jaxx | 54 - .../transmit/MailFolderChooserUIHandler.java | 144 -- .../content/transmit/MailFolderChooserUIModel.java | 68 - .../swing/util/AbstractFaxToMailBeanUIModel.java | 155 -- .../util/AbstractFaxToMailDemandListHandler.java | 349 ----- .../ui/swing/util/AbstractFaxToMailUIHandler.java | 489 ------- .../ui/swing/util/AbstractToolbarPopupButton.java | 116 -- .../ui/swing/util/AbstractToolbarPopupHandler.java | 150 -- .../ui/swing/util/AbstractToolbarPopupUI.css | 27 - .../ui/swing/util/AbstractToolbarPopupUI.jaxx | 56 - .../ui/swing/util/CheckBoxComboBoxModel.java | 81 -- .../ui/swing/util/CheckBoxListCellRenderer.java | 526 ------- .../faxtomail/ui/swing/util/DemandeTableModel.java | 199 --- .../ui/swing/util/FaxToMailExceptionHandler.java | 87 -- .../faxtomail/ui/swing/util/FaxToMailUI.java | 35 - .../faxtomail/ui/swing/util/FaxToMailUIUtil.java | 720 --------- .../faxtomail/ui/swing/util/FolderTreeNode.java | 67 - .../faxtomail/ui/swing/util/JImagePanel.java | 171 --- .../ui/swing/util/PaginationComboModel.java | 40 - .../util/RemoveablePropertyChangeListener.java | 33 - .../faxtomail/ui/swing/util/UIMessageNotifier.java | 33 - .../src/main/resources/PoetsenOne-Regular.ttf | Bin 172456 -> 0 bytes .../demande/DemandeUIModel-error-validation.xml | 111 -- .../reply/ReplyFormUIModel-error-validation.xml | 74 - .../i18n/faxtomail-ui-swing_fr_FR.properties | 332 ----- .../src/main/resources/icons/action-about.png | Bin 936 -> 0 bytes .../src/main/resources/icons/action-archive.png | Bin 766 -> 0 bytes .../src/main/resources/icons/action-attachment.png | Bin 391 -> 0 bytes .../src/main/resources/icons/action-cancel.png | Bin 587 -> 0 bytes .../src/main/resources/icons/action-collapse.png | Bin 372 -> 0 bytes .../src/main/resources/icons/action-compute.png | Bin 543 -> 0 bytes .../src/main/resources/icons/action-config.png | Bin 611 -> 0 bytes .../src/main/resources/icons/action-cross.png | Bin 626 -> 0 bytes .../src/main/resources/icons/action-delete.png | Bin 715 -> 0 bytes .../src/main/resources/icons/action-edit.png | Bin 450 -> 0 bytes .../main/resources/icons/action-email-group.png | Bin 821 -> 0 bytes .../src/main/resources/icons/action-email.png | Bin 783 -> 0 bytes .../src/main/resources/icons/action-exit.png | Bin 830 -> 0 bytes .../src/main/resources/icons/action-expand.png | Bin 371 -> 0 bytes .../main/resources/icons/action-folder_edit.png | Bin 733 -> 0 bytes .../src/main/resources/icons/action-group.png | Bin 343 -> 0 bytes .../main/resources/icons/action-highlighter.png | Bin 155 -> 0 bytes .../src/main/resources/icons/action-hline.png | Bin 344 -> 0 bytes .../src/main/resources/icons/action-import.png | Bin 532 -> 0 bytes .../src/main/resources/icons/action-left.png | Bin 345 -> 0 bytes .../src/main/resources/icons/action-line.png | Bin 344 -> 0 bytes .../src/main/resources/icons/action-list.png | Bin 675 -> 0 bytes .../src/main/resources/icons/action-new-demand.png | Bin 512 -> 0 bytes .../src/main/resources/icons/action-note.png | Bin 500 -> 0 bytes .../src/main/resources/icons/action-open-file.png | Bin 537 -> 0 bytes .../src/main/resources/icons/action-open.png | Bin 688 -> 0 bytes .../src/main/resources/icons/action-print.png | Bin 731 -> 0 bytes .../resources/icons/action-reload-application.png | Bin 525 -> 0 bytes .../resources/icons/action-reload-shortcut.png | Bin 570 -> 0 bytes .../src/main/resources/icons/action-reload-ui.png | Bin 795 -> 0 bytes .../src/main/resources/icons/action-reply.png | Bin 754 -> 0 bytes .../src/main/resources/icons/action-right.png | Bin 349 -> 0 bytes .../icons/action-rotate-anticlockwise.png | Bin 608 -> 0 bytes .../resources/icons/action-rotate-clockwise.png | Bin 602 -> 0 bytes .../src/main/resources/icons/action-save.png | Bin 620 -> 0 bytes .../src/main/resources/icons/action-search.png | Bin 692 -> 0 bytes .../src/main/resources/icons/action-transmit.png | Bin 694 -> 0 bytes .../src/main/resources/icons/action-user.png | Bin 741 -> 0 bytes .../src/main/resources/icons/action-validate.png | Bin 537 -> 0 bytes .../main/resources/icons/action-view-history.png | Bin 711 -> 0 bytes .../src/main/resources/icons/action-vline.png | Bin 370 -> 0 bytes .../src/main/resources/icons/action-zoom-in.png | Bin 680 -> 0 bytes .../src/main/resources/icons/action-zoom-out.png | Bin 657 -> 0 bytes .../src/main/resources/icons/add.png | Bin 733 -> 0 bytes .../src/main/resources/icons/application_home.png | Bin 685 -> 0 bytes .../src/main/resources/icons/cross_blue.png | Bin 2745 -> 0 bytes .../src/main/resources/icons/cross_red.png | Bin 1743 -> 0 bytes .../src/main/resources/icons/email.png | Bin 641 -> 0 bytes .../src/main/resources/icons/house.png | Bin 806 -> 0 bytes .../src/main/resources/log4j2.xml | 55 - .../src/main/resources/splashscreen.png | Bin 25809 -> 0 bytes trunk/faxtomail-ui-web/LICENSE.txt | 674 --------- trunk/faxtomail-ui-web/README.txt | 0 trunk/faxtomail-ui-web/pom.xml | 403 ----- .../src/license/THIRD-PARTY.properties | 70 - .../faxtomail/FaxToMailApplicationContext.java | 160 -- .../faxtomail/web/FaxToMailActionSupport.java | 170 --- .../web/FaxToMailApplicationListener.java | 163 --- .../faxtomail/web/FaxToMailInterceptor.java | 219 --- .../faxtomail/web/FaxToMailJsonAction.java | 52 - .../faxtomail/web/FaxToMailJsonResultSupport.java | 80 - .../faxtomail/web/FaxToMailLoginInterceptor.java | 66 - .../faxtomail/web/FaxToMailSession.java | 97 -- .../faxtomail/web/action/IndexAction.java | 44 - .../faxtomail/web/action/LoginAction.java | 76 - .../faxtomail/web/action/LogoutAction.java | 41 - .../web/action/admin/ConfigurationAction.java | 241 --- .../web/action/admin/ConfigurationJsonAction.java | 73 - .../faxtomail/web/action/admin/ImportAction.java | 149 -- .../web/action/admin/ImportArchiveAction.java | 137 -- .../faxtomail/web/action/admin/LdapAction.java | 109 -- .../faxtomail/web/action/admin/LockAction.java | 87 -- .../web/action/admin/UserFolderAction.java | 110 -- .../faxtomail/web/job/AbstractFaxToMailJob.java | 40 - .../faxtomail/web/job/ClientUpdateJob.java | 74 - .../faxtomail/web/job/EDIManagementJob.java | 79 - .../faxtomail/web/job/MailFilterJob.java | 846 ----------- .../web/json/HibernateProxyTypeAdapter.java | 82 -- .../faxtomail/web/json/TopiaEntityAdapter.java | 62 - .../i18n/faxtomail-ui-web_fr_FR.properties | 42 - .../faxtomail-ui-web/src/main/resources/log4j2.xml | 59 - .../src/main/resources/nuiton-js.properties | 34 - .../src/main/resources/quartz.properties | 28 - .../src/main/resources/struts.properties | 40 - .../faxtomail-ui-web/src/main/resources/struts.xml | 66 - .../src/main/resources/validators.xml | 74 - .../src/main/resources/xwork-conversion.properties | 25 - .../WEB-INF/content/admin/configuration-input.jsp | 1249 ---------------- .../WEB-INF/content/admin/import-archive-input.jsp | 66 - .../webapp/WEB-INF/content/admin/import-input.jsp | 91 -- .../webapp/WEB-INF/content/admin/ldap-input.jsp | 56 - .../webapp/WEB-INF/content/admin/ldap-wait.jsp | 44 - .../webapp/WEB-INF/content/admin/lock-input.jsp | 80 - .../WEB-INF/content/admin/user-folder-input.jsp | 93 -- .../src/main/webapp/WEB-INF/content/index.jsp | 51 - .../main/webapp/WEB-INF/content/login-input.jsp | 69 - .../src/main/webapp/WEB-INF/decorators.xml | 34 - .../src/main/webapp/WEB-INF/decorators/layout.jsp | 90 -- .../src/main/webapp/WEB-INF/web.xml | 70 - .../src/main/webapp/WEB-INF/wro.xml | 94 -- .../src/main/webapp/css/faxtomail.css | 94 -- .../src/main/webapp/js/configuration.js | 1330 ----------------- .../src/main/webapp/js/faxtomail.js | 94 -- .../faxtomail-ui-web/src/main/webapp/js/select2.js | 193 --- .../src/main/webapp/js/select2sortable.js | 254 ---- .../src/main/webapp/js/user-folder.js | 116 -- trunk/pom.xml | 875 ----------- trunk/src/site/resources/img/notepad.png | Bin 25930 -> 0 bytes trunk/src/site/resources/img/txt-to-csv.png | Bin 37447 -> 0 bytes trunk/src/site/rst/import.rst | 98 -- trunk/src/site/rst/index.rst | 29 - trunk/src/site/rst/install.rst | 98 -- trunk/src/site/rst/mssql.rst | 41 - trunk/src/site/site_fr.xml | 65 - 452 files changed, 384 insertions(+), 52128 deletions(-) rename trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentImpl.java => faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/BrandsForDomainImpl.java (55%) create mode 100644 faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql create mode 100644 faxtomail-service/src/main/resources/db/migration/sqlserver/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql create mode 100644 faxtomail-ui-swing/src/main/resources/icons/action-warning.png delete mode 100644 trunk/LICENSE.txt delete mode 100644 trunk/README.txt delete mode 100644 trunk/faxtomail-persistence/LICENSE.txt delete mode 100644 trunk/faxtomail-persistence/README.txt delete mode 100644 trunk/faxtomail-persistence/pom.xml delete mode 100644 trunk/faxtomail-persistence/src/license/THIRD-PARTY.properties delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationOption.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationProvider.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/ProgressionModel.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/RessourceClassLoader.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AbstractFaxToMailTopiaDao.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientImpl.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/DemandStatus.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EdiReturn.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailFilter.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailImpl.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailProtocol.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ExtensionCommandTopiaDao.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryImpl.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailField.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFilterTopiaDao.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderImpl.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderTopiaDao.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClient.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/SearchFilter.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/WaitingStateTopiaDao.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/EnumListUserType.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/EnumSetUserType.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/MailActionEnumSetUserType.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/MailFieldEnumListUserType.java delete mode 100644 trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/MailFieldEnumSetUserType.java delete mode 100644 trunk/faxtomail-persistence/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider delete mode 100644 trunk/faxtomail-persistence/src/main/resources/faxToMail.properties delete mode 100644 trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties delete mode 100644 trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties delete mode 100644 trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo delete mode 100644 trunk/faxtomail-service/LICENSE.txt delete mode 100644 trunk/faxtomail-service/README.txt delete mode 100644 trunk/faxtomail-service/pom.xml delete mode 100644 trunk/faxtomail-service/src/license/THIRD-PARTY.properties delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailDecorator.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailService.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceContext.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceFactory.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceInvocationHandler.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserServiceImpl.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ValidationService.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ValidationServiceImpl.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/exceptions/AlreadyLockedMailException.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/exceptions/FolderNotReadableException.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/exceptions/InvalidClientException.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ArchiveImportBean.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ArchiveImportModel.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportBean.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportModel.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/DemandTypeImportModel.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailAccountImportModel.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailFilterImportModel.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/PriorityImportModel.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/RangeImportModel.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/WaitingStateImportModel.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/AuthenticationException.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/migration/FaxtomailFlywayMigrationService.java delete mode 100644 trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/validators/FaxToMailEmailValidator.java delete mode 100644 trunk/faxtomail-service/src/main/resources/com/franciaflex/faxtomail/persistence/entities/Email-error-validation.xml delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_442__move_object_to_folder_configuration.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_448__add_mail_folder_level_configuration.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_454__add_ldap_config.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_480__remove_faxtomailusergroup_loop_association_and_add_idx.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_520__add_performance_indexes.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_580__transform_enum_set_to_lists.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_583__readd_editranfer_on_demandtype.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_597__mise_a_jour_performances.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_620__modification_newclient_edireturn.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_662__add_company_in_mailfolder.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_442__move_object_to_folder_configuration.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_448__add_mail_folder_level_configuration.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_454__add_ldap_config.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_480__remove_faxtomailusergroup_loop_association_and_add_idx.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_520__add_performance_indexes.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_580__transform_enum_set_to_lists.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_583__readd_editranfer_on_demandtype.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_597__mise_a_jour_performances.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_620__modification_newclient_edireturn.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_662__add_company_in_mailfolder.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_442__move_object_to_folder_configuration.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_448__add_mail_folder_level_configuration.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_454__add_ldap_config.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_480__remove_faxtomailusergroup_loop_association_and_add_idx.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_520__add_performance_indexes.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_580__transform_enum_set_to_lists.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_583__readd_editranfer_on_demandtype.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_597__mise_a_jour_performances.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_620__modification_newclient_edireturn.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_662__add_company_in_mailfolder.sql delete mode 100644 trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties delete mode 100644 trunk/faxtomail-service/src/main/resources/pdf/demande.mustache delete mode 100644 trunk/faxtomail-service/src/main/resources/validators.xml delete mode 100644 trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java delete mode 100644 trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/ClientServiceTest.java delete mode 100644 trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java delete mode 100644 trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestData.java delete mode 100644 trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestDataImpl.java delete mode 100644 trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MailFolderServiceTest.java delete mode 100644 trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java delete mode 100644 trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/migration/FlywayMigrationTest.java delete mode 100644 trunk/faxtomail-service/src/test/resources/archives/archives.csv delete mode 100644 trunk/faxtomail-service/src/test/resources/archives/att1.txt delete mode 100644 trunk/faxtomail-service/src/test/resources/archives/att2.txt delete mode 100644 trunk/faxtomail-service/src/test/resources/csv/clients.csv delete mode 100644 trunk/faxtomail-service/src/test/resources/csv/demandtypes.csv delete mode 100644 trunk/faxtomail-service/src/test/resources/csv/email_accounts.csv delete mode 100644 trunk/faxtomail-service/src/test/resources/csv/email_filters.csv delete mode 100644 trunk/faxtomail-service/src/test/resources/csv/etatattentes.csv delete mode 100644 trunk/faxtomail-service/src/test/resources/csv/fx_clients.csv delete mode 100644 trunk/faxtomail-service/src/test/resources/csv/priorities.csv delete mode 100644 trunk/faxtomail-service/src/test/resources/csv/ranges.csv delete mode 100644 trunk/faxtomail-service/src/test/resources/db/h2data-1_0_0_rc2.h2.db delete mode 100644 trunk/faxtomail-service/src/test/resources/log4j2.xml delete mode 100644 trunk/faxtomail-ui-swing/LICENSE.txt delete mode 100644 trunk/faxtomail-ui-swing/README.txt delete mode 100644 trunk/faxtomail-ui-swing/pom.xml delete mode 100644 trunk/faxtomail-ui-swing/src/license/THIRD-PARTY.properties delete mode 100644 trunk/faxtomail-ui-swing/src/main/assembly/faxtomail-full-component.xml delete mode 100644 trunk/faxtomail-ui-swing/src/main/assembly/full-linux-i586.xml delete mode 100644 trunk/faxtomail-ui-swing/src/main/assembly/full-linux-x64.xml delete mode 100644 trunk/faxtomail-ui-swing/src/main/assembly/full-windows-i586.xml delete mode 100644 trunk/faxtomail-ui-swing/src/main/assembly/full-windows-x64.xml delete mode 100644 trunk/faxtomail-ui-swing/src/main/assembly/full/faxtomail.bat delete mode 100644 trunk/faxtomail-ui-swing/src/main/assembly/full/faxtomail.sh delete mode 100644 trunk/faxtomail-ui-swing/src/main/assembly/i18n.xml delete mode 100644 trunk/faxtomail-ui-swing/src/main/assembly/min/README.txt delete mode 100644 trunk/faxtomail-ui-swing/src/main/assembly/min/launch.bat delete mode 100755 trunk/faxtomail-ui-swing/src/main/assembly/min/launch.sh delete mode 100644 trunk/faxtomail-ui-swing/src/main/assembly/standalone.xml delete mode 100644 trunk/faxtomail-ui-swing/src/main/filtered-resources/faxToMail.properties delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailActionFactory.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailScreen.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/RunFaxToMail.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractFaxToMailAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractMainUIFaxToMailAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AddAttachmentAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AddAttachmentToReplyAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveFromListAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/CloseApplicationAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ComputeQuantitiesByRangeAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GoToPreviousScreenAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/LoadFolderEmailsAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenAttachmentAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenGroupedDemandAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenMailFolderChooserFromListAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/PrintOnDefaultPrinterAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReloadFaxToMailAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenChooseAttachmentToPrintAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenMailFolderChooserAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenModalFrameAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenReplyFormAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenSearchToGroupAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeFromListAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchToGroupAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowAboutAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeListAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowRechercheAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/Common.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellRenderer.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListTableFilter.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUIModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/RangeRowModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/RangeTableModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/ButtonEmailGroup.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupCellRenderer.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/ButtonHistory.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItem.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItem.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItemModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/ButtonDemandReplies.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/RepliesCellEditor.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/RepliesCellRenderer.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyAttachmentModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailBeanUIModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupButton.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.css delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.jaxx delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxComboBoxModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailExceptionHandler.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUI.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FolderTreeNode.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/JImagePanel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/PaginationComboModel.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/RemoveablePropertyChangeListener.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/UIMessageNotifier.java delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/PoetsenOne-Regular.ttf delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel-error-validation.xml delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-about.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-archive.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-attachment.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-cancel.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-collapse.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-compute.png delete mode 100755 trunk/faxtomail-ui-swing/src/main/resources/icons/action-config.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-cross.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-delete.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-edit.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-email-group.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-email.png delete mode 100755 trunk/faxtomail-ui-swing/src/main/resources/icons/action-exit.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-expand.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-folder_edit.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-group.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-highlighter.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-hline.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-import.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-left.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-line.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-list.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-new-demand.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-note.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-open-file.png delete mode 100755 trunk/faxtomail-ui-swing/src/main/resources/icons/action-open.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-print.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-application.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-shortcut.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-ui.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-reply.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-right.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-anticlockwise.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-clockwise.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-save.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-search.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-transmit.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-user.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-validate.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-view-history.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-vline.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-in.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-out.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/add.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/application_home.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/cross_blue.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/cross_red.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/email.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/icons/house.png delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/log4j2.xml delete mode 100644 trunk/faxtomail-ui-swing/src/main/resources/splashscreen.png delete mode 100644 trunk/faxtomail-ui-web/LICENSE.txt delete mode 100644 trunk/faxtomail-ui-web/README.txt delete mode 100644 trunk/faxtomail-ui-web/pom.xml delete mode 100644 trunk/faxtomail-ui-web/src/license/THIRD-PARTY.properties delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/FaxToMailApplicationContext.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonAction.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonResultSupport.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailLoginInterceptor.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailSession.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/IndexAction.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LoginAction.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LogoutAction.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportArchiveAction.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LdapAction.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LockAction.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/AbstractFaxToMailJob.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/ClientUpdateJob.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/EDIManagementJob.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/HibernateProxyTypeAdapter.java delete mode 100644 trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/TopiaEntityAdapter.java delete mode 100644 trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties delete mode 100644 trunk/faxtomail-ui-web/src/main/resources/log4j2.xml delete mode 100644 trunk/faxtomail-ui-web/src/main/resources/nuiton-js.properties delete mode 100644 trunk/faxtomail-ui-web/src/main/resources/quartz.properties delete mode 100644 trunk/faxtomail-ui-web/src/main/resources/struts.properties delete mode 100644 trunk/faxtomail-ui-web/src/main/resources/struts.xml delete mode 100644 trunk/faxtomail-ui-web/src/main/resources/validators.xml delete mode 100644 trunk/faxtomail-ui-web/src/main/resources/xwork-conversion.properties delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-archive-input.jsp delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/ldap-input.jsp delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/ldap-wait.jsp delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/lock-input.jsp delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/index.jsp delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/login-input.jsp delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators.xml delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/web.xml delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/js/select2.js delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/js/select2sortable.js delete mode 100644 trunk/faxtomail-ui-web/src/main/webapp/js/user-folder.js delete mode 100644 trunk/pom.xml delete mode 100644 trunk/src/site/resources/img/notepad.png delete mode 100644 trunk/src/site/resources/img/txt-to-csv.png delete mode 100644 trunk/src/site/rst/import.rst delete mode 100644 trunk/src/site/rst/index.rst delete mode 100644 trunk/src/site/rst/install.rst delete mode 100644 trunk/src/site/rst/mssql.rst delete mode 100644 trunk/src/site/site_fr.xml -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See http://git.codelutin.com/faxtomail.git commit a4e927e2b05966e4e4563ce6b31a4247f049c4af Author: Kevin Morin <morin@codelutin.com> Date: Mon May 4 18:31:23 2015 +0200 - ajout des marques par domaine dans le modele - ajout d'une liste de clients qui matchent lors de la réception - interface admin bien avancée --- .gitignore | 1 + .../persistence/entities/BrandsForDomainImpl.java | 41 + .../src/main/xmi/faxtomail.properties | 3 + faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 30153 -> 31130 bytes .../services/FaxToMailServiceSupport.java | 1 + .../faxtomail/services/service/ClientService.java | 4 +- .../services/service/ClientServiceImpl.java | 34 +- .../services/service/ConfigurationService.java | 8 +- .../services/service/ConfigurationServiceImpl.java | 48 +- ...s_for_domain_and_matching_clients_in_emails.sql | 26 + .../services/service/ClientServiceTest.java | 37 +- .../web/action/admin/ConfigurationAction.java | 18 +- .../faxtomail/web/job/MailFilterJob.java | 17 +- .../WEB-INF/content/admin/configuration-input.jsp | 53 + .../src/main/webapp/js/configuration.js | 26 + pom.xml | 2 +- trunk/LICENSE.txt | 674 --------- trunk/README.txt | 0 trunk/faxtomail-persistence/LICENSE.txt | 674 --------- trunk/faxtomail-persistence/README.txt | 0 trunk/faxtomail-persistence/pom.xml | 165 --- .../src/license/THIRD-PARTY.properties | 53 - .../faxtomail/FaxToMailConfiguration.java | 426 ------ .../faxtomail/FaxToMailConfigurationOption.java | 385 ----- .../faxtomail/FaxToMailConfigurationProvider.java | 62 - .../faxtomail/persistence/ProgressionModel.java | 48 - .../persistence/RessourceClassLoader.java | 189 --- .../entities/AbstractFaxToMailTopiaDao.java | 61 - .../persistence/entities/AttachmentFileImpl.java | 115 -- .../persistence/entities/AttachmentImpl.java | 47 - .../faxtomail/persistence/entities/ClientImpl.java | 65 - .../persistence/entities/ClientTopiaDao.java | 58 - .../persistence/entities/DemandStatus.java | 62 - .../faxtomail/persistence/entities/EdiReturn.java | 38 - .../persistence/entities/EmailFilter.java | 303 ---- .../faxtomail/persistence/entities/EmailImpl.java | 201 --- .../persistence/entities/EmailProtocol.java | 44 - .../persistence/entities/EmailTopiaDao.java | 1027 ------------- .../entities/ExtensionCommandTopiaDao.java | 42 - .../persistence/entities/HistoryImpl.java | 52 - .../persistence/entities/HistoryType.java | 63 - .../faxtomail/persistence/entities/MailAction.java | 37 - .../faxtomail/persistence/entities/MailField.java | 100 -- .../persistence/entities/MailFilterTopiaDao.java | 50 - .../persistence/entities/MailFolderImpl.java | 66 - .../persistence/entities/MailFolderTopiaDao.java | 75 - .../faxtomail/persistence/entities/NewClient.java | 45 - .../persistence/entities/SearchFilter.java | 461 ------ .../persistence/entities/WaitingStateTopiaDao.java | 87 -- .../persistence/hibernate/EnumListUserType.java | 155 -- .../persistence/hibernate/EnumSetUserType.java | 161 -- .../hibernate/MailActionEnumSetUserType.java | 35 - .../hibernate/MailFieldEnumListUserType.java | 35 - .../hibernate/MailFieldEnumSetUserType.java | 35 - .../org.nuiton.config.ApplicationConfigProvider | 1 - .../src/main/resources/faxToMail.properties | 43 - .../i18n/faxtomail-persistence_fr_FR.properties | 46 - .../src/main/xmi/faxtomail.properties | 130 -- .../src/main/xmi/faxtomail.zargo | Bin 29652 -> 0 bytes trunk/faxtomail-service/LICENSE.txt | 674 --------- trunk/faxtomail-service/README.txt | 0 trunk/faxtomail-service/pom.xml | 234 --- .../src/license/THIRD-PARTY.properties | 37 - .../faxtomail/services/DecoratorService.java | 46 - .../faxtomail/services/DecoratorServiceImpl.java | 143 -- .../faxtomail/services/FaxToMailDecorator.java | 285 ---- .../faxtomail/services/FaxToMailService.java | 30 - .../services/FaxToMailServiceContext.java | 260 ---- .../services/FaxToMailServiceFactory.java | 36 - .../FaxToMailServiceInvocationHandler.java | 58 - .../services/FaxToMailServiceSupport.java | 85 -- .../faxtomail/services/FaxToMailServiceUtils.java | 77 - .../faxtomail/services/service/ClientService.java | 40 - .../services/service/ClientServiceImpl.java | 284 ---- .../services/service/ConfigurationService.java | 71 - .../services/service/ConfigurationServiceImpl.java | 606 -------- .../faxtomail/services/service/EmailService.java | 139 -- .../services/service/EmailServiceImpl.java | 1532 -------------------- .../services/service/InitFaxToMailService.java | 34 - .../services/service/InitFaxToMailServiceImpl.java | 465 ------ .../faxtomail/services/service/LdapService.java | 42 - .../services/service/LdapServiceImpl.java | 395 ----- .../services/service/MailFolderService.java | 65 - .../services/service/MailFolderServiceImpl.java | 328 ----- .../services/service/ReferentielService.java | 68 - .../services/service/ReferentielServiceImpl.java | 373 ----- .../faxtomail/services/service/UserService.java | 56 - .../services/service/UserServiceImpl.java | 95 -- .../services/service/ValidationService.java | 36 - .../services/service/ValidationServiceImpl.java | 48 - .../exceptions/AlreadyLockedMailException.java | 49 - .../exceptions/FolderNotReadableException.java | 44 - .../service/exceptions/InvalidClientException.java | 41 - .../service/imports/ArchiveImportBean.java | 73 - .../service/imports/ArchiveImportModel.java | 129 -- .../services/service/imports/ClientImportBean.java | 56 - .../service/imports/ClientImportModel.java | 92 -- .../service/imports/DemandTypeImportModel.java | 47 - .../service/imports/EmailAccountImportModel.java | 72 - .../service/imports/EmailFilterImportModel.java | 64 - .../service/imports/PriorityImportModel.java | 47 - .../services/service/imports/RangeImportModel.java | 47 - .../service/imports/WaitingStateImportModel.java | 47 - .../service/ldap/AuthenticationException.java | 36 - .../services/service/ldap/LdapServiceMock.java | 115 -- .../migration/FaxtomailFlywayMigrationService.java | 57 - .../validators/FaxToMailEmailValidator.java | 42 - .../entities/Email-error-validation.xml | 51 - ..._0_442__move_object_to_folder_configuration.sql | 60 - ..._0_448__add_mail_folder_level_configuration.sql | 6 - .../migration/h2/V1_0_0_454__add_ldap_config.sql | 6 - ...omailusergroup_loop_association_and_add_idx.sql | 39 - .../h2/V1_0_0_520__add_performance_indexes.sql | 18 - .../h2/V1_0_0_580__transform_enum_set_to_lists.sql | 25 - .../V1_0_0_583__readd_editranfer_on_demandtype.sql | 4 - .../h2/V1_0_0_597__mise_a_jour_performances.sql | 81 -- ...1_0_0_620__modification_newclient_edireturn.sql | 43 - .../h2/V1_0_0_662__add_company_in_mailfolder.sql | 5 - ..._0_442__move_object_to_folder_configuration.sql | 60 - ..._0_448__add_mail_folder_level_configuration.sql | 6 - .../postgres/V1_0_0_454__add_ldap_config.sql | 6 - ...omailusergroup_loop_association_and_add_idx.sql | 39 - .../V1_0_0_520__add_performance_indexes.sql | 18 - .../V1_0_0_580__transform_enum_set_to_lists.sql | 25 - .../V1_0_0_583__readd_editranfer_on_demandtype.sql | 4 - .../V1_0_0_597__mise_a_jour_performances.sql | 81 -- ...1_0_0_620__modification_newclient_edireturn.sql | 43 - .../V1_0_0_662__add_company_in_mailfolder.sql | 5 - ..._0_442__move_object_to_folder_configuration.sql | 66 - ..._0_448__add_mail_folder_level_configuration.sql | 7 - .../sqlserver/V1_0_0_454__add_ldap_config.sql | 7 - ...omailusergroup_loop_association_and_add_idx.sql | 47 - .../V1_0_0_520__add_performance_indexes.sql | 18 - .../V1_0_0_580__transform_enum_set_to_lists.sql | 33 - .../V1_0_0_583__readd_editranfer_on_demandtype.sql | 5 - .../V1_0_0_597__mise_a_jour_performances.sql | 90 -- ...1_0_0_620__modification_newclient_edireturn.sql | 50 - .../V1_0_0_662__add_company_in_mailfolder.sql | 6 - .../i18n/faxtomail-service_fr_FR.properties | 6 - .../src/main/resources/pdf/demande.mustache | 124 -- .../src/main/resources/validators.xml | 51 - .../service/AbstractFaxToMailServiceTest.java | 253 ---- .../services/service/ClientServiceTest.java | 123 -- .../services/service/EmailServiceTest.java | 217 --- .../faxtomail/services/service/InitTestData.java | 38 - .../services/service/InitTestDataImpl.java | 354 ----- .../services/service/MailFolderServiceTest.java | 82 -- .../faxtomail/services/service/MiscTest.java | 83 -- .../service/migration/FlywayMigrationTest.java | 117 -- .../src/test/resources/archives/archives.csv | 2 - .../src/test/resources/archives/att1.txt | 1 - .../src/test/resources/archives/att2.txt | 1 - .../src/test/resources/csv/clients.csv | 5 - .../src/test/resources/csv/demandtypes.csv | 4 - .../src/test/resources/csv/email_accounts.csv | 2 - .../src/test/resources/csv/email_filters.csv | 8 - .../src/test/resources/csv/etatattentes.csv | 6 - .../src/test/resources/csv/fx_clients.csv | 5 - .../src/test/resources/csv/priorities.csv | 5 - .../src/test/resources/csv/ranges.csv | 6 - .../src/test/resources/db/h2data-1_0_0_rc2.h2.db | Bin 509952 -> 0 bytes .../src/test/resources/log4j2.xml | 42 - trunk/faxtomail-ui-swing/LICENSE.txt | 674 --------- trunk/faxtomail-ui-swing/README.txt | 0 trunk/faxtomail-ui-swing/pom.xml | 764 ---------- .../src/license/THIRD-PARTY.properties | 69 - .../src/main/assembly/faxtomail-full-component.xml | 108 -- .../src/main/assembly/full-linux-i586.xml | 53 - .../src/main/assembly/full-linux-x64.xml | 53 - .../src/main/assembly/full-windows-i586.xml | 53 - .../src/main/assembly/full-windows-x64.xml | 52 - .../src/main/assembly/full/faxtomail.bat | 27 - .../src/main/assembly/full/faxtomail.sh | 51 - .../faxtomail-ui-swing/src/main/assembly/i18n.xml | 53 - .../src/main/assembly/min/README.txt | 0 .../src/main/assembly/min/launch.bat | 10 - .../src/main/assembly/min/launch.sh | 35 - .../src/main/assembly/standalone.xml | 74 - .../main/filtered-resources/faxToMail.properties | 25 - .../faxtomail/ui/swing/FaxToMailActionFactory.java | 58 - .../faxtomail/ui/swing/FaxToMailScreen.java | 37 - .../faxtomail/ui/swing/FaxToMailUIContext.java | 768 ---------- .../faxtomail/ui/swing/RunFaxToMail.java | 181 --- .../swing/actions/AbstractChangeScreenAction.java | 121 -- .../ui/swing/actions/AbstractFaxToMailAction.java | 80 - .../actions/AbstractMainUIFaxToMailAction.java | 38 - .../ui/swing/actions/AddAttachmentAction.java | 72 - .../swing/actions/AddAttachmentToReplyAction.java | 70 - .../faxtomail/ui/swing/actions/ArchiveAction.java | 106 -- .../ui/swing/actions/ArchiveFromListAction.java | 152 -- .../ui/swing/actions/CloseApplicationAction.java | 55 - .../actions/ComputeQuantitiesByRangeAction.java | 94 -- .../ui/swing/actions/EditAttachmentAction.java | 99 -- .../actions/GenerateAnnotatedAttachmentAction.java | 337 ----- .../ui/swing/actions/GoToPreviousScreenAction.java | 43 - .../faxtomail/ui/swing/actions/GroupAction.java | 94 -- .../ui/swing/actions/LoadFolderEmailsAction.java | 187 --- .../ui/swing/actions/OpenAttachmentAction.java | 61 - .../ui/swing/actions/OpenGroupedDemandAction.java | 176 --- .../OpenMailFolderChooserFromListAction.java | 109 -- .../swing/actions/PrintOnDefaultPrinterAction.java | 187 --- .../ui/swing/actions/ReloadFaxToMailAction.java | 49 - .../faxtomail/ui/swing/actions/ReplyAction.java | 92 -- .../SaveAndOpenChooseAttachmentToPrintAction.java | 68 - .../SaveAndOpenMailFolderChooserAction.java | 68 - .../swing/actions/SaveAndOpenModalFrameAction.java | 66 - .../swing/actions/SaveAndOpenReplyFormAction.java | 76 - .../actions/SaveAndOpenSearchToGroupAction.java | 59 - .../ui/swing/actions/SaveDemandeAction.java | 151 -- .../ui/swing/actions/SaveDemandeAndExitAction.java | 44 - .../swing/actions/SaveDemandeFromListAction.java | 72 - .../faxtomail/ui/swing/actions/SearchAction.java | 109 -- .../ui/swing/actions/SearchToGroupAction.java | 120 -- .../ui/swing/actions/ShowAboutAction.java | 91 -- .../ui/swing/actions/ShowDemandeAction.java | 170 --- .../ui/swing/actions/ShowDemandeListAction.java | 52 - .../ui/swing/actions/ShowRechercheAction.java | 47 - .../faxtomail/ui/swing/actions/TransmitAction.java | 140 -- .../faxtomail/ui/swing/content/Common.css | 26 - .../faxtomail/ui/swing/content/MainUI.css | 86 -- .../faxtomail/ui/swing/content/MainUI.jaxx | 68 - .../faxtomail/ui/swing/content/MainUIHandler.java | 391 ----- .../content/attachment/AttachmentCellEditor.java | 190 --- .../content/attachment/AttachmentCellRenderer.java | 120 -- .../content/attachment/AttachmentEditorUI.css | 59 - .../content/attachment/AttachmentEditorUI.jaxx | 72 - .../attachment/AttachmentEditorUIHandler.java | 262 ---- .../attachment/AttachmentEditorUIModel.java | 135 -- .../ui/swing/content/attachment/AttachmentItem.css | 61 - .../swing/content/attachment/AttachmentItem.jaxx | 51 - .../content/attachment/AttachmentModelAware.java | 49 - .../swing/content/attachment/ButtonAttachment.java | 112 -- .../content/demande/DemandeListTableFilter.java | 302 ---- .../ui/swing/content/demande/DemandeListUI.css | 156 -- .../ui/swing/content/demande/DemandeListUI.jaxx | 120 -- .../content/demande/DemandeListUIHandler.java | 636 -------- .../swing/content/demande/DemandeListUIModel.java | 290 ---- .../ui/swing/content/demande/DemandeUI.css | 342 ----- .../ui/swing/content/demande/DemandeUI.jaxx | 336 ----- .../ui/swing/content/demande/DemandeUIHandler.java | 535 ------- .../ui/swing/content/demande/DemandeUIModel.java | 969 ------------- .../ui/swing/content/demande/DemandesUI.css | 71 - .../ui/swing/content/demande/DemandesUI.jaxx | 66 - .../swing/content/demande/DemandesUIHandler.java | 346 ----- .../ui/swing/content/demande/DemandesUIModel.java | 176 --- .../swing/content/demande/QuantitiesByRangeUI.css | 30 - .../swing/content/demande/QuantitiesByRangeUI.jaxx | 53 - .../demande/QuantitiesByRangeUIHandler.java | 119 -- .../content/demande/QuantitiesByRangeUIModel.java | 66 - .../ui/swing/content/demande/RangeRowModel.java | 127 -- .../ui/swing/content/demande/RangeTableModel.java | 79 - .../demande/demandgroup/ButtonEmailGroup.java | 71 - .../demandgroup/DemandGroupCellRenderer.java | 106 -- .../demande/demandgroup/DemandGroupItem.css | 40 - .../demande/demandgroup/DemandGroupItem.jaxx | 50 - .../content/demande/demandgroup/DemandGroupUI.css | 34 - .../content/demande/demandgroup/DemandGroupUI.jaxx | 46 - .../demande/demandgroup/DemandGroupUIHandler.java | 181 --- .../content/demande/history/ButtonHistory.java | 86 -- .../swing/content/demande/history/HistoryItem.css | 63 - .../swing/content/demande/history/HistoryItem.jaxx | 60 - .../content/demande/history/HistoryItemModel.java | 103 -- .../content/demande/history/HistoryListUI.css | 30 - .../content/demande/history/HistoryListUI.jaxx | 44 - .../demande/history/HistoryListUIHandler.java | 233 --- .../demande/replies/ButtonDemandReplies.java | 102 -- .../content/demande/replies/DemandRepliesUI.css | 42 - .../content/demande/replies/DemandRepliesUI.jaxx | 49 - .../demande/replies/DemandRepliesUIHandler.java | 373 ----- .../content/demande/replies/DemandReplyItem.css | 51 - .../content/demande/replies/DemandReplyItem.jaxx | 58 - .../content/demande/replies/RepliesCellEditor.java | 133 -- .../demande/replies/RepliesCellRenderer.java | 108 -- .../swing/content/pdfeditor/PDFEditorCrossUI.css | 39 - .../swing/content/pdfeditor/PDFEditorCrossUI.jaxx | 63 - .../content/pdfeditor/PDFEditorHighlighterUI.css | 38 - .../content/pdfeditor/PDFEditorHighlighterUI.jaxx | 51 - .../ui/swing/content/pdfeditor/PDFEditorLineUI.css | 38 - .../swing/content/pdfeditor/PDFEditorLineUI.jaxx | 69 - .../ui/swing/content/pdfeditor/PDFEditorNoteUI.css | 56 - .../swing/content/pdfeditor/PDFEditorNoteUI.jaxx | 84 -- .../ui/swing/content/pdfeditor/PDFEditorUI.css | 128 -- .../ui/swing/content/pdfeditor/PDFEditorUI.jaxx | 104 -- .../content/pdfeditor/PDFEditorUIHandler.java | 584 -------- .../swing/content/pdfeditor/PDFEditorUIModel.java | 273 ---- .../content/print/AttachmentToPrintChooserUI.css | 40 - .../content/print/AttachmentToPrintChooserUI.jaxx | 62 - .../print/AttachmentToPrintChooserUIHandler.java | 177 --- .../print/AttachmentToPrintChooserUIModel.java | 76 - .../ui/swing/content/reply/AttachmentItem.css | 49 - .../ui/swing/content/reply/AttachmentItem.jaxx | 50 - .../swing/content/reply/ReplyAttachmentModel.java | 82 -- .../ui/swing/content/reply/ReplyFormUI.css | 150 -- .../ui/swing/content/reply/ReplyFormUI.jaxx | 171 --- .../ui/swing/content/reply/ReplyFormUIHandler.java | 440 ------ .../ui/swing/content/reply/ReplyFormUIModel.java | 357 ----- .../ui/swing/content/search/SearchToGroupUI.css | 333 ----- .../ui/swing/content/search/SearchToGroupUI.jaxx | 399 ----- .../content/search/SearchToGroupUIHandler.java | 383 ----- .../faxtomail/ui/swing/content/search/SearchUI.css | 332 ----- .../ui/swing/content/search/SearchUI.jaxx | 413 ------ .../ui/swing/content/search/SearchUIHandler.java | 354 ----- .../ui/swing/content/search/SearchUIModel.java | 471 ------ .../swing/content/transmit/MailFolderChooserUI.css | 47 - .../content/transmit/MailFolderChooserUI.jaxx | 54 - .../transmit/MailFolderChooserUIHandler.java | 144 -- .../content/transmit/MailFolderChooserUIModel.java | 68 - .../swing/util/AbstractFaxToMailBeanUIModel.java | 155 -- .../util/AbstractFaxToMailDemandListHandler.java | 349 ----- .../ui/swing/util/AbstractFaxToMailUIHandler.java | 489 ------- .../ui/swing/util/AbstractToolbarPopupButton.java | 116 -- .../ui/swing/util/AbstractToolbarPopupHandler.java | 150 -- .../ui/swing/util/AbstractToolbarPopupUI.css | 27 - .../ui/swing/util/AbstractToolbarPopupUI.jaxx | 56 - .../ui/swing/util/CheckBoxComboBoxModel.java | 81 -- .../ui/swing/util/CheckBoxListCellRenderer.java | 526 ------- .../faxtomail/ui/swing/util/DemandeTableModel.java | 199 --- .../ui/swing/util/FaxToMailExceptionHandler.java | 87 -- .../faxtomail/ui/swing/util/FaxToMailUI.java | 35 - .../faxtomail/ui/swing/util/FaxToMailUIUtil.java | 720 --------- .../faxtomail/ui/swing/util/FolderTreeNode.java | 67 - .../faxtomail/ui/swing/util/JImagePanel.java | 171 --- .../ui/swing/util/PaginationComboModel.java | 40 - .../util/RemoveablePropertyChangeListener.java | 33 - .../faxtomail/ui/swing/util/UIMessageNotifier.java | 33 - .../src/main/resources/PoetsenOne-Regular.ttf | Bin 172456 -> 0 bytes .../demande/DemandeUIModel-error-validation.xml | 111 -- .../reply/ReplyFormUIModel-error-validation.xml | 74 - .../i18n/faxtomail-ui-swing_fr_FR.properties | 332 ----- .../src/main/resources/icons/action-about.png | Bin 936 -> 0 bytes .../src/main/resources/icons/action-archive.png | Bin 766 -> 0 bytes .../src/main/resources/icons/action-attachment.png | Bin 391 -> 0 bytes .../src/main/resources/icons/action-cancel.png | Bin 587 -> 0 bytes .../src/main/resources/icons/action-collapse.png | Bin 372 -> 0 bytes .../src/main/resources/icons/action-compute.png | Bin 543 -> 0 bytes .../src/main/resources/icons/action-config.png | Bin 611 -> 0 bytes .../src/main/resources/icons/action-cross.png | Bin 626 -> 0 bytes .../src/main/resources/icons/action-delete.png | Bin 715 -> 0 bytes .../src/main/resources/icons/action-edit.png | Bin 450 -> 0 bytes .../main/resources/icons/action-email-group.png | Bin 821 -> 0 bytes .../src/main/resources/icons/action-email.png | Bin 783 -> 0 bytes .../src/main/resources/icons/action-exit.png | Bin 830 -> 0 bytes .../src/main/resources/icons/action-expand.png | Bin 371 -> 0 bytes .../main/resources/icons/action-folder_edit.png | Bin 733 -> 0 bytes .../src/main/resources/icons/action-group.png | Bin 343 -> 0 bytes .../main/resources/icons/action-highlighter.png | Bin 155 -> 0 bytes .../src/main/resources/icons/action-hline.png | Bin 344 -> 0 bytes .../src/main/resources/icons/action-import.png | Bin 532 -> 0 bytes .../src/main/resources/icons/action-left.png | Bin 345 -> 0 bytes .../src/main/resources/icons/action-line.png | Bin 344 -> 0 bytes .../src/main/resources/icons/action-list.png | Bin 675 -> 0 bytes .../src/main/resources/icons/action-new-demand.png | Bin 512 -> 0 bytes .../src/main/resources/icons/action-note.png | Bin 500 -> 0 bytes .../src/main/resources/icons/action-open-file.png | Bin 537 -> 0 bytes .../src/main/resources/icons/action-open.png | Bin 688 -> 0 bytes .../src/main/resources/icons/action-print.png | Bin 731 -> 0 bytes .../resources/icons/action-reload-application.png | Bin 525 -> 0 bytes .../resources/icons/action-reload-shortcut.png | Bin 570 -> 0 bytes .../src/main/resources/icons/action-reload-ui.png | Bin 795 -> 0 bytes .../src/main/resources/icons/action-reply.png | Bin 754 -> 0 bytes .../src/main/resources/icons/action-right.png | Bin 349 -> 0 bytes .../icons/action-rotate-anticlockwise.png | Bin 608 -> 0 bytes .../resources/icons/action-rotate-clockwise.png | Bin 602 -> 0 bytes .../src/main/resources/icons/action-save.png | Bin 620 -> 0 bytes .../src/main/resources/icons/action-search.png | Bin 692 -> 0 bytes .../src/main/resources/icons/action-transmit.png | Bin 694 -> 0 bytes .../src/main/resources/icons/action-user.png | Bin 741 -> 0 bytes .../src/main/resources/icons/action-validate.png | Bin 537 -> 0 bytes .../main/resources/icons/action-view-history.png | Bin 711 -> 0 bytes .../src/main/resources/icons/action-vline.png | Bin 370 -> 0 bytes .../src/main/resources/icons/action-zoom-in.png | Bin 680 -> 0 bytes .../src/main/resources/icons/action-zoom-out.png | Bin 657 -> 0 bytes .../src/main/resources/icons/add.png | Bin 733 -> 0 bytes .../src/main/resources/icons/application_home.png | Bin 685 -> 0 bytes .../src/main/resources/icons/cross_blue.png | Bin 2745 -> 0 bytes .../src/main/resources/icons/cross_red.png | Bin 1743 -> 0 bytes .../src/main/resources/icons/email.png | Bin 641 -> 0 bytes .../src/main/resources/icons/house.png | Bin 806 -> 0 bytes .../src/main/resources/log4j2.xml | 55 - .../src/main/resources/splashscreen.png | Bin 25809 -> 0 bytes trunk/faxtomail-ui-web/LICENSE.txt | 674 --------- trunk/faxtomail-ui-web/README.txt | 0 trunk/faxtomail-ui-web/pom.xml | 403 ----- .../src/license/THIRD-PARTY.properties | 70 - .../faxtomail/FaxToMailApplicationContext.java | 160 -- .../faxtomail/web/FaxToMailActionSupport.java | 170 --- .../web/FaxToMailApplicationListener.java | 163 --- .../faxtomail/web/FaxToMailInterceptor.java | 219 --- .../faxtomail/web/FaxToMailJsonAction.java | 52 - .../faxtomail/web/FaxToMailJsonResultSupport.java | 80 - .../faxtomail/web/FaxToMailLoginInterceptor.java | 66 - .../faxtomail/web/FaxToMailSession.java | 97 -- .../faxtomail/web/action/IndexAction.java | 44 - .../faxtomail/web/action/LoginAction.java | 76 - .../faxtomail/web/action/LogoutAction.java | 41 - .../web/action/admin/ConfigurationAction.java | 241 --- .../web/action/admin/ConfigurationJsonAction.java | 73 - .../faxtomail/web/action/admin/ImportAction.java | 149 -- .../web/action/admin/ImportArchiveAction.java | 137 -- .../faxtomail/web/action/admin/LdapAction.java | 109 -- .../faxtomail/web/action/admin/LockAction.java | 87 -- .../web/action/admin/UserFolderAction.java | 110 -- .../faxtomail/web/job/AbstractFaxToMailJob.java | 40 - .../faxtomail/web/job/ClientUpdateJob.java | 74 - .../faxtomail/web/job/EDIManagementJob.java | 79 - .../faxtomail/web/job/MailFilterJob.java | 846 ----------- .../web/json/HibernateProxyTypeAdapter.java | 82 -- .../faxtomail/web/json/TopiaEntityAdapter.java | 62 - .../i18n/faxtomail-ui-web_fr_FR.properties | 42 - .../faxtomail-ui-web/src/main/resources/log4j2.xml | 59 - .../src/main/resources/nuiton-js.properties | 34 - .../src/main/resources/quartz.properties | 28 - .../src/main/resources/struts.properties | 40 - .../faxtomail-ui-web/src/main/resources/struts.xml | 66 - .../src/main/resources/validators.xml | 74 - .../src/main/resources/xwork-conversion.properties | 25 - .../WEB-INF/content/admin/configuration-input.jsp | 1249 ---------------- .../WEB-INF/content/admin/import-archive-input.jsp | 66 - .../webapp/WEB-INF/content/admin/import-input.jsp | 91 -- .../webapp/WEB-INF/content/admin/ldap-input.jsp | 56 - .../webapp/WEB-INF/content/admin/ldap-wait.jsp | 44 - .../webapp/WEB-INF/content/admin/lock-input.jsp | 80 - .../WEB-INF/content/admin/user-folder-input.jsp | 93 -- .../src/main/webapp/WEB-INF/content/index.jsp | 51 - .../main/webapp/WEB-INF/content/login-input.jsp | 69 - .../src/main/webapp/WEB-INF/decorators.xml | 34 - .../src/main/webapp/WEB-INF/decorators/layout.jsp | 90 -- .../src/main/webapp/WEB-INF/web.xml | 70 - .../src/main/webapp/WEB-INF/wro.xml | 94 -- .../src/main/webapp/css/faxtomail.css | 94 -- .../src/main/webapp/js/configuration.js | 1330 ----------------- .../src/main/webapp/js/faxtomail.js | 94 -- .../faxtomail-ui-web/src/main/webapp/js/select2.js | 193 --- .../src/main/webapp/js/select2sortable.js | 254 ---- .../src/main/webapp/js/user-folder.js | 116 -- trunk/pom.xml | 875 ----------- trunk/src/site/resources/img/notepad.png | Bin 25930 -> 0 bytes trunk/src/site/resources/img/txt-to-csv.png | Bin 37447 -> 0 bytes trunk/src/site/rst/import.rst | 98 -- trunk/src/site/rst/index.rst | 29 - trunk/src/site/rst/install.rst | 98 -- trunk/src/site/rst/mssql.rst | 41 - trunk/src/site/site_fr.xml | 65 - 443 files changed, 289 insertions(+), 52130 deletions(-) diff --git a/.gitignore b/.gitignore index f09b769..76a9b9b 100644 --- a/.gitignore +++ b/.gitignore @@ -155,4 +155,5 @@ pom.xml.versionsBackup pom.xml.next release.properties +*.zargo~ diff --git a/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/BrandsForDomainImpl.java b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/BrandsForDomainImpl.java new file mode 100644 index 0000000..03df49c --- /dev/null +++ b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/BrandsForDomainImpl.java @@ -0,0 +1,41 @@ +package com.franciaflex.faxtomail.persistence.entities; + +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class BrandsForDomainImpl extends BrandsForDomainAbstract { + + private static final Type LIST_STRING_GSON_TYPE = new TypeToken<List<String>>() {}.getType(); + + @Override + public void setBrands(List<String> brands) { + String json = AbstractFaxToMailTopiaDao.GSON_INSTANCE.toJson(brands); + setBrandsJson(json); + } + + @Override + public List<String> getBrands() { + String json = getBrandsJson(); + List<String> brands = AbstractFaxToMailTopiaDao.GSON_INSTANCE.fromJson(json, LIST_STRING_GSON_TYPE); + return brands; + } + + @Override + public void setBrands(String brands) { + List<String> brandList = new ArrayList<>(); + if (brands != null) { + String[] brandArray = brands.split(","); + for (String brand : brandArray) { + brandList.add(brand.trim()); + } + } + setBrands(brandList); + } +} diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.properties b/faxtomail-persistence/src/main/xmi/faxtomail.properties index 6951ae3..a3e6a5b 100644 --- a/faxtomail-persistence/src/main/xmi/faxtomail.properties +++ b/faxtomail-persistence/src/main/xmi/faxtomail.properties @@ -132,3 +132,6 @@ com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockBy.tagvalu com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.tagvalue.notNull=true #�TODO echatellier 20141003 : wrong property, fix it with stereotype=unique com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.tagvalue.unique=true + +# BrandsForDomain +com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domain.tagvalue.notNull=true \ No newline at end of file diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.zargo b/faxtomail-persistence/src/main/xmi/faxtomail.zargo index 2b0db70..2026af5 100644 Binary files a/faxtomail-persistence/src/main/xmi/faxtomail.zargo and b/faxtomail-persistence/src/main/xmi/faxtomail.zargo differ diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java index b7bff33..25161bb 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java @@ -82,4 +82,5 @@ public class FaxToMailServiceSupport implements FaxToMailService { protected ClientService getClientService() { return newService(ClientService.class); } + } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java index dee8fd9..271aecf 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java @@ -28,11 +28,13 @@ import com.franciaflex.faxtomail.persistence.entities.Client; import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.services.FaxToMailService; +import java.util.List; + /** * @author Kevin Morin (Code Lutin) */ public interface ClientService extends FaxToMailService { - Client getClientForEmailAddress(String emailAddress, Email email, String company, String brand); + List<Client> getClientForEmailAddress(String emailAddress, Email email, String company, List<String> brand); Client getClientForCode(String code, String company); diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java index 211c9eb..ea916a3 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java @@ -32,7 +32,11 @@ import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; import com.franciaflex.faxtomail.persistence.entities.NewClient; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; +import com.google.common.base.Function; import com.google.common.base.Preconditions; +import com.google.common.base.Predicate; +import com.google.common.collect.Collections2; +import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.map.MultiKeyMap; import org.apache.commons.lang3.StringUtils; @@ -70,13 +74,13 @@ public class ClientServiceImpl extends FaxToMailServiceSupport implements Client * @return client for emailAddress (can be {@code null}) */ @Override - public Client getClientForEmailAddress(String emailAddress, Email email, String company, String brand) { + public List<Client> getClientForEmailAddress(String emailAddress, Email email, final String company, List<String> brands) { Preconditions.checkNotNull(email); Preconditions.checkNotNull(emailAddress); ClientTopiaDao clientDao = getPersistenceContext().getClientDao(); - Client client = null; + List<Client> result = null; List<Client> clients; if (StringUtils.isNotBlank(emailAddress)) { clients = clientDao.forEmailAddressesJsonLike(emailAddress); @@ -93,20 +97,30 @@ public class ClientServiceImpl extends FaxToMailServiceSupport implements Client } if (CollectionUtils.isNotEmpty(clients)) { - int i = 0; - while (client == null && i < clients.size()) { - Client c = clients.get(i++); - if ((StringUtils.isBlank(company) || Objects.equals(company, c.getCompany())) - && (StringUtils.isBlank(brand) || Objects.equals(StringUtils.lowerCase(brand), StringUtils.lowerCase(c.getBrand())))) { - client = c; + // transform the brand list into a list of lower case brands + final List<String> lowerCaseBrands = brands == null ? new ArrayList<String>() : + Lists.transform(brands, new Function<String, String>() { + @Override + public String apply(String s) { + return StringUtils.lowerCase(s); } - } + }); + result = new ArrayList<>(Collections2.filter(clients, new Predicate<Client>() { + @Override + public boolean apply(Client client) { + boolean equalsCompany = StringUtils.isBlank(company) + || Objects.equals(company, client.getCompany()); + boolean inBrands = CollectionUtils.isEmpty(lowerCaseBrands) + || lowerCaseBrands.contains(StringUtils.lowerCase(client.getBrand())); + return equalsCompany && inBrands; + } + })); } } // on doit faire l'affectation ici car emailAddress a pu etre remplacé par le numero de fax email.setSender(emailAddress); - return client; + return result; } /** diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java index 3139212..a27ee6d 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java @@ -24,6 +24,7 @@ package com.franciaflex.faxtomail.services.service; * #L% */ +import com.franciaflex.faxtomail.persistence.entities.BrandsForDomain; import com.franciaflex.faxtomail.persistence.entities.Configuration; import com.franciaflex.faxtomail.persistence.entities.DemandType; import com.franciaflex.faxtomail.persistence.entities.EmailAccount; @@ -49,7 +50,7 @@ public interface ConfigurationService extends FaxToMailService { List<MailFilter> getMailFilters(); void save(Configuration configuration, List<DemandType> demandTypes, List<WaitingState> waitingStates, List<MailFolder> mailFolders, - List<MailFilter> mailFilters, List<EmailAccount> emailAccounts); + List<MailFilter> mailFilters, List<EmailAccount> emailAccounts, List<BrandsForDomain> brandsForDomains); List<EmailAccount> getEmailAccountsWithoutPasswords(); @@ -68,4 +69,9 @@ public interface ConfigurationService extends FaxToMailService { long getEmailMaxSize(); List<MailField> getSearchDisplayColumns(); + + List<BrandsForDomain> getAllBrandsForDomains(); + + List<String> getBrandsForDomain(String domain); + } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java index d2a7c85..4cdf20a 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java @@ -24,6 +24,9 @@ package com.franciaflex.faxtomail.services.service; * #L% */ +import com.franciaflex.faxtomail.persistence.entities.BrandsForDomain; +import com.franciaflex.faxtomail.persistence.entities.BrandsForDomainImpl; +import com.franciaflex.faxtomail.persistence.entities.BrandsForDomainTopiaDao; import com.franciaflex.faxtomail.persistence.entities.Configuration; import com.franciaflex.faxtomail.persistence.entities.ConfigurationImpl; import com.franciaflex.faxtomail.persistence.entities.ConfigurationTopiaDao; @@ -142,7 +145,7 @@ public class ConfigurationServiceImpl extends FaxToMailServiceSupport implements */ @Override public void save(Configuration configuration, List<DemandType> demandTypes, List<WaitingState> waitingStates, List<MailFolder> mailFolders, - List<MailFilter> mailFilters, List<EmailAccount> emailAccounts) { + List<MailFilter> mailFilters, List<EmailAccount> emailAccounts, List<BrandsForDomain> brandsForDomains) { Collection<MailFolder> toDeleteMailFolder = new ArrayList<>(); @@ -153,6 +156,7 @@ public class ConfigurationServiceImpl extends FaxToMailServiceSupport implements Map<String, MailFolder> mailFolderCache = saveMailFolders(waitingStateCache, mailFolders, toDeleteMailFolder); saveMailFilters(mailFolderCache, mailFilters); saveEmailAccounts(emailAccounts); + saveBrandsForDomains(brandsForDomains); // delete after loop MailFolderTopiaDao mailFilterDao = getPersistenceContext().getMailFolderDao(); @@ -434,6 +438,36 @@ public class ConfigurationServiceImpl extends FaxToMailServiceSupport implements emailAccountTopiaDao.deleteAll(emailAccountMap.values()); } + protected void saveBrandsForDomains(List<BrandsForDomain> newBrandsForDomains) { + BrandsForDomainTopiaDao brandsForDomainTopiaDao = getPersistenceContext().getBrandsForDomainDao(); + List<BrandsForDomain> brandsForDomains = brandsForDomainTopiaDao.findAll(); + Map<String, BrandsForDomain> brandsForDomainMap = new HashMap<>(Maps.uniqueIndex(brandsForDomains, TopiaEntities.getTopiaIdFunction())); + Binder<BrandsForDomain, BrandsForDomain> binder = BinderFactory.newBinder(BrandsForDomain.class); + + for (BrandsForDomain newBrandsForDomain : newBrandsForDomains) { + BrandsForDomain brandsForDomain; + if (StringUtils.isNotBlank(newBrandsForDomain.getTopiaId())) { + brandsForDomain = brandsForDomainMap.remove(newBrandsForDomain.getTopiaId()); + } else { + brandsForDomain = new BrandsForDomainImpl(); + } + + binder.copyExcluding(newBrandsForDomain, brandsForDomain, + BrandsForDomain.PROPERTY_TOPIA_ID, + BrandsForDomain.PROPERTY_TOPIA_CREATE_DATE, + BrandsForDomain.PROPERTY_TOPIA_VERSION); + + + if (brandsForDomain.isPersisted()) { + brandsForDomainTopiaDao.update(brandsForDomain); + } else { + brandsForDomainTopiaDao.create(brandsForDomain); + } + } + + brandsForDomainTopiaDao.deleteAll(brandsForDomainMap.values()); + } + @Override public void saveUserFolders(Map<String, Collection<MailFolder>> userFolders) { FaxToMailUserTopiaDao faxToMailUserTopiaDao = getPersistenceContext().getFaxToMailUserDao(); @@ -601,4 +635,16 @@ public class ConfigurationServiceImpl extends FaxToMailServiceSupport implements Configuration conf = getConfiguration(); return conf.getSearchDisplayColumns(); } + + @Override + public List<BrandsForDomain> getAllBrandsForDomains() { + return getPersistenceContext().getBrandsForDomainDao().findAll(); + } + + @Override + public List<String> getBrandsForDomain(String domain) { + BrandsForDomainTopiaDao dao = getPersistenceContext().getBrandsForDomainDao(); + BrandsForDomain brandsForDomain = dao.forDomainNameEquals(domain).findUnique(); + return brandsForDomain.getBrands(); + } } diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql b/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql new file mode 100644 index 0000000..3b83474 --- /dev/null +++ b/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql @@ -0,0 +1,26 @@ +-- add brands for domain + +CREATE TABLE BrandsForDomain ( + topiaId VARCHAR(255) NOT NULL, + topiaVersion BIGINT NOT NULL, + topiaCreateDate TIMESTAMP, + domainName longvarchar NOT NULL, + brandsJson longvarchar, + PRIMARY KEY (topiaId) +); + +-- add matching clients in email + +create table email_matchingClients ( + email varchar(255) not null, + matchingClients varchar(255) not null +); +alter table email_matchingClients + add constraint FK_IICRYCV6TYE2EFQU4JTUM9CS1 + foreign key (matchingClients) + references client; +alter table email_matchingClients + add constraint FK_CDHGKIXMOOF90L83HNWB83A35 + foreign key (email) + references email; +CREATE INDEX idx_Email_matchingClients ON email_matchingClients(email); \ No newline at end of file diff --git a/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/ClientServiceTest.java b/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/ClientServiceTest.java index 197012b..c80e8fe 100644 --- a/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/ClientServiceTest.java +++ b/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/ClientServiceTest.java @@ -24,10 +24,13 @@ package com.franciaflex.faxtomail.services.service; * #L% */ +import com.franciaflex.faxtomail.persistence.entities.BrandsForDomain; +import com.franciaflex.faxtomail.persistence.entities.BrandsForDomainTopiaDao; import com.franciaflex.faxtomail.persistence.entities.Client; import com.franciaflex.faxtomail.persistence.entities.ClientTopiaDao; import com.franciaflex.faxtomail.persistence.entities.EmailImpl; import com.franciaflex.faxtomail.persistence.entities.NewClient; +import com.google.common.collect.Lists; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -123,6 +126,13 @@ public class ClientServiceTest extends AbstractFaxToMailServiceTest { @Test public void testGetClientForEmailAddress() { + BrandsForDomainTopiaDao brandsForDomainTopiaDao = getServiceContext().getPersistenceContext().getBrandsForDomainDao(); + + BrandsForDomain brandsForDomain = brandsForDomainTopiaDao.newInstance(); + brandsForDomain.setDomainName("groupecreal.com"); + brandsForDomain.setBrands(Lists.newArrayList("CREAL")); + brandsForDomain = brandsForDomainTopiaDao.create(brandsForDomain); + ClientTopiaDao clientTopiaDao = getServiceContext().getPersistenceContext().getClientDao(); Client client = clientTopiaDao.newInstance(); @@ -130,19 +140,21 @@ public class ClientServiceTest extends AbstractFaxToMailServiceTest { client.setCompany("FX"); String emailAddress = "test@groupecreal.com"; - Assert.assertEquals("@groupecreal.com", emailAddress.substring(emailAddress.lastIndexOf("@"))); + String domain = emailAddress.substring(emailAddress.lastIndexOf("@") + 1); + Assert.assertEquals("groupecreal.com", domain); client.setEmailAddressesJson("[\"" + emailAddress + "\"]"); client.setCode("987654"); client.setName("Test Test"); client = clientTopiaDao.create(client); - Client foundClient = - getServiceContext().getClientService().getClientForEmailAddress("test@groupecreal.com", + List<Client> foundClients = + getServiceContext().getClientService().getClientForEmailAddress(emailAddress, new EmailImpl(), "FX", null); - Assert.assertEquals(client, foundClient); + Assert.assertEquals(foundClients.size(), 1); + Assert.assertEquals(client, foundClients.get(0)); client = clientTopiaDao.newInstance(); client.setBrand("CREAL"); @@ -152,10 +164,21 @@ public class ClientServiceTest extends AbstractFaxToMailServiceTest { client.setName("Test Test"); client = clientTopiaDao.create(client); - foundClient = getServiceContext().getClientService().getClientForEmailAddress("test@groupecreal.com", + List<String> brands = getServiceContext().getConfigurationService().getBrandsForDomain(domain); + foundClients = getServiceContext().getClientService().getClientForEmailAddress(emailAddress, new EmailImpl(), - "FX", "CREAL"); + "FX", brands); + + Assert.assertEquals(1, foundClients.size()); + Assert.assertEquals(client, foundClients.get(0)); + + brandsForDomain.setBrands(Lists.newArrayList("CREAL", "FX")); + brandsForDomain = brandsForDomainTopiaDao.update(brandsForDomain); - Assert.assertEquals(client, foundClient); + brands = getServiceContext().getConfigurationService().getBrandsForDomain(domain); + foundClients = getServiceContext().getClientService().getClientForEmailAddress(emailAddress, + new EmailImpl(), + "FX", brands); + Assert.assertEquals(2, foundClients.size()); } } diff --git a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java index de12103..c690119 100644 --- a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java +++ b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java @@ -24,6 +24,7 @@ package com.franciaflex.faxtomail.web.action.admin; * #L% */ +import com.franciaflex.faxtomail.persistence.entities.BrandsForDomain; import com.franciaflex.faxtomail.persistence.entities.Configuration; import com.franciaflex.faxtomail.persistence.entities.DemandType; import com.franciaflex.faxtomail.persistence.entities.EmailAccount; @@ -94,6 +95,8 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa protected List<FaxToMailUserGroup> groups; + protected List<BrandsForDomain> brandsForDomains; + @Override public void prepare() throws Exception { // check authorization @@ -116,6 +119,7 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa configuration = configurationService.getConfiguration(); users = userService.getAllActiveUsers(); groups = userService.getAllActiveUserGroups(); + brandsForDomains = configurationService.getAllBrandsForDomains(); return INPUT; } @@ -124,7 +128,7 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa public String execute() throws Exception { String result = super.execute(); - configurationService.save(configuration, demandTypes, waitingStates, mailFolders, mailFilters, emailAccounts); + configurationService.save(configuration, demandTypes, waitingStates, mailFolders, mailFilters, emailAccounts, brandsForDomains); return result; } @@ -209,7 +213,17 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa Type type = new TypeToken<List<EmailAccount>>() {}.getType(); this.emailAccounts = getGson().fromJson(json, type); } - + + public List<BrandsForDomain> getBrandsForDomains() { + return brandsForDomains; + } + + public void setBrandsForDomainsJson(String json) { + System.out.println(json); + Type type = new TypeToken<List<BrandsForDomain>>() {}.getType(); + this.brandsForDomains = getGson().fromJson(json, type); + } + public List<FaxToMailUser> getUsers() { return users; } diff --git a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java index ce11938..48d1ed4 100644 --- a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java +++ b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java @@ -327,11 +327,9 @@ public class MailFilterJob extends AbstractFaxToMailJob { filterFolder = filterFolder.getParent(); } String company = filterFolder.getCompany(); - String brand = null; - // TODO kmorin 20150320 retirer cette rustine quand la gestion des marques par nom de domaine sera faite - if ("@groupecreal.com".equals(email.getRecipient().substring(email.getRecipient().lastIndexOf("@")))) { - brand = "creal"; - } + + String domain = email.getRecipient().substring(email.getRecipient().lastIndexOf("@") + 1); + List<String> brands = configurationService.getBrandsForDomain(domain); Address[] addresses = message.getFrom(); if (addresses != null && addresses.length > 0) { @@ -342,12 +340,16 @@ public class MailFilterJob extends AbstractFaxToMailJob { sender = sender.toLowerCase(); // Identification du client en fonction du numéro de fax appelant ou de l'adresse e-mail émettrice - Client client = clientService.getClientForEmailAddress(sender, email, company, brand); + List<Client> clients = clientService.getClientForEmailAddress(sender, email, company, brands); modifiedProperties.add(Email.PROPERTY_SENDER); String object; - if (client != null) { + Client client = null; + if (CollectionUtils.isNotEmpty(clients)) { //TODO echatellier : a valider que l'on affiche bien le premier mail du client + + client = clients.get(0); + String contact = sender; if (email.isFax()) { String faxNumber = contact.substring(0, contact.indexOf('@')).replaceAll(" ", ""); @@ -385,6 +387,7 @@ public class MailFilterJob extends AbstractFaxToMailJob { } email.setObject(object); email.setClient(client); + email.setMatchingClients(clients); modifiedProperties.add(Email.PROPERTY_OBJECT); MailFolder mailFolder = null; diff --git a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp index 8cf7073..145658c 100644 --- a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp +++ b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp @@ -50,6 +50,7 @@ 'searchDisplayColumns': <s:property value="toJson(configuration.searchDisplayColumns)" escapeHtml="false"/>, 'mailFilters': <s:property value="toJson(mailFilters)" escapeHtml="false"/>, 'emailAccounts': <s:property value="toJson(emailAccounts)" escapeHtml="false"/>, + 'brandsForDomains': <s:property value="toJson(brandsForDomains)" escapeHtml="false"/>, // referentiels 'users': <s:property value="toJson(users)" escapeHtml="false"/>, 'groups': <s:property value="toJson(groups)" escapeHtml="false"/>, @@ -78,6 +79,7 @@ <li><a href="#tabs-filters" data-toggle="tab">Filtres de mail</a></li> <li><a href="#tabs-search" data-toggle="tab">Recherche</a></li> <li><a href="#tabs-mailaccounts" data-toggle="tab">Comptes mail</a></li> + <li><a href="#tabs-brandsForDomain" data-toggle="tab">Noms de domaine / Marques</a></li> <li><a href="#tabs-chefgroup" data-toggle="tab">Chef de groupe</a></li> </ul> @@ -1179,6 +1181,57 @@ </div> </div> + <div id="tabs-brandsForDomain" class="tab-pane" ng-controller="ConfigurationBrandsForDomainController"> + <input type="hidden" name="brandsForDomainsJson" value="{{brandsForDomains}}" /> + + <table id='table-snapshot' class="table table-bordered"> + <thead> + <tr> + <th>Nom de domaine</th> + <th>Marques</th> + <th/> + </tr> + </thead> + <tbody> + <tr ng-repeat="brandsForDomain in brandsForDomains"> + <td>{{brandsForDomain.domainName}}</td> + <td>{{brandsForDomain.brands}}</td> + <td> + <a class="btn btn-danger btn-xs" ng-click="removeBrandsForDomain($index)"> + <span class="glyphicon glyphicon-remove"></span> + </a> + </td> + </tr> + <tr ng-if="!brandsForDomains || brandsForDomains.length == 0"> + <td class="emptyTable" colspan="6">Aucun nom de domaine configuré</td> + </tr> + </tbody> + </table> + + <div role="form" ng-form="addBrandsForDomainForm"> + <fieldset> + <legend>Nouveau nom de domaine</legend> + <div class="form row"> + <div class="form-group col-xs-5"> + <label for="brandsForDomainDomain" class="control-label">Nom de domaine :</label> + <!-- <input type="text" class="form-control" ng-model="newAccount.protocol" /> --> + <input id="brandsForDomainDomain" name="newBrandsForDomainDomain" type="text" class="form-control" ng-model="newBrandsForDomain.domainName" ng-minlength="1" /> + </div> + <div class="form-group col-xs-5"> + <label for="brandsForDomainBrands" class="control-label">Marques :</label> + <input id="brandsForDomainBrands" name="newBrandsForDomainBrands" type="text" class="form-control" ng-model="newBrandsForDomain.brands" ng-minlength="1" /> + </div> + <div class="form-group col-xs-2"> + <br/> + <button type="button" class="btn btn-success" ng-disabled="!newBrandsForDomain.domainName || !newBrandsForDomain.brands || newBrandsForDomain.$invalid" ng-click="addBrandsForDomain()"> + <i class="fa fa-plus"></i> Ajouter + </button> + </div> + </div> + </fieldset> + </div> + </div> + <div id="tabs-chefgroup" class="tab-pane" ng-controller="ConfigurationChefGroupController"> <div class="row"> diff --git a/faxtomail-ui-web/src/main/webapp/js/configuration.js b/faxtomail-ui-web/src/main/webapp/js/configuration.js index c3804b4..fa4f193 100644 --- a/faxtomail-ui-web/src/main/webapp/js/configuration.js +++ b/faxtomail-ui-web/src/main/webapp/js/configuration.js @@ -1218,6 +1218,32 @@ ConfigurationModule.controller('ConfigurationEmailAccountsController', ['$scope' }); }]); +/** + * Brands for domain controller. + */ +ConfigurationModule.controller('ConfigurationBrandsForDomainController', ['$scope', '$window', '$http', 'ConfigurationData', + function($scope, $window, $http, ConfigurationData) { + //{Array} Brands for domain + $scope.brandsForDomains = ConfigurationData.brandsForDomains; + //{Object} New accout empty object + $scope.newBrandsForDomain = {}; + + // ajout d'un nouveau domaine + $scope.addBrandsForDomain = function() { + console.log($scope.newBrandsForDomain); + $scope.brandsForDomains.push($scope.newBrandsForDomain); + $scope.newBrandsForDomain = {}; + $scope.addBrandsForDomainForm.$setPristine(); + }; + + // suppression d'un domaine + $scope.removeBrandsForDomain = function(index) { + if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce nom de domaine ?")) { + $scope.brandsForDomains.splice(index, 1); + } + }; + +}]); /** * Chef de groupe controller. diff --git a/pom.xml b/pom.xml index 835527a..a0b6808 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,7 @@ <h2Version>1.3.176</h2Version> <guavaVersion>18.0</guavaVersion> - <jaxxVersion>2.22</jaxxVersion> + <jaxxVersion>2.24</jaxxVersion> <!-- do not upgrade to 1.6.5-1 --> <swingXVersion>1.6.4</swingXVersion> <xworkVersion>2.3.16.3</xworkVersion> diff --git a/trunk/LICENSE.txt b/trunk/LICENSE.txt deleted file mode 100644 index 94a9ed0..0000000 --- a/trunk/LICENSE.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/trunk/README.txt b/trunk/README.txt deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/faxtomail-persistence/LICENSE.txt b/trunk/faxtomail-persistence/LICENSE.txt deleted file mode 100644 index 94a9ed0..0000000 --- a/trunk/faxtomail-persistence/LICENSE.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/trunk/faxtomail-persistence/README.txt b/trunk/faxtomail-persistence/README.txt deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/faxtomail-persistence/pom.xml b/trunk/faxtomail-persistence/pom.xml deleted file mode 100644 index 51d78d6..0000000 --- a/trunk/faxtomail-persistence/pom.xml +++ /dev/null @@ -1,165 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: Persistence - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>faxtomail</artifactId> - <groupId>com.franciaflex</groupId> - <version>1.0</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <groupId>com.franciaflex.faxtomail</groupId> - <artifactId>faxtomail-persistence</artifactId> - - <name>FaxToMail :: Persistence</name> - - <dependencies> - - <!-- commons --> - - <dependency> - <groupId>org.nuiton.topia</groupId> - <artifactId>topia-persistence</artifactId> - </dependency> - - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - </dependency> - - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-c3p0</artifactId> - </dependency> - - <dependency> - <groupId>net.sourceforge.jtds</groupId> - <artifactId>jtds</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-config</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-updater</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-application-api</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.i18n</groupId> - <artifactId>nuiton-i18n</artifactId> - </dependency> - - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-collections4</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - </dependency> - - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - - <dependency> - <groupId>org.swinglabs.swingx</groupId> - <artifactId>swingx-common</artifactId> - </dependency> - - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - </dependency> - </dependencies> - - <build> - <plugins> - - <plugin> - <groupId>org.nuiton.eugene</groupId> - <artifactId>eugene-maven-plugin</artifactId> - <executions> - <execution> - <id>generate-entities</id> - <phase>generate-sources</phase> - <configuration> - <inputs>zargo</inputs> - <defaultPackage>com.franciaflex.faxtomail.persistence.entities</defaultPackage> - <fullPackagePath>com.franciaflex.faxtomail.persistence.entities</fullPackagePath> - <templates> - org.nuiton.eugene.java.JavaInterfaceTransformer, - org.nuiton.topia.templates.TopiaMetaTransformer - </templates> - </configuration> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.nuiton.i18n</groupId> - <artifactId>i18n-maven-plugin</artifactId> - <executions> - <execution> - <id>scan-sources</id> - <goals> - <goal>parserJava</goal> - <goal>gen</goal> - </goals> - </execution> - </executions> - </plugin> - - </plugins> - </build> - -</project> diff --git a/trunk/faxtomail-persistence/src/license/THIRD-PARTY.properties b/trunk/faxtomail-persistence/src/license/THIRD-PARTY.properties deleted file mode 100644 index 8c009b1..0000000 --- a/trunk/faxtomail-persistence/src/license/THIRD-PARTY.properties +++ /dev/null @@ -1,53 +0,0 @@ -### -# #%L -# FaxToMail :: Persistence -# %% -# Copyright (C) 2014 Mac-Groupe, Code Lutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### -# Generated by org.codehaus.mojo.license.AddThirdPartyMojo -#------------------------------------------------------------------------------- -# Already used licenses in project : -# - AL 2.0 -# - Apache License 2.0 -# - Apache License, version 2.0 -# - BSD License -# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 -# - Common Development and Distribution License -# - Common Public License Version 1.0 -# - Eclipse Distribution License (EDL), Version 1.0 -# - Eclipse Public License (EPL), Version 1.0 -# - Eclipse Public License, Version 1.0 -# - GNU General Public License, Version 2 with the Classpath Exception -# - GNU Lesser General Public License, Version 2.1 -# - Indiana University Extreme! Lab Software License, vesion 1.1.1 -# - Lesser General Public License (LGPL) -# - Lesser General Public License (LGPL) v 3.0 -# - Lesser General Public License (LPGL) -# - Lesser General Public License (LPGL) v 2.1 -# - MIT License -# - MPL 1.1 -# - New BSD License -# - Public Domain -# - The Apache Software License, Version 2.0 -#------------------------------------------------------------------------------- -# Please fill the missing licenses for dependencies : -# -# -#Fri Apr 25 11:30:56 CEST 2014 -commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 -dom4j--dom4j--1.6.1=BSD License diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java deleted file mode 100644 index a704e87..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfiguration.java +++ /dev/null @@ -1,426 +0,0 @@ -package com.franciaflex.faxtomail; - -/* - * #%L - * Extranet ENC-AHI :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.awt.Color; -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import javax.swing.KeyStroke; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.builder.ReflectionToStringBuilder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.config.ApplicationConfig; -import org.nuiton.config.ApplicationConfigHelper; -import org.nuiton.config.ApplicationConfigProvider; -import org.nuiton.config.ArgumentsParserException; -import org.nuiton.jaxx.application.ApplicationConfiguration; -import org.nuiton.jaxx.application.ApplicationIOUtil; -import org.nuiton.jaxx.application.ApplicationTechnicalException; -import org.nuiton.util.version.Version; - -import com.google.common.base.Charsets; -import com.google.common.collect.Maps; - -public class FaxToMailConfiguration extends ApplicationConfiguration { - - private static final Log log = LogFactory.getLog(FaxToMailConfiguration.class); - - protected final String[] optionKeyToNotSave; - - protected File configFile; - - public FaxToMailConfiguration(ApplicationConfig applicationConfig) { - super(applicationConfig); - optionKeyToNotSave = null; - } - - public FaxToMailConfiguration(String file, String... args) { - super(new ApplicationConfig()); - applicationConfig.setEncoding(Charsets.UTF_8.name()); - - // get all config providers - Set<ApplicationConfigProvider> providers = - ApplicationConfigHelper.getProviders(null, - null, - null, - true); - - // load all default options - ApplicationConfigHelper.loadAllDefaultOption(applicationConfig, - providers); - - // get all transient and final option keys - Set<String> optionToSkip = - ApplicationConfigHelper.getTransientOptionKeys(providers); - - if (log.isDebugEnabled()) { - log.debug("Option that won't be saved: " + optionToSkip); - } - optionKeyToNotSave = optionToSkip.toArray(new String[optionToSkip.size()]); - - applicationConfig.setConfigFileName(file); - - try { - applicationConfig.parse(args); - - } catch (ArgumentsParserException e) { - throw new ApplicationTechnicalException(t("faxtomail.config.parse.error"), e); - } - - //TODO Review this, this is very dirty to do this... - File faxToMailBasedir = applicationConfig.getOptionAsFile( - FaxToMailConfigurationOption.BASEDIR.getKey()); - - if (faxToMailBasedir == null) { - faxToMailBasedir = new File(""); - } - if (!faxToMailBasedir.isAbsolute()) { - faxToMailBasedir = new File(faxToMailBasedir.getAbsolutePath()); - } - if (faxToMailBasedir.getName().equals("..")) { - faxToMailBasedir = faxToMailBasedir.getParentFile().getParentFile(); - } - if (faxToMailBasedir.getName().equals(".")) { - faxToMailBasedir = faxToMailBasedir.getParentFile(); - } - if (log.isInfoEnabled()) { - log.info("Application basedir: " + faxToMailBasedir); - } - applicationConfig.setOption( - FaxToMailConfigurationOption.BASEDIR.getKey(), - faxToMailBasedir.getAbsolutePath()); - -// if (log.isInfoEnabled()) { -// StringBuilder builder = new StringBuilder(); -// List<FaxToMailConfigurationOption> options = -// Lists.newArrayList(FaxToMailConfigurationOption.values()); -// for (FaxToMailConfigurationOption option : options) { -// String key = option.getKey(); -// Object value = applicationConfig.getOption(option); -// builder.append(String.format("\n%1$-40s = %2$s", -// key, -// value)); -// } -// log.info("faxtomail: " + builder.toString()); -// } - } - - public void prepareDirectories() { - - File dataDirectory = getDataDirectory(); - ApplicationIOUtil.forceMkdir( - dataDirectory, - t("faxtomail.service.mkDir.error", dataDirectory)); - - } - - public File getConfigFile() { - if (configFile == null) { - File dir = getBasedir(); - if (dir == null || !dir.exists() || !isFullLaunchMode()) { - dir = new File(applicationConfig.getUserConfigDirectory()); - } - configFile = new File(dir, applicationConfig.getConfigFileName()); - } - return configFile; - } - - public void save() { - - File file = getConfigFile(); - if (log.isInfoEnabled()) { - log.info("Save configuration at: " + file); - } - try { - applicationConfig.save(file, false, optionKeyToNotSave); - } catch (IOException e) { - throw new ApplicationTechnicalException( - t("faxtomail.config.save.error", file), e); - } - } - - @Override - public String toString() { - return ReflectionToStringBuilder.toString(this); - } - - // OPTION SETTERS - - public void setCsvSeparator(char c) { - applicationConfig.setOption( - FaxToMailConfigurationOption.CSV_SEPARATOR.getKey(), c + ""); - } - - // OPTION GETTERS - - public boolean isDevMode() { - boolean isDevMode = applicationConfig.getOptionAsBoolean(FaxToMailConfigurationOption.DEV_MODE.getKey()); - return isDevMode; - } - - /** - * Get sub properties containing all options starting with "hibernate" and "topia". - * - * @return new sub map - */ - public Map<String, String> getTopiaProperties() { - Map<String, String> jpaParameters = Maps.newHashMap(); - Properties hibernateProperties = applicationConfig.getOptionStartsWith("hibernate"); - jpaParameters.putAll((Map) hibernateProperties); - Properties topiaProperties = applicationConfig.getOptionStartsWith("topia"); - jpaParameters.putAll((Map) topiaProperties); - return jpaParameters; - } - - public String getImportFileEncoding() { - return applicationConfig.getOption(FaxToMailConfigurationOption.IMPORT_FILE_ENCODING.getKey()); - } - - public String getSmtpHost() { - return applicationConfig.getOption(FaxToMailConfigurationOption.SMTP_HOST.getKey()); - } - - public int getSmtpPort() { - return applicationConfig.getOptionAsInt(FaxToMailConfigurationOption.SMTP_PORT.getKey()); - } - - public String getSmtpUser() { - return applicationConfig.getOption(FaxToMailConfigurationOption.SMTP_USER.getKey()); - } - - public String getSmtpPassword() { - return applicationConfig.getOption(FaxToMailConfigurationOption.SMTP_PASSWORD.getKey()); - } - - public boolean isSmtpUseSsl() { - return applicationConfig.getOptionAsBoolean(FaxToMailConfigurationOption.SMTP_SSL.getKey()); - } - - public boolean isMailDelete() { - return applicationConfig.getOptionAsBoolean(FaxToMailConfigurationOption.MAIL_DELETE.getKey()); - } - - public boolean isMailExpunge() { - return applicationConfig.getOptionAsBoolean(FaxToMailConfigurationOption.MAIL_EXPUNGE.getKey()); - } - - public boolean isLdapMock() { - return applicationConfig.getOptionAsBoolean(FaxToMailConfigurationOption.LDAP_MOCK.getKey()); - } - - public String getLdapHost() { - return applicationConfig.getOption(FaxToMailConfigurationOption.LDAP_HOST.getKey()); - } - - public int getLdapPort() { - return applicationConfig.getOptionAsInt(FaxToMailConfigurationOption.LDAP_PORT.getKey()); - } - - public String getLdapUser() { - return applicationConfig.getOption(FaxToMailConfigurationOption.LDAP_USER.getKey()); - } - - public String getLdapPassword() { - return applicationConfig.getOption(FaxToMailConfigurationOption.LDAP_PASSWORD.getKey()); - } - - public String getLdapBaseDn() { - return applicationConfig.getOption(FaxToMailConfigurationOption.LDAP_BASEDN.getKey()); - } - - public List<String> getLdapAdminGroups() { - return applicationConfig.getOptionAsList(FaxToMailConfigurationOption.LDAP_ADMIN_GROUPS.getKey()).getOption(); - } - - public String getLdapTestPrincipal() { - return applicationConfig.getOption(FaxToMailConfigurationOption.LDAP_TEST_PRINCIPAL.getKey()); - } - - public String getJobEdiExpression() { - return applicationConfig.getOption(FaxToMailConfigurationOption.JOB_EDI_EXPRESSION.getKey()); - } - - public String getJobMailExpression() { - return applicationConfig.getOption(FaxToMailConfigurationOption.JOB_MAIL_EXPRESSION.getKey()); - } - - public String getJobCientExpression() { - return applicationConfig.getOption(FaxToMailConfigurationOption.JOB_CLIENT_EXPRESSION.getKey()); - } - - public String getInstanceUrl() { - return applicationConfig.getOption(FaxToMailConfigurationOption.INSTANCE_URL.getKey()); - } - - public String getInstanceDisclaimer() { - return applicationConfig.getOption(FaxToMailConfigurationOption.INSTANCE_DISCLAIMER.getKey()); - } - - public boolean isLogConfigurationProvided() { - boolean logConfigurationProvided = - StringUtils.isNotBlank(applicationConfig.getOption(FaxToMailConfigurationOption.LOG_CONFIGURATION_FILE.getKey())); - return logConfigurationProvided; - } - - public File getLogConfigurationFile() { - return applicationConfig.getOptionAsFile(FaxToMailConfigurationOption.LOG_CONFIGURATION_FILE.getKey()); - } - - @Override - public String getApplicationName() { - return "FaxToMail"; - } - - /** @return {@link FaxToMailConfigurationOption#VERSION} value */ - @Override - public Version getVersion() { - return applicationConfig.getOptionAsVersion(FaxToMailConfigurationOption.VERSION.getKey()); - } - - /** @return {@link FaxToMailConfigurationOption#SITE_URL} value */ - public URL getSiteUrl() { - return applicationConfig.getOptionAsURL(FaxToMailConfigurationOption.SITE_URL.getKey()); - } - - /** @return {@link FaxToMailConfigurationOption#ORGANIZATION_NAME} value */ - public String getOrganizationName() { - return applicationConfig.getOption(FaxToMailConfigurationOption.ORGANIZATION_NAME.getKey()); - } - - /** @return {@link FaxToMailConfigurationOption#INCEPTION_YEAR} value */ - public int getInceptionYear() { - return applicationConfig.getOptionAsInt(FaxToMailConfigurationOption.INCEPTION_YEAR.getKey()); - } - - /** @return {@link FaxToMailConfigurationOption#BASEDIR} value */ - public File getBasedir() { - File result = applicationConfig.getOptionAsFile(FaxToMailConfigurationOption.BASEDIR.getKey()); - return result; - } - - /** @return {@link FaxToMailConfigurationOption#DEMO_DIRECTORY} value */ - public File getDemoDirectory() { - File result = applicationConfig.getOptionAsFile(FaxToMailConfigurationOption.DEMO_DIRECTORY.getKey()); - return result; - } - - /** @return {@link FaxToMailConfigurationOption#DATA_DIRECTORY} value */ - public File getDataDirectory() { - File result = applicationConfig.getOptionAsFile(FaxToMailConfigurationOption.DATA_DIRECTORY.getKey()); - return result; - } - - public char getCsvSeparator() { - return applicationConfig.getOption( - FaxToMailConfigurationOption.CSV_SEPARATOR.getKey()).charAt(0); - } - - public boolean isFullLaunchMode() { - return "full".equals(getFaxToMailLaunchMode()); - } - - public String getFaxToMailLaunchMode() { - return applicationConfig.getOption(FaxToMailConfigurationOption.FAXTOMAIL_LAUNCH_MODE.getKey()); - } - - /** @return {@link FaxToMailConfigurationOption#UI_CONFIG_FILE} value */ - public File getUIConfigFile() { - return applicationConfig.getOptionAsFile(FaxToMailConfigurationOption.UI_CONFIG_FILE.getKey()); - } - - /** @return {@link FaxToMailConfigurationOption#START_ACTION_FILE} value */ - public File getStartActionFile() { - return applicationConfig.getOptionAsFile(FaxToMailConfigurationOption.START_ACTION_FILE.getKey()); - } - - public KeyStroke getShortCut(String actionName) { - KeyStroke result = applicationConfig.getOptionAsKeyStroke( - "faxtomail.ui." + actionName); - return result; - } - - public boolean isAutoPopupNumberEditor() { - return applicationConfig.getOptionAsBoolean(FaxToMailConfigurationOption.AUTO_POPUP_NUMBER_EDITOR.getKey()); - } - - public boolean isShowNumberEditorButton() { - return applicationConfig.getOptionAsBoolean(FaxToMailConfigurationOption.SHOW_NUMBER_EDITOR_BUTTON.getKey()); - } - - public Color getColorBlockingLayer() { - return applicationConfig.getOptionAsColor(FaxToMailConfigurationOption.COLOR_BLOCKING_LAYER.getKey()); - } - - public Color getColorAlternateRow() { - return applicationConfig.getOptionAsColor(FaxToMailConfigurationOption.COLOR_ALTERNATE_ROW.getKey()); - } - - public Color getColorSelectedRow() { - return applicationConfig.getOptionAsColor(FaxToMailConfigurationOption.COLOR_SELECTED_ROW.getKey()); - } - - public int getResultPerPage() { - return applicationConfig.getOptionAsInt(FaxToMailConfigurationOption.RESULT_PER_PAGE.getKey()); - } - - public void setResultPerPage(int resultPerPage) { - applicationConfig.setOption(FaxToMailConfigurationOption.RESULT_PER_PAGE.getKey(), String.valueOf(resultPerPage)); - } - - @Override - public KeyStroke getShortcutClosePopup() { - return applicationConfig.getOptionAsKeyStroke(FaxToMailConfigurationOption.SHORTCUT_CLOSE_POPUP.getKey()); - } - - public String getDateFormat() { - return applicationConfig.getOption(FaxToMailConfigurationOption.DATE_FORMAT.getKey()); - } - - public File getI18nDirectory() { - return applicationConfig.getOptionAsFile( - FaxToMailConfigurationOption.FAXTOMAIL_I18N_DIRECTORY.getKey()); - } - - public Locale getI18nLocale() { - return applicationConfig.getOptionAsLocale( - FaxToMailConfigurationOption.FAXTOMAIL_I18N_LOCALE.getKey()); - } - - public void setI18nLocale(Locale locale) { - applicationConfig.setOption(FaxToMailConfigurationOption.FAXTOMAIL_I18N_LOCALE.getKey(), locale.toString()); - } - -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationOption.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationOption.java deleted file mode 100644 index cf5b600..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationOption.java +++ /dev/null @@ -1,385 +0,0 @@ -package com.franciaflex.faxtomail; - -/* - * #%L - * Extranet ENC-AHI :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.n; - -import java.awt.Color; -import java.io.File; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.Locale; - -import javax.swing.KeyStroke; - -import org.nuiton.config.ConfigOptionDef; -import org.nuiton.util.version.Version; - -public enum FaxToMailConfigurationOption implements ConfigOptionDef { - - INSTANCE_URL( - "faxtomail.instanceUrl", - "URL à laquelle on peut accéder à l'instance de faxToMail", - "http://localhost:8080/faxtomail", String.class), - - INSTANCE_DISCLAIMER( - "faxtomail.instanceDisclaimer", - "Avertissement à afficher aux utilisateurs si l'instance est instable", - null, String.class), - - SMTP_HOST( - "faxtomail.smtp.host", - "Nom d'hôte du serveur SMTP", - null, String.class), - - SMTP_PORT( - "faxtomail.smtp.port", - "Le port du serveur SMTP", - "25", Integer.class), - - SMTP_USER( - "faxtomail.smtp.user", - "Utilisateur du serveur smtp", - null, String.class), - - SMTP_PASSWORD( - "faxtomail.smtp.password", - "Mot de passe de l'utilisateur du smtp", - null, String.class), - - SMTP_SSL( - "faxtomail.smtp.ssl", - "Utilisation on non du mode ssl pour le stmp", - "false", Boolean.class), - - MAIL_DELETE( - "faxtomail.mail.delete", - "Marque les mails comme étant supprimé sur le serveur", - "false", Boolean.class), - - MAIL_EXPUNGE( - "faxtomail.mail.expunge", - "Supprime définitivement les mails marqués comme supprimés", - "false", Boolean.class), - - DEV_MODE( - "faxtomail.devMode", - "Mode développement, court-circuite l'envoi de mail", - "false", Boolean.class), - - LOG_CONFIGURATION_FILE( - "logConfigurationFile", - "Chemin vers le fichier de configuration des journaux", - null, String.class), - - IMPORT_FILE_ENCODING( - "faxtomail.import.file.encoding", - "Encodage des fichiers des fichiers d'import", - StandardCharsets.UTF_8.toString(), String.class), - - LDAP_MOCK( - "faxtomail.ldap.mock", - "Utilisation d'un service ldap mock", "false", Boolean.class), - - LDAP_HOST( - "faxtomail.ldap.host", - "Adresse du serveur LDAP", null, String.class), - - LDAP_PORT( - "faxtomail.ldap.port", - "Port du serveur LDAP", "389", Integer.class), - - LDAP_USER( - "faxtomail.ldap.user", - "Nom d'utilisateur pour la connexion au serveur ldap", null, String.class), - - LDAP_PASSWORD( - "faxtomail.ldap.password", - "Mot de passe pour la connexion au serveur LDAP", null, String.class), - - LDAP_BASEDN( - "faxtomail.ldap.basedn", - "Mot de passe pour la connexion au serveur LDAP", "DC=mac-groupe,DC=net", String.class), - - LDAP_ADMIN_GROUPS( - "faxtomail.ldap.admin.groups", - "DN du groupe ldap ayant les autorisations d'accéder à la partie admin de l'interface web", null, String.class), - - LDAP_TEST_PRINCIPAL( - "faxtomail.ldap.test.principal", - "Principal de test pour forcer un utilsateur particulier", null, String.class), - - JOB_EDI_EXPRESSION( - "faxtomail.job.edi.expression", - "Expression cron de lancement du job EDI", "0 */5 * * * ?", String.class), - - JOB_MAIL_EXPRESSION( - "faxtomail.job.mail.expression", - "Expression cron de lancement du job Mail", "0 * * * * ?", String.class), - - JOB_CLIENT_EXPRESSION( - "faxtomail.job.client.expression", - "Expression cron de lancement du job Client", "0 */15 * * * ?", String.class), - - // TRANSIENT CONFIG - VERSION( - "faxtomail.version", - n("faxtomail.config.option.version.description"), - "", - Version.class, - true), - - SITE_URL( - "faxtomail.site.url", - n("faxtomail.config.option.site.url.description"), - "http://maven-site.forge.codelutin.com/faxtomail", - URL.class, - true), - - ORGANIZATION_NAME( - "faxtomail.organizationName", - n("faxtomail.config.option.organizationName.description"), - "", - String.class, - true), - - INCEPTION_YEAR( - "faxtomail.inceptionYear", - n("faxtomail.config.option.inceptionYear.description"), - "2012", - Integer.class, - true), - - BASEDIR( - "faxtomail.basedir", - n("faxtomail.config.option.basedir.description"), - "${user.home}/.faxtomail", - File.class, - true - ), - - DEMO_DIRECTORY( - "faxtomail.demo.directory", - n("faxtomail.config.option.demo.directory.description"), - "${faxtomail.basedir}/demo", - File.class, - true), - - DATA_DIRECTORY( - "faxtomail.data.directory", - n("faxtomail.config.option.data.directory.description"), - "${faxtomail.basedir}/data", - File.class, - true), - - // NOT TRANSIENT CONFIG - CSV_SEPARATOR( - "faxtomail.csv.separator", - n("faxtomail.config.option.csv.separator.description"), - ";", - char.class), - - // UI - - FAXTOMAIL_LAUNCH_MODE( - "faxtomail.launch.mode", - n("faxtomail.config.option.launch.mode.description"), - null, - String.class, - true - ), - - FAXTOMAIL_I18N_DIRECTORY( - "faxtomail.i18n.directory", - n("faxtomail.config.option.i18n.directory.description"), - "${faxtomail.basedir}/i18n", - File.class, - true - ), - - START_ACTION_FILE( - "faxtomail.startActionFile", - n("faxtomail.config.option.startActionFile.description"), - "${faxtomail.basedir}/faxtomail-start-action", - File.class, - true - ), - FAXTOMAIL_I18N_LOCALE( - "faxtomail.i18n.locale", - n("faxtomail.config.option.i18n.locale.description"), - Locale.FRANCE.getCountry(), - Locale.class - ), - - UI_CONFIG_FILE( - "faxtomail.ui.config.file", - n("faxtomail.config.option.ui.config.file.description"), - "${faxtomail.data.directory}/faxtomailUI.xml", - File.class - ), - - AUTO_POPUP_NUMBER_EDITOR( - "faxtomail.ui.autoPopupNumberEditor", - n("faxtomail.config.option.ui.autoPopupNumberEditor.description"), - String.valueOf(false), - Boolean.class - ), - - SHOW_NUMBER_EDITOR_BUTTON( - "faxtomail.ui.showNumberEditorButton", - n("faxtomail.config.option.ui.showNumberEditorButton.description"), - String.valueOf(true), - Boolean.class - ), - - COLOR_ALTERNATE_ROW( - "faxtomail.ui.color.alternateRow", - n("faxtomail.config.option.ui.color.alternateRow.description"), - new Color(217, 217, 217).toString(), - Color.class - ), - COLOR_SELECTED_ROW( - "faxtomail.ui.color.selectedRow", - n("faxtomail.config.option.ui.color.selectedRow.description"), - new Color(57,105,138).toString(), - Color.class - ), - - /* - UIDefaults defaults = UIManager.getLookAndFeelDefaults(); -defaults.put("Table.alternateRowColor", new Color(217, 217, 217)); - */ - COLOR_BLOCKING_LAYER( - "faxtomail.ui.color.blockingLayer", - n("faxtomail.config.option.ui.color.blockingLayer.description"), - new Color(200, 200, 200).toString(), - Color.class - ), - - SHORTCUT_CLOSE_POPUP( - "faxtomail.ui.shortcut.closePopup", - n("faxtomail.config.option.ui.shortcut.closePopup.description"), - "alt pressed F", - KeyStroke.class - ), - - DATE_FORMAT( - "faxtomail.ui.dateFormat", - n("faxtomail.config.option.ui.dateFormat.description"), - "dd/MM/yyyy", - String.class - ), - - RESULT_PER_PAGE( - "faxtomail.ui.resultPerPage", - n("faxtomail.config.option.ui.resultPerPage.description"), - "50", - Integer.class - ); - - /** Configuration key. */ - private final String key; - - /** I18n key of option description */ - private final String description; - - /** Type of option */ - private final Class<?> type; - - /** Default value of option. */ - private String defaultValue; - - /** Flag to not keep option value on disk */ - private boolean isTransient; - - /** Flag to not allow option value modification */ - private boolean isFinal; - - FaxToMailConfigurationOption(String key, - String description, - String defaultValue, - Class<?> type, - boolean isTransient) { - this.key = key; - this.description = description; - this.defaultValue = defaultValue; - this.type = type; - this.isTransient = isTransient; - this.isFinal = isTransient; - } - - FaxToMailConfigurationOption(String key, - String description, - String defaultValue, - Class<?> type) { - this(key, description, defaultValue, type, false); - } - - @Override - public String getKey() { - return key; - } - - @Override - public Class<?> getType() { - return type; - } - - @Override - public String getDescription() { - return description; - } - - @Override - public String getDefaultValue() { - return defaultValue; - } - - @Override - public boolean isTransient() { - return isTransient; - } - - @Override - public boolean isFinal() { - return isFinal; - } - - @Override - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - @Override - public void setTransient(boolean newValue) { - // not used - } - - @Override - public void setFinal(boolean newValue) { - // not used - } - -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationProvider.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationProvider.java deleted file mode 100644 index 2f8793e..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailConfigurationProvider.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.franciaflex.faxtomail; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.nuiton.config.ApplicationConfigProvider; -import org.nuiton.config.ConfigActionDef; -import org.nuiton.config.ConfigOptionDef; - -import java.util.Locale; - -import static org.nuiton.i18n.I18n.l; - -/** - * Tutti config provider (for site generation). - * Created on 11/24/13. - * - * @author Kevin Morin - morin@codelutin.com - */ -public class FaxToMailConfigurationProvider implements ApplicationConfigProvider { - - @Override - public String getName() { - return "faxToMail"; - } - - @Override - public String getDescription(Locale locale) { - return l(locale, "faxToMail.config"); - } - - @Override - public ConfigOptionDef[] getOptions() { - return FaxToMailConfigurationOption.values(); - } - - @Override - public ConfigActionDef[] getActions() { - return new ConfigActionDef[0]; - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/ProgressionModel.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/ProgressionModel.java deleted file mode 100644 index cbad7af..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/ProgressionModel.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.franciaflex.faxtomail.persistence; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.nuiton.jaxx.application.type.ApplicationProgressionModel; -import org.nuiton.updater.DownloadMonitor; - -/** - * Simple model for a progression long task. - * - * @author Kevin Morin - morin@codelutin.com - */ -public class ProgressionModel extends ApplicationProgressionModel implements DownloadMonitor { - - private static final long serialVersionUID = 1L; - - @Override - public void setSize(long size) { - setTotal((int) size); - } - - @Override - public void setCurrent(long current) { - setCurrent((int) current); - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/RessourceClassLoader.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/RessourceClassLoader.java deleted file mode 100644 index e7b30f4..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/RessourceClassLoader.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.franciaflex.faxtomail.persistence; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.collect.Lists; -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.jaxx.application.ApplicationIOUtil; -import org.nuiton.jaxx.application.ApplicationTechnicalException; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.Enumeration; -import java.util.List; - -import static org.nuiton.i18n.I18n.t; - -/** - * A class loader that search first in a given directory before in parent - * class loader. - * - * @author Kevin Morin - morin@codelutin.com - */ -public class RessourceClassLoader extends ClassLoader { - - /** Logger. */ - private static final Log log = - LogFactory.getLog(RessourceClassLoader.class); - - public static final URL[] EMPTY_URL_ARRAY = new URL[0]; - - protected URLClassLoader loader; - - protected Predicate<String> searchInDirectoriesPredicate; - - protected final List<File> directories; - - public RessourceClassLoader(ClassLoader parent) { - super(parent); - - // by default try in directories if there is some - this.searchInDirectoriesPredicate = new Predicate<String>() { - @Override - public boolean apply(String input) { - return !directories.isEmpty(); - } - }; - directories = Lists.newArrayList(); - loader = URLClassLoader.newInstance(EMPTY_URL_ARRAY); - } - - public void addDirectory(File... directories) { - for (File directory : directories) { - if (!this.directories.contains(directory)) { - this.directories.add(directory); - - // force to create directory - ApplicationIOUtil.forceMkdir(directory, t("faxtomail.persistence.mkDir.error", directory)); - } - } - loader = null; - } - - public void removeDirectory(File... directories) { - for (File directory : directories) { - this.directories.remove(directory); - } - loader = null; - } - - public Predicate<String> getSearchInDirectoriesPredicate() { - return searchInDirectoriesPredicate; - } - - public void addSearchInDirectoriesPredicate(Predicate<String> predicate) { - Preconditions.checkNotNull(predicate, - "search predicate can not be null"); - this.searchInDirectoriesPredicate = - Predicates.and(searchInDirectoriesPredicate, predicate); - } - - public void setSearchInDirectoriesPredicate(Predicate<String> searchInDirectoriesPredicate) { - Preconditions.checkNotNull(searchInDirectoriesPredicate, - "search predicate can not be null"); - this.searchInDirectoriesPredicate = searchInDirectoriesPredicate; - } - - @Override - public URL findResource(String name) { - URL result = null; - if (searchInDirectoriesPredicate.apply(name)) { - if (log.isDebugEnabled()) { - log.debug("findResource [" + name + "] in " + directories); - } - result = getLoader().findResource(name); - } - if (result == null) { - result = super.findResource(name); - } - return result; - } - - @Override - public Enumeration<URL> findResources(String name) throws IOException { - Enumeration<URL> result = null; - if (searchInDirectoriesPredicate.apply(name)) { - if (log.isDebugEnabled()) { - log.debug("findResources [" + name + "] in " + directories); - } - result = getLoader().findResources(name); - } - if (result == null || !result.hasMoreElements()) { - result = super.findResources(name); - } - return result; - } - - @Override - public URL getResource(String name) { - URL result = null; - if (searchInDirectoriesPredicate.apply(name)) { - if (log.isDebugEnabled()) { - log.debug("getResource [" + name + "] in " + - directories); - } - result = getLoader().getResource(name); - } - if (result == null) { - result = super.getResource(name); - } - return result; - } - - @Override - public Enumeration<URL> getResources(String name) throws IOException { - Enumeration<URL> result = null; - if (searchInDirectoriesPredicate.apply(name)) { - if (log.isDebugEnabled()) { - log.debug("getResources [" + name + "] in " + directories); - } - result = getLoader().getResources(name); - } - if (result == null || !result.hasMoreElements()) { - result = super.getResources(name); - } - return result; - } - - protected URLClassLoader getLoader() { - if (loader == null) { - try { - URL[] urls = FileUtils.toURLs( - directories.toArray(new File[directories.size()])); - loader = URLClassLoader.newInstance(urls, null); - } catch (IOException e) { - throw new ApplicationTechnicalException(t("faxtomail.persistence.loader.error", directories), e); - } - } - return loader; - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AbstractFaxToMailTopiaDao.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AbstractFaxToMailTopiaDao.java deleted file mode 100644 index 2261fb0..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AbstractFaxToMailTopiaDao.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.nuiton.topia.persistence.TopiaEntity; -import org.nuiton.topia.persistence.internal.AbstractTopiaDao; -import org.nuiton.util.pagination.PaginationParameter; - -import com.google.gson.Gson; - -public abstract class AbstractFaxToMailTopiaDao<E extends TopiaEntity> extends AbstractTopiaDao<E> { - - /** Instance unique de Gson. (certainement pas le meilleur endroit pour la placer). */ - public static final Gson GSON_INSTANCE = new Gson(); - - /** - * Find all entity for current table not contained in provided collection. - * - * @param others others elements - * @return remaining elements - */ - public List<E> forNotIn(Collection<E> others) { - String query = "FROM " + getEntityClass().getName() + " E" + - " WHERE E not in (:others)"; - Map<String, Object> args = new HashMap<>(); - args.put("others", others); - return findAll(query, args); - } - - public <K> List<K> find(String hql, Map<String, Object> hqlParameters, PaginationParameter pager) { - return super.find(hql, hqlParameters, pager); - } - -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java deleted file mode 100644 index dd0a9b2..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.FileUtil; - -public class AttachmentFileImpl extends AttachmentFileAbstract { - - private static final Log log = LogFactory.getLog(AttachmentFileImpl.class); - - /** Transient file instance with blob content on local file system. */ - protected transient File tmpLocalFile; - - @Override - public File getFile() { - - byte[] content = getContent(); - - if (tmpLocalFile == null && content != null) { - try { - // create temp file - File tempFolder = new File(FileUtils.getTempDirectory(), "faxtomail"); - tempFolder.mkdir(); - - String fileName = getFilename(); - tmpLocalFile = new File(tempFolder, fileName); - - // if the file already exists, then add a number to the name - int i = 1; - String extension = "." + FileUtil.extension(fileName); - String name = FileUtil.basename(fileName, extension); - while (tmpLocalFile.exists()) { - tmpLocalFile = new File(tempFolder, name + "-" + i++ + extension); - } - - if (log.isDebugEnabled()) { - log.debug(String.format("Copy blob content to file : %s", tmpLocalFile.getAbsolutePath())); - } - - tmpLocalFile.deleteOnExit(); - - // copy blob content - // be sure that "is" is not closed because is can be a local fileinputstream - // that hibernate must read to put in database - InputStream is = new ByteArrayInputStream(content); - OutputStream fos = new FileOutputStream(tmpLocalFile); - IOUtils.copy(is, fos); - fos.close(); - - } catch (IOException ex) { - throw new RuntimeException("Can't create file on local file system", ex); - } - } - return tmpLocalFile; - } - - @Override - public long getLength() { - long result = 0; - if (getFile() != null) { - result = getFile().length(); - } - return result; - } - - /** - * Overwrite finalize to delete local tmp file if necessary. - */ - @Override - protected void finalize() throws Throwable { - try { - if (tmpLocalFile != null && tmpLocalFile.exists()) { - if (log.isDebugEnabled()) { - log.debug(String.format("Deleting file : %s", tmpLocalFile.getAbsolutePath())); - } - tmpLocalFile.delete(); - } - } finally { - super.finalize(); - } - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentImpl.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentImpl.java deleted file mode 100644 index c271c64..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * @author Kevin Morin (Code Lutin) - */ -public class AttachmentImpl extends AttachmentAbstract { - - @Override - public void setOriginalFile(AttachmentFile originalFile) { - super.setOriginalFile(originalFile); - if (originalFile != null) { - setOriginalFileName(originalFile.getFilename()); - } - } - - @Override - public void setEditedFile(AttachmentFile editedFile) { - super.setEditedFile(editedFile); - if (editedFile != null) { - setEditedFileName(editedFile.getFilename()); - } - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientImpl.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientImpl.java deleted file mode 100644 index 4ee3325..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.lang.reflect.Type; -import java.util.List; - -import com.google.gson.reflect.TypeToken; - -public class ClientImpl extends ClientAbstract { - - /** serialVersionUID. */ - private static final long serialVersionUID = 645048064844251689L; - - private static final Type LIST_STRING_GSON_TYPE = new TypeToken<List<String>>() {}.getType(); - - @Override - public void setEmailAddresses(List<String> emails) { - String json = AbstractFaxToMailTopiaDao.GSON_INSTANCE.toJson(emails); - setEmailAddressesJson(json); - } - - @Override - public List<String> getEmailAddresses() { - String json = getEmailAddressesJson(); - List<String> emailAddress = AbstractFaxToMailTopiaDao.GSON_INSTANCE.fromJson(json, LIST_STRING_GSON_TYPE); - return emailAddress; - } - - @Override - public void setFaxNumbers(List<String> faxNumbers) { - String json = AbstractFaxToMailTopiaDao.GSON_INSTANCE.toJson(faxNumbers); - setFaxNumbersJson(json); - } - - @Override - public List<String> getFaxNumbers() { - String json = getFaxNumbersJson(); - List<String> faxNumbers = AbstractFaxToMailTopiaDao.GSON_INSTANCE.fromJson(json, LIST_STRING_GSON_TYPE); - return faxNumbers; - } - -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java deleted file mode 100644 index 927049e..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - -import com.google.common.base.Preconditions; - -public class ClientTopiaDao extends AbstractClientTopiaDao<Client> { - - protected List<Client> forPropertyJsonLike(String property, String value) { - Preconditions.checkArgument(StringUtils.isNotBlank(value), "Empty value can produce unexcepted results"); - - String query = "FROM " + Client.class.getName() + " WHERE " + property + " LIKE :propValue"; - - Map<String, Object> args = new HashMap<>(); - args.put("propValue", "%\"" + value + "\"%"); - List<Client> result = findAll(query, args); - return result; - } - - public List<Client> forEmailAddressesJsonLike(String emailAddress) { - List<Client> result = forPropertyJsonLike(Client.PROPERTY_EMAIL_ADDRESSES_JSON, emailAddress); - return result; - } - - public List<Client> forFaxNumbersJsonLike(String faxNumber) { - List<Client> result = forPropertyJsonLike(Client.PROPERTY_FAX_NUMBERS_JSON, faxNumber); - return result; - } - -} //ClientTopiaDao diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/DemandStatus.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/DemandStatus.java deleted file mode 100644 index d92e6ee..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/DemandStatus.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - */ -public enum DemandStatus implements HasLabel { - - UNTREATED(n("faxtomail.demandStatus.untreated"), true), - IN_PROGRESS(n("faxtomail.demandStatus.inProgress"), true), - TRANSMISSION_TO_EDI(n("faxtomail.demandStatus.transmissionToEdi"), false), - TRANSMITTED_TO_EDI(n("faxtomail.demandStatus.transmittedToEdi"), false), - QUALIFIED(n("faxtomail.demandStatus.qualified"), true), - ARCHIVED(n("faxtomail.demandStatus.archive"), false); - - protected String labelKey; - - protected boolean editableStatus; - - private DemandStatus(String labelKey, boolean editable) { - this.labelKey = labelKey; - this.editableStatus = editable; - } - - public String getLabelKey() { - return labelKey; - } - - public String getLabel() { - return t(labelKey); - } - - public boolean isEditableStatus() { - return editableStatus; - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EdiReturn.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EdiReturn.java deleted file mode 100644 index f888bae..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EdiReturn.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * Défini les colonnes de la table EdiReturn en base de données, mais non géré par Topia. - * - * @author Eric Chatellier - */ -public class EdiReturn { - - public static final String PROPERTY_RANGE_ROW_TOPIA_ID = "rangeRowTopiaId"; - public static final String PROPERTY_COMMAND_NUMBER = "commandNumber"; - public static final String PROPERTY_ERROR = "error"; - -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailFilter.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailFilter.java deleted file mode 100644 index bf2ade3..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailFilter.java +++ /dev/null @@ -1,303 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id: EmailFilter.java 598 2014-09-03 13:58:29Z echatellier $ - * $HeadURL: https://svn.codelutin.com/faxtomail/trunk/faxtomail-persistence/src/main/jav... $ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.jdesktop.beans.AbstractSerializableBean; - -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.Set; - -public class EmailFilter extends AbstractSerializableBean { - - /** serialVersionUID. */ - private static final long serialVersionUID = 7039570396201559352L; - - public static final String PROPERTY_PRIORITIES = "priorities"; - public static final String PROPERTY_DEMAND_TYPES = "demandTypes"; - public static final String PROPERTY_DEMAND_OBJECTS = "demandObjects"; - public static final String PROPERTY_CLIENT_CODES = "clientCodes"; - public static final String PROPERTY_CLIENT_BRANDS = "clientBrands"; - public static final String PROPERTY_SENDERS = "senders"; - public static final String PROPERTY_PROJECT_REFERENCES = "projectReferences"; - public static final String PROPERTY_LOCAL_REFERENCES = "localReferences"; - public static final String PROPERTY_REFERENCES = "references"; - public static final String PROPERTY_RECEPTION_DATES = "receptionDates"; - public static final String PROPERTY_RECIPIENTS = "recipients"; - public static final String PROPERTY_DEMAND_STATUS = "demandStatus"; - public static final String PROPERTY_PRODUCT_QUANTITIES = "productsQuantities"; - public static final String PROPERTY_SAV_QUANTITIES = "savQuantities"; - public static final String PROPERTY_QUOTATION_QUANTITIES = "quotationQuantities"; - public static final String PROPERTY_TAKEN_BYS = "takenBys"; - public static final String PROPERTY_COMMENTS = "comments"; - public static final String PROPERTY_EDI_CODE_NUMBERS = "ediCodeNumbers"; - public static final String PROPERTY_LAST_ATTACHMENT_OPENERS = "lastAttachmentOpeners"; - public static final String PROPERTY_WAITING_STATES = "waitingStates"; - - - protected Set<Priority> priorities; - - protected Set<DemandType> demandTypes; - - protected Set<String> demandObjects; - - protected Set<String> clientCodes; - - protected Set<String> clientBrands; - - protected Set<String> senders; - - protected Set<String> projectReferences; - - protected Set<String> localReferences; - - protected Set<String> references; - - protected Set<Date> receptionDates; - - protected Set<String> recipients; - - protected Set<DemandStatus> demandStatus; - - protected Set<Long> productsQuantities; - - protected Set<Long> savQuantities; - - protected Set<Long> quotationQuantities; - - protected Set<FaxToMailUser> takenBys; - - protected Set<String> comments; - - protected Set<String> ediCodeNumbers; - - protected Set<FaxToMailUser> lastAttachmentOpeners; - - protected Set<WaitingState> waitingStates; - - public Set<Priority> getPriorities() { - return priorities; - } - - public void setPriorities(Set<Priority> priorities) { - this.priorities = priorities; - firePropertyChange(PROPERTY_PRIORITIES, null, priorities); - } - - public Set<DemandType> getDemandTypes() { - return demandTypes; - } - - public void setDemandTypes(Set<DemandType> demandTypes) { - this.demandTypes = demandTypes; - firePropertyChange(PROPERTY_DEMAND_TYPES, null, demandTypes); - } - - public Set<String> getDemandObjects() { - return demandObjects; - } - - public void setDemandObjects(Set<String> demandObjects) { - this.demandObjects = demandObjects; - firePropertyChange(PROPERTY_DEMAND_OBJECTS, null, demandObjects); - } - - public Set<String> getClientCodes() { - return clientCodes; - } - - public void setClientCodes(Set<String> clientCodes) { - this.clientCodes = clientCodes; - firePropertyChange(PROPERTY_CLIENT_CODES, null, clientCodes); - } - - public Set<String> getClientBrands() { - return clientBrands; - } - - public void setClientBrands(Set<String> clientBrands) { - this.clientBrands = clientBrands; - firePropertyChange(PROPERTY_CLIENT_BRANDS, null, clientBrands); - } - - public Set<String> getSenders() { - return senders; - } - - public void setSenders(Set<String> senders) { - this.senders = senders; - firePropertyChange(PROPERTY_SENDERS, null, senders); - } - - public Set<String> getProjectReferences() { - return projectReferences; - } - - public void setProjectReferences(Set<String> projectReferences) { - this.projectReferences = projectReferences; - firePropertyChange(PROPERTY_PROJECT_REFERENCES, null, projectReferences); - } - - public Set<String> getLocalReferences() { - return localReferences; - } - - public void setLocalReferences(Set<String> localReferences) { - this.localReferences = localReferences; - firePropertyChange(PROPERTY_LOCAL_REFERENCES, null, localReferences); - } - - public Set<String> getReferences() { - return references; - } - - public void setReferences(Set<String> references) { - this.references = references; - firePropertyChange(PROPERTY_REFERENCES, null, references); - } - - public Set<Date> getReceptionDates() { - return receptionDates; - } - - public void setReceptionDates(Set<Date> receptionDates) { - this.receptionDates = receptionDates; - firePropertyChange(PROPERTY_RECEPTION_DATES, null, receptionDates); - } - - public Set<String> getRecipients() { - return recipients; - } - - public void setRecipients(Set<String> recipients) { - this.recipients = recipients; - firePropertyChange(PROPERTY_RECIPIENTS, null, recipients); - } - - public Set<DemandStatus> getDemandStatus() { - return demandStatus; - } - - public void setDemandStatus(Set<DemandStatus> demandStatus) { - this.demandStatus = demandStatus; - firePropertyChange(PROPERTY_DEMAND_STATUS, null, demandStatus); - } - - public Set<Long> getProductsQuantities() { - return productsQuantities; - } - - public void setProductsQuantities(Set<Long> productsQuantities) { - this.productsQuantities = productsQuantities; - firePropertyChange(PROPERTY_PRODUCT_QUANTITIES, null, productsQuantities); - } - - public Set<Long> getSavQuantities() { - return savQuantities; - } - - public void setSavQuantities(Set<Long> savQuantities) { - this.savQuantities = savQuantities; - firePropertyChange(PROPERTY_SAV_QUANTITIES, null, savQuantities); - } - - public Set<Long> getQuotationQuantities() { - return quotationQuantities; - } - - public void setQuotationQuantities(Set<Long> quotationQuantities) { - this.quotationQuantities = quotationQuantities; - firePropertyChange(PROPERTY_QUOTATION_QUANTITIES, null, quotationQuantities); - } - - public Set<FaxToMailUser> getTakenBys() { - return takenBys; - } - - public void setTakenBys(Set<FaxToMailUser> takenBys) { - this.takenBys = takenBys; - firePropertyChange(PROPERTY_TAKEN_BYS, null, takenBys); - } - - public Set<String> getComments() { - return comments; - } - - public void setComments(Set<String> comments) { - this.comments = comments; - firePropertyChange(PROPERTY_COMMENTS, null, comments); - } - - public Set<String> getEdiCodeNumbers() { - return ediCodeNumbers; - } - - public void setEdiCodeNumbers(Set<String> ediCodeNumbers) { - this.ediCodeNumbers = ediCodeNumbers; - firePropertyChange(PROPERTY_EDI_CODE_NUMBERS, null, ediCodeNumbers); - } - - public Set<FaxToMailUser> getLastAttachmentOpeners() { - return lastAttachmentOpeners; - } - - public void setLastAttachmentOpeners(Set<FaxToMailUser> lastAttachmentOpeners) { - this.lastAttachmentOpeners = lastAttachmentOpeners; - firePropertyChange(PROPERTY_LAST_ATTACHMENT_OPENERS, null, lastAttachmentOpeners); - } - - public Set<WaitingState> getWaitingStates() { - return waitingStates; - } - - public void setWaitingStates(Set<WaitingState> waitingStates) { - this.waitingStates = waitingStates; - firePropertyChange(PROPERTY_WAITING_STATES,null, waitingStates); - } - - public void clear() { - setClientCodes(null); - setWaitingStates(null); - setDemandStatus(null); - setQuotationQuantities(null); - setPriorities(null); - setClientBrands(null); - setComments(null); - setDemandObjects(null); - setDemandTypes(null); - setEdiCodeNumbers(null); - setLastAttachmentOpeners(null); - setTakenBys(null); - setLocalReferences(null); - setReferences(null); - setProjectReferences(null); - setProductsQuantities(null); - setReceptionDates(null); - setRecipients(null); - setSavQuantities(null); - setSenders(null); - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailImpl.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailImpl.java deleted file mode 100644 index 7548303..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailImpl.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id:$ - * $HeadURL:$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.base.Function; -import com.google.common.base.Predicate; -import com.google.common.collect.Collections2; -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.List; - -/** - * @author Kevin Morin (Code Lutin) - */ -public class EmailImpl extends EmailAbstract { - - protected History firstOpeningHistory; - - protected History lastModificationHistory; - - protected History lastAttachmentOpeningInFolderHistory; - - public void findFirstOpeningHistory() { - History result = null; - Date date = null; - Collection<History> histories = getHistory(); - if (histories != null) { - for (History history : histories) { - if (HistoryType.OPENING.equals(history.getType())) { - if (date == null || date.after(history.getModificationDate())) { - date = history.getModificationDate(); - result = history; - } - } - } - } - firstOpeningHistory = result; - } - - public void findLastModificationHistory() { - History result = null; - Date date = null; - Collection<History> histories = getHistory(); - if (histories != null) { - for (History history : histories) { - if (history.getType().isConsideredAsModification()) { - if (date == null || date.before(history.getModificationDate())) { - date = history.getModificationDate(); - result = history; - } - } - } - } - lastModificationHistory = result; - } - - public void findLastAttachmentOpeningInFolderHistory() { - History result = null; - Collection<History> histories = getHistory(); - - if (histories != null) { - History transmissionHistory = null; - for (History history : histories) { - Date modificationDate = history.getModificationDate(); - if (HistoryType.ATTACHMENT_OPENING.equals(history.getType())) { - if ((transmissionHistory == null - || transmissionHistory.getModificationDate().before(modificationDate)) - && (result == null - || result.getModificationDate().before(modificationDate))) { - result = history; - } - - } else if (HistoryType.TRANSMISSION.equals(history.getType())) { - if (transmissionHistory == null - || transmissionHistory.getModificationDate().before(modificationDate)) { - - transmissionHistory = history; - if (result != null && result.getModificationDate().before(transmissionHistory.getModificationDate())) { - result = null; - } - } - } - } - } - lastAttachmentOpeningInFolderHistory = result; - } - - protected History getFirstOpeningHistory() { - if (firstOpeningHistory == null) { - findFirstOpeningHistory(); - } - return firstOpeningHistory; - } - - @Override - public FaxToMailUser getFirstOpeningUser() { - History history = getFirstOpeningHistory(); - return history != null ? history.getFaxToMailUser() : null; - } - - @Override - public Date getFirstOpeningDate() { - History history = getFirstOpeningHistory(); - return history != null ? history.getModificationDate() : null; - } - - protected History getLastModificationHistory() { - if (lastModificationHistory == null) { - findLastModificationHistory(); - } - return lastModificationHistory; - } - - @Override - public FaxToMailUser getLastModificationUser() { - History history = getLastModificationHistory(); - return history != null ? history.getFaxToMailUser() : null; - } - - @Override - public Date getLastModificationDate() { - History history = getLastModificationHistory(); - return history != null ? history.getModificationDate() : null; - } - - protected History getLastAttachmentOpeningInThisFolderHistory() { - if (lastAttachmentOpeningInFolderHistory == null) { - findLastAttachmentOpeningInFolderHistory(); - } - return lastAttachmentOpeningInFolderHistory; - } - - @Override - public FaxToMailUser getLastAttachmentOpeningInFolderUser() { - History history = getLastAttachmentOpeningInThisFolderHistory(); - return history != null ? history.getFaxToMailUser() : null; - } - - @Override - public Date getLastAttachmentOpeningInFolderDate() { - History history = getLastAttachmentOpeningInThisFolderHistory(); - return history != null ? history.getModificationDate() : null; - } - - @Override - public void setHistory(List<History> history) { - firstOpeningHistory = null; - lastModificationHistory = null; - lastAttachmentOpeningInFolderHistory = null; - super.setHistory(history); - } - - public String getReference() { - List<String> reference = new ArrayList<String>(); - if (StringUtils.isNotBlank(getCompanyReference())) { - reference.add(getCompanyReference()); - } - Collection<RangeRow> rangeRow = getRangeRow(); - if (rangeRow != null) { - Collection<String> commandNumbers = Collections2.transform(rangeRow, new Function<RangeRow, String>() { - @Override - public String apply(RangeRow input) { - return input != null ? input.getCommandNumber() : ""; - } - }); - Collections2.filter(commandNumbers, new Predicate<String>() { - @Override - public boolean apply(String input) { - return StringUtils.isNotBlank(input); - } - }); - reference.addAll(commandNumbers); - } - return StringUtils.join(reference, ", "); - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailProtocol.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailProtocol.java deleted file mode 100644 index 5791b09..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailProtocol.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -public enum EmailProtocol { - - POP3(110), - POP3S(995), - IMAP(143), - IMAPS(993); - - private int port; - - private EmailProtocol(int port) { - this.port = port; - } - - public int getDefaultPort() { - return port; - } - -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java deleted file mode 100644 index d8e25cb..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java +++ /dev/null @@ -1,1027 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.hibernate.Hibernate; -import org.nuiton.topia.persistence.TopiaEntities; -import org.nuiton.topia.persistence.TopiaEntity; -import org.nuiton.util.pagination.PaginationParameter; -import org.nuiton.util.pagination.PaginationResult; - -import com.google.common.base.Function; -import com.google.common.base.Objects; -import com.google.common.base.Splitter; -import com.google.common.base.Strings; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - -public class EmailTopiaDao extends AbstractEmailTopiaDao<Email> { - - private static final Log log = LogFactory.getLog(EmailTopiaDao.class); - - /** - * Search for email using filter. - * - * @param searchFilter email filter - * @param readMailFolders readable mail folders (for rights compute) - * @param pagination pagination - * @return email list matching query filters - */ - public PaginationResult<Email> search(SearchFilter searchFilter, Set<MailFolder> readMailFolders, PaginationParameter pagination) { - - //StringBuilder query = new StringBuilder("FROM " + Email.class.getName() + " E"); - StringBuilder query = new StringBuilder(); - Map<String, Object> args = new HashMap<>(); - - // apply security - query.append(" WHERE E." + Email.PROPERTY_MAIL_FOLDER + " in (:readMailFolders)"); - args.put("readMailFolders", readMailFolders); - - // email minReceptionDate - if (searchFilter.getMinReceptionDate() != null) { - Date date = DateUtils.truncate(searchFilter.getMinReceptionDate(), Calendar.DAY_OF_MONTH); - query.append(" AND E." + Email.PROPERTY_RECEPTION_DATE + " >= :" + SearchFilter.PROPERTY_MIN_RECEPTION_DATE); - args.put(SearchFilter.PROPERTY_MIN_RECEPTION_DATE, date); - } - - // email maxReceptionDate - if (searchFilter.getMaxReceptionDate() != null) { - Date date = DateUtils.ceiling(searchFilter.getMaxReceptionDate(), Calendar.DAY_OF_MONTH); - query.append(" AND E." + Email.PROPERTY_RECEPTION_DATE + " <= :" + SearchFilter.PROPERTY_MAX_RECEPTION_DATE); - args.put(SearchFilter.PROPERTY_MAX_RECEPTION_DATE, date); - } - - // email taken by - if (searchFilter.getTakenBy() != null) { - query.append(" AND E." + Email.PROPERTY_TAKEN_BY + " = :" + SearchFilter.PROPERTY_TAKEN_BY); - args.put(SearchFilter.PROPERTY_TAKEN_BY, searchFilter.getTakenBy()); - } - - // history minModificationDate && modifiedBy - if (searchFilter.getMinModificationDate() != null || searchFilter.getModifiedBy() != null) { - query.append(" AND EXISTS (FROM " + History.class.getName() + " H WHERE H in elements(E." + Email.PROPERTY_HISTORY + ")"); - query.append(" AND H." + History.PROPERTY_TYPE + " = :modificationType"); - args.put("modificationType", HistoryType.MODIFICATION); - if (searchFilter.getMinModificationDate() != null) { - Date date = DateUtils.truncate(searchFilter.getMinModificationDate(), Calendar.DAY_OF_MONTH); - query.append(" AND H." + History.PROPERTY_MODIFICATION_DATE + " >= :" + SearchFilter.PROPERTY_MIN_MODIFICATION_DATE); - args.put(SearchFilter.PROPERTY_MIN_MODIFICATION_DATE, date); - } - if (searchFilter.getModifiedBy() != null) { - query.append(" AND H." + History.PROPERTY_FAX_TO_MAIL_USER + " = :" + SearchFilter.PROPERTY_MODIFIED_BY); - args.put(SearchFilter.PROPERTY_MODIFIED_BY, searchFilter.getModifiedBy()); - } - query.append(")"); - } - - // history maxModificationDate && modifiedBy - if (searchFilter.getMaxModificationDate() != null || searchFilter.getModifiedBy() != null) { - query.append(" AND EXISTS (FROM " + History.class.getName() + " H WHERE H in elements(E." + Email.PROPERTY_HISTORY + ")"); - query.append(" AND H." + History.PROPERTY_TYPE + " = :modificationType"); - args.put("modificationType", HistoryType.MODIFICATION); - if (searchFilter.getMaxModificationDate() != null) { - Date date = DateUtils.ceiling(searchFilter.getMaxModificationDate(), Calendar.DAY_OF_MONTH); - query.append(" AND H." + History.PROPERTY_MODIFICATION_DATE + " <= :" + SearchFilter.PROPERTY_MAX_MODIFICATION_DATE); - args.put(SearchFilter.PROPERTY_MAX_MODIFICATION_DATE, date); - } - if (searchFilter.getModifiedBy() != null) { - query.append(" AND H." + History.PROPERTY_FAX_TO_MAIL_USER + " = :" + SearchFilter.PROPERTY_MODIFIED_BY); - args.put(SearchFilter.PROPERTY_MODIFIED_BY, searchFilter.getModifiedBy()); - } - query.append(")"); - } - - // history minTransferDate && transferBy - if (searchFilter.getMinTransferDate() != null || searchFilter.getTransferBy() != null) { - query.append(" AND EXISTS (FROM " + History.class.getName() + " H WHERE H in elements(E." + Email.PROPERTY_HISTORY + ")"); - query.append(" AND H." + History.PROPERTY_TYPE + " = :transmissionType"); - args.put("transmissionType", HistoryType.TRANSMISSION); - if (searchFilter.getMinTransferDate() != null) { - Date date = DateUtils.truncate(searchFilter.getMinTransferDate(), Calendar.DAY_OF_MONTH); - query.append(" AND H." + History.PROPERTY_MODIFICATION_DATE + " >= :" + SearchFilter.PROPERTY_MIN_TRANSFER_DATE); - args.put(SearchFilter.PROPERTY_MIN_TRANSFER_DATE, date); - } - if (searchFilter.getTransferBy() != null) { - query.append(" AND H." + History.PROPERTY_FAX_TO_MAIL_USER + " = :" + SearchFilter.PROPERTY_TRANSFER_BY); - args.put(SearchFilter.PROPERTY_TRANSFER_BY, searchFilter.getTransferBy()); - } - query.append(")"); - } - - // history maxTransferDate && transferBy - if (searchFilter.getMaxTransferDate() != null || searchFilter.getTransferBy() != null) { - query.append(" AND EXISTS (FROM " + History.class.getName() + " H WHERE H in elements(E." + Email.PROPERTY_HISTORY + ")"); - query.append(" AND H." + History.PROPERTY_TYPE + " = :transmissionType"); - args.put("transmissionType", HistoryType.TRANSMISSION); - if (searchFilter.getMaxTransferDate() != null) { - Date date = DateUtils.ceiling(searchFilter.getMaxTransferDate(), Calendar.DAY_OF_MONTH); - query.append(" AND H." + History.PROPERTY_MODIFICATION_DATE + " <= :" + SearchFilter.PROPERTY_MAX_TRANSFER_DATE); - args.put(SearchFilter.PROPERTY_MAX_TRANSFER_DATE, date); - } - if (searchFilter.getTransferBy() != null) { - query.append(" AND H." + History.PROPERTY_FAX_TO_MAIL_USER + " = :" + SearchFilter.PROPERTY_TRANSFER_BY); - args.put(SearchFilter.PROPERTY_TRANSFER_BY, searchFilter.getTransferBy()); - } - query.append(")"); - } - - // history minArchivedDate && transferBy - if (searchFilter.getMinArchivedDate() != null || searchFilter.getArchivedBy() != null) { - query.append(" AND EXISTS (FROM " + History.class.getName() + " H WHERE H in elements(E." + Email.PROPERTY_HISTORY + ")"); - query.append(" AND H." + History.PROPERTY_TYPE + " = :archivedType"); - args.put("archivedType", HistoryType.ARCHIVED); - if (searchFilter.getMinArchivedDate() != null) { - Date date = DateUtils.truncate(searchFilter.getMinArchivedDate(), Calendar.DAY_OF_MONTH); - query.append(" AND H." + History.PROPERTY_MODIFICATION_DATE + " >= :" + SearchFilter.PROPERTY_MIN_ARCHIVED_DATE); - args.put(SearchFilter.PROPERTY_MIN_ARCHIVED_DATE, date); - } - if (searchFilter.getArchivedBy() != null) { - query.append(" AND H." + History.PROPERTY_FAX_TO_MAIL_USER + " = :" + SearchFilter.PROPERTY_ARCHIVED_BY); - args.put(SearchFilter.PROPERTY_ARCHIVED_BY, searchFilter.getArchivedBy()); - } - query.append(")"); - } - - // history maxArchivedDate && transferBy - if (searchFilter.getMaxArchivedDate() != null || searchFilter.getArchivedBy() != null) { - query.append(" AND EXISTS (FROM " + History.class.getName() + " H WHERE H in elements(E." + Email.PROPERTY_HISTORY + ")"); - query.append(" AND H." + History.PROPERTY_TYPE + " = :archivedType"); - args.put("archivedType", HistoryType.ARCHIVED); - if (searchFilter.getMaxArchivedDate() != null) { - Date date = DateUtils.ceiling(searchFilter.getMaxArchivedDate(), Calendar.DAY_OF_MONTH); - query.append(" AND H." + History.PROPERTY_MODIFICATION_DATE + " <= :" + SearchFilter.PROPERTY_MAX_ARCHIVED_DATE); - args.put(SearchFilter.PROPERTY_MAX_ARCHIVED_DATE, date); - } - if (searchFilter.getArchivedBy() != null) { - query.append(" AND H." + History.PROPERTY_FAX_TO_MAIL_USER + " = :" + SearchFilter.PROPERTY_ARCHIVED_BY); - args.put(SearchFilter.PROPERTY_ARCHIVED_BY, searchFilter.getArchivedBy()); - } - query.append(")"); - } - - // email minPrintingDate - if (searchFilter.getMinPrintingDate() != null || searchFilter.getPrintingBy() != null) { - query.append(" AND EXISTS (FROM " + History.class.getName() + " H WHERE H in elements(E." + Email.PROPERTY_HISTORY + ")"); - query.append(" AND H." + History.PROPERTY_TYPE + " = :printingType"); - args.put("printingType", HistoryType.PRINTING); - if (searchFilter.getMinPrintingDate() != null) { - Date date = DateUtils.truncate(searchFilter.getMinPrintingDate(), Calendar.DAY_OF_MONTH); - query.append(" AND H." + History.PROPERTY_MODIFICATION_DATE + " >= :" + SearchFilter.PROPERTY_MIN_PRINTING_DATE); - args.put(SearchFilter.PROPERTY_MIN_PRINTING_DATE, date); - } - if (searchFilter.getPrintingBy() != null) { - query.append(" AND H." + History.PROPERTY_FAX_TO_MAIL_USER + " = :" + SearchFilter.PROPERTY_PRINTING_BY); - args.put(SearchFilter.PROPERTY_PRINTING_BY, searchFilter.getPrintingBy()); - } - query.append(")"); - } - - // email maxPrintingDate - if (searchFilter.getMaxPrintingDate() != null || searchFilter.getPrintingBy() != null) { - query.append(" AND EXISTS (FROM " + History.class.getName() + " H WHERE H in elements(E." + Email.PROPERTY_HISTORY + ")"); - query.append(" AND H." + History.PROPERTY_TYPE + " = :printingType"); - args.put("printingType", HistoryType.PRINTING); - if (searchFilter.getMaxPrintingDate() != null) { - Date date = DateUtils.ceiling(searchFilter.getMaxPrintingDate(), Calendar.DAY_OF_MONTH); - query.append(" AND H." + History.PROPERTY_MODIFICATION_DATE + " <= :" + SearchFilter.PROPERTY_MAX_PRINTING_DATE); - args.put(SearchFilter.PROPERTY_MAX_PRINTING_DATE, date); - } - if (searchFilter.getPrintingBy() != null) { - query.append(" AND H." + History.PROPERTY_FAX_TO_MAIL_USER + " = :" + SearchFilter.PROPERTY_PRINTING_BY); - args.put(SearchFilter.PROPERTY_PRINTING_BY, searchFilter.getPrintingBy()); - } - query.append(")"); - } - - // email minReplyDate - if (searchFilter.getMinReplyDate() != null || searchFilter.getReplyBy() != null) { - query.append(" AND EXISTS (FROM " + History.class.getName() + " H WHERE H in elements(E." + Email.PROPERTY_HISTORY + ")"); - query.append(" AND H." + History.PROPERTY_TYPE + " = :replyType"); - args.put("replyType", HistoryType.REPLY); - if (searchFilter.getMinReplyDate() != null) { - Date date = DateUtils.truncate(searchFilter.getMinReplyDate(), Calendar.DAY_OF_MONTH); - query.append(" AND H." + History.PROPERTY_MODIFICATION_DATE + " >= :" + SearchFilter.PROPERTY_MIN_REPLY_DATE); - args.put(SearchFilter.PROPERTY_MIN_REPLY_DATE, date); - } - if (searchFilter.getReplyBy() != null) { - query.append(" AND H." + History.PROPERTY_FAX_TO_MAIL_USER + " = :" + SearchFilter.PROPERTY_REPLY_BY); - args.put(SearchFilter.PROPERTY_REPLY_BY, searchFilter.getReplyBy()); - } - query.append(")"); - } - - // email maxReplyDate - if (searchFilter.getMaxReplyDate() != null || searchFilter.getReplyBy() != null) { - query.append(" AND EXISTS (FROM " + History.class.getName() + " H WHERE H in elements(E." + Email.PROPERTY_HISTORY + ")"); - query.append(" AND H." + History.PROPERTY_TYPE + " = :replyType"); - args.put("replyType", HistoryType.REPLY); - if (searchFilter.getMaxReplyDate() != null) { - Date date = DateUtils.ceiling(searchFilter.getMaxReplyDate(), Calendar.DAY_OF_MONTH); - query.append(" AND H." + History.PROPERTY_MODIFICATION_DATE + " <= :" + SearchFilter.PROPERTY_MAX_REPLY_DATE); - args.put(SearchFilter.PROPERTY_MAX_REPLY_DATE, date); - } - if (searchFilter.getReplyBy() != null) { - query.append(" AND H." + History.PROPERTY_FAX_TO_MAIL_USER + " = :" + SearchFilter.PROPERTY_REPLY_BY); - args.put(SearchFilter.PROPERTY_REPLY_BY, searchFilter.getReplyBy()); - } - query.append(")"); - } - - // email sender - if (StringUtils.isNotBlank(searchFilter.getSender())) { - query.append(" AND lower(E." + Email.PROPERTY_SENDER + ") LIKE lower(:" + SearchFilter.PROPERTY_SENDER + ")"); - args.put(SearchFilter.PROPERTY_SENDER, "%" + searchFilter.getSender() + "%"); - } - - // client code - if (StringUtils.isNoneBlank(searchFilter.getClientCode())) { - query.append(" AND lower(E." + Email.PROPERTY_CLIENT + "." + Client.PROPERTY_CODE + ") LIKE lower(:" + SearchFilter.PROPERTY_CLIENT_CODE + ")"); - args.put(SearchFilter.PROPERTY_CLIENT_CODE, "%" + searchFilter.getClientCode() + "%"); - } - - // email subject - if (StringUtils.isNotBlank(searchFilter.getDemandObject())) { - query.append(" AND lower(E." + Email.PROPERTY_OBJECT + ") LIKE lower(:" + SearchFilter.PROPERTY_DEMAND_OBJECT + ")"); - args.put(SearchFilter.PROPERTY_DEMAND_OBJECT, "%" + searchFilter.getDemandObject() + "%"); - } - - // email demand type - List<DemandType> demandType = searchFilter.getDemandType(); - if (CollectionUtils.isNotEmpty(demandType)) { - query.append(" AND (E." + Email.PROPERTY_DEMAND_TYPE + " IN (:" + SearchFilter.PROPERTY_DEMAND_TYPE + ")"); - args.put(SearchFilter.PROPERTY_DEMAND_TYPE, demandType); - - if (demandType.contains(null)) { - query.append(" OR E." + Email.PROPERTY_DEMAND_TYPE + " IS NULL"); - } - query.append(")"); - } - - // email ediCodeNumber - if (StringUtils.isNotBlank(searchFilter.getEdiCodeNumber())) { - query.append(" AND lower(E." + Email.PROPERTY_EDI_ERROR + ") LIKE lower(:" + SearchFilter.PROPERTY_EDI_CODE_NUMBER + ")"); - args.put(SearchFilter.PROPERTY_EDI_CODE_NUMBER, "%" + searchFilter.getEdiCodeNumber() + "%"); - } - - // email projectReference - if (StringUtils.isNotBlank(searchFilter.getProjectReference())) { - query.append(" AND lower(E." + Email.PROPERTY_PROJECT_REFERENCE + ") LIKE lower(:" + SearchFilter.PROPERTY_PROJECT_REFERENCE + ")"); - args.put(SearchFilter.PROPERTY_PROJECT_REFERENCE, "%" + searchFilter.getProjectReference() + "%"); - } - - // email priority - List<Priority> priority = searchFilter.getPriority(); - if (CollectionUtils.isNotEmpty(priority)) { - query.append(" AND (E." + Email.PROPERTY_PRIORITY + " IN (:" + SearchFilter.PROPERTY_PRIORITY + ")"); - args.put(SearchFilter.PROPERTY_PRIORITY, priority); - - if (priority.contains(null)) { - query.append(" OR E." + Email.PROPERTY_PRIORITY + " IS NULL"); - } - query.append(")"); - } - - // email demand status - List<DemandStatus> demandStatus = searchFilter.getDemandStatus(); - if (CollectionUtils.isNotEmpty(demandStatus)) { - query.append(" AND (E." + Email.PROPERTY_DEMAND_STATUS + " IN (:" + SearchFilter.PROPERTY_DEMAND_STATUS + ")"); - args.put(SearchFilter.PROPERTY_DEMAND_STATUS, demandStatus); - - if (demandStatus.contains(null)) { - query.append(" OR E." + Email.PROPERTY_DEMAND_STATUS + " IS NULL"); - } - query.append(")"); - } - - // email etat attente - List<WaitingState> waitingStates = searchFilter.getWaitingStates(); - if (CollectionUtils.isNotEmpty(waitingStates)) { - query.append(" AND (E." + Email.PROPERTY_WAITING_STATE + " IN (:" + SearchFilter.PROPERTY_WAITING_STATES + ")"); - args.put(SearchFilter.PROPERTY_WAITING_STATES, waitingStates); - - if (waitingStates.contains(null)) { - query.append(" OR E." + Email.PROPERTY_WAITING_STATE + " IS NULL"); - } - query.append(")"); - } - - // email message - if (StringUtils.isNotBlank(searchFilter.getMessage())) { - query.append(" AND lower(E." + Email.PROPERTY_COMMENT + ") LIKE lower(:" + SearchFilter.PROPERTY_MESSAGE + ")"); - args.put(SearchFilter.PROPERTY_MESSAGE, "%" + searchFilter.getMessage() + "%"); - } - - if (StringUtils.isNotBlank(searchFilter.getBody())) { - query.append(" AND lower(E." + Email.PROPERTY_ORIGINAL_EMAIL + ") LIKE lower(:" + SearchFilter.PROPERTY_BODY + ")"); - args.put(SearchFilter.PROPERTY_BODY, "%" + searchFilter.getBody() + "%"); - } - - // email gamme - List<Range> gamme = searchFilter.getGamme(); - if (CollectionUtils.isNotEmpty(gamme)) { - query.append(" AND ((EXISTS (FROM " + RangeRow.class.getName() + " RR WHERE RR in elements(E." + Email.PROPERTY_RANGE_ROW + ")"); - query.append(" AND RR." + RangeRow.PROPERTY_RANGE + " IN (:" + SearchFilter.PROPERTY_GAMME + "))"); - args.put(SearchFilter.PROPERTY_GAMME, gamme); - - if (gamme.contains(null)) { - query.append(" OR NOT EXISTS (FROM " + RangeRow.class.getName() + " RR WHERE RR in elements(E." + Email.PROPERTY_RANGE_ROW + "))"); - } - query.append("))"); - } - - // email localReference - if (StringUtils.isNotBlank(searchFilter.getLocalReference())) { - query.append(" AND (EXISTS (FROM " + RangeRow.class.getName() + " RR WHERE RR in elements(E." + Email.PROPERTY_RANGE_ROW + ")"); - query.append(" AND lower(RR." + RangeRow.PROPERTY_COMMAND_NUMBER + ") LIKE lower(:" + SearchFilter.PROPERTY_LOCAL_REFERENCE + "))"); - query.append(" OR lower(E." + Email.PROPERTY_COMPANY_REFERENCE + ") LIKE lower(:" + SearchFilter.PROPERTY_LOCAL_REFERENCE + ")"); - args.put(SearchFilter.PROPERTY_LOCAL_REFERENCE, "%" + searchFilter.getLocalReference() + "%"); - query.append(")"); - } - - // command Nb - if (StringUtils.isNotBlank(searchFilter.getCommandNb())) { - query.append(" AND (EXISTS (FROM " + RangeRow.class.getName() + " RR WHERE RR in elements(E." + Email.PROPERTY_RANGE_ROW + ")"); - query.append(" AND lower(RR." + RangeRow.PROPERTY_COMMAND_NUMBER + ") LIKE lower(:" + SearchFilter.PROPERTY_COMMAND_NB + "))"); - query.append(" OR lower(E." + Email.PROPERTY_COMPANY_REFERENCE + ") LIKE lower(:" + SearchFilter.PROPERTY_COMMAND_NB + ")"); - args.put(SearchFilter.PROPERTY_COMMAND_NB, "%" + searchFilter.getCommandNb() + "%"); - query.append(")"); - } - - // add same fecth liste as emailService#getEmailForFolder() - String hqlForFetchStep1 = "select E." + TopiaEntity.PROPERTY_TOPIA_ID + " FROM " + Email.class.getName() + " E " - + "WHERE E." + TopiaEntity.PROPERTY_TOPIA_ID + " IN (" - + "select E." + TopiaEntity.PROPERTY_TOPIA_ID + " FROM " + Email.class.getName() + " E " - + query.toString() + ") "; - - if (searchFilter.isAddGroupDemands()) { - hqlForFetchStep1 += "OR E." + TopiaEntity.PROPERTY_TOPIA_ID + " IN (" - + "select E2." + TopiaEntity.PROPERTY_TOPIA_ID + " FROM " + Email.class.getName() + " E " - + "LEFT OUTER JOIN E." + Email.PROPERTY_EMAIL_GROUP + " AS G " - + "LEFT OUTER JOIN G." + EmailGroup.PROPERTY_EMAIL + " AS E2 " - + query.toString() + ")"; - } - - String hqlForFetchStep2 = "select distinct E FROM " + Email.class.getName() + " E " + addAllFecthes( - Email.PROPERTY_PRIORITY, - Email.PROPERTY_DEMAND_TYPE, - Email.PROPERTY_CLIENT, - //Email.PROPERTY_RANGE_ROW + "." + RangeRow.PROPERTY_RANGE, - Email.PROPERTY_WAITING_STATE, - Email.PROPERTY_TAKEN_BY - //Email.PROPERTY_REPLIES, - //Email.PROPERTY_ATTACHMENT, - //Email.PROPERTY_HISTORY + "." + History.PROPERTY_FAX_TO_MAIL_USER, - //Email.PROPERTY_HISTORY + "." + History.PROPERTY_FIELDS, - //Email.PROPERTY_EMAIL_GROUP + "." + EmailGroup.PROPERTY_EMAIL - ) + " WHERE E." + TopiaEntity.PROPERTY_TOPIA_ID + " in ( :topiaIdsForFetch_ )"; - - // code copied from topia to perform search - PaginationResult<String> pageResult = findPage(hqlForFetchStep1, args, pagination); - List<String> step1ResultTopiaIds = pageResult.getElements(); - - List<Email> sortedEntities; - if (CollectionUtils.isEmpty(step1ResultTopiaIds)) { - sortedEntities = Lists.newArrayList(); - } else { - Map<String, Object> step2Args = Maps.newHashMap(); - step2Args.put("topiaIdsForFetch_", step1ResultTopiaIds); - List<Email> entities = forHql(hqlForFetchStep2, step2Args).findAll(); - - sortedEntities = sortAccordingToIds(entities, step1ResultTopiaIds); - } - - PaginationResult<Email> result = PaginationResult.of(sortedEntities, pageResult.getCount(), pageResult.getCurrentPage()); - - //PaginationResult<Email> result = findPage(query.toString(), args, pagination); - - // manual fetch - // Email.PROPERTY_PRIORITY, - // Email.PROPERTY_DEMAND_TYPE, - // Email.PROPERTY_CLIENT, - // Email.PROPERTY_RANGE_ROW + "." + RangeRow.PROPERTY_RANGE, - // Email.PROPERTY_ETAT_ATTENTE, - // Email.PROPERTY_TAKEN_BY, - // Email.PROPERTY_REPLIES, - // Email.PROPERTY_ATTACHMENT, - // Email.PROPERTY_HISTORY + "." + History.PROPERTY_FAX_TO_MAIL_USER, - // Email.PROPERTY_HISTORY + "." + History.PROPERTY_FIELDS, - // Email.PROPERTY_EMAIL_GROUP + "." + EmailGroup.PROPERTY_EMAIL) - for (Email email : result.getElements()) { - //Hibernate.initialize(email.getPriority()); - //Hibernate.initialize(email.getDemandType()); - //Hibernate.initialize(email.getClient()); - List<RangeRow> rangeRows = email.getRangeRow(); - if (rangeRows != null) { - for (RangeRow rangeRow : rangeRows) { - Hibernate.initialize(rangeRow.getRange()); - } - } - //Hibernate.initialize(email.getWaitingState()); - //Hibernate.initialize(email.getTakenBy()); - Hibernate.initialize(email.getReplies()); - Hibernate.initialize(email.getAttachment()); - List<History> histories = email.getHistory(); - if (histories != null) { - for (History history : histories) { - Hibernate.initialize(history.getFaxToMailUser()); - Hibernate.initialize(history.getFields()); - } - } - EmailGroup emailGroup = email.getEmailGroup(); - if (emailGroup != null) { - Hibernate.initialize(emailGroup.getEmail()); - // initialize folder of the grouped demand to transmit the grouped emails of the same folder - for (Email groupedEmail : emailGroup.getEmail()) { - Hibernate.initialize(groupedEmail.getMailFolder()); - } - } - } - return result; - } - - /** - * Search for email using filter. - * - * @param emailFilter email filter - * @param folder readable mail folders (for rights compute) - * @param pagination pagination - * @return email list matching query filters - */ - public PaginationResult<Email> getEmailForFolder(EmailFilter emailFilter, MailFolder folder, PaginationParameter pagination) { - - Map<String, Object> args = new HashMap<>(); - String query = filteredDemandsOfFolderCondition(folder, emailFilter, args); - - // add same fecth liste as emailService#getEmailForFolder() - String hqlForFetchStep1 = "select E." + TopiaEntity.PROPERTY_TOPIA_ID + " FROM " + Email.class.getName() + " E " + query; - String hqlForFetchStep2 = "select distinct E FROM " + Email.class.getName() + " E " + addAllFecthes( - Email.PROPERTY_PRIORITY, - Email.PROPERTY_DEMAND_TYPE, - Email.PROPERTY_CLIENT, - //Email.PROPERTY_RANGE_ROW + "." + RangeRow.PROPERTY_RANGE, - Email.PROPERTY_WAITING_STATE, - Email.PROPERTY_TAKEN_BY - //Email.PROPERTY_REPLIES, - //Email.PROPERTY_ATTACHMENT, - //Email.PROPERTY_HISTORY + "." + History.PROPERTY_FAX_TO_MAIL_USER, - //Email.PROPERTY_HISTORY + "." + History.PROPERTY_FIELDS, - //Email.PROPERTY_EMAIL_GROUP + "." + EmailGroup.PROPERTY_EMAIL - ) + " WHERE E." + TopiaEntity.PROPERTY_TOPIA_ID + " in ( :topiaIdsForFetch_ )"; - - // code copied from topia to perform search - PaginationResult<String> pageResult = findPage(hqlForFetchStep1, args, pagination); - List<String> step1ResultTopiaIds = pageResult.getElements(); - - List<Email> sortedEntities; - if (CollectionUtils.isEmpty(step1ResultTopiaIds)) { - sortedEntities = Lists.newArrayList(); - } else { - Map<String, Object> step2Args = Maps.newHashMap(); - step2Args.put("topiaIdsForFetch_", step1ResultTopiaIds); - List<Email> entities = forHql(hqlForFetchStep2, step2Args).findAll(); - - sortedEntities = sortAccordingToIds(entities, step1ResultTopiaIds); - } - - PaginationResult<Email> result = PaginationResult.of(sortedEntities, pageResult.getCount(), pageResult.getCurrentPage()); - - //PaginationResult<Email> result = findPage(query.toString(), args, pagination); - - // manual fetch - // Email.PROPERTY_PRIORITY, - // Email.PROPERTY_DEMAND_TYPE, - // Email.PROPERTY_CLIENT, - // Email.PROPERTY_RANGE_ROW + "." + RangeRow.PROPERTY_RANGE, - // Email.PROPERTY_ETAT_ATTENTE, - // Email.PROPERTY_TAKEN_BY, - // Email.PROPERTY_REPLIES, - // Email.PROPERTY_ATTACHMENT, - // Email.PROPERTY_HISTORY + "." + History.PROPERTY_FAX_TO_MAIL_USER, - // Email.PROPERTY_HISTORY + "." + History.PROPERTY_FIELDS, - // Email.PROPERTY_EMAIL_GROUP + "." + EmailGroup.PROPERTY_EMAIL) - for (Email email : result.getElements()) { - //Hibernate.initialize(email.getPriority()); - //Hibernate.initialize(email.getDemandType()); - //Hibernate.initialize(email.getClient()); - List<RangeRow> rangeRows = email.getRangeRow(); - if (rangeRows != null) { - for (RangeRow rangeRow : rangeRows) { - Hibernate.initialize(rangeRow.getRange()); - } - } - //Hibernate.initialize(email.getWaitingState()); - //Hibernate.initialize(email.getTakenBy()); - Hibernate.initialize(email.getReplies()); - Hibernate.initialize(email.getAttachment()); - List<History> histories = email.getHistory(); - if (histories != null) { - for (History history : histories) { - Hibernate.initialize(history.getFaxToMailUser()); - Hibernate.initialize(history.getFields()); - } - } - EmailGroup emailGroup = email.getEmailGroup(); - if (emailGroup != null) { - Hibernate.initialize(emailGroup.getEmail()); - // initialize folder of the grouped demand to transmit the grouped emails of the same folder - for (Email groupedEmail : emailGroup.getEmail()) { - Hibernate.initialize(groupedEmail.getMailFolder()); - } - } - } - return result; - } - - protected String filteredDemandsOfFolderCondition(MailFolder folder, EmailFilter emailFilter, Map<String, Object> args) { - StringBuilder query = new StringBuilder(); - - query.append(" WHERE E." + Email.PROPERTY_MAIL_FOLDER + " = :folder AND E." + Email.PROPERTY_DEMAND_STATUS + " != :archiveStatus"); - args.put("folder", folder); - args.put("archiveStatus", DemandStatus.ARCHIVED); - - Set<Date> receptionDates = emailFilter.getReceptionDates(); - if (receptionDates != null) { - query.append(" AND ("); - int i = 0; - for (Date date : receptionDates) { - query.append(" E." + Email.PROPERTY_RECEPTION_DATE + " BETWEEN :" + EmailFilter.PROPERTY_RECEPTION_DATES + i + "Min"); - query.append(" AND :" + EmailFilter.PROPERTY_RECEPTION_DATES + i + "Max"); - - args.put(EmailFilter.PROPERTY_RECEPTION_DATES + i + "Min", date); - args.put(EmailFilter.PROPERTY_RECEPTION_DATES + i + "Max", DateUtils.addMinutes(date, 1)); - - if (i++ < receptionDates.size() - 1) { - query.append(" OR"); - } - } - query.append(")"); - } - - Set<DemandStatus> demandStatus = emailFilter.getDemandStatus(); - if (demandStatus != null) { - query.append(" AND (E." + Email.PROPERTY_DEMAND_STATUS + " in (:" + EmailFilter.PROPERTY_DEMAND_STATUS + ")"); - args.put(EmailFilter.PROPERTY_DEMAND_STATUS, demandStatus); - - if (demandStatus.contains(null)) { - query.append(" OR E." + Email.PROPERTY_DEMAND_STATUS + " IS NULL"); - } - query.append(")"); - } - - Set<String> senders = emailFilter.getSenders(); - if (senders != null) { - query.append(" AND (E." + Email.PROPERTY_SENDER + " in (:" + EmailFilter.PROPERTY_SENDERS + ")"); - args.put(EmailFilter.PROPERTY_SENDERS, senders); - - if (senders.contains(null)) { - query.append(" OR E." + Email.PROPERTY_SENDER + " IS NULL"); - } - query.append(")"); - } - - Set<String> clientBrands = emailFilter.getClientBrands(); - if (clientBrands != null) { - query.append(" AND (E." + Email.PROPERTY_CLIENT + "." + Client.PROPERTY_BRAND + " IN (:" + EmailFilter.PROPERTY_CLIENT_BRANDS + ")"); - args.put(EmailFilter.PROPERTY_CLIENT_BRANDS, clientBrands); - - if (clientBrands.contains(null)) { - query.append(" OR E." + Email.PROPERTY_CLIENT + " IS NULL"); - query.append(" OR E." + Email.PROPERTY_CLIENT + "." + Client.PROPERTY_BRAND + " IS NULL"); - } - query.append(")"); - } - - Set<String> clientCodes = emailFilter.getClientCodes(); - if (clientCodes != null) { - query.append(" AND (E." + Email.PROPERTY_CLIENT + "." + Client.PROPERTY_CODE + " IN (:" + EmailFilter.PROPERTY_CLIENT_CODES + ")"); - args.put(EmailFilter.PROPERTY_CLIENT_CODES, clientCodes); - - if (clientCodes.contains(null)) { - query.append(" OR E." + Email.PROPERTY_CLIENT + " IS NULL"); - query.append(" OR E." + Email.PROPERTY_CLIENT + "." + Client.PROPERTY_CODE + " IS NULL"); - } - query.append(")"); - } - - Set<String> comments = emailFilter.getComments(); - if (comments != null) { - query.append(" AND (E." + Email.PROPERTY_COMMENT + " in (:" + EmailFilter.PROPERTY_COMMENTS + ")"); - args.put(EmailFilter.PROPERTY_COMMENTS, comments); - - if (comments.contains(null)) { - query.append(" OR E." + Email.PROPERTY_COMMENT + " IS NULL"); - } - query.append(")"); - } - - Set<String> demandObjects = emailFilter.getDemandObjects(); - if (demandObjects != null) { - query.append(" AND (E." + Email.PROPERTY_OBJECT + " in (:" + EmailFilter.PROPERTY_DEMAND_OBJECTS + ")"); - args.put(EmailFilter.PROPERTY_DEMAND_OBJECTS, demandObjects); - - if (demandObjects.contains(null)) { - query.append(" OR E." + Email.PROPERTY_OBJECT + " IS NULL"); - } - query.append(")"); - } - - Set<DemandType> demandTypes = emailFilter.getDemandTypes(); - if (demandTypes != null) { - query.append(" AND (E." + Email.PROPERTY_DEMAND_TYPE + " in (:" + EmailFilter.PROPERTY_DEMAND_TYPES + ")"); - args.put(EmailFilter.PROPERTY_DEMAND_TYPES, demandTypes); - - if (demandTypes.contains(null)) { - query.append(" OR E." + Email.PROPERTY_DEMAND_TYPE + " IS NULL"); - } - query.append(")"); - } - - Set<String> ediCodeNumbers = emailFilter.getEdiCodeNumbers(); - if (ediCodeNumbers != null) { - query.append(" AND (E." + Email.PROPERTY_EDI_ERROR + " in (:" + EmailFilter.PROPERTY_EDI_CODE_NUMBERS + ")"); - args.put(EmailFilter.PROPERTY_EDI_CODE_NUMBERS, ediCodeNumbers); - - if (ediCodeNumbers.contains(null)) { - query.append(" OR E." + Email.PROPERTY_EDI_ERROR + " IS NULL"); - } - query.append(")"); - } - - Set<FaxToMailUser> takenBys = emailFilter.getTakenBys(); - if (takenBys != null) { - query.append(" AND (E." + Email.PROPERTY_TAKEN_BY + " in (:" + EmailFilter.PROPERTY_TAKEN_BYS + ")"); - args.put(EmailFilter.PROPERTY_TAKEN_BYS, takenBys); - - if (takenBys.contains(null)) { - query.append(" OR E." + Email.PROPERTY_TAKEN_BY + " IS NULL"); - } - query.append(")"); - } - - Set<FaxToMailUser> lastAttachmentOpeners = emailFilter.getLastAttachmentOpeners(); - if (lastAttachmentOpeners != null) { - query.append(" AND (E." + Email.PROPERTY_LAST_ATTACHMENT_OPENER + " in (:" + EmailFilter.PROPERTY_LAST_ATTACHMENT_OPENERS + ")"); - args.put(EmailFilter.PROPERTY_LAST_ATTACHMENT_OPENERS, lastAttachmentOpeners); - - if (lastAttachmentOpeners.contains(null)) { - query.append(" OR E." + Email.PROPERTY_LAST_ATTACHMENT_OPENER + " IS NULL"); - } - query.append(")"); - } - - Set<String> recipients = emailFilter.getRecipients(); - if (recipients != null) { - query.append(" AND (E." + Email.PROPERTY_RECIPIENT + " in (:" + EmailFilter.PROPERTY_RECIPIENTS + ")"); - args.put(EmailFilter.PROPERTY_RECIPIENTS, recipients); - - if (recipients.contains(null)) { - query.append(" OR E." + Email.PROPERTY_RECIPIENT + " IS NULL"); - } - query.append(")"); - } - - Set<Priority> priorities = emailFilter.getPriorities(); - if (priorities != null) { - query.append(" AND (E." + Email.PROPERTY_PRIORITY + " in (:" + EmailFilter.PROPERTY_PRIORITIES + ")"); - args.put(EmailFilter.PROPERTY_PRIORITIES, priorities); - - if (priorities.contains(null)) { - query.append(" OR E." + Email.PROPERTY_PRIORITY + " IS NULL"); - } - query.append(")"); - } - - Set<Long> savQuantities = emailFilter.getSavQuantities(); - if (CollectionUtils.isNotEmpty(savQuantities)) { - query.append(" AND ((EXISTS (FROM " + RangeRow.class.getName() + " RR WHERE RR in elements(E." + Email.PROPERTY_RANGE_ROW + "))" - + " AND (select sum(RR." + RangeRow.PROPERTY_SAV_QUANTITY + ") " + - "FROM " + RangeRow.class.getName() + " RR WHERE RR in elements(E." + Email.PROPERTY_RANGE_ROW + ")"); - query.append(") IN (:" + EmailFilter.PROPERTY_SAV_QUANTITIES + ")"); - - if (savQuantities.contains(null) || savQuantities.contains(0L)) { - query.append(" OR NOT EXISTS (FROM " + RangeRow.class.getName() + " RR WHERE RR in elements(E." + Email.PROPERTY_RANGE_ROW + "))"); - } - query.append("))"); - - args.put(EmailFilter.PROPERTY_SAV_QUANTITIES, savQuantities); - } - - Set<Long> quotationQuantities = emailFilter.getQuotationQuantities(); - if (CollectionUtils.isNotEmpty(quotationQuantities)) { - query.append(" AND ((EXISTS (FROM " + RangeRow.class.getName() + " RR WHERE RR in elements(E." + Email.PROPERTY_RANGE_ROW + "))" - + " AND (select sum(RR." + RangeRow.PROPERTY_QUOTATION_QUANTITY + ") " + - "FROM " + RangeRow.class.getName() + " RR WHERE RR in elements(E." + Email.PROPERTY_RANGE_ROW + ")"); - query.append(") IN (:" + EmailFilter.PROPERTY_QUOTATION_QUANTITIES + ")"); - - if (quotationQuantities.contains(null) || quotationQuantities.contains(0L)) { - query.append(" OR NOT EXISTS (FROM " + RangeRow.class.getName() + " RR WHERE RR in elements(E." + Email.PROPERTY_RANGE_ROW + "))"); - } - query.append("))"); - - args.put(EmailFilter.PROPERTY_QUOTATION_QUANTITIES, quotationQuantities); - } - - Set<String> projectReferences = emailFilter.getProjectReferences(); - if (projectReferences != null) { - query.append(" AND (E." + Email.PROPERTY_PROJECT_REFERENCE + " in (:" + EmailFilter.PROPERTY_PROJECT_REFERENCES + ")"); - args.put(EmailFilter.PROPERTY_PROJECT_REFERENCES, projectReferences); - - if (projectReferences.contains(null)) { - query.append(" OR E." + Email.PROPERTY_PROJECT_REFERENCE + " IS NULL"); - } - query.append(")"); - } - - Set<String> localReferences = emailFilter.getLocalReferences(); - if (localReferences != null) { - query.append(" AND (E." + Email.PROPERTY_COMPANY_REFERENCE + " in (:" + EmailFilter.PROPERTY_LOCAL_REFERENCES + ")"); - args.put(EmailFilter.PROPERTY_LOCAL_REFERENCES, localReferences); - - if (localReferences.contains(null)) { - query.append(" OR E." + Email.PROPERTY_COMPANY_REFERENCE + " IS NULL"); - } - query.append(")"); - } - - Set<String> references = emailFilter.getReferences(); - if (references != null) { - query.append(" AND ((EXISTS (FROM " + RangeRow.class.getName() + " RR WHERE RR in elements(E." + Email.PROPERTY_RANGE_ROW + ")"); - query.append(" AND RR." + RangeRow.PROPERTY_COMMAND_NUMBER + " IN (:" + EmailFilter.PROPERTY_LOCAL_REFERENCES + "))"); - query.append(" OR E." + Email.PROPERTY_COMPANY_REFERENCE + " IN (:" + EmailFilter.PROPERTY_LOCAL_REFERENCES + ")"); - args.put(EmailFilter.PROPERTY_LOCAL_REFERENCES, references); - - if (references.contains(null)) { - query.append(" OR (NOT EXISTS (FROM " + RangeRow.class.getName() + " RR WHERE RR in elements(E." + Email.PROPERTY_RANGE_ROW + "))"); - query.append(" AND E." + Email.PROPERTY_COMPANY_REFERENCE + " IS NULL)"); - } - query.append("))"); - } - - Set<WaitingState> waitingStates = emailFilter.getWaitingStates(); - if (waitingStates != null) { - query.append(" AND (E." + Email.PROPERTY_WAITING_STATE + " in (:" + EmailFilter.PROPERTY_WAITING_STATES + ")"); - args.put(EmailFilter.PROPERTY_WAITING_STATES, waitingStates); - - if (waitingStates.contains(null)) { - query.append(" OR E." + Email.PROPERTY_WAITING_STATE + " IS NULL"); - } - query.append(")"); - } - - return query.toString(); - } - - /** - * Retounre le nombre d'email par dossier. - * - * @return le nombre d'email par dossier - */ - public Map<String, Long> getMailCountByFolder() { - String query = "SELECT mailFolder.topiaId, count(*) FROM " + Email.class.getName() + " group by mailFolder.topiaId"; - - Map<String, Long> result = new HashMap<>(); - - List<Object[]> queryResuts = findAll(query); - for (Object[] queryResut : queryResuts) { - String mailFolder = (String)queryResut[0]; - Long count = (Long)queryResut[1]; - result.put(mailFolder, count); - } - return result; - } - - public Map<String, Long[]> computeQuantitiesByRange(List<MailFolder> folders) { - - // this has been modifier from - // SELECT range - // to - // SELECT range.topiaId - // do to bug https://hibernate.atlassian.net/browse/HHH-1615 that can be reproduced - // on sql server - - String query = "SELECT range." + Range.PROPERTY_TOPIA_ID + "," + - " SUM(rangeRow." + RangeRow.PROPERTY_PRODUCT_QUANTITY + ") AS prodQ," + - " SUM(rangeRow." + RangeRow.PROPERTY_SAV_QUANTITY + ") AS savQ," + - " SUM(rangeRow." + RangeRow.PROPERTY_QUOTATION_QUANTITY + ") AS quotQ" + - " FROM " + Email.class.getName() + " AS email " + - " INNER JOIN email." + Email.PROPERTY_RANGE_ROW + " AS rangeRow" + - " INNER JOIN rangeRow." + RangeRow.PROPERTY_RANGE + " AS range" + - " WHERE email." + Email.PROPERTY_MAIL_FOLDER + " IN :folders" + - " GROUP BY range." + Range.PROPERTY_TOPIA_ID; - - Map<String, Object> args = new HashMap<>(); - args.put("folders", folders); - - Map<String, Long[]> result = new LinkedHashMap<>(); - - List<Object[]> queryResuts = findAll(query, args); - for (Object[] queryResut : queryResuts) { - String range = (String) queryResut[0]; - Long[] sums = new Long[3]; - sums[0] = (Long) queryResut[1]; - sums[1] = (Long) queryResut[2]; - sums[2] = (Long) queryResut[3]; - result.put(range, sums); - } - - return result; - } - - /* - * @deprecated because this need to be supported by topia (see http://forge.nuiton.org/issues/3427) - */ - @Deprecated - protected String addAllFecthes(String... fetchProperties) { - StringBuilder hqlFromClauseBuilder = new StringBuilder(); - //if (includeFetch) { - int fetchedPropertiesAliasIndex = 0; - Map<String, String> aliases = Maps.newHashMap(); - for (String propertyName : fetchProperties) { - - // addAllFetches("a.b").addAllFetches("i.j.k") will produce: - // left join topiaEntity_.a fetchedProp0_ left join fetch fetchedProp0_.b - // left join topiaEntity_.i fetchedProp1_ left join fetch fetchedProp1_.j fetchedProp2_ left join fetchedProp2_.k - - // addAllFetches("a.b").addAllFetches("a.c") will produce: - // left join topiaEntity_.a fetchedProp0_ left join fetch fetchedProp1_.b - // left join fetch fetchedProp1_.c - StringBuilder path = new StringBuilder(); // The path to reach the property - - // Loop over each part of the "a.b.c" - for (String part : Splitter.on('.').split(propertyName)) { - - // Look for the parent alias if already computed - String previousPath = path.toString(); - String previousAlias = Objects.firstNonNull(aliases.get(previousPath), "E"); - - // Compute the current path and look for its alias - if (path.length() > 0) { - path.append('.'); - } - path.append(part); - String currentPath = path.toString(); - String currentAlias = aliases.get(currentPath); - - // No current alias found, create and add it - if (Strings.isNullOrEmpty(currentAlias)) { - currentAlias = String.format("fetchedProp%d_", fetchedPropertiesAliasIndex++); - aliases.put(currentPath, currentAlias); - - String fetch = String.format(" LEFT JOIN FETCH %s.%s %s ", previousAlias, part, currentAlias); - hqlFromClauseBuilder.append(fetch); - } - } - } - //} - return hqlFromClauseBuilder.toString(); - } - - /* - * @deprecated beacause this need to be supported by topia (see http://forge.nuiton.org/issues/3427) - */ - @Deprecated - protected <O extends TopiaEntity> List<O> sortAccordingToIds(List<O> entities, final List<String> idsList) { - - // Cannot sort on second query, will sort according to the first result list - final Map<String, O> entitiesIndex = Maps.uniqueIndex(entities, TopiaEntities.getTopiaIdFunction()); - Iterable<O> transformed = Iterables.transform(idsList, new Function<String, O>() { - @Override - public O apply(String input) { - return entitiesIndex.get(input); - } - }); - - List<O> result = Lists.newArrayList(transformed); - return result; - } - - public Set<Object> getDistinctValues(MailFolder folder, String[] properties, boolean sum) { - Map<String, Object> args = new HashMap<>(); - String folderAndStatusCondition = " WHERE email." + Email.PROPERTY_MAIL_FOLDER + " = :folder" + - " AND email." + Email.PROPERTY_DEMAND_STATUS + " != :archiveStatus"; - args.put("folder", folder); - args.put("archiveStatus", DemandStatus.ARCHIVED); - - String propertyList; - if (sum) { - propertyList = "sum(" + StringUtils.join(properties, "), sum(") + ")"; - } else { - propertyList = StringUtils.join(properties, ", "); - } - String query = "SELECT DISTINCT " + propertyList + - " FROM " + Email.class.getName() + " AS email"; - - for (String property : properties) { - if (property.startsWith("client.")) { - query += " LEFT OUTER JOIN email." + Email.PROPERTY_CLIENT + " AS client"; - break; - } - } - for (String property : properties) { - if (property.startsWith("rangeRow.")) { - query += " LEFT OUTER JOIN email." + Email.PROPERTY_RANGE_ROW + " AS rangeRow"; - break; - } - } - query += folderAndStatusCondition; - - if (sum) { - query += " group by email." + Email.PROPERTY_TOPIA_ID; - } - - List<Object> queryResults = findAll(query, args); - Set<Object> result = new HashSet<>(); - if (properties.length == 1) { - result.addAll(queryResults); - - } else { - for (Object o1 : queryResults) { - Object[] objects = (Object[]) o1; - for (Object o2 : objects) { - result.add(o2); - } - } - } - - // check if the property is sometimes null - /*if (property.startsWith("rangeRow.")) { - query = "FROM " + Email.class.getName() + " AS email" + - " LEFT OUTER JOIN email." + Email.PROPERTY_RANGE_ROW + " AS rangeRow" + - folderAndStatusCondition + " AND rangeRow IS NULL"; - - queryResults = findAll(query, args); - if (!queryResults.isEmpty()) { - result.add(null); - } - } - - if (!result.contains(null)) { - query = "FROM " + Email.class.getName() + " AS email"; - if (property.startsWith("client.")) { - query += " LEFT OUTER JOIN email." + Email.PROPERTY_CLIENT + " AS client"; - - } else if (property.startsWith("rangeRow.")) { - query += " LEFT OUTER JOIN email." + Email.PROPERTY_RANGE_ROW + " AS rangeRow"; - } - query += folderAndStatusCondition + " AND " + property + " IS NULL"; - - if (StringUtils.isNotBlank(condition)) { - query += " AND " + condition; - } - queryResults = findAll(query, args); - if (!queryResults.isEmpty()) { - result.add(null); - } - }*/ - - // TODO echatellier 20140918 : on ajoute null dans tous les cas car les requetes precendente - // sont trop lente juste pour savoir si on a vraiment besoin de savoir si l'on doit vraiment - // avoir des valeurs nulles - if (sum && result.contains(null)) { - result.remove(null); - result.add(0L); - - } else if (!result.contains("")) { - result.add(null); - } - - return result; - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ExtensionCommandTopiaDao.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ExtensionCommandTopiaDao.java deleted file mode 100644 index 42672e6..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ExtensionCommandTopiaDao.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.HashMap; -import java.util.Map; - -public class ExtensionCommandTopiaDao extends AbstractExtensionCommandTopiaDao<ExtensionCommand> { - - public ExtensionCommand findByExtension(String extension) { - String query = "FROM " + ExtensionCommand.class.getName() + - " WHERE lower(" + ExtensionCommand.PROPERTY_EXTENSION + ") = :extension"; - - Map<String, Object> args = new HashMap<>(); - args.put("extension", extension); - ExtensionCommand result = findUniqueOrNull(query, args); - return result; - } - -} //ExtensionCommandTopiaDao diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryImpl.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryImpl.java deleted file mode 100644 index 667e646..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.lang.reflect.Type; -import java.util.Set; - -import com.google.gson.reflect.TypeToken; - -public class HistoryImpl extends HistoryAbstract { - - /** serialVersionUID. */ - private static final long serialVersionUID = 7357010358014312848L; - - private static final Type SET_STRING_GSON_TYPE = new TypeToken<Set<String>>() {}.getType(); - - @Override - public void setFields(Set<String> field) { - String json = AbstractFaxToMailTopiaDao.GSON_INSTANCE.toJson(field); - setFieldsJson(json); - } - - @Override - public Set<String> getFields() { - String json = getFieldsJson(); - Set<String> fields = AbstractFaxToMailTopiaDao.GSON_INSTANCE.fromJson(json, SET_STRING_GSON_TYPE); - return fields; - } - -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java deleted file mode 100644 index 0ee972e..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryType.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - */ -public enum HistoryType implements HasLabel { - - CREATION(n("faxtomail.historyType.creation"), true), - OPENING(n("faxtomail.historyType.opening"), false), - MODIFICATION(n("faxtomail.historyType.modification"), true), - TRANSMISSION_TO_EDI(n("faxtomail.historyType.transmissionToEdi"), true), - TRANSMISSION(n("faxtomail.historyType.transmission"), true), - REPLY(n("faxtomail.historyType.reply"), false), - PRINTING(n("faxtomail.historyType.printing"), false), - ARCHIVED(n("faxtomail.historyType.archive"), true), - GROUP(n("faxtomail.historyType.group"), true), - ATTACHMENT_OPENING(n("faxtomail.historyType.attachmentOpening"), false), - ATTACHMENT_MODIFICATION(n("faxtomail.historyType.attachmentModification"), true); - - protected String labelKey; - - protected boolean consideredAsModification; - - private HistoryType(String labelKey, boolean consideredAsModification) { - this.labelKey = labelKey; - this.consideredAsModification = consideredAsModification; - } - - public String getLabel() { - return t(labelKey); - } - - public boolean isConsideredAsModification() { - return consideredAsModification; - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java deleted file mode 100644 index cb68e59..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * @author Kevin Morin (Code Lutin) - */ -public enum MailAction { - - TRANSMIT, - PRINT, - ARCHIVE, - REPLY, - GROUP -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailField.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailField.java deleted file mode 100644 index 459120f..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailField.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * Required email fields for specific {@link WaitingState}. - * - * @author Eric Chatellier - */ -public enum MailField { - - OBJECT, - PROJECT_REFERENCE, - PRIORITY, - RANGE_ROW, - CLIENT, - WAITING_STATE, - COMPANY_REFERENCE, - COMMENT, - DEMAND_TYPE, - CLIENT_CODE, - CLIENT_BRAND, - SENDER, - REFERENCE, - RECEPTION_DATE, - RECIPIENT, - DEMAND_STATUS, - PF_NB, - SAV_NB, - QUOTATION_NB, - TAKEN_BY, - LAST_ATTACHMENT_OPENING_IN_THIS_FOLDER_USER, - REPLIES, - ATTACHMENT, - GROUP, - EDI_RETURN; - - public static MailField[] getCanBeRequiredMailFields() { - return new MailField[] { - OBJECT, - PROJECT_REFERENCE, - PRIORITY, - RANGE_ROW, - CLIENT, - WAITING_STATE, - COMPANY_REFERENCE, - COMMENT - }; - } - - public static MailField[] getTableFields() { - return new MailField[] { - PRIORITY, - DEMAND_TYPE, - OBJECT, - CLIENT_CODE, - CLIENT_BRAND, - SENDER, - PROJECT_REFERENCE, - COMPANY_REFERENCE, - REFERENCE, - RECEPTION_DATE, - RECIPIENT, - DEMAND_STATUS, - WAITING_STATE, - PF_NB, - SAV_NB, - QUOTATION_NB, - TAKEN_BY, - COMMENT, - EDI_RETURN, - LAST_ATTACHMENT_OPENING_IN_THIS_FOLDER_USER, - REPLIES, - ATTACHMENT, - GROUP - }; - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFilterTopiaDao.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFilterTopiaDao.java deleted file mode 100644 index 3ecd4b4..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFilterTopiaDao.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -public class MailFilterTopiaDao extends AbstractMailFilterTopiaDao<MailFilter> { - - @Override - public void delete(MailFilter entity) { - - // code from AbstractTopiaDao - topiaJpaSupport.delete(entity); - entity.notifyDeleted(); - topiaFiresSupport.notifyEntityDeleted(entity); - -// do nothing just to disable strange topia code -// org.hibernate.PropertyValueException: not-null property references a null or transient value : com.franciaflex.faxtomail.persistence.entities.MailFilterImpl.mailFolder -// org.hibernate.engine.internal.Nullability.checkNullability(Nullability.java:106) -// org.hibernate.event.internal.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:279) -// org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:160) -// org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:73) -// org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:920) -// org.hibernate.internal.SessionImpl.delete(SessionImpl.java:896) -// org.nuiton.topia.persistence.internal.support.HibernateTopiaJpaSupport.delete(HibernateTopiaJpaSupport.java:218) -// org.nuiton.topia.persistence.internal.AbstractTopiaDao.delete(AbstractTopiaDao.java:335) - - } - -} //MailFilterTopiaDao diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderImpl.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderImpl.java deleted file mode 100644 index 7a68a1f..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * @author Kevin Morin (Code Lutin) - * @since x.x - */ -public class MailFolderImpl extends MailFolderAbstract { - - protected transient boolean folderReadable; - protected transient boolean folderWritable; - protected transient boolean folderMoveable; - - @Override - public boolean isFolderReadable() { - return folderReadable; - } - - @Override - public void setFolderReadable(boolean folderReadable) { - this.folderReadable = folderReadable; - } - - @Override - public boolean isFolderWritable() { - return folderWritable; - } - - @Override - public void setFolderWritable(boolean folderWritable) { - this.folderWritable = folderWritable; - } - - @Override - public void setFolderMoveable(boolean moveable) { - this.folderMoveable = moveable; - } - - @Override - public boolean isFolderMoveable() { - return folderMoveable; - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderTopiaDao.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderTopiaDao.java deleted file mode 100644 index f5d751a..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderTopiaDao.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.collect.Maps; - -import java.util.Collection; -import java.util.HashMap; - -public class MailFolderTopiaDao extends AbstractMailFolderTopiaDao<MailFolder> { - - @Override - public void delete(MailFolder entity) { - - // code from AbstractTopiaDao - topiaJpaSupport.delete(entity); - entity.notifyDeleted(); - topiaFiresSupport.notifyEntityDeleted(entity); - -// do nothing just to disable strange topia code -// org.nuiton.topia.persistence.TopiaException: An error occurs during query operation: from com.franciaflex.faxtomail.persistence.entities.Email topiaEntity_ where topiaEntity_.mailFolder = :mailFolder0 : not-null property references a null or transient value : com.franciaflex.faxtomail.persistence.entities.MailFilterImpl.mailFolder -// org.nuiton.topia.persistence.internal.support.HibernateTopiaJpaSupport.findAll(HibernateTopiaJpaSupport.java:116) -// org.nuiton.topia.persistence.internal.AbstractTopiaDao.findAll(AbstractTopiaDao.java:540) -// org.nuiton.topia.persistence.internal.AbstractTopiaDao$InnerTopiaQueryBuilderRunQueryStep.findAll(AbstractTopiaDao.java:1084) -// org.nuiton.topia.persistence.internal.AbstractTopiaDao$InnerTopiaQueryBuilderAddCriteriaOrRunQueryStep.findAll(AbstractTopiaDao.java:944) -// com.franciaflex.faxtomail.persistence.entities.GeneratedMailFolderTopiaDao.delete(GeneratedMailFolderTopiaDao.java:59) -// com.franciaflex.faxtomail.persistence.entities.GeneratedMailFolderTopiaDao.delete(GeneratedMailFolderTopiaDao.java:1) -// org.nuiton.topia.persistence.internal.AbstractTopiaDao.deleteAll(AbstractTopiaDao.java:343) -// com.franciaflex.faxtomail.services.service.ConfigurationService.saveMailFolders(ConfigurationService.java:239) -// com.franciaflex.faxtomail.services.service.ConfigurationService.save(ConfigurationService.java:139) -// com.franciaflex.faxtomail.web.action.admin.ConfigurationAction.execute(ConfigurationAction.java:126) - - } - - public Collection<MailFolder> getReadableFolders(FaxToMailUser user) { - String query = newFromClause("mf") + " where :user in elements(mf.readRightUsers) or exists (from mf.readRightGroups g where g in (:groups))"; - HashMap<String, Object> map = Maps.newHashMap(); - map.put("user", user); - map.put("groups", user.getUserGroups()); - Collection<MailFolder> folders = findAll(query, map); - return folders; - } - - public Collection<MailFolder> getMoveableFolders(FaxToMailUser user) { - String query = newFromClause("mf") + " where :user in elements(mf.moveRightUsers) or exists (from mf.moveRightGroups g where g in (:groups))"; - HashMap<String, Object> map = Maps.newHashMap(); - map.put("user", user); - map.put("groups", user.getUserGroups()); - Collection<MailFolder> folders = findAll(query, map); - return folders; - } - -} //MailFolderTopiaDao diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClient.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClient.java deleted file mode 100644 index aec9846..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClient.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * Défini les colonnes de la table NewClient en base de données, mais non géré par Topia. - * - * @author Eric Chatellier - */ -public class NewClient { - - public static final String PROPERTY_NAME = "name"; - public static final String PROPERTY_EMAIL_ADDRESS = "emailAddress"; - public static final String PROPERTY_FAX_NUMBER = "faxNumber"; - public static final String PROPERTY_CARACTERISTIC1 = "caracteristic1"; - public static final String PROPERTY_CARACTERISTIC2 = "caracteristic2"; - public static final String PROPERTY_CARACTERISTIC3 = "caracteristic3"; - public static final String PROPERTY_CODE = "code"; - public static final String PROPERTY_BRAND = "brand"; - public static final String PROPERTY_COMPANY = "company"; - public static final String PROPERTY_PERSON_IN_CHARGE = "personInCharge"; - -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/SearchFilter.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/SearchFilter.java deleted file mode 100644 index 057dbb7..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/SearchFilter.java +++ /dev/null @@ -1,461 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.Date; -import java.util.List; - -import org.jdesktop.beans.AbstractSerializableBean; - -public class SearchFilter extends AbstractSerializableBean { - - /** serialVersionUID. */ - private static final long serialVersionUID = 7039570396201559352L; - - public static final String PROPERTY_SENDER = "sender"; - public static final String PROPERTY_DEMAND_OBJECT = "demandObject"; - public static final String PROPERTY_MESSAGE = "message"; - public static final String PROPERTY_BODY = "body"; - public static final String PROPERTY_WAITING_STATES = "WaitingStates"; - public static final String PROPERTY_GAMME = "gamme"; - public static final String PROPERTY_TAKEN_BY = "takenBy"; - public static final String PROPERTY_PRIORITY = "priority"; - public static final String PROPERTY_DEMAND_TYPE = "demandType"; - public static final String PROPERTY_DEMAND_STATUS = "demandStatus"; - public static final String PROPERTY_EDI_CODE_NUMBER = "ediCodeNumber"; - public static final String PROPERTY_PROJECT_REFERENCE = "projectReference"; - public static final String PROPERTY_COMMAND_NB = "commandNb"; - public static final String PROPERTY_LOCAL_REFERENCE = "localReference"; - public static final String PROPERTY_MODIFIED_BY = "modifiedBy"; - public static final String PROPERTY_PRINTING_BY = "printingBy"; - public static final String PROPERTY_ARCHIVED_BY = "archivedBy"; - public static final String PROPERTY_TRANSFER_BY = "transferBy"; - public static final String PROPERTY_REPLY_BY = "replyBy"; - public static final String PROPERTY_MIN_MODIFICATION_DATE = "minModificationDate"; - public static final String PROPERTY_MAX_MODIFICATION_DATE = "maxModificationDate"; - public static final String PROPERTY_MIN_RECEPTION_DATE = "minReceptionDate"; - public static final String PROPERTY_MAX_RECEPTION_DATE = "maxReceptionDate"; - public static final String PROPERTY_MIN_PRINTING_DATE = "minPrintingDate"; - public static final String PROPERTY_MAX_PRINTING_DATE = "maxPrintingDate"; - public static final String PROPERTY_MIN_ARCHIVED_DATE = "minArchivedDate"; - public static final String PROPERTY_MAX_ARCHIVED_DATE = "maxArchivedDate"; - public static final String PROPERTY_MIN_TRANSFER_DATE = "minTransferDate"; - public static final String PROPERTY_MAX_TRANSFER_DATE = "maxTransferDate"; - public static final String PROPERTY_MIN_REPLY_DATE = "minReplyDate"; - public static final String PROPERTY_MAX_REPLY_DATE = "maxReplyDate"; - public static final String PROPERTY_CLIENT_CODE = "clientCode"; - public static final String PROPERTY_ADD_GROUP_DEMANDS = "addGroupDemands"; - - protected String sender; - - protected String demandObject; - - protected String message; - - protected String body; - - protected List<WaitingState> waitingStates; - - protected List<Priority> priority; - - protected List<DemandType> demandType; - - protected List<DemandStatus> demandStatus; - - protected List<Range> gamme; - - protected String ediCodeNumber; - - protected String projectReference; - - protected String commandNb; - - protected String localReference; - - protected FaxToMailUser takenBy; - - protected FaxToMailUser modifiedBy; - - protected FaxToMailUser printingBy; - - protected FaxToMailUser transferBy; - - protected FaxToMailUser archivedBy; - - protected FaxToMailUser replyBy; - - protected Date minModificationDate; - - protected Date maxModificationDate; - - protected Date minReceptionDate; - - protected Date maxReceptionDate; - - protected Date minPrintingDate; - - protected Date maxPrintingDate; - - protected Date minTransferDate; - - protected Date maxTransferDate; - - protected Date minArchivedDate; - - protected Date maxArchivedDate; - - protected Date minReplyDate; - - protected Date maxReplyDate; - - protected String clientCode; - - protected boolean addGroupDemands; - - public String getSender() { - return sender; - } - - public void setSender(String sender) { - String oldValue = this.sender; - this.sender = sender; - firePropertyChange(PROPERTY_SENDER, oldValue, sender); - } - - public String getDemandObject() { - return demandObject; - } - - public void setDemandObject(String demandObject) { - String oldValue = this.demandObject; - this.demandObject = demandObject; - firePropertyChange(PROPERTY_DEMAND_OBJECT, oldValue, demandObject); - } - - public List<WaitingState> getWaitingStates() { - return waitingStates; - } - - public void setWaitingStates(List<WaitingState> waitingStates) { - this.waitingStates = waitingStates; - firePropertyChange(PROPERTY_WAITING_STATES, null, waitingStates); - } - - public FaxToMailUser getTakenBy() { - return takenBy; - } - - public void setTakenBy(FaxToMailUser takenBy) { - FaxToMailUser oldValue = this.takenBy; - this.takenBy = takenBy; - firePropertyChange(PROPERTY_TAKEN_BY, oldValue, takenBy); - } - - public List<Priority> getPriority() { - return priority; - } - - public void setPriority(List<Priority> priority) { - this.priority = priority; - firePropertyChange(PROPERTY_PRIORITY, null, priority); - } - - public List<DemandType> getDemandType() { - return demandType; - } - - public void setDemandType(List<DemandType> demandType) { - this.demandType = demandType; - firePropertyChange(PROPERTY_DEMAND_TYPE, null, demandType); - } - - public List<DemandStatus> getDemandStatus() { - return demandStatus; - } - - public void setDemandStatus(List<DemandStatus> demandStatus) { - this.demandStatus = demandStatus; - firePropertyChange(PROPERTY_DEMAND_STATUS, null, demandStatus); - } - - public String getEdiCodeNumber() { - return ediCodeNumber; - } - - public void setEdiCodeNumber(String ediCodeNumber) { - String oldValue = this.ediCodeNumber; - this.ediCodeNumber = ediCodeNumber; - firePropertyChange(PROPERTY_EDI_CODE_NUMBER, oldValue, ediCodeNumber); - } - - public String getProjectReference() { - return projectReference; - } - - public void setProjectReference(String projectReference) { - String oldValue = this.projectReference; - this.projectReference = projectReference; - firePropertyChange(PROPERTY_PROJECT_REFERENCE, oldValue, projectReference); - } - - public FaxToMailUser getModifiedBy() { - return modifiedBy; - } - - public void setModifiedBy(FaxToMailUser modifiedBy) { - FaxToMailUser oldValue = modifiedBy; - this.modifiedBy = modifiedBy; - firePropertyChange(PROPERTY_MODIFIED_BY, oldValue, modifiedBy); - } - - public Date getMinModificationDate() { - return minModificationDate; - } - - public void setMinModificationDate(Date minModificationDate) { - Date oldValue = this.minModificationDate; - this.minModificationDate = minModificationDate; - firePropertyChange(PROPERTY_MIN_MODIFICATION_DATE, oldValue, minModificationDate); - } - - public Date getMaxModificationDate() { - return maxModificationDate; - } - - public void setMaxModificationDate(Date maxModificationDate) { - Date oldValue = this.maxModificationDate; - this.maxModificationDate = maxModificationDate; - firePropertyChange(PROPERTY_MAX_MODIFICATION_DATE, oldValue, maxModificationDate); - } - - public Date getMinReceptionDate() { - return minReceptionDate; - } - - public void setMinReceptionDate(Date minReceptionDate) { - Date oldValue = this.minReceptionDate; - this.minReceptionDate = minReceptionDate; - firePropertyChange(PROPERTY_MIN_RECEPTION_DATE, oldValue, minReceptionDate); - } - - public Date getMaxReceptionDate() { - return maxReceptionDate; - } - - public void setMaxReceptionDate(Date maxReceptionDate) { - Date oldValue = this.maxReceptionDate; - this.maxReceptionDate = maxReceptionDate; - firePropertyChange(PROPERTY_MAX_RECEPTION_DATE, oldValue, maxReceptionDate); - } - - public Date getMinPrintingDate() { - return minPrintingDate; - } - - public void setMinPrintingDate(Date minPrintingDate) { - Date oldValue = this.minPrintingDate; - this.minPrintingDate = minPrintingDate; - firePropertyChange(PROPERTY_MIN_PRINTING_DATE, oldValue, minPrintingDate); - } - - public Date getMaxPrintingDate() { - return maxPrintingDate; - } - - public void setMaxPrintingDate(Date maxPrintingDate) { - Date oldValue = this.maxPrintingDate; - this.maxPrintingDate = maxPrintingDate; - firePropertyChange(PROPERTY_MAX_PRINTING_DATE, oldValue, maxPrintingDate); - } - - public String getClientCode() { - return clientCode; - } - - public void setClientCode(String clientCode) { - String oldValue = this.clientCode; - this.clientCode = clientCode; - firePropertyChange(PROPERTY_CLIENT_CODE, oldValue, clientCode); - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - String oldValue = this.message; - this.message = message; - firePropertyChange(PROPERTY_MESSAGE, oldValue, message); - } - - public String getBody() { - return body; - } - - public void setBody(String body) { - String oldValue = this.body; - this.body = body; - firePropertyChange(PROPERTY_BODY, oldValue, body); - } - - public List<Range> getGamme() { - return gamme; - } - - public void setGamme(List<Range> gamme) { - this.gamme = gamme; - firePropertyChange(PROPERTY_GAMME, null, gamme); - } - - public String getCommandNb() { - return commandNb; - } - - public void setCommandNb(String commandNb) { - String oldValue = this.commandNb; - this.commandNb = commandNb; - firePropertyChange(PROPERTY_COMMAND_NB, oldValue, commandNb); - } - - public String getLocalReference() { - return localReference; - } - - public void setLocalReference(String localReference) { - String oldValue = this.localReference; - this.localReference = localReference; - firePropertyChange(PROPERTY_LOCAL_REFERENCE, oldValue, localReference); - } - - public FaxToMailUser getPrintingBy() { - return printingBy; - } - - public void setPrintingBy(FaxToMailUser printingBy) { - FaxToMailUser oldValue = this.printingBy; - this.printingBy = printingBy; - firePropertyChange(PROPERTY_PRINTING_BY, oldValue, printingBy); - } - - public FaxToMailUser getTransferBy() { - return transferBy; - } - - public void setTransferBy(FaxToMailUser transferBy) { - FaxToMailUser oldValue = this.transferBy; - this.transferBy = transferBy; - firePropertyChange(PROPERTY_TRANSFER_BY, oldValue, transferBy); - } - - public FaxToMailUser getArchivedBy() { - return archivedBy; - } - - public void setArchivedBy(FaxToMailUser archivedBy) { - FaxToMailUser oldValue = this.archivedBy; - this.archivedBy = archivedBy; - firePropertyChange(PROPERTY_ARCHIVED_BY, oldValue, archivedBy); - } - - public FaxToMailUser getReplyBy() { - return replyBy; - } - - public void setReplyBy(FaxToMailUser replyBy) { - FaxToMailUser oldValue = this.replyBy; - this.replyBy = replyBy; - firePropertyChange(PROPERTY_REPLY_BY, oldValue, replyBy); - } - - public Date getMinTransferDate() { - return minTransferDate; - } - - public void setMinTransferDate(Date minTransferDate) { - Date oldValue = this.minTransferDate; - this.minTransferDate = minTransferDate; - firePropertyChange(PROPERTY_MIN_TRANSFER_DATE, oldValue, minTransferDate); - } - - public Date getMaxTransferDate() { - return maxTransferDate; - } - - public void setMaxTransferDate(Date maxTransferDate) { - Date oldValue = this.maxTransferDate; - this.maxTransferDate = maxTransferDate; - firePropertyChange(PROPERTY_MAX_TRANSFER_DATE, oldValue, maxTransferDate); - } - - public Date getMinArchivedDate() { - return minArchivedDate; - } - - public void setMinArchivedDate(Date minArchivedDate) { - Date oldValue = this.minArchivedDate; - this.minArchivedDate = minArchivedDate; - firePropertyChange(PROPERTY_MIN_ARCHIVED_DATE, oldValue, minArchivedDate); - } - - public Date getMaxArchivedDate() { - return maxArchivedDate; - } - - public void setMaxArchivedDate(Date maxArchivedDate) { - Date oldValue = this.maxArchivedDate; - this.maxArchivedDate = maxArchivedDate; - firePropertyChange(PROPERTY_MAX_ARCHIVED_DATE, oldValue, maxArchivedDate); - } - - public Date getMinReplyDate() { - return minReplyDate; - } - - public void setMinReplyDate(Date minReplyDate) { - Date oldValue = this.minReplyDate; - this.minReplyDate = minReplyDate; - firePropertyChange(PROPERTY_MIN_REPLY_DATE, oldValue, minReplyDate); - } - - public Date getMaxReplyDate() { - return maxReplyDate; - } - - public void setMaxReplyDate(Date maxReplyDate) { - Date oldValue = this.maxReplyDate; - this.maxReplyDate = maxReplyDate; - firePropertyChange(PROPERTY_MAX_REPLY_DATE, oldValue, maxReplyDate); - } - - public boolean isAddGroupDemands() { - return addGroupDemands; - } - - public void setAddGroupDemands(boolean addGroupDemands) { - Object oldValue = this.addGroupDemands; - this.addGroupDemands = addGroupDemands; - firePropertyChange(PROPERTY_ADD_GROUP_DEMANDS, oldValue, addGroupDemands); - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/WaitingStateTopiaDao.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/WaitingStateTopiaDao.java deleted file mode 100644 index fa80699..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/WaitingStateTopiaDao.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.franciaflex.faxtomail.persistence.entities; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class WaitingStateTopiaDao extends AbstractWaitingStateTopiaDao<WaitingState> { - - - @Override - public void delete(WaitingState entity) { - - // code from AbstractTopiaDao - topiaJpaSupport.delete(entity); - entity.notifyDeleted(); - topiaFiresSupport.notifyEntityDeleted(entity); - -// do nothing just to disable strange topia code -// org.postgresql.util.PSQLException: Le nom de colonne topiaVersion n'a pas été trouvé dans ce ResultSet. -// org.postgresql.jdbc2.AbstractJdbc2ResultSet.findColumn(AbstractJdbc2ResultSet.java:2728) -// org.postgresql.jdbc2.AbstractJdbc2ResultSet.getLong(AbstractJdbc2ResultSet.java:2594) -// com.mchange.v2.c3p0.impl.NewProxyResultSet.getLong(NewProxyResultSet.java:2625) -// org.hibernate.type.descriptor.sql.BigIntTypeDescriptor$2.doExtract(BigIntTypeDescriptor.java:74) -// org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64) -// org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:267) -// org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:263) -// org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253) -// org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:338) -// org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2969) -// org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1695) -// org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1627) -// org.hibernate.loader.Loader.getRow(Loader.java:1514) -// org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:725) -// org.hibernate.loader.Loader.processResultSet(Loader.java:952) -// org.hibernate.loader.Loader.doQuery(Loader.java:920) -// org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:354) -// org.hibernate.loader.Loader.doList(Loader.java:2553) -// org.hibernate.loader.Loader.doList(Loader.java:2539) -// org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2369) -// org.hibernate.loader.Loader.list(Loader.java:2364) -// org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:353) -// org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1873) -// org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:311) -// org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:141) -// com.franciaflex.faxtomail.persistence.entities.GeneratedWaitingStateTopiaDao.delete(GeneratedEtatAttenteTopiaDao.java:65) -// com.franciaflex.faxtomail.persistence.entities.GeneratedWaitingStateTopiaDao.delete(GeneratedEtatAttenteTopiaDao.java:1) - - } - - public Map<String, Long> getWaitingStateCountByFolder() { - String query = "SELECT waitingState.topiaId, count(*) FROM " + Email.class.getName() + " group by waitingState.topiaId"; - - Map<String, Long> result = new HashMap<>(); - - List<Object[]> queryResuts = findAll(query); - for (Object[] queryResut : queryResuts) { - String etatAttente = (String)queryResut[0]; - Long count = (Long)queryResut[1]; - result.put(etatAttente, count); - } - return result; - } -} //EtatAttenteTopiaDao diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/EnumListUserType.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/EnumListUserType.java deleted file mode 100644 index c1e4572..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/EnumListUserType.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.franciaflex.faxtomail.persistence.hibernate; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.Serializable; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Types; -import java.util.ArrayList; -import java.util.List; - -import org.hibernate.HibernateException; -import org.hibernate.engine.spi.SessionImplementor; -import org.hibernate.usertype.UserType; - -/** - * See https://community.jboss.org/wiki/Java5EnumUserType. - * and inspired by http://2lips.pl/blog/usertype-enumset-mysql-set-column. - * - * @author Eric Chatellier - * - * @param <T> - */ -public abstract class EnumListUserType<T extends Enum<T>> implements UserType { - - private Class<T> typeClazz = null; - private Class<? extends List> returnedType = null; - - public EnumListUserType(Class<T> typeClazz) { - this.typeClazz = typeClazz; - returnedType = ArrayList.class; - } - - public Class returnedClass() { - return returnedType; - } - - public int[] sqlTypes() { - return new int[] { Types.LONGVARCHAR }; - } - - public boolean isMutable() { - return false; - } - - /** - * Retrieve an instance of the mapped class from a JDBC resultset. - * Implementors should handle possibility of null values. - * - * @param rs a JDBC result set - * @param names the column names - * @param owner the containing entity - * @return Object - * @throws HibernateException - * @throws SQLException - */ - @Override - public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { - String name = rs.getString(names[0]); - List<T> result = null; - if (!rs.wasNull()) { - String[] values = name.split(","); - result = new ArrayList<T>(); - for (String value : values) { - if (!value.isEmpty()) { - result.add(Enum.valueOf(typeClazz, value)); - } - } - } - return result; - } - - /** - * Write an instance of the mapped class to a prepared statement. - * Implementors should handle possibility of null values. A multi-column - * type should be written to parameters starting from <tt>index</tt>. - * - * @param st a JDBC prepared statement - * @param value the object to write - * @param index statement parameter index - * @param session session - * @throws HibernateException - * @throws SQLException - */ - @Override - public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { - if (null == value) { - st.setNull(index, Types.VARCHAR); - } else { - List<T> values = (List<T>)value; - String sqlValue = ""; - if (!values.isEmpty()) { - StringBuilder buf = new StringBuilder(); - for(T val : values) { - buf.append(val.name()).append(","); - } - sqlValue = buf.substring(0, buf.length() - 1); - } - st.setString(index, sqlValue); - } - } - - public Object assemble(Serializable cached, Object owner) throws HibernateException { - return cached; - } - - public Serializable disassemble(Object value) throws HibernateException { - return (Enum<?>) value; - } - - public Object deepCopy(Object value) throws HibernateException { - return value; - } - - public boolean equals(Object x, Object y) throws HibernateException { - if (x == y) { - return true; - } - if (null == x || null == y) { - return false; - } - return x.equals(y); - } - - public int hashCode(Object x) throws HibernateException { - return x.hashCode(); - } - - public Object replace(Object original, Object target, Object owner) throws HibernateException { - return original; - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/EnumSetUserType.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/EnumSetUserType.java deleted file mode 100644 index 1a84f8f..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/EnumSetUserType.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.franciaflex.faxtomail.persistence.hibernate; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.Serializable; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Types; -import java.util.EnumSet; -import java.util.LinkedHashSet; -import java.util.Set; - -import org.hibernate.HibernateException; -import org.hibernate.engine.spi.SessionImplementor; -import org.hibernate.usertype.UserType; - -/** - * See https://community.jboss.org/wiki/Java5EnumUserType. - * and inspired by http://2lips.pl/blog/usertype-enumset-mysql-set-column. - * - * @author Eric Chatellier - * - * @param <T> - */ -public abstract class EnumSetUserType<T extends Enum<T>> implements UserType { - - private Class<T> typeClazz = null; - private Class<? extends EnumSet> returnedType = null; - - public EnumSetUserType(Class<T> typeClazz) { - this.typeClazz = typeClazz; - returnedType = EnumSet.noneOf(typeClazz).getClass(); - } - - public Class returnedClass() { - return returnedType; - } - - public int[] sqlTypes() { - return new int[] { Types.LONGVARCHAR }; - } - - public boolean isMutable() { - return false; - } - - /** - * Retrieve an instance of the mapped class from a JDBC resultset. - * Implementors should handle possibility of null values. - * - * @param rs a JDBC result set - * @param names the column names - * @param owner the containing entity - * @return Object - * @throws HibernateException - * @throws SQLException - */ - @Override - public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { - String name = rs.getString(names[0]); - EnumSet<T> result = null; - if (!rs.wasNull()) { - String[] values = name.split(","); - Set<T> enumList = new LinkedHashSet<T>(); - for (String value : values) { - if (!value.isEmpty()) { - enumList.add(Enum.valueOf(typeClazz, value)); - } - } - if (enumList.isEmpty()) { - result = EnumSet.noneOf(typeClazz); - } else { - result = EnumSet.copyOf(enumList); - } - } - return result; - } - - /** - * Write an instance of the mapped class to a prepared statement. - * Implementors should handle possibility of null values. A multi-column - * type should be written to parameters starting from <tt>index</tt>. - * - * @param st a JDBC prepared statement - * @param value the object to write - * @param index statement parameter index - * @param session session - * @throws HibernateException - * @throws SQLException - */ - @Override - public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { - if (null == value) { - st.setNull(index, Types.VARCHAR); - } else { - Set<T> values = (Set<T>)value; - String sqlValue = ""; - if (!values.isEmpty()) { - StringBuilder buf = new StringBuilder(); - for (T val : values) { - buf.append(val.name()).append(","); - } - sqlValue = buf.substring(0, buf.length() - 1); - } - st.setString(index, sqlValue); - } - } - - public Object assemble(Serializable cached, Object owner) throws HibernateException { - return cached; - } - - public Serializable disassemble(Object value) throws HibernateException { - return (Enum<?>) value; - } - - public Object deepCopy(Object value) throws HibernateException { - return value; - } - - public boolean equals(Object x, Object y) throws HibernateException { - if (x == y) { - return true; - } - if (null == x || null == y) { - return false; - } - return x.equals(y); - } - - public int hashCode(Object x) throws HibernateException { - return x.hashCode(); - } - - public Object replace(Object original, Object target, Object owner) throws HibernateException { - return original; - } -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/MailActionEnumSetUserType.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/MailActionEnumSetUserType.java deleted file mode 100644 index e893f33..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/MailActionEnumSetUserType.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.franciaflex.faxtomail.persistence.hibernate; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.MailAction; - -public class MailActionEnumSetUserType extends EnumSetUserType<MailAction> { - - public MailActionEnumSetUserType() { - super(MailAction.class); - } - -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/MailFieldEnumListUserType.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/MailFieldEnumListUserType.java deleted file mode 100644 index 6259c4c..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/MailFieldEnumListUserType.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.franciaflex.faxtomail.persistence.hibernate; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.MailField; - -public class MailFieldEnumListUserType extends EnumListUserType<MailField>{ - - public MailFieldEnumListUserType() { - super(MailField.class); - } - -} diff --git a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/MailFieldEnumSetUserType.java b/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/MailFieldEnumSetUserType.java deleted file mode 100644 index 7957083..0000000 --- a/trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/hibernate/MailFieldEnumSetUserType.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.franciaflex.faxtomail.persistence.hibernate; - -/* - * #%L - * FaxToMail :: Persistence - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.MailField; - -public class MailFieldEnumSetUserType extends EnumSetUserType<MailField>{ - - public MailFieldEnumSetUserType() { - super(MailField.class); - } - -} diff --git a/trunk/faxtomail-persistence/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider b/trunk/faxtomail-persistence/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider deleted file mode 100644 index c109be7..0000000 --- a/trunk/faxtomail-persistence/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider +++ /dev/null @@ -1 +0,0 @@ -com.franciaflex.faxtomail.FaxToMailConfigurationProvider \ No newline at end of file diff --git a/trunk/faxtomail-persistence/src/main/resources/faxToMail.properties b/trunk/faxtomail-persistence/src/main/resources/faxToMail.properties deleted file mode 100644 index 550fed0..0000000 --- a/trunk/faxtomail-persistence/src/main/resources/faxToMail.properties +++ /dev/null @@ -1,43 +0,0 @@ -### -# #%L -# FaxToMail :: Persistence -# $Id$ -# $HeadURL$ -# %% -# Copyright (C) 2014 Mac-Groupe, Code Lutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### - -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.connection.driver_class=org.h2.Driver -hibernate.connection.url=jdbc:h2:file:/tmp/faxtomail/h2data;MODE=MSSQLServer;AUTO_SERVER=TRUE -hibernate.connection.username=sa -hibernate.connection.password= - -#hibernate.dialect=org.hibernate.dialect.SQLServer2008Dialect -#hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver -#hibernate.connection.url=jdbc:jtds:sqlserver://192.168.100.247:1433/faxtomailtest -#hibernate.connection.username=fx -#hibernate.connection.password=FX2013! - -#hibernate.hbm2ddl.auto=validate -hibernate.hbm2ddl.auto= - -hibernate.c3p0.min_size=5 -hibernate.c3p0.max_size=20 -hibernate.c3p0.timeout=1800 -hibernate.c3p0.max_statements=50 diff --git a/trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties b/trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties deleted file mode 100644 index 52ac1f4..0000000 --- a/trunk/faxtomail-persistence/src/main/resources/i18n/faxtomail-persistence_fr_FR.properties +++ /dev/null @@ -1,46 +0,0 @@ -faxToMail.config= -faxtomail.config.option.basedir.description= -faxtomail.config.option.csv.separator.description= -faxtomail.config.option.data.directory.description= -faxtomail.config.option.demo.directory.description= -faxtomail.config.option.i18n.directory.description= -faxtomail.config.option.i18n.locale.description= -faxtomail.config.option.inceptionYear.description= -faxtomail.config.option.launch.mode.description= -faxtomail.config.option.organizationName.description= -faxtomail.config.option.site.url.description= -faxtomail.config.option.startActionFile.description= -faxtomail.config.option.tmp.directory.description= -faxtomail.config.option.ui.autoPopupNumberEditor.description= -faxtomail.config.option.ui.color.alternateRow.description= -faxtomail.config.option.ui.color.blockingLayer.description= -faxtomail.config.option.ui.color.selectedRow.description= -faxtomail.config.option.ui.config.file.description= -faxtomail.config.option.ui.dateFormat.description= -faxtomail.config.option.ui.resultPerPage.description= -faxtomail.config.option.ui.shortcut.closePopup.description= -faxtomail.config.option.ui.showNumberEditorButton.description= -faxtomail.config.option.version.description= -faxtomail.config.parse.error= -faxtomail.config.save.error= -faxtomail.demandStatus.archive=Archive -faxtomail.demandStatus.inProgress=En cours -faxtomail.demandStatus.qualified=Qualifié -faxtomail.demandStatus.transmissionToEdi=En cours de transmission à l'EDI -faxtomail.demandStatus.transmittedToEdi=Transmis à l'EDI -faxtomail.demandStatus.untreated=Non traité -faxtomail.historyType.archive=Archivage -faxtomail.historyType.attachmentModification=Modification de pièce jointe -faxtomail.historyType.attachmentOpening=Ouverture de pièce jointe -faxtomail.historyType.creation=Création -faxtomail.historyType.group=Groupement -faxtomail.historyType.modification=Modification -faxtomail.historyType.opening=Ouverture -faxtomail.historyType.printing=Impression -faxtomail.historyType.reply=Réponse -faxtomail.historyType.transmission=Déplacement -faxtomail.historyType.transmissionToEdi=Transmission à l'EDI -faxtomail.persistence.loader.error= -faxtomail.persistence.mkDir.error= -faxtomail.service.config.deleteTempDirectory.error= -faxtomail.service.mkDir.error= diff --git a/trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties b/trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties deleted file mode 100644 index 82cacb2..0000000 --- a/trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties +++ /dev/null @@ -1,130 +0,0 @@ -### -# #%L -# FaxToMail :: Persistence -# $Id$ -# $HeadURL$ -# %% -# Copyright (C) 2014 Mac-Groupe, Code Lutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### -model.tagValue.notGenerateToString=true -model.tagValue.constantPrefix=PROPERTY_ -model.tagValue.hibernateAttributeType.java.lang.String=text -model.tagValue.useEnumerationName=true - -# WaitingState -com.franciaflex.faxtomail.persistence.entities.WaitingState.attribute.label.tagvalue.naturalId=true -com.franciaflex.faxtomail.persistence.entities.WaitingState.attribute.invalidFormDisabledActions.tagvalue.hibernateAttributeType=com.franciaflex.faxtomail.persistence.hibernate.MailActionEnumSetUserType -com.franciaflex.faxtomail.persistence.entities.WaitingState.attribute.validFormDisabledActions.tagvalue.hibernateAttributeType=com.franciaflex.faxtomail.persistence.hibernate.MailActionEnumSetUserType - -# Priority -com.franciaflex.faxtomail.persistence.entities.Priority.attribute.label.tagvalue.naturalId=true - -# Range -com.franciaflex.faxtomail.persistence.entities.Range.attribute.label.tagvalue.naturalId=true - -# DemandType -com.franciaflex.faxtomail.persistence.entities.DemandType.attribute.label.tagvalue.naturalId=true -com.franciaflex.faxtomail.persistence.entities.DemandType.attribute.requiredFields.tagvalue.hibernateAttributeType=com.franciaflex.faxtomail.persistence.hibernate.MailFieldEnumSetUserType - -# Client -com.franciaflex.faxtomail.persistence.entities.Client.attribute.company.tagvalue.naturalId=true -com.franciaflex.faxtomail.persistence.entities.Client.attribute.code.tagvalue.naturalId=true - -# NewClient -com.franciaflex.faxtomail.persistence.entities.NewClient.attribute.code.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.NewClient.attribute.company.tagvalue.notNull=true - -# EdiReturn -com.franciaflex.faxtomail.persistence.entities.EdiReturn.attribute.rangeRowTopiaId.tagvalue.notNull=true - -# EmailAccount -com.franciaflex.faxtomail.persistence.entities.EmailAccount.attribute.protocol.tagvalue.naturalId=true -com.franciaflex.faxtomail.persistence.entities.EmailAccount.attribute.host.tagvalue.naturalId=true -com.franciaflex.faxtomail.persistence.entities.EmailAccount.attribute.login.tagvalue.naturalId=true - - -#�Configuration -com.franciaflex.faxtomail.persistence.entities.Configuration.attribute.searchDisplayColumns.tagvalue.hibernateAttributeType=com.franciaflex.faxtomail.persistence.hibernate.MailFieldEnumListUserType -com.franciaflex.faxtomail.persistence.entities.Configuration.attribute.invalidFormDisabledActions.tagvalue.hibernateAttributeType=com.franciaflex.faxtomail.persistence.hibernate.MailActionEnumSetUserType - -# ExtensionCommand -com.franciaflex.faxtomail.persistence.entities.ExtensionCommand.attribute.extension.tagvalue.naturalId=true - - -# Attachment -com.franciaflex.faxtomail.persistence.entities.Attachment.attribute.originalFile.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.Attachment.attribute.originalFileName.tagvalue.notNull=true - -# AttachmentFile -com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.filename.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.content.tagvalue.notNull=true -# il faut mettre une valeur > a 8000 pour que la mapping genere un type varbinary(max) -com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.content.tagValue.hibernateAttributeType=binary -com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.content.tagvalue.length=9999999 - -# MailFolder -com.franciaflex.faxtomail.persistence.entities.MailFolder.class.tagvalue.naturalIdMutable=true -com.franciaflex.faxtomail.persistence.entities.MailFolder.attribute.parent.tagvalue.naturalId=true -com.franciaflex.faxtomail.persistence.entities.MailFolder.attribute.parent.tagvalue.notNull=false -com.franciaflex.faxtomail.persistence.entities.MailFolder.attribute.name.tagvalue.naturalId=true -com.franciaflex.faxtomail.persistence.entities.MailFolder.attribute.folderTableColumns.tagvalue.hibernateAttributeType=com.franciaflex.faxtomail.persistence.hibernate.MailFieldEnumListUserType - -# MailFilter -com.franciaflex.faxtomail.persistence.entities.MailFilter.attribute.expression.tagvalue.naturalId=true -com.franciaflex.faxtomail.persistence.entities.MailFilter.attribute.mailFolder.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.MailFilter.attribute.position.tagvalue.unique=true - -# Email -com.franciaflex.faxtomail.persistence.entities.Email.attribute.mailFolder.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.Email.attribute.originalEmail.tagvalue.notNull=true - -# Reply -com.franciaflex.faxtomail.persistence.entities.Reply.attribute.sentDate.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.Reply.attribute.subject.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.Reply.attribute.sender.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.Reply.attribute.recipient.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.Reply.attribute.sentBy.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.Reply.attribute.replyContent.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.Reply.attribute.replyContent.tagvalue.notNull=true - -# ReplyContent -com.franciaflex.faxtomail.persistence.entities.ReplyContent.attribute.source.tagvalue.notNull=true -# il faut mettre une valeur > a 8000 pour que la mapping genere un type varbinary(max) -com.franciaflex.faxtomail.persistence.entities.ReplyContent.attribute.source.tagValue.hibernateAttributeType=binary -com.franciaflex.faxtomail.persistence.entities.ReplyContent.attribute.source.tagvalue.length=9999999 - -# EmailGroup -com.franciaflex.faxtomail.persistence.entities.EmailGroup.attribute.email.stereotype=unique - -# History -com.franciaflex.faxtomail.persistence.entities.History.attribute.type.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.History.attribute.fields.stereotype=unique - -# FaxToMailUser -com.franciaflex.faxtomail.persistence.entities.FaxToMailUser.attribute.login.tagvalue.naturalId=true - -# FaxToMailUserGroup -com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup.attribute.name.tagvalue.naturalId=true - -# GroupChef -com.franciaflex.faxtomail.persistence.entities.GroupChef.attribute.userGroup.tagvalue.notNull=true - -# MailLock -com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockBy.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.tagvalue.unique=true diff --git a/trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo b/trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo deleted file mode 100644 index 7cabe8c..0000000 Binary files a/trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo and /dev/null differ diff --git a/trunk/faxtomail-service/LICENSE.txt b/trunk/faxtomail-service/LICENSE.txt deleted file mode 100644 index 94a9ed0..0000000 --- a/trunk/faxtomail-service/LICENSE.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/trunk/faxtomail-service/README.txt b/trunk/faxtomail-service/README.txt deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/faxtomail-service/pom.xml b/trunk/faxtomail-service/pom.xml deleted file mode 100644 index 209e5c8..0000000 --- a/trunk/faxtomail-service/pom.xml +++ /dev/null @@ -1,234 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: Service - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <artifactId>faxtomail</artifactId> - <groupId>com.franciaflex</groupId> - <version>1.0</version> - </parent> - - <groupId>com.franciaflex.faxtomail</groupId> - <artifactId>faxtomail-service</artifactId> - - <name>FaxToMail :: Service</name> - - <properties> - <!-- make sure flyway files are not updated by non human --> - <license.excludes>**/i18n/*.properties, **/THIRD-PARTY.properties, **/*.sh, **/*.sql</license.excludes> - </properties> - - <dependencies> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>faxtomail-persistence</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.nuiton.topia</groupId> - <artifactId>topia-persistence</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.topia</groupId> - <artifactId>topia-service-flyway</artifactId> - </dependency> - - <dependency> - <groupId>org.flywaydb</groupId> - <artifactId>flyway-core</artifactId> - </dependency> - - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - </dependency> - - <dependency> - <groupId>com.mchange</groupId> - <artifactId>c3p0</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-decorator</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.i18n</groupId> - <artifactId>nuiton-i18n</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-csv</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-validator</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.struts.xwork</groupId> - <artifactId>xwork-core</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-application-api</artifactId> - </dependency> - - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-collections4</artifactId> - </dependency> - - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - - <dependency> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-email</artifactId> - </dependency> - - <dependency> - <groupId>javax.activation</groupId> - <artifactId>activation</artifactId> - </dependency> - - <!-- Logging --> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-jcl</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - </dependency> - - <dependency> - <groupId>com.unboundid</groupId> - <artifactId>unboundid-ldapsdk</artifactId> - </dependency> - - <dependency> - <groupId>org.postgresql</groupId> - <artifactId>postgresql</artifactId> - </dependency> - - <dependency> - <groupId>com.github.spullara.mustache.java</groupId> - <artifactId>compiler</artifactId> - </dependency> - - <dependency> - <groupId>org.xhtmlrenderer</groupId> - <artifactId>flying-saucer-pdf-itext5</artifactId> - </dependency> - </dependencies> - - <build> - - <plugins> - - <plugin> - <groupId>org.nuiton.i18n</groupId> - <artifactId>i18n-maven-plugin</artifactId> - <executions> - <execution> - <id>scan-sources</id> - <configuration> - <entries> - <entry> - <specificGoal>parserValidation</specificGoal> - <basedir>${maven.src.dir}/main/java/</basedir> - <includes> - <param>**/**-validation.xml</param> - </includes> - </entry> - </entries> - </configuration> - <goals> - <goal>parserJava</goal> - <goal>parserValidation</goal> - <goal>gen</goal> - </goals> - </execution> - </executions> - </plugin> - - </plugins> - </build> - -</project> diff --git a/trunk/faxtomail-service/src/license/THIRD-PARTY.properties b/trunk/faxtomail-service/src/license/THIRD-PARTY.properties deleted file mode 100644 index bd27d79..0000000 --- a/trunk/faxtomail-service/src/license/THIRD-PARTY.properties +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by org.codehaus.mojo.license.AddThirdPartyMojo -#------------------------------------------------------------------------------- -# Already used licenses in project : -# - AL 2.0 -# - Apache License 2.0 -# - Apache License, version 2.0 -# - BSD License -# - CDDL -# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 -# - Common Development and Distribution License -# - Common Public License Version 1.0 -# - Eclipse Distribution License (EDL), Version 1.0 -# - Eclipse Public License (EPL), Version 1.0 -# - Eclipse Public License, Version 1.0 -# - GNU General Public License, Version 2 with the Classpath Exception -# - GNU Lesser General Public License, Version 2.1 -# - GNU Library or Lesser General Public License -# - GPLv2+CE -# - General Public License (GPL) -# - Indiana University Extreme! Lab Software License, vesion 1.1.1 -# - Lesser General Public License (LGPL) -# - Lesser General Public License (LGPL) v 3.0 -# - Lesser General Public License (LPGL) -# - Lesser General Public License (LPGL) v 2.1 -# - MIT License -# - MPL 1.1 -# - New BSD License -# - Public Domain -# - The Apache Software License, Version 2.0 -# - The H2 License, Version 1.0 -#------------------------------------------------------------------------------- -# Please fill the missing licenses for dependencies : -# -# -#Fri Apr 25 11:47:01 CEST 2014 -commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 -dom4j--dom4j--1.6.1=BSD License diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java deleted file mode 100644 index 64b63c3..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.franciaflex.faxtomail.services; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.nuiton.decorator.Decorator; - -/** - * @author Kevin Morin (Code Lutin) - */ -public interface DecoratorService extends FaxToMailService { - String SEPARATOR = "#"; - String DATE = "date"; - - <O> Decorator<O> getDecorator(O object); - - <O> Decorator<O> getDecorator(O object, String name); - - <O> Decorator<O> getDecoratorByType(Class<O> type); - - <O> Decorator<O> getDecoratorByType(Class<O> type, String name); - - @Override - void setServiceContext(FaxToMailServiceContext context); -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java deleted file mode 100644 index 7b3c493..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.franciaflex.faxtomail.services; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.text.DateFormat; -import java.util.Date; - -import org.nuiton.decorator.Decorator; -import org.nuiton.decorator.DecoratorProvider; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.HasLabel; -import com.franciaflex.faxtomail.persistence.entities.Reply; - -/** - * FaxToMail decorator service. - * - * @author Kevin Morin - morin@codelutin.com - */ -public class DecoratorServiceImpl extends FaxToMailServiceSupport implements DecoratorService { - - /** Delegate decorator provider. */ - protected DecoratorProvider decoratorProvider; - - @Override - public <O> Decorator<O> getDecorator(O object) { - return decoratorProvider.getDecorator(object); - } - - @Override - public <O> Decorator<O> getDecorator(O object, String name) { - return decoratorProvider.getDecorator(object, name); - } - - @Override - public <O> Decorator<O> getDecoratorByType(Class<O> type) { - return decoratorProvider.getDecoratorByType(type); - } - - @Override - public <O> Decorator<O> getDecoratorByType(Class<O> type, String name) { - return decoratorProvider.getDecoratorByType(type, name); - } - - @Override - public void setServiceContext(FaxToMailServiceContext context) { - super.setServiceContext(context); - - decoratorProvider = new DecoratorProvider() { - @Override - protected void loadDecorators() { - - registerDecorator(new Decorator<Float>(Float.class) { - private static final long serialVersionUID = 1L; - - @Override - public String toString(Object bean) { - return bean == null ? "" : String.valueOf(bean); - } - }); - registerDecorator(new Decorator<Number>(Number.class) { - private static final long serialVersionUID = 1L; - - @Override - public String toString(Object bean) { - return bean == null ? "" : String.valueOf(bean); - } - }); - registerDecorator(new Decorator<Date>(Date.class) { - private static final long serialVersionUID = 1L; - - @Override - public String toString(Object bean) { - if (bean == null) { - return ""; - } - return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(bean); - } - }); - registerDecorator(DATE, new Decorator<Date>(Date.class) { - private static final long serialVersionUID = 1L; - - @Override - public String toString(Object bean) { - if (bean == null) { - return ""; - } - return DateFormat.getDateInstance(DateFormat.MEDIUM).format(bean); - } - }); - registerMultiJXPathDecorator(HasLabel.class, "${label}$s", SEPARATOR, " - "); - registerDecorator(new Decorator<Attachment>(Attachment.class) { - private static final long serialVersionUID = 1L; - - @Override - public String toString(Object bean) { - if (bean == null) { - return ""; - } - return ((Attachment) bean).getOriginalFileName(); - } - }); - registerDecorator(new Decorator<AttachmentFile>(AttachmentFile.class) { - private static final long serialVersionUID = 1L; - - @Override - public String toString(Object bean) { - if (bean == null) { - return ""; - } - return ((AttachmentFile) bean).getFilename(); - } - }); - registerMultiJXPathDecorator(Reply.class, "${sentDate}$s#${subject}$s", SEPARATOR, " - "); - registerMultiJXPathDecorator(FaxToMailUser.class, "${trigraph}$s#${firstName}$s#${lastName}$s", SEPARATOR, " "); - } - }; - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailDecorator.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailDecorator.java deleted file mode 100644 index 7f06506..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailDecorator.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.franciaflex.faxtomail.services; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.base.Preconditions; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.Maps; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.decorator.DecoratorUtil; -import org.nuiton.decorator.JXPathDecorator; -import org.nuiton.decorator.MultiJXPathDecorator; -import org.nuiton.util.beans.BeanUtil; - -import java.beans.PropertyDescriptor; -import java.io.Serializable; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutionException; - -/** - * Faxtomail decorator. - * - * @author kmorin - morin@codelutin.com - */ -public class FaxToMailDecorator<O> extends MultiJXPathDecorator<O> implements Cloneable { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = LogFactory.getLog(FaxToMailDecorator.class); - - protected final Map<String, Method> tokenMethods; - - protected final LoadingCache<O, String> cache; - - protected boolean useCache; - - /** - * To sort always on the selected context. - * - */ - protected boolean sortOnlyOnSelectedContext; - - /** - * List of tokens to sort using the {@link #sortOnlyOnSelectedContext} mode. - * If the mode is not set, then won't use this. - * - */ - protected Set<String> sortOnlyOnSelectedContextTokens; - - public static <O> FaxToMailDecorator<O> newDecorator(Class<O> internalClass, - String expression, - String separator, - String separatorReplacement) { - return new FaxToMailDecorator<O>(internalClass, expression, separator, separatorReplacement); - } - - protected FaxToMailDecorator(Class<O> internalClass, - String expression, - String separator, - String separatorReplacement) throws IllegalArgumentException, NullPointerException { - super(internalClass, - expression, - separator, - separatorReplacement, - DecoratorUtil.<O>createMultiJXPathContextKeepingOrder(expression, - separator, - separatorReplacement)); - tokenMethods = Maps.newHashMap(); - Set<PropertyDescriptor> descriptors = - BeanUtil.getDescriptors(type, BeanUtil.IS_READ_DESCRIPTOR); - - for (String token : getTokens()) { - Method m = null; - for (PropertyDescriptor propertyDescriptor : descriptors) { - if (propertyDescriptor.getName().equals(token)) { - m = propertyDescriptor.getReadMethod(); - break; - } - } - if (m == null) { - throw new IllegalArgumentException( - "could not find the property " + token + " in " + type); - } - tokenMethods.put(token, m); - } - - int i = 0; - for (Context<O> OContext : contexts) { - OContext.setComparator(new FaxToMailDecoratorComparator<O>(getProperty(i++))); - } - - this.cache = CacheBuilder.newBuilder().build(new CacheLoader<O, String>() { - @Override - public String load(O key) throws Exception { - String result; - if (key == null) { - result = ""; - } else { - result = FaxToMailDecorator.this.toString(key); - } - return result; - } - }); - } - - public boolean isUseCache() { - return useCache; - } - - public void setUseCache(boolean useCache) { - this.useCache = useCache; - cache.invalidateAll(); - } - - public boolean isSortOnlyOnSelectedContext() { - return sortOnlyOnSelectedContext; - } - - public void setSortOnlyOnSelectedContext(boolean sortOnlyOnSelectedContext) { - this.sortOnlyOnSelectedContext = sortOnlyOnSelectedContext; - } - - public Set<String> getSortOnlyOnSelectedContextTokens() { - return sortOnlyOnSelectedContextTokens; - } - - public void setSortOnlyOnSelectedContextTokens(Set<String> sortOnlyOnSelectedContextTokens) { - this.sortOnlyOnSelectedContextTokens = sortOnlyOnSelectedContextTokens; - } - - public FaxToMailDecoratorComparator<O> getCurrentComparator() { - return (FaxToMailDecoratorComparator<O>) context.getComparator(0); - } - - @Override - public String toString(Object bean) { - O bean1 = (O) bean; - String result = null; - - if (useCache) { - - // try first in cache - try { - result = cache.get(bean1); - } catch (ExecutionException e) { - if (log.isErrorEnabled()) { - log.error("Could not obtain from cache", e); - } - } - } - if (result == null) { - - if (bean != null) { - Object[] args = new Object[nbToken]; - - String[] tokens = getTokens(); - for (int i = 0; i < nbToken; i++) { - String token = tokens[i]; - Object value = getValue(bean1, token); - if (value == null) { - value = onNullValue(bean1, token); - } - args[i] = value; - } - - try { - result = String.format(getExpression(), args); - } catch (Exception eee) { - if (log.isErrorEnabled()) { - log.error("Could not format " + getExpression() + "" + - " with args : " + Arrays.toString(args), eee); - } - result = ""; - } - - if (useCache) { - cache.put(bean1, result); - } - } - } - - return result; - } - - protected Object getValue(O bean, String token) { - Method method = tokenMethods.get(token); - Preconditions.checkNotNull(method, - "Could not find method for token " + token); - Object result; - try { - result = method.invoke(bean); - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Could not obtain token [" + token + "] value", e); - } - result = ""; - } - return result; - } - - protected Object onNullValue(O bean, String token) { - return null; - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - public static class FaxToMailDecoratorComparator<O> extends JXPathComparator<O> implements Serializable, Cloneable { - - private static final long serialVersionUID = 1L; - - protected String expression; - - public FaxToMailDecoratorComparator(String expression) { - super(expression); - this.expression = expression; - } - - @Override - public void init(JXPathDecorator<O> decorator, List<O> datas) { - clear(); - FaxToMailDecorator<O> faxToMailDecorator = (FaxToMailDecorator<O>) decorator; - String token = decorator.getTokens()[0]; - boolean sortOnlyOnSelectedContext = - faxToMailDecorator.isSortOnlyOnSelectedContext() && - faxToMailDecorator.getSortOnlyOnSelectedContextTokens() != null && - faxToMailDecorator.getSortOnlyOnSelectedContextTokens().contains(token); - - for (O data : datas) { - if (sortOnlyOnSelectedContext) { - Object tokenValue = faxToMailDecorator.getValue(data, token); - - valueCache.put(data, (Comparable) tokenValue); - } else if (data instanceof Number) { - valueCache.put(data, (Comparable) data); - } else { - Comparable key = faxToMailDecorator.toString(data); - valueCache.put(data, key); - } - } - } - - @Override - public FaxToMailDecoratorComparator<O> clone() { - FaxToMailDecoratorComparator<O> result = - new FaxToMailDecoratorComparator<O>(expression); - return result; - } - - public String getExpression() { - return expression; - } - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailService.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailService.java deleted file mode 100644 index 34787d7..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailService.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.franciaflex.faxtomail.services; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -public interface FaxToMailService { - - void setServiceContext(FaxToMailServiceContext context); -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceContext.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceContext.java deleted file mode 100644 index d3e15b3..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceContext.java +++ /dev/null @@ -1,260 +0,0 @@ -package com.franciaflex.faxtomail.services; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.Closeable; -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Proxy; -import java.util.Date; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaApplicationContext; -import com.franciaflex.faxtomail.services.service.ClientService; -import com.franciaflex.faxtomail.services.service.ConfigurationService; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.services.service.InitFaxToMailService; -import com.franciaflex.faxtomail.services.service.LdapServiceImpl; -import com.franciaflex.faxtomail.services.service.MailFolderService; -import com.franciaflex.faxtomail.services.service.ReferentielService; -import com.franciaflex.faxtomail.services.service.UserService; -import com.franciaflex.faxtomail.services.service.ValidationService; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.jaxx.application.ApplicationTechnicalException; - -import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext; -import com.franciaflex.faxtomail.services.service.LdapService; -import com.franciaflex.faxtomail.services.service.ldap.LdapServiceMock; -import com.google.common.base.Preconditions; - -public class FaxToMailServiceContext implements Closeable { - - private static final Log log = LogFactory.getLog(FaxToMailServiceContext.class); - - protected FaxToMailServiceContext delegateServiceContext; - - protected FaxToMailConfiguration applicationConfig; - - protected FaxToMailTopiaApplicationContext topiaApplicationContext; - - protected FaxToMailTopiaPersistenceContext persistenceContext; - - protected FaxToMailServiceFactory serviceFactory; - - public static FaxToMailServiceContext newServiceContext(FaxToMailTopiaApplicationContext applicationContext) { - return new FaxToMailServiceContext(applicationContext, new FaxToMailProxiedServiceFactory()); - } - - public static FaxToMailServiceContext newDirectServiceContext(FaxToMailTopiaApplicationContext applicationContext) { - return new FaxToMailServiceContext(applicationContext, new FaxToMailDefaultServiceFactory()); - } - - public static FaxToMailServiceContext newDirectServiceContext(FaxToMailTopiaPersistenceContext persistenceContext) { - return new FaxToMailServiceContext(persistenceContext, new FaxToMailDefaultServiceFactory()); - } - - private FaxToMailServiceContext(FaxToMailTopiaApplicationContext topiaApplicationContext, FaxToMailServiceFactory serviceFactory) { - Preconditions.checkNotNull(topiaApplicationContext, "Cannot create an ServiceContext without an ApplicationContext"); - Preconditions.checkNotNull(serviceFactory, "Cannot create an ServiceContext without a ServiceFactory"); - this.topiaApplicationContext = topiaApplicationContext; - this.serviceFactory = serviceFactory; - this.serviceFactory.setServiceContext(this); - } - - private FaxToMailServiceContext(FaxToMailTopiaPersistenceContext persistenceContext, FaxToMailServiceFactory serviceFactory) { - this.persistenceContext = persistenceContext; - this.serviceFactory = serviceFactory; - this.serviceFactory.setServiceContext(this); - } - - private FaxToMailServiceContext(FaxToMailServiceContext delegateServiceContext, FaxToMailServiceFactory serviceFactory) { - this.delegateServiceContext = delegateServiceContext; - this.serviceFactory = serviceFactory; - this.serviceFactory.setServiceContext(this); - } - - public FaxToMailConfiguration getApplicationConfig() { - if (delegateServiceContext != null) { - return delegateServiceContext.getApplicationConfig(); - } else { - return applicationConfig; - } - } - - public FaxToMailTopiaPersistenceContext getPersistenceContext() { - if (delegateServiceContext != null) { - return delegateServiceContext.getPersistenceContext(); - } else { - if (persistenceContext == null) { - persistenceContext = topiaApplicationContext.newPersistenceContext(); - } - return persistenceContext; - } - } - - public void setApplicationConfig(FaxToMailConfiguration applicationConfig) { - if (delegateServiceContext != null) { - delegateServiceContext.setApplicationConfig(applicationConfig); - } else { - this.applicationConfig = applicationConfig; - } - } - - public <E extends FaxToMailService> E newService(Class<E> serviceInterfaceClass) { - return serviceFactory.newService(serviceInterfaceClass); - } - - public static class FaxToMailDefaultServiceFactory implements FaxToMailServiceFactory { - - protected FaxToMailServiceContext serviceContext; - - @Override - public void setServiceContext(FaxToMailServiceContext serviceContext) { - this.serviceContext = serviceContext; - } - - @Override - public <E extends FaxToMailService> E newService(Class<E> serviceInterfaceClass) { - - E service; - try { - Class<E> serviceImplClass = (Class<E>) Class.forName(serviceInterfaceClass.getCanonicalName() + "Impl"); - - // special case for mock services - if (serviceImplClass.equals(LdapServiceImpl.class) && serviceContext.getApplicationConfig().isLdapMock()) { - serviceImplClass = (Class<E>) LdapServiceMock.class; - } - - Constructor<E> constructor = serviceImplClass.getConstructor(); - service = constructor.newInstance(); - - } catch (NoSuchMethodException e) { - throw new ApplicationTechnicalException("all services must provide a non-argument constructor", e); - } catch (InvocationTargetException|InstantiationException|IllegalAccessException e) { - throw new ApplicationTechnicalException("unable to instantiate service", e); - } catch (ClassNotFoundException e) { - throw new ApplicationTechnicalException("unable to find the implementation of the service", e); - } - - service.setServiceContext(serviceContext); - - return service; - - } - } - - public static class FaxToMailProxiedServiceFactory implements FaxToMailServiceFactory { - - protected FaxToMailDefaultServiceFactory defaultServiceFactory; - - protected FaxToMailServiceContext subServiceContext; - - protected FaxToMailServiceContext serviceContext; - - @Override - public void setServiceContext(FaxToMailServiceContext serviceContext) { - this.serviceContext = serviceContext; - } - - @Override - public <E extends FaxToMailService> E newService(Class<E> serviceInterfaceClass) { - - if (defaultServiceFactory == null) { - defaultServiceFactory = new FaxToMailDefaultServiceFactory(); - subServiceContext = new FaxToMailServiceContext(serviceContext, defaultServiceFactory); - defaultServiceFactory.setServiceContext(subServiceContext); - } - - E realService = defaultServiceFactory.newService(serviceInterfaceClass); - - E service = (E) Proxy.newProxyInstance(serviceInterfaceClass.getClassLoader(), new Class[]{serviceInterfaceClass}, - new FaxToMailServiceInvocationHandler(realService, serviceContext)); - - return service; - - } - } - - public Date getNow() { - Date now = new Date(); - return now; - } - - public DecoratorService getDecoratorService() { - return newService(DecoratorService.class); - } - - public ValidationService getValidationService() { - return newService(ValidationService.class); - } - - public MailFolderService getMailFolderService() { - return newService(MailFolderService.class); - } - - public UserService getUserService() { - return newService(UserService.class); - } - - public LdapService getLdapService() { - return newService(LdapService.class); - } - - public EmailService getEmailService() { - return newService(EmailService.class); - } - - public ReferentielService getReferentielService() { - return newService(ReferentielService.class); - } - - public ConfigurationService getConfigurationService() { - return newService(ConfigurationService.class); - } - - public InitFaxToMailService getInitFaxToMailService() { - return newService(InitFaxToMailService.class); - } - - public ClientService getClientService() { - return newService(ClientService.class); - } - - @Override - public void close() throws IOException { - if (persistenceContext != null) { - - if (Boolean.getBoolean("hibernate.generate_statistics") && log.isInfoEnabled()) { - log.info(persistenceContext.getHibernateSupport().getHibernateFactory().getStatistics()); - } - - persistenceContext.close(); - persistenceContext = null; - } - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceFactory.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceFactory.java deleted file mode 100644 index cbe070d..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.franciaflex.faxtomail.services; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * @author Arnaud Thimel (Code Lutin) - */ -public interface FaxToMailServiceFactory { - - void setServiceContext(FaxToMailServiceContext serviceContext); - - public <E extends FaxToMailService> E newService(Class<E> serviceInterfaceClass); - -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceInvocationHandler.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceInvocationHandler.java deleted file mode 100644 index 493a1bf..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceInvocationHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.franciaflex.faxtomail.services; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.commons.io.IOUtils; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * @author Kevin Morin (Code Lutin) - * @since x.x - */ -public class FaxToMailServiceInvocationHandler implements InvocationHandler { - - protected Object wrappedService; - protected FaxToMailServiceContext serviceContext; - - public FaxToMailServiceInvocationHandler(Object service, FaxToMailServiceContext serviceContext) { - this.wrappedService = service; - this.serviceContext = serviceContext; - } - - @Override - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - try { - Object result = method.invoke(wrappedService, args); - return result; - } catch (InvocationTargetException ex) { - throw ex.getCause(); - } finally { - IOUtils.closeQuietly(serviceContext); - } - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java deleted file mode 100644 index b7bff33..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceSupport.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.franciaflex.faxtomail.services; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext; -import com.franciaflex.faxtomail.services.service.ClientService; -import com.franciaflex.faxtomail.services.service.ConfigurationService; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.services.service.MailFolderService; -import com.franciaflex.faxtomail.services.service.ReferentielService; - -import java.util.Date; - -public class FaxToMailServiceSupport implements FaxToMailService { - - protected FaxToMailServiceContext serviceContext; - - @Override - public void setServiceContext(FaxToMailServiceContext serviceContext) { - this.serviceContext = serviceContext; - } - - protected FaxToMailConfiguration getApplicationConfig() { - return serviceContext.getApplicationConfig(); - } - - protected Date getNow() { - return serviceContext.getNow(); - } - - protected FaxToMailTopiaPersistenceContext getPersistenceContext() { - return serviceContext.getPersistenceContext(); - } - - public <E extends FaxToMailService> E newService(Class<E> serviceClass) { - return serviceContext.newService(serviceClass); - } - - protected DecoratorService getDecoratorService() { - return newService(DecoratorService.class); - } - - protected ConfigurationService getConfigurationService() { - return newService(ConfigurationService.class); - } - - protected MailFolderService getMailFolderService() { - return newService(MailFolderService.class); - } - - protected EmailService getEmailService() { - return newService(EmailService.class); - } - - protected ReferentielService getReferentielService() { - return newService(ReferentielService.class); - } - - protected ClientService getClientService() { - return newService(ClientService.class); - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java deleted file mode 100644 index 01d0099..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.franciaflex.faxtomail.services; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.nio.charset.Charset; -import java.util.Collection; - -import javax.mail.MessagingException; -import javax.mail.Part; -import javax.mail.internet.ContentType; - -import org.apache.commons.io.Charsets; - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; - -/** - * @author Kevin Morin (Code Lutin) - */ -public class FaxToMailServiceUtils { - - public static String addFaxDomainToFaxNumber(String faxNumber, MailFolder folder) { - while (!folder.isUseCurrentLevelFaxDomain() - && folder.getParent() != null) { - folder = folder.getParent(); - } - int endIndex = faxNumber.indexOf('@'); - if (endIndex >= 0) { - faxNumber = faxNumber.substring(0, endIndex); - } - faxNumber += "@" + folder.getFaxDomain(); - return faxNumber; - } - - public static Charset getCharset(Part part) throws MessagingException { - ContentType contentType = new ContentType(part.getContentType()); - String charsetName = contentType.getParameter("charset"); - Charset charset = Charsets.toCharset(charsetName); - return charset; - } - - /** - * Return true if given collection is not null and contains requested value. - * - * @param coll collection - * @param value value - * @return true if set contains value - */ - public static <T extends Enum<T>> boolean contains(Collection<T> coll, T value) { - boolean result = false; - if (coll != null) { - result = coll.contains(value); - } - return result; - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java deleted file mode 100644 index a1656e5..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Client; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.services.FaxToMailService; - -/** - * @author Kevin Morin (Code Lutin) - */ -public interface ClientService extends FaxToMailService { - Client getClientForEmailAddress(String emailAddress, Email email, String company); - - Client getClientForCode(String code, String company); - - void updateNewClients(); -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java deleted file mode 100644 index e54cc45..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java +++ /dev/null @@ -1,284 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import com.google.common.base.Predicate; -import com.google.common.collect.Collections2; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.collections4.map.MultiKeyMap; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.persistence.TopiaQueryBuilderAddCriteriaOrRunQueryStep; -import org.nuiton.topia.persistence.support.TopiaSqlSupport; -import org.nuiton.topia.persistence.support.TopiaSqlWork; - -import com.franciaflex.faxtomail.persistence.entities.Client; -import com.franciaflex.faxtomail.persistence.entities.ClientImpl; -import com.franciaflex.faxtomail.persistence.entities.ClientTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.NewClient; -import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; -import com.google.common.base.Preconditions; - -/** - * Service de gestion des clients. - * - * @author Kevin Morin (Code Lutin) - */ -public class ClientServiceImpl extends FaxToMailServiceSupport implements ClientService { - - private static final Log log = LogFactory.getLog(ClientServiceImpl.class); - - /** - * Recherche le client qui correspond à l'adresse email de l'expediteur du mail. - * - * This method is a getter, but modify input {@code email} ! - * - * @param emailAddress sender address - * @param email email - * @param company company of the client - * @return client for emailAddress (can be {@code null}) - */ - @Override - public Client getClientForEmailAddress(String emailAddress, Email email, String company) { - Preconditions.checkNotNull(email); - Preconditions.checkNotNull(emailAddress); - - ClientTopiaDao clientDao = getPersistenceContext().getClientDao(); - - Client client = null; - List<Client> clients; - if (StringUtils.isNotBlank(emailAddress)) { - clients = clientDao.forEmailAddressesJsonLike(emailAddress); - - // on essaye de voir si on peut gérer l'adresse de l'expediteur comme un fax - if (CollectionUtils.isEmpty(clients)) { - String faxNumber = emailAddress.substring(0, emailAddress.indexOf('@')).replaceAll(" ", ""); - // NumberUtils.isNumber peut echouer (notation octal) - if (StringUtils.isNumeric(faxNumber)) { - emailAddress = StringUtils.leftPad(faxNumber, 10, '0'); - clients = clientDao.forFaxNumbersJsonLike(emailAddress); - email.setFax(true); - } - } - - if (CollectionUtils.isNotEmpty(clients)) { - int i = 0; - while (client == null && i < clients.size()) { - Client c = clients.get(i++); - if (StringUtils.isBlank(company) || Objects.equals(company, c.getCompany())) { - client = c; - } - } - } - } - - // on doit faire l'affectation ici car emailAddress a pu etre remplacé par le numero de fax - email.setSender(emailAddress); - return client; - } - - /** - * Recherche un client par code et société. - * - * @param code client code - * @param company - * @return le client pour la société - */ - @Override - public Client getClientForCode(String code, String company) { - ClientTopiaDao clientDao = getPersistenceContext().getClientDao(); - Client client = null; - if (StringUtils.isNotBlank(code)) { - TopiaQueryBuilderAddCriteriaOrRunQueryStep<Client> ctqbacorqs = clientDao.forCodeEquals(code); - if (StringUtils.isNotBlank(company)) { - ctqbacorqs = ctqbacorqs.addEquals(Client.PROPERTY_COMPANY, company); - } - client = ctqbacorqs.findAnyOrNull(); - } - return client; - } - - /** - * Récupère les information de la table NewClient pour mettre à jour la table Client. - */ - @Override - public void updateNewClients() { - - final ClientTopiaDao clientDao = getPersistenceContext().getClientDao(); - final FaxToMailUserTopiaDao faxToMailUserDao = getPersistenceContext().getFaxToMailUserDao(); - - TopiaSqlSupport sqlSupport = getPersistenceContext().getSqlSupport(); - sqlSupport.doSqlWork(new TopiaSqlWork() { - - @Override - public void execute(Connection connection) throws SQLException { - - int importedCount = 0; - - // attention, le sql à pour cible postgresql, mssql, h2, il doit rester simple - String query = String.format("SELECT %s, %s, %s, %s, %s, %s, %s, %s, %s, %s FROM %s", - NewClient.PROPERTY_NAME, - NewClient.PROPERTY_EMAIL_ADDRESS, - NewClient.PROPERTY_FAX_NUMBER, - NewClient.PROPERTY_CARACTERISTIC1, - NewClient.PROPERTY_CARACTERISTIC2, - NewClient.PROPERTY_CARACTERISTIC3, - NewClient.PROPERTY_CODE, - NewClient.PROPERTY_BRAND, - NewClient.PROPERTY_COMPANY, - NewClient.PROPERTY_PERSON_IN_CHARGE, - NewClient.class.getSimpleName()); - Statement stat = connection.createStatement(); - - // get query result set - ResultSet resultSet = stat.executeQuery(query); - // cache utilise pour mettre à jour les mêmes client dans le cas ou - // il reviennt plusieurs fois - MultiKeyMap<String, Client> clientCache = new MultiKeyMap<>(); - - // parse result set - while (resultSet.next()) { - String name = resultSet.getString(NewClient.PROPERTY_NAME); - String emailAddress = resultSet.getString(NewClient.PROPERTY_EMAIL_ADDRESS); - String faxNumber = resultSet.getString(NewClient.PROPERTY_FAX_NUMBER); - String caracteristic1 = resultSet.getString(NewClient.PROPERTY_CARACTERISTIC1); - String caracteristic2 = resultSet.getString(NewClient.PROPERTY_CARACTERISTIC2); - String caracteristic3 = resultSet.getString(NewClient.PROPERTY_CARACTERISTIC3); - String code = resultSet.getString(NewClient.PROPERTY_CODE); - String brand = resultSet.getString(NewClient.PROPERTY_BRAND); - String company = resultSet.getString(NewClient.PROPERTY_COMPANY); - String personInCharge = resultSet.getString(NewClient.PROPERTY_PERSON_IN_CHARGE); - - // clear some data - if ("null".equalsIgnoreCase(caracteristic1)) { - caracteristic1 = null; - } - if ("null".equalsIgnoreCase(caracteristic2)) { - caracteristic2 = null; - } - if ("null".equalsIgnoreCase(caracteristic3)) { - caracteristic3 = null; - } - if ("null".equalsIgnoreCase(brand)) { - brand = null; - } - if ("null".equalsIgnoreCase(emailAddress)) { - emailAddress = null; - } - if (faxNumber != null) { - faxNumber = StringUtils.removePattern(faxNumber, "[^0-9]"); - if (faxNumber.isEmpty() || faxNumber.equals("0")) { - faxNumber = null; - } - } - - // save data - Client client = clientCache.get(code, company); - if (client == null) { - client = clientDao.forCodeEquals(code).addEquals(Client.PROPERTY_COMPANY, company).findUniqueOrNull(); - if (client == null) { - client = new ClientImpl(); - client.setCode(code); - client.setCompany(company); - } - - client.setName(name); - client.setCaracteristic1(caracteristic1); - client.setCaracteristic2(caracteristic2); - client.setCaracteristic3(caracteristic3); - client.setBrand(brand); - - // clear current adresses and fax numbers - client.setEmailAddresses(null); - client.setFaxNumbers(null); - - // look for personInCharge - FaxToMailUser faxToMailUserInCharge = null; - if (StringUtils.isNotBlank(personInCharge)) { - faxToMailUserInCharge = faxToMailUserDao.forLoginEquals(personInCharge).findUniqueOrNull(); - } - client.setPersonInCharge(faxToMailUserInCharge); - - if (client.isPersisted()) { - client = clientDao.update(client); - } else { - client = clientDao.create(client); - } - - // update cache - clientCache.put(code, company, client); - } - - // only manage emailAdress and faxNumber in this case client is in cache - if (StringUtils.isNotBlank(emailAddress)) { - List<String> currentAddresses = client.getEmailAddresses(); - if (currentAddresses == null) { - currentAddresses = new ArrayList<String>(); - } - currentAddresses.add(emailAddress); - client.setEmailAddresses(currentAddresses); - client = clientDao.update(client); - } - // and............................ faxNumber - if (StringUtils.isNotBlank(faxNumber)) { - List<String> faxNumbers = client.getFaxNumbers(); - if (faxNumbers == null) { - faxNumbers = new ArrayList<String>(); - } - faxNumbers.add(faxNumber); - client.setFaxNumbers(faxNumbers); - client = clientDao.update(client); - } - - importedCount++; - } - - // delete all rows - stat = connection.createStatement(); - stat.execute("DELETE FROM " + NewClient.class.getSimpleName()); - - // usefull log info (do not remove) - if (importedCount > 0 && log.isInfoEnabled()) { - log.info(String.format("Imported %d new client rows", importedCount)); - } - } - }); - - getPersistenceContext().commit(); - } - -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java deleted file mode 100644 index 8f574d4..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.franciaflex.faxtomail.persistence.entities.Configuration; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.EmailAccount; -import com.franciaflex.faxtomail.persistence.entities.ExtensionCommand; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.MailFilter; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.services.FaxToMailService; - -/** - * @author Kevin Morin (Code Lutin) - */ -public interface ConfigurationService extends FaxToMailService { - Configuration getConfiguration(); - - List<MailFilter> getMailFilters(); - - void save(Configuration configuration, List<DemandType> demandTypes, List<WaitingState> waitingStates, List<MailFolder> mailFolders, - List<MailFilter> mailFilters, List<EmailAccount> emailAccounts); - - List<EmailAccount> getEmailAccountsWithoutPasswords(); - - List<EmailAccount> getEmailAccounts(); - - void saveUserFolders(Map<String, Collection<MailFolder>> userFolders); - - ExtensionCommand getExtensionCommand(String extension); - - Set<FaxToMailUser> getUserManagedUsers(FaxToMailUser user); - - Map<String, Object> checkDirectory(String path); - - Map<String, Object> checkMailaccount(EmailAccount account); - - long getEmailMaxSize(); - - List<MailField> getSearchDisplayColumns(); -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java deleted file mode 100644 index ea7eaf1..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java +++ /dev/null @@ -1,606 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import javax.mail.MessagingException; -import javax.mail.Session; -import javax.mail.Store; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.persistence.TopiaEntities; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; - -import com.franciaflex.faxtomail.persistence.entities.Configuration; -import com.franciaflex.faxtomail.persistence.entities.ConfigurationImpl; -import com.franciaflex.faxtomail.persistence.entities.ConfigurationTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.DemandTypeImpl; -import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.EmailAccount; -import com.franciaflex.faxtomail.persistence.entities.EmailAccountImpl; -import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.EmailProtocol; -import com.franciaflex.faxtomail.persistence.entities.ExtensionCommand; -import com.franciaflex.faxtomail.persistence.entities.ExtensionCommandTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.GroupChef; -import com.franciaflex.faxtomail.persistence.entities.GroupChefTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.MailFilter; -import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.MailFolderImpl; -import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.persistence.entities.WaitingStateImpl; -import com.franciaflex.faxtomail.persistence.entities.WaitingStateTopiaDao; -import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; -import com.google.common.base.Function; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - -/** - * @author kmorin - kmorin@codelutin.com - */ -public class ConfigurationServiceImpl extends FaxToMailServiceSupport implements ConfigurationService { - - private static final Log log = LogFactory.getLog(ConfigurationServiceImpl.class); - - - protected static final Function<MailFilter, String> GET_EXPRESSION = new Function<MailFilter, String>() { - @Override - public String apply(MailFilter input) { - return input == null ? null : input.getExpression(); - } - }; - - /** - * Return unique database configuration. - * - * @return configuration (not {@code null}, created on not found in database) - */ - @Override - public Configuration getConfiguration() { - ConfigurationTopiaDao dao = getPersistenceContext().getConfigurationDao(); - Configuration config = dao.forAll().findUniqueOrNull(); - if (config == null) { - config = new ConfigurationImpl(); - } - return config; - } - - /** - * Get all mail filter ordered by position. - * - * @return all mail filter - */ - @Override - public List<MailFilter> getMailFilters() { - MailFilterTopiaDao mailFilterDao = getPersistenceContext().getMailFilterDao(); - List<MailFilter> result = mailFilterDao.forAll().setOrderByArguments(MailFilter.PROPERTY_POSITION + " asc").findAll(); - return result; - } - - /** - * Save configuration. - * - * @param config configuration to save - */ - protected void saveConfiguration(Configuration config) { - ConfigurationTopiaDao dao = getPersistenceContext().getConfigurationDao(); - if (config.isPersisted()) { - config = dao.update(config); - } else { - config = dao.create(config); - } - } - - /** - * Sauve l'ensemble de la configuration. - * - * @param configuration configuration - * @param demandTypes types de demande - * @param waitingStates etat d'attentes - * @param mailFolders mail folder - * @param mailFilters mail filters - * @param emailAccounts mail accounts - */ - @Override - public void save(Configuration configuration, List<DemandType> demandTypes, List<WaitingState> waitingStates, List<MailFolder> mailFolders, - List<MailFilter> mailFilters, List<EmailAccount> emailAccounts) { - - Collection<MailFolder> toDeleteMailFolder = new ArrayList<>(); - - // sauvegarde - saveConfiguration(configuration); - saveDemandTypes(demandTypes); - Map<String, WaitingState> waitingStateCache = saveWaitingStates(waitingStates); - Map<String, MailFolder> mailFolderCache = saveMailFolders(waitingStateCache, mailFolders, toDeleteMailFolder); - saveMailFilters(mailFolderCache, mailFilters); - saveEmailAccounts(emailAccounts); - - // delete after loop - MailFolderTopiaDao mailFilterDao = getPersistenceContext().getMailFolderDao(); - mailFilterDao.deleteAll(toDeleteMailFolder); - - // unique commit pour toute la conf - getPersistenceContext().commit(); - } - - protected void saveDemandTypes(List<DemandType> demandTypes) { - Binder<DemandType, DemandType> binderDemandType = BinderFactory.newBinder(DemandType.class); - DemandTypeTopiaDao demandTypeDAO = getPersistenceContext().getDemandTypeDao(); - - List<DemandType> allDemandType = demandTypeDAO.findAll(); - Map<String, DemandType> allDemandTypeIndex = new HashMap<>(Maps.uniqueIndex(allDemandType, TopiaEntities.getTopiaIdFunction())); - for (DemandType demandType : demandTypes) { - // get current etat attente - DemandType currentDemandType; - if (StringUtils.isBlank(demandType.getTopiaId()) || demandType.getTopiaId().startsWith("new_")) { - currentDemandType = new DemandTypeImpl(); - } else { - currentDemandType = allDemandTypeIndex.remove(demandType.getTopiaId()); - } - - // copy - binderDemandType.copyExcluding(demandType, currentDemandType, - DemandType.PROPERTY_TOPIA_ID, - DemandType.PROPERTY_TOPIA_CREATE_DATE, - DemandType.PROPERTY_TOPIA_VERSION); - - // persist - if (currentDemandType.isPersisted()) { - demandTypeDAO.update(currentDemandType); - } else { - demandTypeDAO.create(currentDemandType); - } - } - } - - /** - * - * @param waitingStates - */ - protected Map<String, WaitingState> saveWaitingStates(Collection<WaitingState> waitingStates) { - - Map<String, WaitingState> cache = new HashMap<>(); - Binder<WaitingState, WaitingState> binderEtatAttente = BinderFactory.newBinder(WaitingState.class); - WaitingStateTopiaDao waitingStateDAO = getPersistenceContext().getWaitingStateDao(); - - List<WaitingState> allWaitingStates = waitingStateDAO.findAll(); - Map<String, WaitingState> allWaitingStateIndex = new HashMap<>(Maps.uniqueIndex(allWaitingStates, TopiaEntities.getTopiaIdFunction())); - for (WaitingState waitingState : waitingStates) { - // get current etat attente - WaitingState currentWaitingState; - if (StringUtils.isBlank(waitingState.getTopiaId()) || waitingState.getTopiaId().startsWith("new_")) { - currentWaitingState = new WaitingStateImpl(); - } else { - currentWaitingState = allWaitingStateIndex.remove(waitingState.getTopiaId()); - } - - // copy - binderEtatAttente.copyExcluding(waitingState, currentWaitingState, - WaitingState.PROPERTY_TOPIA_ID, - WaitingState.PROPERTY_TOPIA_CREATE_DATE, - WaitingState.PROPERTY_TOPIA_VERSION); - - // persist - if (currentWaitingState.isPersisted()) { - waitingStateDAO.update(currentWaitingState); - } else { - waitingStateDAO.create(currentWaitingState); - } - - // cache - cache.put(waitingState.getTopiaId(), currentWaitingState); - } - - // delete remaining (not done here, done after reference cleaning) - waitingStateDAO.deleteAll(allWaitingStateIndex.values()); - - return cache; - } - - /** - * Save mail folder without commit. - * - * @param waitingStateCache cache etat attente - * @param newMailFolders mail folders - * @return mail folder cache with input ids - */ - protected Map<String, MailFolder> saveMailFolders(Map<String, WaitingState> waitingStateCache, Collection<MailFolder> newMailFolders, Collection<MailFolder> toDeleteMailFolder) { - // get current folders - MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); - List<MailFolder> mailFolders = dao.findAll(); - Map<String, MailFolder> mailFolderMap = new HashMap<>(Maps.uniqueIndex(mailFolders, TopiaEntities.getTopiaIdFunction())); - - // recursive update - Map<String, MailFolder> mailFolderCache = new HashMap<>(); - saveMailFolders(dao, waitingStateCache, mailFolderMap, null, newMailFolders, mailFolderCache); - - // if map is not empty after recursive iteration, remaining folder must be deleted - toDeleteMailFolder.addAll(mailFolderMap.values()); - - return mailFolderCache; - } - - /** - * Save mail folder without commit. - * - * @param dao - * @param waitingStateCache - * @param mailFolderMap - * @param parent - * @param mailFolders - * @param mailFolderCache - * @return - */ - protected Collection<MailFolder> saveMailFolders(MailFolderTopiaDao dao, Map<String, WaitingState> waitingStateCache, - Map<String, MailFolder> mailFolderMap, MailFolder parent, Collection<MailFolder> mailFolders, Map<String, MailFolder> mailFolderCache) { - - Collection<MailFolder> result = Lists.newArrayList(); - if (mailFolders == null) { - return result; - } - - Binder<MailFolder, MailFolder> binderMailFolder = BinderFactory.newBinder(MailFolder.class); - for (MailFolder mailFolder : mailFolders) { - - MailFolder currentMailFolder; - if (StringUtils.isBlank(mailFolder.getTopiaId()) || mailFolder.getTopiaId().startsWith("new_")) { - currentMailFolder = new MailFolderImpl(); - } else { - currentMailFolder = mailFolderMap.remove(mailFolder.getTopiaId()); - } - - binderMailFolder.copyExcluding(mailFolder, currentMailFolder, - MailFolder.PROPERTY_TOPIA_ID, - MailFolder.PROPERTY_TOPIA_CREATE_DATE, - MailFolder.PROPERTY_TOPIA_VERSION, - MailFolder.PROPERTY_CHILDREN, - MailFolder.PROPERTY_WAITING_STATES, - MailFolder.PROPERTY_PARENT); - - // gestion des bonnes références des états d'attente (surtout le cas "new_") - currentMailFolder.clearWaitingStates(); - if (mailFolder.getWaitingStates() != null) { - for (WaitingState waitingState : mailFolder.getWaitingStates()) { - // etatAttente.getTopiaId() peut retourner un id qui commence par new_ - currentMailFolder.addWaitingStates(waitingStateCache.get(waitingState.getTopiaId())); - } - } - - currentMailFolder.setParent(parent); - - if (!currentMailFolder.isPersisted()) { - currentMailFolder = dao.create(currentMailFolder); - } - - Collection<MailFolder> children = saveMailFolders(dao, waitingStateCache, mailFolderMap, - currentMailFolder, mailFolder.getChildren(), mailFolderCache); - currentMailFolder.setChildren(children); - dao.update(currentMailFolder); - - result.add(currentMailFolder); - - // add in cache - mailFolderCache.put(mailFolder.getTopiaId(), currentMailFolder); - } - - return result; - } - - /** - * Save all mail filters without commit. - * - * @param mailFolderCache mail folder cache (with corrects ids) - * @param mailFilters mail filters to save - */ - protected void saveMailFilters(Map<String, MailFolder> mailFolderCache, List<MailFilter> mailFilters) { - MailFilterTopiaDao dao = getPersistenceContext().getMailFilterDao(); - - int position = 0; - List<MailFilter> filters = dao.findAll(); - // order by naturalId - Map<String, MailFilter> filterByExpression = new HashMap<>(Maps.uniqueIndex(filters, GET_EXPRESSION)); - for (MailFilter mailFilter : mailFilters) { - - MailFilter filter = filterByExpression.remove(mailFilter.getExpression().toLowerCase()); - boolean create = filter == null; - if (create) { - filter = dao.newInstance(); - } - - filter.setExpression(mailFilter.getExpression().toLowerCase()); - filter.setFilterFolderPriority(mailFilter.isFilterFolderPriority()); - - // mailFilter.getMailFolder().getTopiaId() can start with new_ - MailFolder mailFolder = mailFolderCache.get(mailFilter.getMailFolder().getTopiaId()); - filter.setMailFolder(mailFolder); - filter.setPosition(position); - - if (create) { - filter = dao.create(filter); - } else { - filter = dao.update(filter); - } - position++; - } - - dao.deleteAll(filterByExpression.values()); - } - - /** - * Return all email accounts (without password info). - * - * @return all email account - */ - @Override - public List<EmailAccount> getEmailAccountsWithoutPasswords() { - List<EmailAccount> accounts = getEmailAccounts(); - // remove password information from bean - final Binder<EmailAccount, EmailAccount> binderEmailAccount = BinderFactory.newBinder(EmailAccount.class); - List<EmailAccount> result = Lists.transform(accounts, new Function<EmailAccount, EmailAccount>() { - @Override - public EmailAccount apply(EmailAccount input) { - EmailAccount account = new EmailAccountImpl(); - binderEmailAccount.copyExcluding(input, account, EmailAccount.PROPERTY_PASSWORD); - return account; - } - }); - - return result; - } - - @Override - public List<EmailAccount> getEmailAccounts() { - EmailAccountTopiaDao emailAccountTopiaDao = getPersistenceContext().getEmailAccountDao(); - List<EmailAccount> result = emailAccountTopiaDao.findAll(); - return result; - } - - /** - * Save email account without commit. - * - * @param newEmailAccounts new email account list to save - */ - protected void saveEmailAccounts(List<EmailAccount> newEmailAccounts) { - EmailAccountTopiaDao emailAccountTopiaDao = getPersistenceContext().getEmailAccountDao(); - List<EmailAccount> emailAccounts = emailAccountTopiaDao.findAll(); - Map<String, EmailAccount> emailAccountMap = new HashMap<>(Maps.uniqueIndex(emailAccounts, TopiaEntities.getTopiaIdFunction())); - Binder<EmailAccount, EmailAccount> binder = BinderFactory.newBinder(EmailAccount.class); - - for (EmailAccount newEmailAccount : newEmailAccounts) { - EmailAccount emailAccount; - if (StringUtils.isNotBlank(newEmailAccount.getTopiaId())) { - emailAccount = emailAccountMap.remove(newEmailAccount.getTopiaId()); - } else { - emailAccount = new EmailAccountImpl(); - } - - binder.copyExcluding(newEmailAccount, emailAccount, - EmailAccount.PROPERTY_TOPIA_ID, - EmailAccount.PROPERTY_TOPIA_CREATE_DATE, - EmailAccount.PROPERTY_TOPIA_VERSION, - EmailAccount.PROPERTY_PASSWORD); - - // password is only present for new account (not for edited ones) - if (StringUtils.isNotEmpty(newEmailAccount.getPassword())) { - emailAccount.setPassword(newEmailAccount.getPassword()); - } - - if (emailAccount.isPersisted()) { - emailAccountTopiaDao.update(emailAccount); - } else { - emailAccountTopiaDao.create(emailAccount); - } - } - - emailAccountTopiaDao.deleteAll(emailAccountMap.values()); - } - - @Override - public void saveUserFolders(Map<String, Collection<MailFolder>> userFolders) { - FaxToMailUserTopiaDao faxToMailUserTopiaDao = getPersistenceContext().getFaxToMailUserDao(); - - for (Map.Entry<String, Collection<MailFolder>> entry : userFolders.entrySet()) { - String userId = entry.getKey(); - Collection<MailFolder> mailFolders = entry.getValue(); - - FaxToMailUser user = faxToMailUserTopiaDao.forTopiaIdEquals(userId).findUnique(); - user.clearAffectedFolders(); - for (MailFolder mailFolder : mailFolders) { - user.addAffectedFolders(mailFolder); - } - faxToMailUserTopiaDao.update(user); - } - - getPersistenceContext().commit(); - } - - @Override - public ExtensionCommand getExtensionCommand(String extension) { - ExtensionCommandTopiaDao extensionCommandDao = getPersistenceContext().getExtensionCommandDao(); - ExtensionCommand result = extensionCommandDao.findByExtension(extension); - return result; - } - - /** - * Retourne l'ensemble des utilisateurs appartenant aux groupes gérés par les groupes chef. - * - * @param user current user - * @return all managed users - */ - @Override - public Set<FaxToMailUser> getUserManagedUsers(FaxToMailUser user) { - - Set<FaxToMailUser> result = new HashSet<>(); - - // s'il n'y a pas de group, il ne peut pas y avoir de droits - if (user.getUserGroups() != null) { - - // recuperation de tout les groupes chef dont l'utilsateur est membre - GroupChefTopiaDao groupChefTopiaDao = getPersistenceContext().getGroupChefDao(); - List<GroupChef> groupChefs = groupChefTopiaDao.forUserGroupIn(user.getUserGroups()).findAll(); - - // recuperation de tous les users des groups gérés - FaxToMailUserTopiaDao faxToMailUserTopiaDao = getPersistenceContext().getFaxToMailUserDao(); - for (GroupChef groupChef : groupChefs) { - // groups - if (groupChef.getManagedGroups() != null) { - for (FaxToMailUserGroup group : groupChef.getManagedGroups()) { - List<FaxToMailUser> users = faxToMailUserTopiaDao.forUserGroupsContains(group).findAll(); - result.addAll(users); - } - } - // users - if (groupChef.getManagedUsers() != null) { - result.addAll(groupChef.getManagedUsers()); - } - } - } - - return result; - } - - /** - * Return file information on file path. - * - * @param path path - * @return file info - */ - @Override - public Map<String, Object> checkDirectory(String path) { - Map<String, Object> result = new HashMap<>(); - File file = new File(path); - result.put("path", path); - result.put("exist", file.exists()); - result.put("isDirectory", file.isDirectory()); - result.put("canRead", file.canRead()); - result.put("canWrite", file.canWrite()); - result.put("canExecute", file.canExecute()); - return result; - } - - /** - * Verification de la connexion à un serveur de mail. - * - * @param account email account to check - * @return - */ - @Override - public Map<String, Object> checkMailaccount(EmailAccount account) { - Map<String, Object> result = new HashMap<>(); - - long before = System.currentTimeMillis(); - if (log.isDebugEnabled()) { - log.debug("Check account " + account.getProtocol() + " : " + account.getHost()); - } - - Properties properties = new Properties(); - - if (account.getProtocol() == EmailProtocol.POP3S) { - properties.setProperty("mail.pop3.ssl.enable", "true"); - } - - switch (account.getProtocol()) { - case IMAPS: - properties.setProperty("mail.imap.ssl.enable", "true"); - case IMAP: - properties.setProperty("mail.store.protocol", "imap"); - properties.setProperty("mail.imap.host", account.getHost()); - properties.setProperty("mail.imap.port", String.valueOf(account.getPort())); - properties.setProperty("mail.imap.connectiontimeout", "2000"); - break; - case POP3S: - properties.setProperty("mail.pop3.ssl.enable", "true"); - case POP3: - properties.setProperty("mail.store.protocol", "pop3"); - properties.setProperty("mail.pop3.host", account.getHost()); - properties.setProperty("mail.pop3.port", String.valueOf(account.getPort())); - properties.setProperty("mail.pop3.connectiontimeout", "2000"); - break; - } - - Session session = Session.getInstance(properties); - Store store = null; - - try { - store = session.getStore(); - store.connect(account.getLogin(), account.getPassword()); - store.close(); - - // set result map - result.put("ok", true); - } catch (MessagingException e) { - log.error("Error while getting emails from the mailbox", e); - - // set result map - result.put("ok", false); - result.put("error", e.getMessage()); - } finally { - if (store != null) { - try { - store.close(); - } catch (MessagingException ex) { - // silent close - } - } - } - - if (log.isDebugEnabled()) { - long after = System.currentTimeMillis(); - log.debug("Checked in " + (after - before) + " ms"); - } - return result; - } - - @Override - public long getEmailMaxSize() { - Configuration conf = getConfiguration(); - return conf.getEmailMaxSize(); - } - - @Override - public List<MailField> getSearchDisplayColumns() { - Configuration conf = getConfiguration(); - return conf.getSearchDisplayColumns(); - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java deleted file mode 100644 index 9fee501..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.mail.MessagingException; - -import com.franciaflex.faxtomail.persistence.entities.EmailFilter; -import com.franciaflex.faxtomail.persistence.entities.SearchFilter; -import org.apache.commons.mail.EmailException; -import org.nuiton.util.pagination.PaginationParameter; -import org.nuiton.util.pagination.PaginationResult; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.HistoryType; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.MailLock; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.persistence.entities.Reply; -import com.franciaflex.faxtomail.persistence.entities.ReplyContent; -import com.franciaflex.faxtomail.services.FaxToMailService; -import com.franciaflex.faxtomail.services.service.exceptions.AlreadyLockedMailException; -import com.franciaflex.faxtomail.services.service.exceptions.FolderNotReadableException; -import com.franciaflex.faxtomail.services.service.exceptions.InvalidClientException; - -/** - * @author Kevin Morin (Code Lutin) - */ -public interface EmailService extends FaxToMailService { - Email getEmailById(String id); - - Email getFullEmailById(String id); - - Email getFullEmailById(String id, FaxToMailUser user); - - Email saveEmail(Email email, FaxToMailUser user, String... modifiedFields) throws InvalidClientException; - - Email saveEmail(Email email, Collection<Attachment> attachments, Collection<Reply> replies, String clientCode, - FaxToMailUser user, String... modifiedFields) throws InvalidClientException; - - void transmitPendingDemandsToEdi(); - - Set<Object> getDistinctValues(MailFolder folder, String[] properties, boolean sum); - - PaginationResult<Email> getEmailForFolder(MailFolder folder, FaxToMailUser currentUser, EmailFilter filter, PaginationParameter page); - - List<MailFolder> getChildrenRecursively(MailFolder folder); - - Map<Range, Long[]> computeQuantitiesByRange(MailFolder rootFolder); - - Email addToHistory(String emailId, HistoryType type, FaxToMailUser user, Date date, String... fields); - - Email openEmail(String emailId, FaxToMailUser user, boolean takeEmail) throws FolderNotReadableException; - - Email lockEmail(String emailId, FaxToMailUser currentUser) throws AlreadyLockedMailException, FolderNotReadableException; - - void unlockEmail(String emailId); - - PaginationResult<Email> search(SearchFilter emailFilter, FaxToMailUser user, PaginationParameter pagination); - - Email groupEmails(String email1Id, String email2Id, FaxToMailUser user); - - Email reply(String from, String to, String cc, String bcc, String subject, - String content, Collection<AttachmentFile> attachments, - String originalEmailId, FaxToMailUser user) throws EmailException, MessagingException, IOException; - - /** - * Get reply content on demand for lazy loading. - * - * @param replyId reply topia id - * @return reply content for reply id. - */ - ReplyContent getReplyContent(String replyId); - - void transmit(Collection<String> emailIds, MailFolder newFolder, FaxToMailUser currentUser); - - AttachmentFile getAttachmentFileFromStream(InputStream contentStream); - - AttachmentFile getAttachmentFile(String attachmentId, boolean original); - - List<MailLock> getAllMailLocks(); - - void unlockMails(List<String> mailLockIds); - - void rejectEmail(String from, String to, String subject, String content) - throws EmailException, MessagingException, IOException; - - void updateRangeRowsWithEdiReturns(); - - AttachmentFile getEmailDetailAsAttachment(Email email); - - /** - * Retourne le nombre de mail archivé. - * - * @return le nombre de mail archivé - */ - long getArchivedMailCount(); - - /** - * Import archive from input stream. - * - * @param is input stream of csv file - * @param attachmentBase base folder containing attachment listed in csv file - */ - void importArchive(InputStream is, File attachmentBase); -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java deleted file mode 100644 index e74c327..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java +++ /dev/null @@ -1,1532 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.io.BufferedWriter; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.StringWriter; -import java.io.Writer; -import java.nio.charset.StandardCharsets; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeMap; - -import javax.activation.DataSource; -import javax.activation.FileDataSource; -import javax.mail.MessagingException; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.collections4.Predicate; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.time.DateFormatUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.mail.DefaultAuthenticator; -import org.apache.commons.mail.EmailConstants; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.MultiPartEmail; -import org.hibernate.Hibernate; -import org.nuiton.csv.Import; -import org.nuiton.csv.ImportRuntimeException; -import org.nuiton.decorator.Decorator; -import org.nuiton.jaxx.application.ApplicationTechnicalException; -import org.nuiton.topia.persistence.TopiaEntities; -import org.nuiton.topia.persistence.support.TopiaSqlSupport; -import org.nuiton.topia.persistence.support.TopiaSqlWork; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; -import org.nuiton.util.pagination.PaginationParameter; -import org.nuiton.util.pagination.PaginationResult; -import org.xhtmlrenderer.pdf.ITextRenderer; - -import com.franciaflex.faxtomail.persistence.entities.*; -import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; -import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; -import com.franciaflex.faxtomail.services.service.exceptions.AlreadyLockedMailException; -import com.franciaflex.faxtomail.services.service.exceptions.FolderNotReadableException; -import com.franciaflex.faxtomail.services.service.exceptions.InvalidClientException; -import com.franciaflex.faxtomail.services.service.imports.ArchiveImportBean; -import com.franciaflex.faxtomail.services.service.imports.ArchiveImportModel; -import com.github.mustachejava.DefaultMustacheFactory; -import com.github.mustachejava.Mustache; -import com.github.mustachejava.MustacheFactory; -import com.google.common.base.Function; -import com.google.common.base.Preconditions; -import com.google.common.base.Splitter; -import com.google.common.base.Strings; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - -/** - * @author kmorin - kmorin@codelutin.com - */ -public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailService { - - private static final Log log = LogFactory.getLog(EmailServiceImpl.class); - - protected Binder<Attachment, Attachment> attachmentBinder = - BinderFactory.newBinder(Attachment.class, Attachment.class); - - @Override - public Email getEmailById(String id) { - Email email = getPersistenceContext().getEmailDao().forTopiaIdEquals(id).findUnique(); - return email; - } - - protected Email getEmailById(String id, String fetch, String... otherFetches) { - Email email = getPersistenceContext().getEmailDao().forTopiaIdEquals(id).addAllFetches(fetch, otherFetches).findUnique(); - return email; - } - - @Override - public Email getFullEmailById(String id) { - - Email email = getPersistenceContext().getEmailDao() - .forTopiaIdEquals(id) - .addAllFetches(Email.PROPERTY_DEMAND_TYPE, - //Email.PROPERTY_RANGE_ROW + "." + RangeRow.PROPERTY_RANGE, - //Email.PROPERTY_HISTORY + "." + History.PROPERTY_FAX_TO_MAIL_USER, - //Email.PROPERTY_REPLIES, - //Email.PROPERTY_ATTACHMENT, - Email.PROPERTY_TAKEN_BY, - Email.PROPERTY_CLIENT, - //Email.PROPERTY_EMAIL_GROUP + "." + EmailGroup.PROPERTY_EMAIL, - //Email.PROPERTY_EMAIL_GROUP + "." + EmailGroup.PROPERTY_EMAIL + "." + Email.PROPERTY_MAIL_FOLDER, - Email.PROPERTY_WAITING_STATE, - Email.PROPERTY_PRIORITY).findUnique(); - - // manual fetch - //Hibernate.initialize(email.getPriority()); - //Hibernate.initialize(email.getDemandType()); - //Hibernate.initialize(email.getClient()); - List<RangeRow> rangeRows = email.getRangeRow(); - if (rangeRows != null) { - for (RangeRow rangeRow : rangeRows) { - Hibernate.initialize(rangeRow.getRange()); - } - } - //Hibernate.initialize(email.getWaitingState())); - //Hibernate.initialize(email.getTakenBy()); - Hibernate.initialize(email.getReplies()); - Hibernate.initialize(email.getAttachment()); - List<History> histories = email.getHistory(); - if (histories != null) { - for (History history : histories) { - Hibernate.initialize(history.getFaxToMailUser()); - } - } - EmailGroup emailGroup = email.getEmailGroup(); - if (emailGroup != null) { - Collection<Email> emails = emailGroup.getEmail(); - for (Email email2 : emails) { - Hibernate.initialize(email2.getMailFolder()); - } - } - - return email; - } - - @Override - public Email getFullEmailById(String id, FaxToMailUser user) { - Email email = getFullEmailById(id); - - MailFolderService mailFolderService = serviceContext.getMailFolderService(); - MailFolder folder = email.getMailFolder(); - browseFolderParent(folder, user, mailFolderService); - - return email; - } - - protected void browseFolderParent(MailFolder folder, FaxToMailUser user, MailFolderService mailFolderService) { - Hibernate.initialize(folder); - Hibernate.initialize(folder.getChildren()); - mailFolderService.fetchFolderAttributes(folder); - - MailFolder parent = folder.getParent(); - if (parent != null) { - browseFolderParent(parent, user, mailFolderService); - } - - boolean writable = parent != null && parent.isFolderWritable(); - if (folder.getWriteRightGroups() != null && user.getUserGroups() != null) { - writable |= CollectionUtils.containsAny(folder.getWriteRightGroups(), user.getUserGroups()); - } - writable |= folder.containsWriteRightUsers(user); - - boolean readable = parent != null && parent.isFolderReadable(); - if (folder.getReadRightGroups() != null && user.getUserGroups() != null) { - readable |= CollectionUtils.containsAny(folder.getReadRightGroups(), user.getUserGroups()); - } - readable |= folder.containsReadRightUsers(user); - - folder.setFolderWritable(writable); - folder.setFolderReadable(readable); - } - - /** - * Save email with default email client code. - * - * @param email email - * @param user user - * @param modifiedFields modified fields - * @return updated email instance - * @throws InvalidClientException if client code is not valid - */ - @Override - public Email saveEmail(Email email, FaxToMailUser user, String... modifiedFields) throws InvalidClientException { - Client client = email.getClient(); - return saveEmail(email, null, null, client != null ? client.getCode() : null, user, modifiedFields); - } - - @Override - public Email saveEmail(Email email, Collection<Attachment> attachments, Collection<Reply> replies, String clientCode, - FaxToMailUser user, String... modifiedFields) throws InvalidClientException { - Date now = getNow(); - EmailTopiaDao dao = getPersistenceContext().getEmailDao(); - HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao(); - - MailFolder folder = email.getMailFolder(); - while (!folder.isUseCurrentLevelCompany() && folder.getParent() != null) { - folder = folder.getParent(); - } - String company = folder.getCompany(); - - // if client code is null, do not manage client at all - Client client = null; - if (StringUtils.isNotBlank(clientCode)) { - Client emailClient = email.getClient(); - if (emailClient != null && clientCode.equals(email.getClient().getCode())) { - client = emailClient; - - } else { - client = getClientService().getClientForCode(clientCode, company); - if (client == null) { - String message = t("faxtomail.service.email.save.clientCode.error", clientCode); - throw new InvalidClientException(message); - } - } - } - email.setClient(client); - - if (attachments != null) { - updateAttachments(email, attachments); - } - if (replies != null) { - updateReplies(email); - } - - if (email.getRangeRow() != null) { - RangeRowTopiaDao rangeRowDao = getPersistenceContext().getRangeRowDao(); - for (RangeRow rangeRow : email.getRangeRow()) { - if (!rangeRow.isPersisted()) { - rangeRowDao.create(rangeRow); - } else { - rangeRowDao.update(rangeRow); - } - } - } - - if (!email.isPersisted()) { - if (email.getHistory() != null) { - historyDao.createAll(email.getHistory()); - } - - email = dao.create(email); - } - - Set<String> fieldSet = Sets.newHashSet(modifiedFields); - - History transmissionToEdi = CollectionUtils.find(email.getHistory(), new Predicate<History>() { - @Override - public boolean evaluate(History object) { - return object.getType() == HistoryType.TRANSMISSION_TO_EDI; - } - }); - - // we transmit to EDI if: - // - it has never been transmitted before - // - all the required fields are filled - if (transmissionToEdi == null - && email.getClient() != null - && email.getDemandType() != null - && StringUtils.isNotBlank(email.getProjectReference())) { - - handleEdiTransmission(email, historyDao, fieldSet); - } - - History history = null; - if (fieldSet.contains(Email.PROPERTY_ARCHIVE_DATE)) { - history = historyDao.create(History.PROPERTY_TYPE, HistoryType.ARCHIVED, - History.PROPERTY_FAX_TO_MAIL_USER, user, - History.PROPERTY_MODIFICATION_DATE, now); - - } else if (fieldSet.contains(Email.PROPERTY_MAIL_FOLDER)) { - history = historyDao.create(History.PROPERTY_TYPE, HistoryType.TRANSMISSION, - History.PROPERTY_FAX_TO_MAIL_USER, user, - History.PROPERTY_MODIFICATION_DATE, now); - - } else { - if (email.getTakenBy() == null && - !fieldSet.isEmpty() && !fieldSet.contains(Email.PROPERTY_TAKEN_BY)) { - email.setTakenBy(user); - fieldSet.add(Email.PROPERTY_TAKEN_BY); - } - - boolean historyEmpty = email.isHistoryEmpty(); - if (historyEmpty || !fieldSet.isEmpty()) { - history = historyDao.create(History.PROPERTY_TYPE, historyEmpty ? HistoryType.CREATION : HistoryType.MODIFICATION, - History.PROPERTY_FAX_TO_MAIL_USER, user, - History.PROPERTY_MODIFICATION_DATE, now); - history.setFields(fieldSet); - } - } - if (history != null) { - email.addHistory(history); - } - - Email result = dao.update(email); - getPersistenceContext().commit(); - - return result; - } - - /** - * Les réponses sont modifiées par l'ui pour ne pas charger le contenu binaire, pour la sauvegarde, - * il faut bien rétablir les replyContent avec ceux en base. - * - * @param email - */ - protected void updateReplies(Email email) { - ReplyTopiaDao replyTopiaDao = getPersistenceContext().getReplyDao(); - - List<Reply> currentReplies = new ArrayList<Reply>(email.getReplies()); - email.clearReplies(); - for (Reply reply : currentReplies) { - // normalement elle sont toutes persistée et non modifiées par l'ui - // donc reprendre la version en base avec un replyContent non null est suffisant dans ce cas - Reply newReply = replyTopiaDao.forTopiaIdEquals(reply.getTopiaId()).findUnique(); - email.addReplies(newReply); - } - } - - /** - * Les attachment sont copiés dans l'UI sans la valorisation des champs "originalFile" et "editedFile". - * Ici ont revalorise ces champs pour la sauvegarde. - * - * @param email - * @param attachments - */ - protected void updateAttachments(Email email, Collection<Attachment> attachments) { - AttachmentTopiaDao attachmentTopiaDao = getPersistenceContext().getAttachmentDao(); - - List<Attachment> currentAttachments = attachmentTopiaDao.forTopiaIdIn(email.getAttachmentTopiaIds()).findAll(); - if (currentAttachments == null) { - currentAttachments = new ArrayList<>(); - } - Map<String, Attachment> currentAttachmentIndex = new HashMap<>(Maps.uniqueIndex(currentAttachments, TopiaEntities.getTopiaIdFunction())); - - AttachmentFileTopiaDao attachementFileTopiaDao = getPersistenceContext().getAttachmentFileDao(); - for (Attachment attachment : attachments) { - - // get session attachment from id - Attachment currentAttachment; - if (StringUtils.isNotBlank(attachment.getTopiaId())) { - currentAttachment = currentAttachmentIndex.remove(attachment.getTopiaId()); - } else { - currentAttachment = new AttachmentImpl(); - } - - AttachmentFile originalFile = null; - AttachmentFile editedFile = null; - // dans tout les cas, les pieces jointes courante de l'attchent prévale - // sur celles en base - if (attachment.getOriginalFile() != null) { - originalFile = attachment.getOriginalFile(); - } else { - originalFile = currentAttachment.getOriginalFile(); - } - if (attachment.getEditedFile() != null) { - editedFile = attachment.getEditedFile(); - } else { - editedFile = currentAttachment.getEditedFile(); - } - - // copy new data - attachmentBinder.copyExcluding(attachment, currentAttachment, - Attachment.PROPERTY_EDITED_FILE, - Attachment.PROPERTY_EDITED_FILE_NAME, - Attachment.PROPERTY_ORIGINAL_FILE, - Attachment.PROPERTY_ORIGINAL_FILE_NAME, - Attachment.PROPERTY_TOPIA_CREATE_DATE, - Attachment.PROPERTY_TOPIA_ID, - Attachment.PROPERTY_TOPIA_VERSION); - - currentAttachment.setEditedFile(editedFile); - currentAttachment.setOriginalFile(originalFile); - - // ici les pieces jointes peuvent être sauvegardées sans que les pièces jointes - // soit présentes dans les entités car l'ui ne les a pas copiées - // pour ne pas les charger inutilement - // donc on les remet manuellement - - if (!originalFile.isPersisted()) { - attachementFileTopiaDao.create(originalFile); - } else { - attachementFileTopiaDao.update(originalFile); - } - - if (editedFile != null) { - if (!editedFile.isPersisted()) { - attachementFileTopiaDao.create(editedFile); - } else { - attachementFileTopiaDao.update(editedFile); - } - } - - if (!currentAttachment.isPersisted()) { - // persist using cascade - currentAttachments.add(currentAttachment); - } - } - - // delete not found attachments - for (Attachment attachment : currentAttachmentIndex.values()) { - currentAttachments.remove(attachment); - } - - email.setAttachment(currentAttachments); - } - - protected void handleEdiTransmission(Email email, HistoryTopiaDao historyDao, Set<String> fieldSet) { - History transmissionToEdi; - - // le transfert EDI est configuré par type de demande ET par société - if (FaxToMailServiceUtils.contains(email.getDemandType().getRequiredFields(), MailField.RANGE_ROW) - && email.getDemandType().isEdiTransfer()) { - - // si les gammes sont vides, la demande n'est pas valide, on ne fait rien dans ce cas - // sinon on transfer à edi - if (email.isRangeRowNotEmpty()) { - - // recherche parmis les dossiers parent, si la configuration ediTranfer à été demandée - Boolean ediTranfer = null; - MailFolder loopFolder = email.getMailFolder(); - do { - ediTranfer = loopFolder.getEdiTransfer(); - loopFolder = loopFolder.getParent(); - } while (ediTranfer == null && loopFolder != null); - - if (BooleanUtils.isTrue(ediTranfer)) { - // ajout d'un historique - transmissionToEdi = historyDao.create(History.PROPERTY_TYPE, HistoryType.TRANSMISSION_TO_EDI, - History.PROPERTY_MODIFICATION_DATE, new Date()); - email.addHistory(transmissionToEdi); - - // changement du status - email.setDemandStatus(DemandStatus.TRANSMISSION_TO_EDI); - fieldSet.add(Email.PROPERTY_DEMAND_STATUS); - - } else { - // TODO echatellier : pas sur qu'il faille l'ajouter tout le temps, mais sinon, le transfer se reproduira - transmissionToEdi = historyDao.create(History.PROPERTY_TYPE, HistoryType.TRANSMISSION_TO_EDI, - History.PROPERTY_MODIFICATION_DATE, new Date()); - email.addHistory(transmissionToEdi); - - // passage en status - email.setDemandStatus(DemandStatus.IN_PROGRESS); - fieldSet.add(Email.PROPERTY_DEMAND_STATUS); - } - } - - } else { - - // TODO echatellier : pas sur qu'il faille l'ajouter tout le temps, mais sinon, le transfer se reproduira - transmissionToEdi = historyDao.create(History.PROPERTY_TYPE, HistoryType.TRANSMISSION_TO_EDI, - History.PROPERTY_MODIFICATION_DATE, new Date()); - email.addHistory(transmissionToEdi); - - // passage en status - email.setDemandStatus(DemandStatus.IN_PROGRESS); - fieldSet.add(Email.PROPERTY_DEMAND_STATUS); - } - } - - @Override - public void transmitPendingDemandsToEdi() { - EmailTopiaDao dao = getPersistenceContext().getEmailDao(); - - List<Email> toTransmitToEdi = dao.forDemandStatusEquals(DemandStatus.TRANSMISSION_TO_EDI).findAll(); - if (log.isDebugEnabled()) { - log.debug(toTransmitToEdi.size() + " demands to transmit to edi"); - } - for (Email email : toTransmitToEdi) { - transmitDemandToEdi(email); - } - } - - /** - * Generate txt file to send demand to EDI system. - * - * @param email email to send - */ - protected void transmitDemandToEdi(Email email) { - Preconditions.checkArgument(email.getDemandStatus() == DemandStatus.TRANSMISSION_TO_EDI); - Preconditions.checkArgument(!email.getRangeRow().isEmpty()); - - // recherche du dossier ou deposer les demandes EDI - MailFolder folder = email.getMailFolder(); - while (!folder.isUseCurrentLevelEdiFolder() && folder.getParent() != null) { - folder = folder.getParent(); - } - String ediFolder = folder.getEdiFolder(); - if (StringUtils.isBlank(ediFolder)) { - if (log.isFatalEnabled()) { - log.fatal("Aucun dossier de depot des demandes EDI défini pour le dossier " + folder.getName()); - } - return; - } - File ediFolderDirectory = new File(ediFolder); - if (!ediFolderDirectory.canWrite()) { - if (log.isFatalEnabled()) { - log.fatal("Le dossier " + ediFolderDirectory.getAbsolutePath() + " ne dispose pas des droits d'écriture !"); - } - return; - } - - //TODO kmorin 20140521 maybe check if the file is not being read - - // get output file with pattern name depending on date - Date now = serviceContext.getNow(); - String fileDate = DateFormatUtils.format(now, "yyMMddHHmmss"); - - // create a file for each commande - for (RangeRow rangeRow : email.getRangeRow()) { - - String fileName = "ORD_FAX_" + fileDate + "_" + rangeRow.getTopiaId() + ".txt"; - - File ediFile = new File(ediFolderDirectory, fileName); - - // generate output content - String separator = ";"; - try (Writer ediWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(ediFile), StandardCharsets.UTF_8))) { - - ediWriter.write("%BEGIN_ENTETE_QUOTE\n"); - - //N° Champ/Champ/Type/Longueur/Observation - //01/Id Enregistrement/Alpha/1/Cst : E (En-tête) - ediWriter.write("E" + separator); - //02/N° d’ordre achat/Numérique/6/Cst : OARFAX - ediWriter.write("OARFAX" + separator); - //03/Date traitement/Date/6/JJMMAA dte système - ediWriter.write(DateFormatUtils.format(now, "ddMMyy") + separator); - //04/Date livraison prévue/Date/6/JJMMAA dte de réception - ediWriter.write(DateFormatUtils.format(email.getReceptionDate(), "ddMMyy") + separator); - //05/Commentaire/Alpha/70/Vide - ediWriter.write(separator); - //06/Commentaire/Alpha/70/Vide - ediWriter.write(separator); - //07/Commentaire/Alpha/70/Vide - ediWriter.write(separator); - //08/Commentaire/Alpha/70/Vide - ediWriter.write(separator); - //09//Référence client FX/Alpha/36/Référence Chantier - ediWriter.write(Strings.nullToEmpty(email.getProjectReference()) + separator); - //10/Nom du contact/Alpha/35/Vide - ediWriter.write(separator); - //11/Téléphone contact/Alpha/15/Vide - ediWriter.write(separator); - //12/Fax contact/Alpha/15/Vide - ediWriter.write(separator); - //13/Devise/Alpha/3/Cst : EUR - ediWriter.write("EUR" + separator); - //14/Condition de livraison/Alpha/3/Vide - ediWriter.write(separator); - //15/Type de commande/Alpha/Type de document - ediWriter.write(email.getDemandType().getLabel() + separator); - //16/Adresse livr : Nom/Alpha/35/Vide - ediWriter.write(separator); - //18/Adresse livr : adr1/Alpha/30/Vide - ediWriter.write(separator); - //19/Adresse livr : adr2/Alpha/30/Vide - ediWriter.write(separator); - //20/Adresse livr : cp ville/Alpha/30/Vide - ediWriter.write(separator); - //21/Adresse livr : compl./Alpha/30/Vide - ediWriter.write(separator); - //22/Adresse livr : Code postal/Alpha/10/Vide - ediWriter.write(separator); - //23/Adresse livr : Code Pays/Alpha/3/Vide - ediWriter.write(separator); - //24/Code Ean acheteur/Alpha/13/Code client - ediWriter.write(email.getClient().getCode() + separator); - //25/Code Ean facturé/Alpha/13/Code client - ediWriter.write(email.getClient().getCode() + separator); - //26/Code Ean fournisseur/Alpha/13/Gamme - ediWriter.write(rangeRow.getRange().getLabel() + separator); - //27/Identifiant Unique - ediWriter.write(rangeRow.getTopiaId() + "\n"); - - ediWriter.write("%END_ENTETE_QUOTE\n"); - - } catch (IOException ex) { - throw new RuntimeException("Can't generate EDI file"); - } - - } - - // changement du status - EmailTopiaDao dao = getPersistenceContext().getEmailDao(); - email.setDemandStatus(DemandStatus.TRANSMITTED_TO_EDI); - dao.update(email); - } - - @Override - public Set<Object> getDistinctValues(MailFolder folder, String[] properties, boolean sum) { - Set<Object> result = null; - if (folder.isFolderReadable()) { - EmailTopiaDao dao = getPersistenceContext().getEmailDao(); - result = dao.getDistinctValues(folder, properties, sum); - } - return result; - } - - /** - * Recupère les demandes d'un dossier visible par un utilisateur. - * - * La methode et les résultats sont paginés. - * - * @param folder folder to get demande - * @param currentUser user to check rigth - * @param page pagination - * @return paginated results - */ - @Override - public PaginationResult<Email> getEmailForFolder(MailFolder folder, - FaxToMailUser currentUser, - EmailFilter filter, - PaginationParameter page) { - - // perform request or not depending on rigths - PaginationResult<Email> result; - if (folder.isFolderReadable()) { - EmailTopiaDao dao = getPersistenceContext().getEmailDao(); - - result = dao.getEmailForFolder(filter, folder, page); -// TopiaQueryBuilderAddCriteriaOrRunQueryStep<Email> builderAddCriteriaOrRunQueryStep = -// dao.forMailFolderEquals(folder) -// .addNull(Email.PROPERTY_ARCHIVE_DATE) -// .addNotEquals(Email.PROPERTY_DEMAND_STATUS, DemandStatus.ARCHIVED); -// -// if (CollectionUtils.isNotEmpty(filter.getDemandStatus())) { -// builderAddCriteriaOrRunQueryStep.addIn(Email.PROPERTY_DEMAND_STATUS, filter.getDemandStatus()); -// } -// if (CollectionUtils.isNotEmpty(filter.getSenders())) { -// builderAddCriteriaOrRunQueryStep.addIn(Email.PROPERTY_SENDER, filter.getSenders()); -// } -// -// if (Boolean.getBoolean("faxtomail.fullfetch")) { -// result = builderAddCriteriaOrRunQueryStep -// .addAllFetches(Email.PROPERTY_PRIORITY, -// Email.PROPERTY_DEMAND_TYPE, -// Email.PROPERTY_CLIENT, -// Email.PROPERTY_RANGE_ROW + "." + RangeRow.PROPERTY_RANGE, -// Email.PROPERTY_WAITING_STATE, -// Email.PROPERTY_TAKEN_BY, -// Email.PROPERTY_REPLIES, -// Email.PROPERTY_ATTACHMENT -// //Email.PROPERTY_HISTORY + "." + History.PROPERTY_FAX_TO_MAIL_USER -// ).findPage(page); -// } else { -// result = builderAddCriteriaOrRunQueryStep -// .addAllFetches(Email.PROPERTY_PRIORITY, -// Email.PROPERTY_DEMAND_TYPE, -// Email.PROPERTY_CLIENT, -// //Email.PROPERTY_RANGE_ROW + "." + RangeRow.PROPERTY_RANGE, -// Email.PROPERTY_WAITING_STATE, -// Email.PROPERTY_TAKEN_BY -// //Email.PROPERTY_REPLIES, -// //Email.PROPERTY_ATTACHMENT, -// //Email.PROPERTY_HISTORY + "." + History.PROPERTY_FAX_TO_MAIL_USER -// ).findPage(page); -// -// -// // manual fetch -// for (Email email : result.getElements()) { -// //Hibernate.initialize(email.getPriority()); -// //Hibernate.initialize(email.getDemandType()); -// //Hibernate.initialize(email.getClient()); -// List<RangeRow> rangeRows = email.getRangeRow(); -// if (rangeRows != null) { -// for (RangeRow rangeRow : rangeRows) { -// Hibernate.initialize(rangeRow.getRange()); -// } -// } -// //Hibernate.initialize(email.getWaitingState()); -// //Hibernate.initialize(email.getTakenBy()); -// Hibernate.initialize(email.getReplies()); -// Hibernate.initialize(email.getAttachment()); -// /*List<History> histories = email.getHistory(); -// if (histories != null) { -// for (History history : histories) { -// Hibernate.initialize(history.getFaxToMailUser()); -// } -// }*/ -// } -// } - - } else { - List<Email> elements = Collections.emptyList(); - result = PaginationResult.of(elements, 0, page); - } - return result; - } - - @Override - public List<MailFolder> getChildrenRecursively(MailFolder folder) { - List<MailFolder> folders = new ArrayList<>(); - folders.add(folder); - Collection<MailFolder> children = folder.getChildren(); - if (children != null) { - for (MailFolder child : children) { - folders.addAll(getChildrenRecursively(child)); - } - } - return folders; - } - - @Override - public Map<Range, Long[]> computeQuantitiesByRange(MailFolder rootFolder) { - // get results by topia id - List<MailFolder> folders = getChildrenRecursively(rootFolder); - EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); - Map<String, Long[]> daoResult = emailDao.computeQuantitiesByRange(folders); - - // convert topiaId to entities - RangeTopiaDao rangeDao = getPersistenceContext().getRangeDao(); - Map<Range, Long[]> result = new TreeMap<Range, Long[]>(new Comparator<Range>() { - @Override - public int compare(Range o1, Range o2) { - return o1.getLabel().compareTo(o2.getLabel()); - } - }); - for (Entry<String, Long[]> entry : daoResult.entrySet()) { - Range range = rangeDao.forTopiaIdEquals(entry.getKey()).findUnique(); - result.put(range, entry.getValue()); - } - - return result; - } - - @Override - public Email addToHistory(String emailId, HistoryType type, FaxToMailUser user, Date date, String... fields) { - EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); - Email email = getEmailById(emailId, - Email.PROPERTY_HISTORY + "." + History.PROPERTY_FAX_TO_MAIL_USER); - - HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao(); - History history = historyDao.create(History.PROPERTY_TYPE, type, - History.PROPERTY_FAX_TO_MAIL_USER, user, - History.PROPERTY_MODIFICATION_DATE, date); - history.setFields(Sets.newHashSet(fields)); - - email.addHistory(history); - - // pour eviter de charger tout l'historique dans la liste, on duplique l'information de - // dernier ouvreur de PJ directement dans l'email - if (type == HistoryType.ATTACHMENT_OPENING) { - email.setLastAttachmentOpener(user); - } - - email = emailDao.update(email); - getPersistenceContext().commit(); - - return email; - } - - @Override - public Email openEmail(String emailId, FaxToMailUser user, boolean takeEmail) throws FolderNotReadableException { - EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); - Email email = getFullEmailById(emailId, user); - - MailFolder mailFolder = email.getMailFolder(); - if (!mailFolder.isFolderReadable()) { - throw new FolderNotReadableException(String.format("Mail folder %s not readable by %s", - mailFolder.getName(), - user.getLogin()), - mailFolder); - } - - HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao(); - History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.OPENING, - History.PROPERTY_FAX_TO_MAIL_USER, user, - History.PROPERTY_MODIFICATION_DATE, new Date()); - email.addHistory(history); - if (takeEmail) { - history = historyDao.create(History.PROPERTY_TYPE, HistoryType.MODIFICATION, - History.PROPERTY_FAX_TO_MAIL_USER, user, - History.PROPERTY_MODIFICATION_DATE, new Date()); - history.setFields(Sets.newHashSet(Email.PROPERTY_TAKEN_BY)); - email.addHistory(history); - email.setTakenBy(user); - } - - email = emailDao.update(email); - getPersistenceContext().commit(); - return email; - } - - /** - * Vérrouille une demande par un utilisateur empechant les autres de l'ouvrir. - * - * @param emailId topiaId de la demande à vérouiller - * @param currentUser user - * @return email - * @throws AlreadyLockedMailException if email is already locked by another user - */ - @Override - public Email lockEmail(String emailId, FaxToMailUser currentUser) throws AlreadyLockedMailException, - FolderNotReadableException { - - // get current lock on mail if any - EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); - MailLockTopiaDao mailLockDao = getPersistenceContext().getMailLockDao(); - Email email = emailDao.forTopiaIdEquals(emailId).findUnique(); - - MailFolderService mailFolderService = serviceContext.getMailFolderService(); - MailFolder folder = email.getMailFolder(); - browseFolderParent(folder, currentUser, mailFolderService); - - if (!folder.isFolderReadable()) { - throw new FolderNotReadableException(String.format("Mail folder %s not readable by %s", - folder.getName(), - currentUser.getLogin()), - folder); - } - - Hibernate.initialize(email.getTakenBy()); - - MailLock mailLock = mailLockDao.forLockOnEquals(email).findUniqueOrNull(); - - // if no lock found, create new one - if (mailLock == null) { - - // dévérouillage automatique des mails qui ne font pas partit du même group que celui du mail - // qui vient d'être locké - List<MailLock> mailLocksToRemove; - if (email.getEmailGroup() != null) { - // si le mail courant à un group, ont déverrouilles tous les mails - // qui ne porte pas sur le même groupe - mailLocksToRemove = mailLockDao.forLockByEquals(currentUser) - .addNotEquals(MailLock.PROPERTY_LOCK_ON + "." + Email.PROPERTY_EMAIL_GROUP, email.getEmailGroup()).findAll(); - } else { - mailLocksToRemove = mailLockDao.forLockByEquals(currentUser).findAll(); - } - if (log.isDebugEnabled()) { - for (MailLock mailLockToRemove : mailLocksToRemove) { - log.debug("[UNLOCK] " + mailLockToRemove.getLockOn().getTopiaId() + " unlocked (automatic)"); - } - } - mailLockDao.deleteAll(mailLocksToRemove); - - // ajout d'un nouveau lock - mailLock = new MailLockImpl(); - mailLock.setLockBy(currentUser); - mailLock.setLockOn(email); - mailLock = mailLockDao.create(mailLock); - - if (log.isDebugEnabled()) { - log.debug("[LOCK] " + emailId + " locked by " + currentUser.getLogin()); - } - - getPersistenceContext().commit(); - - } else if (!mailLock.getLockBy().equals(currentUser)) { - // throw exception if already locked by another user - throw new AlreadyLockedMailException(String.format("Mail %s already locked by %s", emailId, mailLock.getLockBy().getTopiaId()), mailLock.getLockBy()); - } - - return email; - } - - /** - * Dévérrouille une demande. - * - * @param emailId topiaId de la demande à devérouiller - */ - @Override - public void unlockEmail(String emailId) { - MailLockTopiaDao mailLockDao = getPersistenceContext().getMailLockDao(); - MailLock mailLock = mailLockDao.forAll().addEquals(MailLock.PROPERTY_LOCK_ON + "." + Email.PROPERTY_TOPIA_ID, emailId).findUniqueOrNull(); - // ca peut être null si c'est un emailId qui est valorisé suite à une creation et donc - // qui n'a pas été vérrouillé avant - if (mailLock != null) { - mailLockDao.delete(mailLock); - if (log.isDebugEnabled()) { - log.debug("[UNLOCK] " + emailId + " unlocked"); - } - getPersistenceContext().commit(); - } - } - - /** - * Calcule recursivement l'ensemble des répertoires lisible par un utilisateur récursivement. - * - * @param readMailFolders result mail folders - * @param mailFolders mail folder to allow - */ - protected void computeUserReadableFolder(Set<MailFolder> readMailFolders, Iterable<MailFolder> mailFolders) { - if (mailFolders != null) { - for (MailFolder mailFolder : mailFolders) { - readMailFolders.add(mailFolder); - computeUserReadableFolder(readMailFolders, mailFolder.getChildren()); - } - } - } - - @Override - public PaginationResult<Email> search(SearchFilter emailFilter, FaxToMailUser user, PaginationParameter pagination) { - - // compute rigths - MailFolderTopiaDao mailFolderDao = getPersistenceContext().getMailFolderDao(); - Set<MailFolder> readMailFolders = new HashSet<MailFolder>(); - // read rights for user - Iterable<MailFolder> mailFolders = mailFolderDao.forReadRightUsersContains(user).findAll(); - computeUserReadableFolder(readMailFolders, mailFolders); - // read rigths for groups - if (user.getUserGroups() != null) { - for (FaxToMailUserGroup group : user.getUserGroups()) { - mailFolders = mailFolderDao.forReadRightGroupsContains(group).findAll(); - computeUserReadableFolder(readMailFolders, mailFolders); - } - } - - // compute search - EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); - PaginationResult<Email> result = emailDao.search(emailFilter, readMailFolders, pagination); - return result; - } - - @Override - public Email groupEmails(String email1Id, String email2Id, FaxToMailUser user) { - EmailGroupTopiaDao groupDao = getPersistenceContext().getEmailGroupDao(); - - Email email1 = getFullEmailById(email1Id, user); - Email email2 = getEmailById(email2Id); - - EmailGroup group1 = email1.getEmailGroup(); - EmailGroup group2 = email2.getEmailGroup(); - - // if both groups are null - if (group1 == null && group2 == null) { - EmailGroup group = groupDao.create(EmailGroup.PROPERTY_EMAIL, Sets.newHashSet(email1, email2)); - email1.setEmailGroup(group); - email2.setEmailGroup(group); - - // if only group 1 is null - } else if (group1 == null) { - email1.setEmailGroup(group2); - group2.addEmail(email1); - groupDao.update(group2); - - // if only group 2 is null - } else if (group2 == null) { - email2.setEmailGroup(group1); - group1.addEmail(email2); - groupDao.update(group1); - - // if the groups are equals, do nothing - } else if (group1.equals(group2)) { - return email1; - - // if both groups exist, merge them - } else { - group1.addAllEmail(group2.getEmail()); - email2.setEmailGroup(group1); - group2.clearEmail(); - groupDao.delete(group2); - groupDao.update(group1); - } - - EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); - HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao(); - Date now = new Date(); - - History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.GROUP, - History.PROPERTY_FAX_TO_MAIL_USER, user, - History.PROPERTY_MODIFICATION_DATE, now); - history.setFields(Sets.newHashSet(email2.getObject())); - email1.addHistory(history); - - Email result = emailDao.update(email1); - - History history2 = historyDao.create(History.PROPERTY_TYPE, HistoryType.GROUP, - History.PROPERTY_FAX_TO_MAIL_USER, user, - History.PROPERTY_MODIFICATION_DATE, now); - history2.setFields(Sets.newHashSet(email1.getObject())); - email2.addHistory(history2); - emailDao.update(email2); - - getPersistenceContext().commit(); - - return result; - } - - /** - * Envoi une réponse et retourne l'email. - * - * @param from from - * @param to to - * @param cc cc - * @param bcc bcc - * @param subject subject - * @param content content - * @param attachments attachement - * @param originalEmailId mail topia id - * @param user user to add new history entry for user - * @return modified email - * @throws EmailException if message can't be sent - * @throws MessagingException if message can't be sent - * @throws IOException if message can't be sent - */ - @Override - public Email reply(String from, String to, String cc, String bcc, String subject, - String content, Collection<AttachmentFile> attachments, - String originalEmailId, FaxToMailUser user) throws EmailException, MessagingException, IOException { - - Email email = getEmailById(originalEmailId, - Email.PROPERTY_HISTORY + "." + History.PROPERTY_FAX_TO_MAIL_USER, - Email.PROPERTY_REPLIES); - - final String smtpUser = getApplicationConfig().getSmtpUser(); - final String password = getApplicationConfig().getSmtpPassword(); - final boolean useSsl = getApplicationConfig().isSmtpUseSsl(); - - MultiPartEmail message = new MultiPartEmail(); - message.setHostName(getApplicationConfig().getSmtpHost()); - message.setSmtpPort(getApplicationConfig().getSmtpPort()); - if (StringUtils.isNotBlank(smtpUser) && password != null) { - message.setAuthenticator(new DefaultAuthenticator(smtpUser, password)); - } - message.setSSLOnConnect(useSsl); - - message.setCharset(EmailConstants.UTF_8); - message.setFrom(from); - message.addTo(to); - if (StringUtils.isNotBlank(cc)) { - message.addCc(cc); - } - if (StringUtils.isNotBlank(bcc)) { - message.addBcc(bcc); - } - message.setSubject(subject); - message.setMsg(content); - - for (AttachmentFile attachmentFile : attachments) { - // Create the attachment - File file = attachmentFile.getFile(); - DataSource source = new FileDataSource(file); - message.attach(source, attachmentFile.getFilename(), null); - } - - message.send(); - - ReplyTopiaDao replyTopiaDao = getPersistenceContext().getReplyDao(); - ReplyContentTopiaDao replyContentTopiaDao = getPersistenceContext().getReplyContentDao(); - Date now = new Date(); - - // build mail header part - StringBuilder emailHeaders = new StringBuilder(); - Enumeration<String> headerLines = message.getMimeMessage().getAllHeaderLines(); - while (headerLines.hasMoreElements()) { - String headerLine = headerLines.nextElement(); - emailHeaders.append(headerLine).append("\n"); - } - emailHeaders.append("\n"); // blank line (IMPORTANT) - - // build mail serialization part - ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); - IOUtils.write(emailHeaders, byteOut); - IOUtils.copy(message.getMimeMessage().getInputStream(), byteOut); - - ReplyContent replyContent = replyContentTopiaDao.createByNotNull(byteOut.toByteArray()); - - Reply reply = replyTopiaDao.create(Reply.PROPERTY_REPLY_CONTENT, replyContent, - Reply.PROPERTY_SENT_DATE, now, - Reply.PROPERTY_SUBJECT, subject, - Reply.PROPERTY_SENDER, from, - Reply.PROPERTY_RECIPIENT, to, - Reply.PROPERTY_SENT_BY, user); - - email.addReplies(reply); - - HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao(); - History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.REPLY, - History.PROPERTY_FAX_TO_MAIL_USER, user, - History.PROPERTY_MODIFICATION_DATE, now); - email.addHistory(history); - - email = saveEmail(email, user); - - return email; - } - - @Override - public void transmit(Collection<String> emailIds, MailFolder newFolder, FaxToMailUser currentUser) { - EmailTopiaDao dao = getPersistenceContext().getEmailDao(); - HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao(); - - List<Email> emails = dao.forTopiaIdIn(emailIds).findAll(); - for (Email email : emails) { - email.setDemandStatus(DemandStatus.QUALIFIED); - email.setMailFolder(newFolder); - email.setTakenBy(null); - - History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.TRANSMISSION, - History.PROPERTY_FAX_TO_MAIL_USER, currentUser, - History.PROPERTY_MODIFICATION_DATE, new Date()); - - email.addHistory(history); - } - dao.updateAll(emails); - getPersistenceContext().commit(); - } - - /** - * Save content stream into attachment file content. - * - * @param contentStream content - * @return attachmentFile filled by content - */ - @Override - public AttachmentFile getAttachmentFileFromStream(InputStream contentStream) { - AttachmentFile attachmentFile = new AttachmentFileImpl(); - try { - //Session hibernateSession = getPersistenceContext().getHibernateSupport().getHibernateSession(); - //Blob contentBlob = Hibernate.getLobCreator(hibernateSession).createBlob(contentStream, contentStream.available()); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - IOUtils.copy(contentStream, output); - attachmentFile.setContent(output.toByteArray()); - } catch (Exception ex) { - throw new RuntimeException("Can't save content", ex); - } - return attachmentFile; - } - - @Override - public AttachmentFile getAttachmentFile(String attachmentId, boolean original) { - AttachmentTopiaDao dao = getPersistenceContext().getAttachmentDao(); - Attachment attachment = dao.forTopiaIdEquals(attachmentId).findUnique(); - AttachmentFile result = original ? attachment.getOriginalFile() : attachment.getEditedFile(); - if (result != null) { - // force lazy initialize - Hibernate.initialize(result); - } - return result; - } - - @Override - public ReplyContent getReplyContent(String replyId) { - ReplyTopiaDao dao = getPersistenceContext().getReplyDao(); - Reply reply = dao.forTopiaIdEquals(replyId).findUnique(); - ReplyContent result = reply.getReplyContent(); - // force lazy initialize - Hibernate.initialize(result); - return result; - } - - /** - * Retourne la liste des vérrouillages actifs. - * - * @return email list - */ - @Override - public List<MailLock> getAllMailLocks() { - MailLockTopiaDao mailLockDao = getPersistenceContext().getMailLockDao(); - List<MailLock> result = mailLockDao.findAll(); - return result; - } - - /** - * Dévérrouille les mails specifiés. - * - * @param mailLockIds mail lock ids to unlock - */ - @Override - public void unlockMails(List<String> mailLockIds) { - MailLockTopiaDao mailLockDao = getPersistenceContext().getMailLockDao(); - Collection<MailLock> mailLocks = mailLockDao.forTopiaIdIn(mailLockIds).findAll(); - mailLockDao.deleteAll(mailLocks); - - getPersistenceContext().commit(); - } - - @Override - public void rejectEmail(String from, String to, String subject, String content) - throws EmailException, MessagingException, IOException { - - final String smtpUser = getApplicationConfig().getSmtpUser(); - final String password = getApplicationConfig().getSmtpPassword(); - final boolean useSsl = getApplicationConfig().isSmtpUseSsl(); - - MultiPartEmail message = new MultiPartEmail(); - message.setHostName(getApplicationConfig().getSmtpHost()); - message.setSmtpPort(getApplicationConfig().getSmtpPort()); - if (StringUtils.isNotBlank(smtpUser) && password != null) { - message.setAuthenticator(new DefaultAuthenticator(smtpUser, password)); - } - message.setSSLOnConnect(useSsl); - - message.setCharset(EmailConstants.UTF_8); - message.setFrom(from); - message.addTo(to); - message.setSubject(subject); - message.setMsg(content); - - message.send(); - } - - @Override - public void updateRangeRowsWithEdiReturns() { - final RangeRowTopiaDao rangeRowTopiaDao = getPersistenceContext().getRangeRowDao(); - final EmailTopiaDao emailTopiaDao = getPersistenceContext().getEmailDao(); - - final Set<Email> emailsToUpdate = new HashSet<>(); - - TopiaSqlSupport sqlSupport = getPersistenceContext().getSqlSupport(); - sqlSupport.doSqlWork(new TopiaSqlWork() { - - @Override - public void execute(Connection connection) throws SQLException { - - int importedCount = 0; - - // attention, le sql à pour cible postgresql, mssql, h2, il doit rester simple - String query = String.format("SELECT %s, %s, %s FROM %s", - EdiReturn.PROPERTY_RANGE_ROW_TOPIA_ID, - EdiReturn.PROPERTY_COMMAND_NUMBER, - EdiReturn.PROPERTY_ERROR, - EdiReturn.class.getSimpleName()); - Statement stat = connection.createStatement(); - - // execute query - ResultSet resultSet = stat.executeQuery(query); - while (resultSet.next()) { - - String rangeRowTopiaId = resultSet.getString(EdiReturn.PROPERTY_RANGE_ROW_TOPIA_ID); - String commandNumber = resultSet.getString(EdiReturn.PROPERTY_COMMAND_NUMBER); - String error = resultSet.getString(EdiReturn.PROPERTY_ERROR); - - // manage email and range row - RangeRow rangeRow = rangeRowTopiaDao.forTopiaIdEquals(rangeRowTopiaId).findUniqueOrNull(); - if (rangeRow == null) { - if (log.isErrorEnabled()) { - log.error("Can't find rangeRow " + rangeRowTopiaId + " to update"); - } - continue; - } - Email email = emailTopiaDao.forRangeRowContains(rangeRow).findUniqueOrNull(); - if (email == null) { - if (log.isErrorEnabled()) { - log.error("Can't find email for " + rangeRowTopiaId + " to update"); - } - continue; - } - - if (StringUtils.isNotBlank(error)) { - //error - String oldError = email.getEdiError(); - if (StringUtils.isNotBlank(oldError)) { - error = oldError + ", " + error; - } - email.setEdiError(error); - - } else { - rangeRow.setCommandNumber(commandNumber); - rangeRowTopiaDao.update(rangeRow); - } - - email.setDemandStatus(DemandStatus.IN_PROGRESS); - emailsToUpdate.add(email); - - importedCount++; - } - - // delete all rows - stat = connection.createStatement(); - stat.execute("DELETE FROM " + EdiReturn.class.getSimpleName()); - - // usefull log info (do not remove) - if (importedCount > 0 && log.isInfoEnabled()) { - log.info(String.format("Imported %d ediReturn rows", importedCount)); - } - } - }); - - emailTopiaDao.updateAll(emailsToUpdate); - getPersistenceContext().commit(); - } - - /** - * Generate email details as PDF and return it as an printable attachment. - * - * @param email email - * @return attachment filled with pdf content - */ - @Override - public AttachmentFile getEmailDetailAsAttachment(Email email) { - - AttachmentFile result = null; - - try { - - // get html content - String content = getEmailDetailAsHtml(email); - - // generate pdf - ByteArrayOutputStream out = new ByteArrayOutputStream(); - ITextRenderer renderer = new ITextRenderer(); - renderer.setDocumentFromString(content); - renderer.layout(); - renderer.createPDF(out); - - // create attachent - result = new AttachmentFileImpl(); - result.setContent(out.toByteArray()); - result.setFilename(t("faxtomail.attachment.demand.filename") + ".pdf"); - result.getFile(); - - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("", e); - } - } - return result; - } - - protected String getEmailDetailAsHtml(Email email) { - Decorator<FaxToMailUser> userDecorator = getDecoratorService().getDecoratorByType(FaxToMailUser.class); - - Map<String, Object> scopes = new HashMap<String, Object>(); - - String result = email.getObject(); - String ref = email.getReference(); - if (!ref.isEmpty()) { - result = ref + " - " + result; - } - - scopes.put("title", result); - scopes.put("receivedDate", DateFormatUtils.format(email.getReceptionDate(), "dd/MM/yyyy HH:mm")); - scopes.put("sender", email.getSender()); - scopes.put("object", email.getObject()); - scopes.put("client", email.getClient()); - scopes.put("demandType", email.getDemandType()); - scopes.put("priority", email.getPriority()); - scopes.put("projectReference", email.getProjectReference()); - scopes.put("companyReference", email.getCompanyReference()); - scopes.put("waitingState", email.getWaitingState()); - scopes.put("status", email.getDemandStatus()); - scopes.put("takenBy", email.getTakenBy() == null ? "" : userDecorator.toString(email.getTakenBy())); - scopes.put("message", email.getComment()); - scopes.put("date", DateFormatUtils.format(serviceContext.getNow(), "dd/MM/yyyy HH:mm")); - - scopes.put("firstOpeningUser", email.getFirstOpeningUser() == null ? - "" : userDecorator.toString(email.getFirstOpeningUser())); - scopes.put("firstOpeningDate", email.getFirstOpeningDate() == null ? - "" : DateFormatUtils.format(email.getFirstOpeningDate(), "dd/MM/yyyy HH:mm")); - - scopes.put("lastModificationUser", email.getLastModificationUser() == null ? - "" : userDecorator.toString(email.getLastModificationUser())); - scopes.put("lastModificationDate", email.getLastModificationDate() == null ? - "" : DateFormatUtils.format(email.getLastModificationDate(), "dd/MM/yyyy HH:mm")); - - scopes.put("lastAttachmentOpeningInFolderUser", email.getLastAttachmentOpeningInFolderUser() == null ? - "" : userDecorator.toString(email.getLastAttachmentOpeningInFolderUser())); - scopes.put("lastAttachmentOpeningInFolderDate", email.getLastAttachmentOpeningInFolderDate() == null ? - "" : DateFormatUtils.format(email.getLastAttachmentOpeningInFolderDate(), "dd/MM/yyyy HH:mm")); - - scopes.put("hasRangeRows", email.sizeRangeRow() > 0); - scopes.put("rangeRows", email.getRangeRow()); - - // find template - InputStream is = EmailServiceImpl.class.getResourceAsStream("/pdf/demande.mustache"); - MustacheFactory mf = new DefaultMustacheFactory(); - Mustache mustache = mf.compile(new InputStreamReader(is, StandardCharsets.UTF_8), "demande"); - StringWriter writer = new StringWriter(); - mustache.execute(writer, scopes); - writer.flush(); - - return writer.toString(); - } - - /** - * Compute mail folder path (separated by /) from root to current. - * - * @param folder folder to get path - * @return full mail folder path - */ - protected String getFullMailFolderPath(MailFolder folder) { - StringBuilder sb = new StringBuilder(folder.getName()); - MailFolder loopFolder = folder.getParent(); - while (loopFolder != null) { - sb.insert(0, "/"); - sb.insert(0, loopFolder.getName()); - loopFolder = loopFolder.getParent(); - } - return sb.toString(); - } - - @Override - public void importArchive(InputStream inputStream, File attachmentBase) { - - // all doas involved - EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); - DemandTypeTopiaDao demandTypedao = getPersistenceContext().getDemandTypeDao(); - PriorityTopiaDao priorityDao = getPersistenceContext().getPriorityDao(); - WaitingStateTopiaDao waitingStateDao = getPersistenceContext().getWaitingStateDao(); - MailFolderTopiaDao mailFolderDao = getPersistenceContext().getMailFolderDao(); - AttachmentTopiaDao attachmentDao = getPersistenceContext().getAttachmentDao(); - AttachmentFileTopiaDao attachmentFileDao = getPersistenceContext().getAttachmentFileDao(); - - // get referentiel map - Map<String, DemandType> allDemandTypes = Maps.uniqueIndex(demandTypedao, new Function<DemandType, String>() { - @Override - public String apply(DemandType input) { - return input.getLabel(); - } - }); - Map<String, Priority> allPriority = Maps.uniqueIndex(priorityDao, new Function<Priority, String>() { - @Override - public String apply(Priority input) { - return input.getLabel(); - } - }); - Map<String, WaitingState> allWaitingStates = Maps.uniqueIndex(waitingStateDao, new Function<WaitingState, String>() { - @Override - public String apply(WaitingState input) { - return input.getLabel(); - } - }); - - // build folder map - Map<String, MailFolder> mailFolderMap = Maps.uniqueIndex(mailFolderDao, new Function<MailFolder, String>() { - @Override - public String apply(MailFolder input) { - return getFullMailFolderPath(input); - } - }); - - // run import - ArchiveImportModel archiveImportModel = new ArchiveImportModel(';', allWaitingStates, allDemandTypes, allPriority, mailFolderMap); - Binder<ArchiveImportBean, Email> emailBinder = BinderFactory.newBinder(ArchiveImportBean.class, Email.class); - Import<ArchiveImportBean> importer = null; - try { - importer = Import.newImport(archiveImportModel, new InputStreamReader(inputStream, getApplicationConfig().getImportFileEncoding())); - for (ArchiveImportBean archiveBean : importer) { - - // create new email to persist - Email email = emailDao.newInstance(); - emailBinder.copy(archiveBean, email); - email.setDemandStatus(DemandStatus.ARCHIVED); - - // persist it - email = emailDao.create(email); - - // manage attachments - if (archiveBean.getAttachmentPaths() != null) { - Iterable<String> itAttachmentPaths = Splitter.on(',').omitEmptyStrings().trimResults().split(archiveBean.getAttachmentPaths()); - for (String attachmentPath : itAttachmentPaths) { - File attFile; - if (attachmentBase != null) { - attFile = new File(attachmentBase, attachmentPath); - } else { - attFile = new File(attachmentPath); - } - if (!attFile.isFile()) { - throw new RuntimeException("Missing file " + attFile.getAbsolutePath()); - } - - Attachment attachment = new AttachmentImpl(); - AttachmentFile attachmentFile = new AttachmentFileImpl(); - attachmentFile.setFilename(attFile.getName()); - attachmentFile.setContent(FileUtils.readFileToByteArray(attFile)); - attachmentFile = attachmentFileDao.create(attachmentFile); - attachment.setOriginalFile(attachmentFile); - - attachment = attachmentDao.create(attachment); - email.addAttachment(attachment); - } - - emailDao.update(email); - } - } - - getPersistenceContext().commit(); - - } catch (ImportRuntimeException|IOException e) { - String message; - if (e.getCause() != null) { - message = e.getCause().getMessage(); - } else { - message = e.getMessage(); - } - throw new ApplicationTechnicalException(message, e); - } finally { - IOUtils.closeQuietly(importer); - IOUtils.closeQuietly(inputStream); - } - } - - @Override - public long getArchivedMailCount() { - EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); - long result = emailDao.forDemandStatusEquals(DemandStatus.ARCHIVED).count(); - return result; - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java deleted file mode 100644 index 7b15d40..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.services.FaxToMailService; - -/** - * @author Kevin Morin (Code Lutin) - */ -public interface InitFaxToMailService extends FaxToMailService { - void init(); -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java deleted file mode 100644 index 3e85c54..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java +++ /dev/null @@ -1,465 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.decorator.Decorator; - -import com.franciaflex.faxtomail.persistence.entities.Client; -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.History; -import com.franciaflex.faxtomail.persistence.entities.HistoryTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.HistoryType; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Priority; -import com.franciaflex.faxtomail.persistence.entities.PriorityTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import com.franciaflex.faxtomail.persistence.entities.RangeRowTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.RangeTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.persistence.entities.WaitingStateTopiaDao; -import com.franciaflex.faxtomail.services.DecoratorService; -import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; -import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; -import com.franciaflex.faxtomail.services.service.exceptions.InvalidClientException; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; - -public class InitFaxToMailServiceImpl extends FaxToMailServiceSupport implements InitFaxToMailService { - - private static final Log log = LogFactory.getLog(InitFaxToMailServiceImpl.class); - - @Override - public void init() { - - if (log.isInfoEnabled()) { - log.info("faxtomail initialization started"); - } - - boolean devMode = serviceContext.getApplicationConfig().isDevMode(); - - if (devMode) { - initSampleData(); - } - - // Reset the value stack used, if required, a new will be recreated using the struts ActionContext. - // Need to do it here, if we want to be synched between the struts ActionContext and the value stack. -// XWork2ValidatorUtil.setSharedValueStack(null); - - if (log.isInfoEnabled()) { - log.info("faxtomail initialization done"); - } - - } - - protected void initSampleData() { - log.debug("init Sample Data"); - - DemandTypeTopiaDao demandTypeDao = getPersistenceContext().getDemandTypeDao(); - long count = demandTypeDao.count(); - - if (count == 0) { - - List<DemandType> types = Lists.newArrayList( - demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande", - DemandType.PROPERTY_REQUIRED_FIELDS, EnumSet.of(MailField.RANGE_ROW)), - demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Réponse"), - demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Annulation/Modification"), - demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Diffus"), - demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Chantier"), - demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Gros Chantier"), - demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Réponse/Modification"), - demandTypeDao.create(DemandType.PROPERTY_LABEL, "Réclamation"), - demandTypeDao.create(DemandType.PROPERTY_LABEL, "Autres") - ); - - WaitingStateTopiaDao waitingStateDao = getPersistenceContext().getWaitingStateDao(); - List<WaitingState> waitingStates = Lists.newArrayList( - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "BAT attente retour BAT lettrage-logo"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "CLT attente réponse client"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "DAC attente pour assistance chantier"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "DAV attente analyse avoir"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "EXP attente expertise"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "GAB attente reception gabarit"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "GRA attente accord gratuit"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "ODC attente Ouverture de Compte"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "PPC attente chiffrage BEI PPC"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "PROFORMA attente paiement proforma"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "PROTO attente accord proto"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "REM Attente Remise-accord expo"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "RET attente retour materiel"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "SIGN attente réponse BEI signature"), - waitingStateDao.create(WaitingState.PROPERTY_LABEL, "SPAM") - ); - - PriorityTopiaDao priorityDao = getPersistenceContext().getPriorityDao(); - List<Priority> priorities = Lists.newArrayList( - priorityDao.create(Priority.PROPERTY_LABEL, "!"), - priorityDao.create(Priority.PROPERTY_LABEL, "F") - ); - - RangeTopiaDao rangeDao = getPersistenceContext().getRangeDao(); - List<Range> ranges = Lists.newArrayList( - rangeDao.create(Range.PROPERTY_LABEL, "FFE VR"), - rangeDao.create(Range.PROPERTY_LABEL, "FFE AUTRE"), - rangeDao.create(Range.PROPERTY_LABEL, "FME FX DROIT"), - rangeDao.create(Range.PROPERTY_LABEL, "FME FX CINTRE"), - rangeDao.create(Range.PROPERTY_LABEL, "FME NOEL"), - rangeDao.create(Range.PROPERTY_LABEL, "FSE BANNE"), - rangeDao.create(Range.PROPERTY_LABEL, "FSE ROCH AUTRE"), - rangeDao.create(Range.PROPERTY_LABEL, "FSE CHECY"), - rangeDao.create(Range.PROPERTY_LABEL, "FSI"), - rangeDao.create(Range.PROPERTY_LABEL, "FSI FMI") - ); - - // user groups - FaxToMailUserGroupTopiaDao userGroupDao = getPersistenceContext().getFaxToMailUserGroupDao(); - userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Chargés de clientèle", - FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, "Franciaflex/Chargés de clientèle"); - FaxToMailUserGroup commerciauxGroup = userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Commerciaux", - FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, "Franciaflex/Commerciaux"); - FaxToMailUserGroup savGroup = userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "SAV", - FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, "Franciaflex/SAV"); - userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Administrateurs", - FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, "Franciaflex/Administrateurs"); - - FaxToMailUserTopiaDao userDao = getPersistenceContext().getFaxToMailUserDao(); - FaxToMailUser marc = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Lefèbvre", - FaxToMailUser.PROPERTY_FIRST_NAME, "Marc", - FaxToMailUser.PROPERTY_LOGIN, "mlefebvre", - FaxToMailUser.PROPERTY_TRIGRAPH, "MLE", - FaxToMailUser.PROPERTY_USER_GROUPS, Collections.singletonList(commerciauxGroup)); - FaxToMailUser cyril = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Baillet", - FaxToMailUser.PROPERTY_FIRST_NAME, "Cyril", - FaxToMailUser.PROPERTY_LOGIN, "cbaillet", - FaxToMailUser.PROPERTY_TRIGRAPH, "CBA"); - FaxToMailUser frederic = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Viala", - FaxToMailUser.PROPERTY_FIRST_NAME, "Frédéric", - FaxToMailUser.PROPERTY_LOGIN, "fviala", - FaxToMailUser.PROPERTY_TRIGRAPH, "FVI", - FaxToMailUser.PROPERTY_USER_GROUPS, Collections.singletonList(commerciauxGroup)); - FaxToMailUser claire = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Marquis", - FaxToMailUser.PROPERTY_FIRST_NAME, "Claire", - FaxToMailUser.PROPERTY_LOGIN, "cmarquis", - FaxToMailUser.PROPERTY_TRIGRAPH, "CMA"); - FaxToMailUser agathe = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Borde", - FaxToMailUser.PROPERTY_FIRST_NAME, "Agathe", - FaxToMailUser.PROPERTY_LOGIN, "aborde", - FaxToMailUser.PROPERTY_TRIGRAPH, "ABO", - FaxToMailUser.PROPERTY_USER_GROUPS, Collections.singletonList(savGroup)); - FaxToMailUser jeanne = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Bourgoin", - FaxToMailUser.PROPERTY_FIRST_NAME, "Jeanne", - FaxToMailUser.PROPERTY_LOGIN, "jbourgoin", - FaxToMailUser.PROPERTY_TRIGRAPH, "JBO", - FaxToMailUser.PROPERTY_USER_GROUPS, Collections.singletonList(commerciauxGroup)); - - MailFolderTopiaDao folderDao = getPersistenceContext().getMailFolderDao(); - Map<String, MailFolder> folders = new HashMap<>(); - - // fixme seed to be used in test - Random random = new Random(1234); - EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); - HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao(); - RangeRowTopiaDao rangeRowDao = getPersistenceContext().getRangeRowDao(); - - int waitingStateSize = waitingStates.size(); - - // root folders (~companies) - MailFolder franciaflex = folderDao.create(MailFolder.PROPERTY_NAME, "Franciaflex", - MailFolder.PROPERTY_USE_CURRENT_LEVEL_REJECT_RESPONSE_MAIL_ADDRESS, true, - MailFolder.PROPERTY_USE_CURRENT_LEVEL_REJECT_RESPONSE_MESSAGE, true); - MailFolder faber = folderDao.create(MailFolder.PROPERTY_NAME, "Faber"); - MailFolder franceFermeture = folderDao.create(MailFolder.PROPERTY_NAME, "France-fermeture"); - - // categories - MailFolder chargesClientelle = folderDao.create(MailFolder.PROPERTY_NAME, "Chargés de clientèle", - MailFolder.PROPERTY_PARENT, franciaflex, - MailFolder.PROPERTY_REPLY_ADDRESSES, Lists.newArrayList("no-reply@franciaflex.com")); - franciaflex.addChildren(chargesClientelle); - folders.put("Chargés de clientèle", chargesClientelle); - - Collections.shuffle(waitingStates); - MailFolder sav = folderDao.create(MailFolder.PROPERTY_NAME, "SAV", - MailFolder.PROPERTY_PARENT, franciaflex, - MailFolder.PROPERTY_WAITING_STATES, waitingStates.subList(0, random.nextInt(waitingStateSize - 8) + 2), - MailFolder.PROPERTY_USE_CURRENT_LEVEL_WAITING_STATE, true); - franciaflex.addChildren(sav); - folders.put("SAV", sav); - - // user folders - Collections.shuffle(waitingStates); - MailFolder cyrilFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Cyril", - MailFolder.PROPERTY_PARENT, chargesClientelle, - MailFolder.PROPERTY_WAITING_STATES, waitingStates.subList(0, random.nextInt(waitingStateSize - 8) + 2), - MailFolder.PROPERTY_USE_CURRENT_LEVEL_WAITING_STATE, true); - chargesClientelle.addChildren(cyrilFolder); - folders.put("Cyril", cyrilFolder); - - MailFolder claireFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Claire", - MailFolder.PROPERTY_PARENT, chargesClientelle); - chargesClientelle.addChildren(claireFolder); - folders.put("Claire", claireFolder); - - Collections.shuffle(waitingStates); - MailFolder agatheFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Agathe", - MailFolder.PROPERTY_PARENT, chargesClientelle, - MailFolder.PROPERTY_WAITING_STATES, waitingStates.subList(0, random.nextInt(waitingStateSize - 8) + 2), - MailFolder.PROPERTY_USE_CURRENT_LEVEL_WAITING_STATE, true); - chargesClientelle.addChildren(agatheFolder); - folders.put("Agathe", agatheFolder); - - MailFolder marcFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Marc", - MailFolder.PROPERTY_PARENT, sav); - sav.addChildren(marcFolder); - folders.put("Marc", marcFolder); - - MailFolder fredericFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Frédéric", - MailFolder.PROPERTY_PARENT, sav); - sav.addChildren(fredericFolder); - folders.put("Frédéric", fredericFolder); - - MailFolder jeanneFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Jeanne", - MailFolder.PROPERTY_PARENT, sav); - sav.addChildren(jeanneFolder); - folders.put("Jeanne", jeanneFolder); - - // email accounts - File demoDirectory = getApplicationConfig().getDemoDirectory(); - File emailAcountFile = new File(demoDirectory, "email_accounts.csv"); - try { - InputStream emailAccountsPropertiesStream = new FileInputStream(emailAcountFile); - if (emailAccountsPropertiesStream != null) { - getReferentielService().importEmailAccounts(emailAccountsPropertiesStream); - } - - } catch(Exception e) { - log.error("error getting the email accounts", e); - } - - // email filters - File emailFilterFile = new File(demoDirectory, "email_filters.csv"); - try { - InputStream emailFiltersPropertiesStream = new FileInputStream(emailFilterFile); - if (emailFiltersPropertiesStream != null) { - getReferentielService().importEmailFilters(emailFiltersPropertiesStream, folders); - } - - } catch(Exception e) { - log.error("error getting the email filters", e); - } - - // clients and emails - File clientFile = new File(demoDirectory, "fx_clients.csv"); - try { - InputStream fxClientsStream = new FileInputStream(clientFile); - if (fxClientsStream != null) { - List<Client> clients = getReferentielService().importClients(fxClientsStream); - - createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, cyrilFolder, cyril); - createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, claireFolder, claire); - createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, agatheFolder, agathe); - createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, marcFolder, marc); - createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, fredericFolder, frederic); - createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, jeanneFolder, jeanne); - } - - } catch(Exception e) { - log.error("error getting the client file", e); - } - - getPersistenceContext().commit(); - } - } - - protected void createEmails(Random random, HistoryTopiaDao historyDao, RangeRowTopiaDao rangeRowDao, EmailTopiaDao emailDao, - List<Range> ranges, List<Client> clients, List<DemandType> types, List<Priority> priorities, - MailFolder folder, FaxToMailUser user) throws InvalidClientException { - int r = random.nextInt(100) + 50; - for (int i = 0 ; i < r ; i++) { - createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, folder, user); - } - } - - protected void createEmail(Random random, - HistoryTopiaDao historyDao, - RangeRowTopiaDao rangeRowDao, - EmailTopiaDao emailDao, - List<Range> ranges, - List<Client> clients, - List<DemandType> types, - List<Priority> priorities, - MailFolder folder, - FaxToMailUser user) throws InvalidClientException { - - List<RangeRow> rangeRows = new ArrayList<>(); - - Client client = clients.get(random.nextInt(clients.size())); - boolean fax = false; - List<String> senders = client.getEmailAddresses(); - List<String> faxNumbers = client.getFaxNumbers(); - if (CollectionUtils.isEmpty(senders) && CollectionUtils.isNotEmpty(faxNumbers)) { - senders = Collections.singletonList(client.getFaxNumbers().get(0)); - fax = true; - } - String sender = null; - if (CollectionUtils.isNotEmpty(senders)) { - sender = senders.get(0); - } - String faxNumber = null; - if (CollectionUtils.isNotEmpty(faxNumbers)) { - faxNumber = faxNumbers.get(0); - } - - boolean opened = random.nextBoolean(); - - Decorator<Date> dateDecorator = getDecoratorService().getDecoratorByType(Date.class, DecoratorService.DATE); - - Date now = new Date(); - History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.CREATION, - History.PROPERTY_MODIFICATION_DATE, now); - history.setFields(Sets.newHashSet(Email.PROPERTY_SENDER, - Email.PROPERTY_CLIENT, - Email.PROPERTY_PROJECT_REFERENCE, - Email.PROPERTY_OBJECT, - Email.PROPERTY_RECEPTION_DATE, - Email.PROPERTY_MAIL_FOLDER, - Email.PROPERTY_DEMAND_STATUS)); - String projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(now)); - - Email email = emailDao.create(Email.PROPERTY_SENDER, sender, - Email.PROPERTY_FAX, fax, - Email.PROPERTY_CLIENT, client, - Email.PROPERTY_PROJECT_REFERENCE, projectRef, - Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + faxNumber + " / " + dateDecorator.toString(now), - Email.PROPERTY_RECEPTION_DATE, now, - Email.PROPERTY_MAIL_FOLDER, folder, - Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED, - Email.PROPERTY_HISTORY, Lists.newArrayList(history), - Email.PROPERTY_ORIGINAL_EMAIL, "Demo data"); - - - if (opened) { - - getEmailService().addToHistory(email.getTopiaId(), HistoryType.OPENING, user, now); - DemandType demandType = types.get(random.nextInt(types.size())); - if (FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.RANGE_ROW)) { - for (int j = 0; j < random.nextInt(4) + 1; j++) { - RangeRow rangeRow = rangeRowDao.create(RangeRow.PROPERTY_RANGE, ranges.get(random.nextInt(ranges.size())), - RangeRow.PROPERTY_COMMAND_NUMBER, RandomStringUtils.randomNumeric(6), - RangeRow.PROPERTY_PRODUCT_QUANTITY, random.nextInt(100), - RangeRow.PROPERTY_SAV_QUANTITY, random.nextInt(100)); - rangeRows.add(rangeRow); - } - email.setRangeRow(rangeRows); - } - - email.setDemandType(demandType); - email.setPriority(priorities.get(random.nextInt(priorities.size()))); - email.setRangeRow(rangeRows); - getEmailService().saveEmail(email, user, - Email.PROPERTY_DEMAND_TYPE, Email.PROPERTY_PRIORITY, Email.PROPERTY_RANGE_ROW); - } - - Calendar cal = Calendar.getInstance(); - cal.add(Calendar.DAY_OF_MONTH, -1); - Date yesterday = cal.getTime(); - history = historyDao.create(History.PROPERTY_TYPE, HistoryType.CREATION, - History.PROPERTY_MODIFICATION_DATE, yesterday); - history.setFields(Sets.newHashSet(Email.PROPERTY_SENDER, - Email.PROPERTY_CLIENT, - Email.PROPERTY_PROJECT_REFERENCE, - Email.PROPERTY_OBJECT, - Email.PROPERTY_RECEPTION_DATE, - Email.PROPERTY_MAIL_FOLDER, - Email.PROPERTY_DEMAND_STATUS)); - projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(yesterday)); - - email = emailDao.create(Email.PROPERTY_SENDER, sender, - Email.PROPERTY_FAX, fax, - Email.PROPERTY_CLIENT, client, - Email.PROPERTY_PROJECT_REFERENCE, projectRef, - Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + faxNumber + " / " + dateDecorator.toString(yesterday), - Email.PROPERTY_RECEPTION_DATE, yesterday, - Email.PROPERTY_MAIL_FOLDER, folder, - Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED, - Email.PROPERTY_HISTORY, Lists.newArrayList(history), - Email.PROPERTY_ORIGINAL_EMAIL, "Demo data"); - - - if (opened) { - getEmailService().addToHistory(email.getTopiaId(), HistoryType.OPENING, user, now); - DemandType demandType = types.get(random.nextInt(types.size())); - if (FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.RANGE_ROW)) { - for (int j = 0; j < random.nextInt(4) + 1; j++) { - RangeRow rangeRow = rangeRowDao.create(RangeRow.PROPERTY_RANGE, ranges.get(random.nextInt(ranges.size())), - RangeRow.PROPERTY_COMMAND_NUMBER, RandomStringUtils.randomNumeric(6), - RangeRow.PROPERTY_PRODUCT_QUANTITY, random.nextInt(100), - RangeRow.PROPERTY_SAV_QUANTITY, random.nextInt(100)); - rangeRows.add(rangeRow); - } - email.setRangeRow(rangeRows); - - if (random.nextBoolean()) { - email.setEdiError("error 42"); - } - } - email.setDemandType(demandType); - email.setPriority(priorities.get(random.nextInt(priorities.size()))); - email.setRangeRow(rangeRows); - getEmailService().saveEmail(email, null, null, email.getClient().getCode(), user, - Email.PROPERTY_DEMAND_TYPE, Email.PROPERTY_PRIORITY, Email.PROPERTY_RANGE_ROW); - } - } - -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java deleted file mode 100644 index e49cbc1..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.services.FaxToMailService; -import com.franciaflex.faxtomail.services.service.ldap.AuthenticationException; - -/** - * @author Kevin Morin (Code Lutin) - */ -public interface LdapService extends FaxToMailService { - void updateLdapData(); - - FaxToMailUser getUserBean(String userTopiaId); - - FaxToMailUser authenticateUser(String login, String password) throws AuthenticationException; - - FaxToMailUser getUserFromPrincipal(String login) throws AuthenticationException; -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java deleted file mode 100644 index 826e2ad..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java +++ /dev/null @@ -1,395 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserImpl; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; -import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; -import com.franciaflex.faxtomail.services.service.ldap.AuthenticationException; -import com.unboundid.ldap.sdk.LDAPConnection; -import com.unboundid.ldap.sdk.LDAPException; -import com.unboundid.ldap.sdk.SearchResult; -import com.unboundid.ldap.sdk.SearchResultEntry; -import com.unboundid.ldap.sdk.SearchScope; - -public class LdapServiceImpl extends FaxToMailServiceSupport implements LdapService { - - private static final Log log = LogFactory.getLog(LdapServiceImpl.class); - - /** - * Update all user and group from ldap. - */ - @Override - public void updateLdapData() { - - LDAPConnection connection = null; - try { - connection = new LDAPConnection(getApplicationConfig().getLdapHost(), - getApplicationConfig().getLdapPort(), - getApplicationConfig().getLdapUser(), - getApplicationConfig().getLdapPassword()); - if (connection.isConnected()) { - - FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao(); - FaxToMailUserGroupTopiaDao faxtomailUserGroupDao = getPersistenceContext().getFaxToMailUserGroupDao(); - - // cache group DN > faxtomail user group instance - Map<String, FaxToMailUserGroup> groupCache = new HashMap<>(); - // cache user DN > faxtomail user instance - Map<String, FaxToMailUser> userCache = new HashMap<>(); - - // get all groups - String groupsBaseDN = "OU=Mac-Groupe,DC=mac-groupe,DC=net"; - String groupsFilter = "(objectCategory=CN=Group,CN=Schema,CN=Configuration,DC=mac-groupe,DC=net)"; - SearchResult groupsResult = connection.search(groupsBaseDN, SearchScope.SUB, groupsFilter); - List<SearchResultEntry> groupEntries = groupsResult.getSearchEntries(); - for (SearchResultEntry groupEntry : groupEntries) { - String groupDN = groupEntry.getDN(); - String groupPath = getGroupCompleteName(groupDN); - String groupName = StringUtils.substringAfterLast(groupPath, "/"); - FaxToMailUserGroup userGroup = faxtomailUserGroupDao.forNameEquals(groupName).findUniqueOrNull(); - if (userGroup == null) { - userGroup = faxtomailUserGroupDao.create( - FaxToMailUserGroup.PROPERTY_NAME, groupName, - FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, groupPath); - } - groupCache.put(groupDN, userGroup); - } - - // get all users ( - String usersBaseDN = "OU=Mac-Groupe,DC=mac-groupe,DC=net"; - String usersFilter = "(objectCategory=CN=Person,CN=Schema,CN=Configuration,DC=mac-groupe,DC=net)"; - // on recupere d'abord les organisationUnit pour fractionner les requettes - // sinon au dela de 1000 resultats ca veux plus - SearchResult usersResult = connection.search(usersBaseDN, SearchScope.SUB, "(objectClass=organizationalUnit)"); - List<SearchResultEntry> unitEntries = usersResult.getSearchEntries(); - for (SearchResultEntry unitEntry : unitEntries) { - if (log.isDebugEnabled()) { - log.debug("Search for unit " + unitEntry.getDN()); - } - SearchResult userResult = connection.search(unitEntry.getDN(), SearchScope.ONE, usersFilter); - - List<SearchResultEntry> userEntries = userResult.getSearchEntries(); - for (SearchResultEntry userEntry : userEntries) { - - String login = userEntry.getAttributeValue("sAMAccountName"); - String userDN = userEntry.getDN(); - if (login == null) { - if (log.isWarnEnabled()) { - log.warn("Null sAMAccountName for DN " + userDN); - } - } else { - login = login.toLowerCase(); - FaxToMailUser user = updateUserFormLdap(connection, userEntry, login, groupCache); - userCache.put(userDN, user); - } - } - } - - // make remaining user and groups in database as 'hidden' - Collection<FaxToMailUser> usersToHide = faxtomailUserDao.forNotIn(userCache.values()); - for (FaxToMailUser userToHide : usersToHide) { - userToHide.setHidden(true); - faxtomailUserDao.update(userToHide); - } - Collection<FaxToMailUserGroup> userGroupsToHide = faxtomailUserGroupDao.forNotIn(groupCache.values()); - for (FaxToMailUserGroup userGroupToHide : userGroupsToHide) { - userGroupToHide.setHidden(true); - faxtomailUserGroupDao.update(userGroupToHide); - } - getPersistenceContext().commit(); - } - - } catch (LDAPException ex) { - throw new RuntimeException("Can't connect to ldap", ex); - } finally { - if (connection != null) { - connection.close(); - } - } - } - - /** - * Transform group CN to group path. - * - * Example: - * CN=Tout Franciaflex,OU=Listes de distribution,OU=Comptes Spéciaux,OU=Mac-Groupe,DC=mac-groupe,DC=net - * net/mac-groupe/Mac-Groupe/Comptes Spéciaux/Listes de distribution/Tout Franciaflex - * - * @param groupCN - * @return - */ - protected String getGroupCompleteName(String groupCN) { - String[] parts = groupCN.split(","); - ArrayUtils.reverse(parts); - - // join tab - String separator = ""; - StringBuilder result = new StringBuilder(); - for (String part : parts) { - result.append(separator); - result.append(StringUtils.substringAfter(part, "=")); - separator = "/"; - } - return result.toString(); - } - - /** - * Return user for given user id. - * - * @param userTopiaId userTopiaId - * @return user bean (without password) - */ - @Override - public FaxToMailUser getUserBean(String userTopiaId) { - FaxToMailUser result = null; - - FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao(); - FaxToMailUser user = faxtomailUserDao.forTopiaIdEquals(userTopiaId).findUniqueOrNull(); - if (user != null) { - Binder<FaxToMailUser, FaxToMailUser> faxToMailUserBinder = BinderFactory.newBinder(FaxToMailUser.class); - result = new FaxToMailUserImpl(); - faxToMailUserBinder.copyExcluding(user, result); - } - return result; - } - - /** - * Authenticate and update ldap user. - * - * @param login login - * @param password password - * @return authenticated user - * @throws AuthenticationException if authentication fails - */ - @Override - public FaxToMailUser authenticateUser(String login, String password) throws AuthenticationException { - - FaxToMailUser result; - - login = login.toLowerCase(); - try { - // first connexion to get full user login - LDAPConnection adminConnect = new LDAPConnection(); - adminConnect.connect(getApplicationConfig().getLdapHost(), getApplicationConfig().getLdapPort()); - adminConnect.bind(getApplicationConfig().getLdapUser(), getApplicationConfig().getLdapPassword()); - - // search user in ldap - String userDN = null; - SearchResultEntry searchEntry = null; - if (adminConnect.isConnected()) { - // sn est le login interne à franciaflex - String filter = String.format("(sAMAccountName=%s)", login); - SearchResult searchResult = adminConnect.search(getApplicationConfig().getLdapBaseDn(), SearchScope.SUB, filter); - if (!searchResult.getSearchEntries().isEmpty()) { - searchEntry = searchResult.getSearchEntries().get(0); - userDN = searchEntry.getDN(); - } - } - - if (searchEntry != null) { - // ouvre une connexion avec l'identification de l'utilisateur qui essaye de se connecter - // à l'application (ca permet de vérifier l'authentification) - LDAPConnection userConnect = new LDAPConnection(); - userConnect.connect(getApplicationConfig().getLdapHost(), getApplicationConfig().getLdapPort()); - userConnect.bind(userDN, password); - - if (userConnect.isConnected()) { - // update in database - result = updateUserFormLdap(adminConnect, searchEntry, login, null); - getPersistenceContext().commit(); - - userConnect.close(); - } else { - throw new AuthenticationException("Not connected"); - } - } else { - throw new AuthenticationException("Utilisateur inconnu : " + login); - } - adminConnect.close(); - - } catch (LDAPException ex) { - if (log.isWarnEnabled()) { - log.warn("Can't login to ldap", ex); - } - throw new AuthenticationException(ex.getResultCode().getName(), ex); - } - return result; - } - - /** - * Retreive user from principal and updated user database instance. - * - * This method doesn't require any password. - * - * @param login user principal (without domain) - * @return user instance - * @throws AuthenticationException is user can't be found in ldap - */ - @Override - public FaxToMailUser getUserFromPrincipal(String login) throws AuthenticationException { - - FaxToMailUser result; - - login = login.toLowerCase(); - - try { - // first connexion to get full user login - LDAPConnection adminConnect = new LDAPConnection(); - adminConnect.connect(getApplicationConfig().getLdapHost(), getApplicationConfig().getLdapPort()); - adminConnect.bind(getApplicationConfig().getLdapUser(), getApplicationConfig().getLdapPassword()); - - // search user in ldap - SearchResultEntry searchEntry = null; - if (adminConnect.isConnected()) { - // sAMAccountName est l'identifiant kerberos - String filter = String.format("(sAMAccountName=%s)", login); - SearchResult searchResult = adminConnect.search(getApplicationConfig().getLdapBaseDn(), SearchScope.SUB, filter); - if (!searchResult.getSearchEntries().isEmpty()) { - searchEntry = searchResult.getSearchEntries().get(0); - } - - } else { - throw new AuthenticationException("Utilisateur inconnu : " + login); - } - - if( searchEntry != null ) { - // update in database - result = updateUserFormLdap(adminConnect, searchEntry, login, null); - getPersistenceContext().commit(); - } else { - throw new AuthenticationException("Utilisateur inconnu : " + login); - } - - adminConnect.close(); - } catch (LDAPException ex) { - if (log.isWarnEnabled()) { - log.warn("Can't login to ldap", ex); - } - throw new AuthenticationException(ex.getResultCode().getName(), ex); - } - return result; - } - - /** - * Update user (or create) in database from ldap search result entry. - * - * @param adminConnect admin connection used to load groups content - * @param searchEntry entry containing data - * @param login login - * @param groupCache group cache when mass update (can be null) - * @return updated user - * @throws LDAPException - */ - protected FaxToMailUser updateUserFormLdap(LDAPConnection adminConnect, SearchResultEntry searchEntry, String login, Map<String, FaxToMailUserGroup> groupCache) throws LDAPException { - - FaxToMailUser user; - - // create or - FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao(); - FaxToMailUserGroupTopiaDao faxtomailUserGroupDao = getPersistenceContext().getFaxToMailUserGroupDao(); - user = faxtomailUserDao.forLoginEquals(login).findUniqueOrNull(); - - if (user == null) { - user = new FaxToMailUserImpl(); - user.setLogin(login); - } - user.setHidden(false); - - // update other ldap fields - String fullName = searchEntry.getAttributeValue("name"); - if (fullName.indexOf(' ') != -1) { - String lastName = fullName.substring(0, fullName.indexOf(' ')); - String firstName = fullName.substring(fullName.indexOf(' ') + 1); - user.setFirstName(firstName); - user.setLastName(lastName); - } else { - user.setFirstName(""); - user.setLastName(fullName); - } - - String trigraph = searchEntry.getAttributeValue("sAMAccountName"); - user.setTrigraph(StringUtils.upperCase(trigraph)); - - // manage user groups - user.clearUserGroups(); - String[] groups = searchEntry.getAttributeValues("memberOf"); - if (ArrayUtils.isNotEmpty(groups)) { - for (String group : groups) { - - // en mass-update, on a le cache - if (groupCache != null) { - FaxToMailUserGroup userGroup = groupCache.get(group); - if (userGroup != null) { - user.addUserGroups(userGroup); - } - } else { - // parmis tous les groupes, on n'utilise que ceux qui sont de la catégories - // CN=Group,CN=Schema,CN=Configuration,DC=mac-groupe,DC=net - SearchResultEntry groupSearchEntry = adminConnect.getEntry(group); - String objectCategory = groupSearchEntry.getAttributeValue("objectCategory"); - if ("CN=Group,CN=Schema,CN=Configuration,DC=mac-groupe,DC=net".equals(objectCategory)) { - String groupPath = getGroupCompleteName(group); - String groupName = StringUtils.substringAfterLast(groupPath, "/"); - FaxToMailUserGroup userGroup = faxtomailUserGroupDao.forNameEquals(groupName).findUniqueOrNull(); - if (userGroup == null) { - userGroup = faxtomailUserGroupDao.create( - FaxToMailUserGroup.PROPERTY_NAME, groupName, - FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, groupPath); - } - user.addUserGroups(userGroup); - } - } - } - } - - if (user.isPersisted()) { - user = faxtomailUserDao.update(user); - } else { - user = faxtomailUserDao.create(user); - } - - // force collection loading to force non lazy collections - user.isAffectedFoldersEmpty(); - user.isUserGroupsEmpty(); - - return user; - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java deleted file mode 100644 index 8dd2448..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailFilter; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.services.FaxToMailService; - -/** - * @author Kevin Morin (Code Lutin) - */ -public interface MailFolderService extends FaxToMailService { - MailFolder getFolderForRecipient(String recipient); - - Collection<MailFilter> getFiltersForRecipient(String recipient); - - List<MailFolder> getAllMailFolders(); - - List<MailFolder> getRootMailFolders(); - - void fetchFolderAttributes(MailFolder folder); - - List<MailFolder> getRootMailFoldersWithReadingRights(FaxToMailUser user); - - List<MailFolder> getRootMailFoldersWithMoveRights(FaxToMailUser user); - - List<MailFolder> getMailFolders(Collection<String> ids); - - Collection<MailFolder> getFoldersWithWaitingState(Set<WaitingState> waitingStates); - - Map<String, Long> getMailFoldersUsage(); - - MailFolder getFolderForFaxToMailUser(FaxToMailUser customerResponsible); - - MailFolder getMailFolder(String topiaId); -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java deleted file mode 100644 index 19d58a7..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java +++ /dev/null @@ -1,328 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.collections4.CollectionUtils; -import org.hibernate.Hibernate; -import org.nuiton.util.pagination.PaginationParameter; - -import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailFilter; -import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; - -/** - * @author kmorin - kmorin@codelutin.com - */ -public class MailFolderServiceImpl extends FaxToMailServiceSupport implements MailFolderService { - - @Override - public MailFolder getFolderForRecipient(String recipient) { - MailFilterTopiaDao filterTopiaDao = getPersistenceContext().getMailFilterDao(); - - PaginationParameter tpb = PaginationParameter.of(0, -1, MailFilter.PROPERTY_POSITION, false); - - String query = "FROM " + MailFilter.class.getCanonicalName() + " WHERE :recipient LIKE " + MailFilter.PROPERTY_EXPRESSION; - Map<String, Object> params = new HashMap<>(); - params.put("recipient", recipient); - - Collection<MailFilter> filters = filterTopiaDao.find(query, params, tpb); - MailFolder result; - if (CollectionUtils.isNotEmpty(filters)) { - result = filters.iterator().next().getMailFolder(); - } else { - result = null; - } - return result; - } - - @Override - public Collection<MailFilter> getFiltersForRecipient(String recipient) { - MailFilterTopiaDao filterTopiaDao = getPersistenceContext().getMailFilterDao(); - - PaginationParameter tpb = PaginationParameter.of(0, -1, MailFilter.PROPERTY_POSITION, false); - - String query = "FROM " + MailFilter.class.getCanonicalName() + " WHERE :recipient LIKE " + MailFilter.PROPERTY_EXPRESSION; - Map<String, Object> params = new HashMap<>(); - params.put("recipient", recipient); - - Collection<MailFilter> filters = filterTopiaDao.find(query, params, tpb); - return filters; - } - - @Override - public List<MailFolder> getAllMailFolders() { - MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); - return new ArrayList<MailFolder>(dao.findAll()); - } - - @Override - public List<MailFolder> getRootMailFolders() { - MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); - List<MailFolder> result = dao.forParentEquals(null).findAll(); - return result; - } - - @Override - public List<MailFolder> getRootMailFoldersWithReadingRights(FaxToMailUser user) { - FaxToMailUser upToDateUser = serviceContext.getUserService().getUser(user.getTopiaId()); - user.setAffectedFolders(upToDateUser.getAffectedFolders()); - - MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); - - List<MailFolder> folders = new ArrayList<>(dao.getReadableFolders(user)); - // copy the list to be able to remove the folders whose parent is already in the list - List<MailFolder> result = new ArrayList<>(folders); - - for (MailFolder folder : folders) { - MailFolder f = folder; - while (f.getParent() != null) { - f = f.getParent(); - - // if the parent is already in the readable roots, remove the current folder from the roots - if (result.contains(f)) { - result.remove(folder); - folder = null; - break; - } - - Hibernate.initialize(f); - f.setFolderReadable(false); - f.setFolderWritable(false); - - fetchFolderAttributes(f); - } - - if (folder != null) { - browseReadableFolders(folder, result, user, false); - } - } - return result; - } - - protected void browseReadableFolders(MailFolder folder, List<MailFolder> readableRoots, FaxToMailUser user, boolean writable) { - folder.setFolderReadable(true); - - if (!writable && folder.sizeWriteRightGroups() > 0) { - writable = CollectionUtils.containsAny(folder.getWriteRightGroups(), user.getUserGroups()); - } - if (!writable && folder.sizeWriteRightUsers() > 0) { - writable = folder.containsWriteRightUsers(user); - } - folder.setFolderWritable(writable); - - if (folder.isChildrenNotEmpty()) { - for (MailFolder child : folder.getChildren()) { - browseReadableFolders(child, readableRoots, user, writable); - } - } - - fetchFolderAttributes(folder); - - } - - @Override - public List<MailFolder> getRootMailFoldersWithMoveRights(FaxToMailUser user) { - MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); - - List<MailFolder> folders = new ArrayList<>(dao.getMoveableFolders(user)); - // copy the list to be able to remove the folders whose parent is already in the list - List<MailFolder> result = new ArrayList<>(folders); - - for (MailFolder folder : folders) { - MailFolder f = folder; - Boolean allowMoveDemandIntoFolder = folder.getAllowMoveDemandIntoFolder(); - while (f.getParent() != null) { - f = f.getParent(); - - // if the parent is already in the moveable roots, remove the current folder from the roots - if (result.contains(f)) { - result.remove(folder); - folder = null; - break; - } - - fetchFolderAttributes(f); - - if (allowMoveDemandIntoFolder == null) { - allowMoveDemandIntoFolder = f.getAllowMoveDemandIntoFolder(); - } - } - - if (folder != null) { - browseMoveableFolders(folder, result, allowMoveDemandIntoFolder); - } - } - return result; - } - - protected void browseMoveableFolders(MailFolder folder, List<MailFolder> readableRoots, boolean inheritedAllowMoveDemandIntoFolder) { - Boolean allowMoveDemandIntoFolder = folder.getAllowMoveDemandIntoFolder(); - if (allowMoveDemandIntoFolder == null) { - allowMoveDemandIntoFolder = inheritedAllowMoveDemandIntoFolder; - } else { - inheritedAllowMoveDemandIntoFolder = allowMoveDemandIntoFolder; - } - folder.setFolderMoveable(allowMoveDemandIntoFolder); - - if (folder.isChildrenNotEmpty()) { - for (MailFolder child : folder.getChildren()) { - // if the child is in the moveable roots, remove it to merge the branches - if (!readableRoots.remove(child)) { - browseMoveableFolders(child, readableRoots, inheritedAllowMoveDemandIntoFolder); - } - } - } - - fetchFolderAttributes(folder); - } - - protected void findMoveFolders(MailFolder folder, FaxToMailUser user, List<MailFolder> folders) { - if (folder.containsMoveRightUsers(user) - || !CollectionUtils.intersection(folder.getMoveRightGroups(), user.getUserGroups()).isEmpty()) { - folders.add(folder); - - } else if (folder.isChildrenNotEmpty()) { - for (MailFolder child : folder.getChildren()) { - findMoveFolders(child, user, folders); - } - } - } - - @Override - public void fetchFolderAttributes(MailFolder folder) { - Hibernate.initialize(folder.getFolderTableColumns()); - Hibernate.initialize(folder.getRanges()); - Hibernate.initialize(folder.getReplyAddresses()); - Hibernate.initialize(folder.getReplyDomains()); - - if (folder.sizeWaitingStates() > 0) { - for (WaitingState waitingState : folder.getWaitingStates()) { - Hibernate.initialize(waitingState.getInvalidFormDisabledActions()); - Hibernate.initialize(waitingState.getValidFormDisabledActions()); - } - } - - Hibernate.initialize(folder.getDemandTypes()); - } - - @Override - public List<MailFolder> getMailFolders(Collection<String> ids) { - MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); - return new ArrayList<MailFolder>(dao.forTopiaIdIn(ids).findAll()); - } - - /** - * Retourne les dossiers qui ont l'ensemble des etats d'attente compatible avec ceux en argument. - */ - @Override - public Set<MailFolder> getFoldersWithWaitingState(Set<WaitingState> requiredWaitingStates) { - Set<MailFolder> result = new HashSet<>(); - - MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); - List<MailFolder> roots = dao.forParentEquals(null).findAll(); - - for (MailFolder root : roots) { - Collection<MailFolder> mailFolders = getFoldersWithWaitingState(root, new HashSet<WaitingState>(), requiredWaitingStates); - result.addAll(mailFolders); - } - - return result; - } - - protected Collection<MailFolder> getFoldersWithWaitingState(MailFolder folder, - Collection<WaitingState> parentWaitingState, - Set<WaitingState> requiredWaitingStates) { - Collection<WaitingState> waitingStates = folder.getWaitingStates(); - if (CollectionUtils.isEmpty(waitingStates)) { - waitingStates = parentWaitingState; - } else { - parentWaitingState = waitingStates; - } - - // resursion - Collection<MailFolder> result = new HashSet<>(); - Collection<MailFolder> children = folder.getChildren(); - if (children != null) { - for (MailFolder child : children) { - Collection<MailFolder> subMailFolders = getFoldersWithWaitingState(child, - parentWaitingState, requiredWaitingStates); - result.addAll(subMailFolders); - } - } - - // pour qu'un dossier soit sélectionné il faut que les dossiers ait des etat d'attentes (ou ses parents) - // que les etats d'attente requis ne soit pas vide - if ((CollectionUtils.isEmpty(waitingStates) || - CollectionUtils.isEmpty(requiredWaitingStates) || - waitingStates.containsAll(requiredWaitingStates))) { - result.add(folder); - } - - return result; - - } - - /** - * Retourne une map avec les identifiants des {@code mailFolder}s et le nombre de mails qu'ils - * contiennent pour pouvoir empecher la suppression. - * Seulement pour les dossiers qui ont au moins un email. - * - * @return le nombre de mail par dossier - */ - @Override - public Map<String, Long> getMailFoldersUsage() { - EmailTopiaDao dao = getPersistenceContext().getEmailDao(); - Map<String, Long> result = dao.getMailCountByFolder(); - return result; - } - - @Override - public MailFolder getFolderForFaxToMailUser(FaxToMailUser customerResponsible) { - MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); - MailFolder result = dao.forCustomerResponsiblesContains(customerResponsible).findAnyOrNull(); - return result; - } - - @Override - public MailFolder getMailFolder(String topiaId) { - MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); - MailFolder result = dao.forTopiaIdEquals(topiaId).findUnique(); - return result; - } - -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java deleted file mode 100644 index fbf1847..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.InputStream; -import java.util.List; -import java.util.Map; - -import com.franciaflex.faxtomail.persistence.entities.Client; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.EmailAccount; -import com.franciaflex.faxtomail.persistence.entities.MailFilter; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.Priority; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.services.FaxToMailService; - -/** - * @author Kevin Morin (Code Lutin) - */ -public interface ReferentielService extends FaxToMailService { - List<DemandType> getAllDemandType(); - - List<Priority> getAllPriority(); - - List<Range> getAllRange(); - - List<WaitingState> getAllWaitingState(); - - Map<String, Long> getWaitingStatesUsage(); - - List<Client> importClients(InputStream inputStream); - - List<EmailAccount> importEmailAccounts(InputStream inputStream); - - List<MailFilter> importEmailFilters(InputStream inputStream, Map<String, MailFolder> foldersByName); - - List<WaitingState> importWaitingStates(InputStream inputStream); - - List<Priority> importPriorities(InputStream inputStream); - - List<Range> importRanges(InputStream inputStream); - - List<DemandType> importDemandTypes(InputStream inputStream); -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java deleted file mode 100644 index b1f0846..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java +++ /dev/null @@ -1,373 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.commons.collections4.map.MultiKeyMap; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.nuiton.csv.Import; -import org.nuiton.csv.ImportRuntimeException; -import org.nuiton.jaxx.application.ApplicationTechnicalException; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; - -import com.franciaflex.faxtomail.persistence.entities.Client; -import com.franciaflex.faxtomail.persistence.entities.ClientImpl; -import com.franciaflex.faxtomail.persistence.entities.ClientTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.EmailAccount; -import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.MailFilter; -import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.Priority; -import com.franciaflex.faxtomail.persistence.entities.PriorityTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.persistence.entities.RangeTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.persistence.entities.WaitingStateTopiaDao; -import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; -import com.franciaflex.faxtomail.services.service.imports.ClientImportBean; -import com.franciaflex.faxtomail.services.service.imports.ClientImportModel; -import com.franciaflex.faxtomail.services.service.imports.DemandTypeImportModel; -import com.franciaflex.faxtomail.services.service.imports.EmailAccountImportModel; -import com.franciaflex.faxtomail.services.service.imports.EmailFilterImportModel; -import com.franciaflex.faxtomail.services.service.imports.PriorityImportModel; -import com.franciaflex.faxtomail.services.service.imports.RangeImportModel; -import com.franciaflex.faxtomail.services.service.imports.WaitingStateImportModel; - -/** - * @author kmorin - kmorin@codelutin.com - */ -public class ReferentielServiceImpl extends FaxToMailServiceSupport implements ReferentielService { - - @Override - public List<DemandType> getAllDemandType() { - DemandTypeTopiaDao dao = getPersistenceContext().getDemandTypeDao(); - return dao.findAll(); - } - - @Override - public List<Priority> getAllPriority() { - PriorityTopiaDao dao = getPersistenceContext().getPriorityDao(); - return dao.findAll(); - } - - @Override - public List<Range> getAllRange() { - RangeTopiaDao dao = getPersistenceContext().getRangeDao(); - return dao.findAll(); - } - - @Override - public List<WaitingState> getAllWaitingState() { - WaitingStateTopiaDao dao = getPersistenceContext().getWaitingStateDao(); - return dao.findAll(); - } - - @Override - public Map<String, Long> getWaitingStatesUsage() { - WaitingStateTopiaDao dao = getPersistenceContext().getWaitingStateDao(); - Map<String, Long> result = dao.getWaitingStateCountByFolder(); - return result; - } - - @Override - public List<Client> importClients(InputStream inputStream) { - List<Client> result = new ArrayList<>(); - ClientTopiaDao dao = getPersistenceContext().getClientDao(); - - ClientImportModel clientImportModel = new ClientImportModel(';'); - Binder<ClientImportBean, Client> clientBinder = BinderFactory.newBinder(ClientImportBean.class, Client.class); - Import<ClientImportBean> importer = null; - try { - importer = Import.newImport(clientImportModel, new InputStreamReader(inputStream, getApplicationConfig().getImportFileEncoding())); - - MultiKeyMap<String, Client> clientCache = new MultiKeyMap<>(); - for (ClientImportBean client : importer) { - - Client current = clientCache.get(client.getCode(), client.getCompany()); - if (current == null) { - current = dao.forCodeEquals(client.getCode()).addEquals(Client.PROPERTY_COMPANY, client.getCompany()).findAnyOrNull(); - if (current == null) { - current = new ClientImpl(); - } - - clientBinder.copyExcluding(client, current, - Client.PROPERTY_TOPIA_ID, - Client.PROPERTY_TOPIA_CREATE_DATE, - Client.PROPERTY_TOPIA_VERSION); - - // clear current adresses and fax numbers - current.setEmailAddresses(null); - current.setFaxNumbers(null); - - // update cache - clientCache.put(client.getCode(), client.getCompany(), current); - } - - // manage special collections - if (StringUtils.isNotBlank(client.getEmailAddress())) { - List<String> currentAddresses = current.getEmailAddresses(); - if (currentAddresses == null) { - currentAddresses = new ArrayList<String>(); - } - currentAddresses.add(client.getEmailAddress()); - current.setEmailAddresses(currentAddresses); - } - if (StringUtils.isNotBlank(client.getFaxNumber())) { - List<String> faxNumbers = current.getFaxNumbers(); - if (faxNumbers == null) { - faxNumbers = new ArrayList<String>(); - } - faxNumbers.add(client.getFaxNumber()); - current.setFaxNumbers(faxNumbers); - } - - if (client.isPersisted()) { - current = dao.update(current); - } else { - current = dao.create(current); - } - result.add(current); - } - getPersistenceContext().commit(); - - } catch (ImportRuntimeException|UnsupportedEncodingException e) { - String message; - if (e.getCause() != null) { - message = e.getCause().getMessage(); - } else { - message = e.getMessage(); - } - throw new ApplicationTechnicalException(message, e); - } finally { - IOUtils.closeQuietly(importer); - IOUtils.closeQuietly(inputStream); - } - return result; - } - - @Override - public List<EmailAccount> importEmailAccounts(InputStream inputStream) { - List<EmailAccount> result = new ArrayList<>(); - EmailAccountTopiaDao dao = getPersistenceContext().getEmailAccountDao(); - - EmailAccountImportModel emailAccountImportModel = new EmailAccountImportModel(';'); - try (Import<EmailAccount> importer = Import.newImport(emailAccountImportModel, new InputStreamReader(inputStream, getApplicationConfig().getImportFileEncoding()))) { - for (EmailAccount emailAccount : importer) { - result.add(dao.create(emailAccount)); - } - getPersistenceContext().commit(); - } catch (ImportRuntimeException|UnsupportedEncodingException e) { - String message; - if (e.getCause() != null) { - message = e.getCause().getMessage(); - } else { - message = e.getMessage(); - } - throw new ApplicationTechnicalException(message, e); - - } finally { - IOUtils.closeQuietly(inputStream); - } - return result; - } - - @Override - public List<MailFilter> importEmailFilters(InputStream inputStream, Map<String, MailFolder> foldersByName) { - List<MailFilter> result = new ArrayList<>(); - MailFilterTopiaDao dao = getPersistenceContext().getMailFilterDao(); - - EmailFilterImportModel emailFilterImportModel = new EmailFilterImportModel(';', foldersByName); - try (Import<MailFilter> importer = Import.newImport(emailFilterImportModel, new InputStreamReader(inputStream, getApplicationConfig().getImportFileEncoding()))) { - for (MailFilter emailFilter : importer) { - result.add(dao.create(emailFilter)); - } - getPersistenceContext().commit(); - - } catch (ImportRuntimeException|UnsupportedEncodingException e) { - String message; - if (e.getCause() != null) { - message = e.getCause().getMessage(); - } else { - message = e.getMessage(); - } - throw new ApplicationTechnicalException(message, e); - - } finally { - IOUtils.closeQuietly(inputStream); - } - return result; - } - - @Override - public List<WaitingState> importWaitingStates(InputStream inputStream) { - - List<WaitingState> result = new ArrayList<>(); - WaitingStateTopiaDao waitingStateTopiaDao = getPersistenceContext().getWaitingStateDao(); - - WaitingStateImportModel importModel = new WaitingStateImportModel(';'); - try (Import<WaitingState> importer = Import.newImport(importModel, new InputStreamReader(inputStream, getApplicationConfig().getImportFileEncoding()))) { - for (WaitingState waitingState : importer) { - - WaitingState currentWaitingState = waitingStateTopiaDao.forLabelEquals(waitingState.getLabel()).findAnyOrNull(); - if (currentWaitingState == null) { - currentWaitingState = waitingStateTopiaDao.create(waitingState); - } - // else maybe update current ? - - result.add(currentWaitingState); - } - getPersistenceContext().commit(); - - } catch (ImportRuntimeException|UnsupportedEncodingException e) { - String message; - if (e.getCause() != null) { - message = e.getCause().getMessage(); - } else { - message = e.getMessage(); - } - throw new ApplicationTechnicalException(message, e); - - } finally { - IOUtils.closeQuietly(inputStream); - } - - return result; - } - - @Override - public List<Priority> importPriorities(InputStream inputStream) { - List<Priority> result = new ArrayList<>(); - PriorityTopiaDao priorityTopiaDao = getPersistenceContext().getPriorityDao(); - - PriorityImportModel importModel = new PriorityImportModel(';'); - try (Import<Priority> importer = Import.newImport(importModel, new InputStreamReader(inputStream, getApplicationConfig().getImportFileEncoding()))) { - for (Priority priority : importer) { - - Priority currentPriority = priorityTopiaDao.forLabelEquals(priority.getLabel()).findAnyOrNull(); - if (currentPriority == null) { - currentPriority = priorityTopiaDao.create(priority); - } - // else maybe update current ? - - result.add(currentPriority); - } - getPersistenceContext().commit(); - - } catch (ImportRuntimeException|UnsupportedEncodingException e) { - String message; - if (e.getCause() != null) { - message = e.getCause().getMessage(); - } else { - message = e.getMessage(); - } - throw new ApplicationTechnicalException(message, e); - - } finally { - IOUtils.closeQuietly(inputStream); - } - - return result; - } - - @Override - public List<Range> importRanges(InputStream inputStream) { - List<Range> result = new ArrayList<>(); - RangeTopiaDao rangeTopiaDao = getPersistenceContext().getRangeDao(); - - RangeImportModel importModel = new RangeImportModel(';'); - try (Import<Range> importer = Import.newImport(importModel, new InputStreamReader(inputStream, getApplicationConfig().getImportFileEncoding()))) { - for (Range range : importer) { - - Range currentRange = rangeTopiaDao.forLabelEquals(range.getLabel()).findAnyOrNull(); - if (currentRange == null) { - currentRange = rangeTopiaDao.create(range); - } - // else maybe update current ? - - result.add(currentRange); - } - getPersistenceContext().commit(); - - } catch (ImportRuntimeException|UnsupportedEncodingException e) { - String message; - if (e.getCause() != null) { - message = e.getCause().getMessage(); - } else { - message = e.getMessage(); - } - throw new ApplicationTechnicalException(message, e); - - } finally { - IOUtils.closeQuietly(inputStream); - } - return result; - } - - @Override - public List<DemandType> importDemandTypes(InputStream inputStream) { - List<DemandType> result = new ArrayList<>(); - DemandTypeTopiaDao demandTypeTopiaDao = getPersistenceContext().getDemandTypeDao(); - - DemandTypeImportModel importModel = new DemandTypeImportModel(';'); - try (Import<DemandType> importer = Import.newImport(importModel, new InputStreamReader(inputStream, getApplicationConfig().getImportFileEncoding()))) { - for (DemandType demandType : importer) { - - DemandType currentDemandType = demandTypeTopiaDao.forLabelEquals(demandType.getLabel()).findAnyOrNull(); - if (currentDemandType == null) { - currentDemandType = demandTypeTopiaDao.create(demandType); - } - // else maybe update current ? - - result.add(currentDemandType); - } - getPersistenceContext().commit(); - - } catch (ImportRuntimeException|UnsupportedEncodingException e) { - String message; - if (e.getCause() != null) { - message = e.getCause().getMessage(); - } else { - message = e.getMessage(); - } - throw new ApplicationTechnicalException(message, e); - - } finally { - IOUtils.closeQuietly(inputStream); - } - return result; - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java deleted file mode 100644 index 9dbb6bf..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; -import com.franciaflex.faxtomail.services.FaxToMailService; - -import java.util.List; - -/** - * @author Kevin Morin (Code Lutin) - */ -public interface UserService extends FaxToMailService { - long getActiveUserCount(); - - long getActiveGroupCount(); - - List<FaxToMailUser> getAllActiveUsers(); - - /** - * Get user by login. - * - * No fetching. - * - * @param login user login - * @return user by login - */ - FaxToMailUser getUserByLogin(String login); - - List<FaxToMailUserGroup> getAllActiveUserGroups(); - - FaxToMailUser getUser(String topiaId); -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserServiceImpl.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserServiceImpl.java deleted file mode 100644 index 8318211..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserServiceImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.List; - -import org.hibernate.Hibernate; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; -import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; - -/** - * @author kmorin - kmorin@codelutin.com - */ -public class UserServiceImpl extends FaxToMailServiceSupport implements UserService { - - /** - * Retourne le nombre d'utilisateur en base. - * - * @return user count - */ - @Override - public long getActiveUserCount() { - FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao(); - long result = faxtomailUserDao.forHiddenEquals(false).count(); - return result; - } - - /** - * Retourne le nombre de groupe en base. - * - * @return group count - */ - @Override - public long getActiveGroupCount() { - FaxToMailUserGroupTopiaDao faxtomailUserGroupDao = getPersistenceContext().getFaxToMailUserGroupDao(); - long result = faxtomailUserGroupDao.forHiddenEquals(false).count(); - return result; - } - - @Override - public List<FaxToMailUser> getAllActiveUsers() { - FaxToMailUserTopiaDao dao = getPersistenceContext().getFaxToMailUserDao(); - return dao.forHiddenEquals(false).setOrderByArguments(FaxToMailUser.PROPERTY_FIRST_NAME, FaxToMailUser.PROPERTY_LAST_NAME).findAll(); - } - - @Override - public FaxToMailUser getUserByLogin(String login) { - FaxToMailUserTopiaDao dao = getPersistenceContext().getFaxToMailUserDao(); - FaxToMailUser user = dao.forLoginEquals(login) - .findUnique(); - return user; - } - - @Override - public List<FaxToMailUserGroup> getAllActiveUserGroups() { - FaxToMailUserGroupTopiaDao dao = getPersistenceContext().getFaxToMailUserGroupDao(); - return dao.forHiddenEquals(false).setOrderByArguments(FaxToMailUserGroup.PROPERTY_COMPLETE_NAME).findAll(); - } - - @Override - public FaxToMailUser getUser(String topiaId) { - FaxToMailUserTopiaDao dao = getPersistenceContext().getFaxToMailUserDao(); - FaxToMailUser user = dao.forTopiaIdEquals(topiaId) - /*.addAllFetches(FaxToMailUser.PROPERTY_AFFECTED_FOLDERS)*/ - .findUnique(); - Hibernate.initialize(user.getAffectedFolders()); - return user; - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ValidationService.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ValidationService.java deleted file mode 100644 index 7c406bf..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ValidationService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.services.FaxToMailService; -import org.nuiton.validator.NuitonValidatorResult; - -/** - * @author Kevin Morin (Code Lutin) - */ -public interface ValidationService extends FaxToMailService { - NuitonValidatorResult validateEmail(Email email); -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ValidationServiceImpl.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ValidationServiceImpl.java deleted file mode 100644 index 65dd871..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ValidationServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.nuiton.validator.NuitonValidator; -import org.nuiton.validator.NuitonValidatorFactory; -import org.nuiton.validator.NuitonValidatorResult; - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; - -/** - * To validate some incoming data using nuiton-validators. - * - * @author kmorin - morin@codelutin.com - */ -public class ValidationServiceImpl extends FaxToMailServiceSupport implements ValidationService { - - @Override - public NuitonValidatorResult validateEmail(Email email) { - NuitonValidator<Email> validator = NuitonValidatorFactory.newValidator(Email.class); - NuitonValidatorResult result = validator.validate(email); - return result; - } - -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/exceptions/AlreadyLockedMailException.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/exceptions/AlreadyLockedMailException.java deleted file mode 100644 index db77125..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/exceptions/AlreadyLockedMailException.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.franciaflex.faxtomail.services.service.exceptions; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * Exception throw when trying to define a lock on en email already locked by another user. - * - * @author Eric Chatellier - */ -public class AlreadyLockedMailException extends Exception { - - /** serialVersionUID. */ - private static final long serialVersionUID = 7090578827422040229L; - - protected FaxToMailUser lockedBy; - - public AlreadyLockedMailException(String message, FaxToMailUser lockedBy) { - super(message); - this.lockedBy = lockedBy; - } - - public FaxToMailUser getLockedBy() { - return lockedBy; - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/exceptions/FolderNotReadableException.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/exceptions/FolderNotReadableException.java deleted file mode 100644 index 1a4074e..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/exceptions/FolderNotReadableException.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.franciaflex.faxtomail.services.service.exceptions; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; - -/** - * @author Kevin Morin (Code Lutin) - */ -public class FolderNotReadableException extends Exception { - - protected MailFolder forbiddenFolder; - - public FolderNotReadableException(String message, MailFolder forbiddenFolder) { - super(message); - this.forbiddenFolder = forbiddenFolder; - } - - public MailFolder getForbiddenFolder() { - return forbiddenFolder; - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/exceptions/InvalidClientException.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/exceptions/InvalidClientException.java deleted file mode 100644 index 37146a6..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/exceptions/InvalidClientException.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.franciaflex.faxtomail.services.service.exceptions; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.nuiton.jaxx.application.ApplicationBusinessException; - -public class InvalidClientException extends ApplicationBusinessException { - - /** serialVersionUID. */ - private static final long serialVersionUID = 1926451364755356679L; - - public InvalidClientException(String message, Throwable cause) { - super(message, cause); - } - - public InvalidClientException(String message) { - super(message); - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ArchiveImportBean.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ArchiveImportBean.java deleted file mode 100644 index ff7060f..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ArchiveImportBean.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.franciaflex.faxtomail.services.service.imports; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.EmailImpl; - -/** - * Bean model d'import des archives. (très proche de l'entité - * {@link com.franciaflex.faxtomail.persistence.entities.Email}). - * - * @author Eric Chatellier - */ -public class ArchiveImportBean extends EmailImpl { - - /** serialVersionUID. */ - private static final long serialVersionUID = 1498046445018851410L; - - protected static final String PROPERTY_ATTACHMENT_PATHS = "attachmentPaths"; - protected static final String PROPERTY_CLIENT_CODE = "clientCode"; - protected static final String PROPERTY_CLIENT_BRAND = "clientBrand"; - - protected String attachmentPaths; - - protected String clientCode; - - protected String clientBrand; - - public String getAttachmentPaths() { - return attachmentPaths; - } - - public void setAttachmentPaths(String attachmentPaths) { - this.attachmentPaths = attachmentPaths; - } - - public String getClientCode() { - return clientCode; - } - - public void setClientCode(String clientCode) { - this.clientCode = clientCode; - } - - public String getClientBrand() { - return clientBrand; - } - - public void setClientBrand(String clientBrand) { - this.clientBrand = clientBrand; - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ArchiveImportModel.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ArchiveImportModel.java deleted file mode 100644 index 6383ff2..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ArchiveImportModel.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.franciaflex.faxtomail.services.service.imports; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Map; - -import org.nuiton.csv.Common; -import org.nuiton.csv.ValueParser; -import org.nuiton.csv.ext.AbstractImportModel; - -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.Priority; - -/** - * Modele d'import des archives, défini comme suit: - * - * receptionDate;projectReference;sender;fax;recipient;object;archiveDate;companyReference; - * originalEmail;comment;etatAttente;demandType;priority;mailFolder;client-code;client-brand;attachments - * - * @author Eric Chatellier - */ -public class ArchiveImportModel extends AbstractImportModel<ArchiveImportBean> { - - /** - * Parse date pattern : dd/MM/yyyy hh:mm:ss. - */ - protected ValueParser<Date> dateValueParser = new ValueParser<Date>() { - protected DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); - @Override - public Date parse(String value) throws ParseException { - return dateFormat.parse(value); - } - }; - - /** - * Parser for boolean fields. - */ - protected ValueParser<Boolean> yesNoParser = new ValueParser<Boolean>() { - @Override - public Boolean parse(String value) throws ParseException { - return "oui".equalsIgnoreCase(value); - } - }; - - public ArchiveImportModel(char separator, - final Map<String, WaitingState> waitingStates, final Map<String, DemandType> demandTypes, - final Map<String, Priority> priorities, final Map<String, MailFolder> mailFolderMap) { - super(separator); - - newMandatoryColumn("receptionDate", Email.PROPERTY_RECEPTION_DATE, dateValueParser); - newMandatoryColumn("projectReference", Email.PROPERTY_PROJECT_REFERENCE); - newMandatoryColumn("sender", Email.PROPERTY_SENDER, new ValueParser<Object>() { - @Override - public Object parse(String value) throws ParseException { - value = value.replaceFirst("^.*<(.*)>$", "$1"); - value = value.toLowerCase(); - return value; - } - }); - newMandatoryColumn("fax", Email.PROPERTY_FAX, Common.PRIMITIVE_BOOLEAN); - newMandatoryColumn("recipient", Email.PROPERTY_RECIPIENT); - newMandatoryColumn("object", Email.PROPERTY_OBJECT); - newMandatoryColumn("archiveDate", Email.PROPERTY_ARCHIVE_DATE, dateValueParser); - newMandatoryColumn("companyReference", Email.PROPERTY_COMPANY_REFERENCE); - newMandatoryColumn("originalEmail", Email.PROPERTY_ORIGINAL_EMAIL); - newMandatoryColumn("comment", Email.PROPERTY_COMMENT); - newMandatoryColumn("etatAttente", Email.PROPERTY_WAITING_STATE, new ValueParser<WaitingState>() { - @Override - public WaitingState parse(String value) throws ParseException { - return waitingStates.get(value); - } - }); - newMandatoryColumn("demandType", Email.PROPERTY_DEMAND_TYPE, new ValueParser<DemandType>() { - @Override - public DemandType parse(String value) throws ParseException { - return demandTypes.get(value); - } - }); - newMandatoryColumn("priority", Email.PROPERTY_PRIORITY, new ValueParser<Priority>() { - @Override - public Priority parse(String value) throws ParseException { - return priorities.get(value); - } - }); - newMandatoryColumn("mailFolder", Email.PROPERTY_MAIL_FOLDER, new ValueParser<MailFolder>() { - @Override - public MailFolder parse(String value) throws ParseException { - return mailFolderMap.get(value); - } - }); - newMandatoryColumn("client-code", ArchiveImportBean.PROPERTY_CLIENT_CODE); - newMandatoryColumn("client-brand", ArchiveImportBean.PROPERTY_CLIENT_BRAND); - newMandatoryColumn("attachments", ArchiveImportBean.PROPERTY_ATTACHMENT_PATHS); - } - - @Override - public ArchiveImportBean newEmptyInstance() { - return new ArchiveImportBean(); - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportBean.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportBean.java deleted file mode 100644 index 9a724f6..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportBean.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.franciaflex.faxtomail.services.service.imports; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.ClientImpl; - -public class ClientImportBean extends ClientImpl { - - /** serialVersionUID. */ - private static final long serialVersionUID = 5690836443815313312L; - - public static final String PROPERTY_EMAIL_ADDRESS = "emailAddress"; - public static final String PROPERTY_FAX_NUMBER = "faxNumber"; - - protected String emailAddress; - - protected String faxNumber; - - public String getEmailAddress() { - return emailAddress; - } - - public void setEmailAddress(String emailAddress) { - this.emailAddress = emailAddress; - } - - public String getFaxNumber() { - return faxNumber; - } - - public void setFaxNumber(String faxNumber) { - this.faxNumber = faxNumber; - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportModel.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportModel.java deleted file mode 100644 index 84da084..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportModel.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.franciaflex.faxtomail.services.service.imports; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Client; - -import org.apache.commons.lang3.StringUtils; -import org.nuiton.csv.ValueParser; -import org.nuiton.csv.ext.AbstractImportModel; - -import java.text.ParseException; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class ClientImportModel extends AbstractImportModel<ClientImportBean> { - - public ClientImportModel(char separator) { - super(separator); - - ValueParser<String> nullParser = new ValueParser<String>() { - @Override - public String parse(String s) throws ParseException { - if ("NULL".equals(s)) { - s = null; - } - return s; - } - }; - - // parser qui retire les non nombres des numero de fax - ValueParser<String> faxParser = new ValueParser<String>() { - @Override - public String parse(String s) throws ParseException { - if ("NULL".equals(s)) { - s = null; - } - if (s != null) { - s = StringUtils.removePattern(s, "[^0-9]"); - if ("0".equals(s) || s.isEmpty()) { - s = null; - } - } - - return s; - } - }; - - newIgnoredColumn("Id_Correspondance"); - newMandatoryColumn("Societe", Client.PROPERTY_COMPANY); - newMandatoryColumn("Marque", Client.PROPERTY_BRAND, nullParser); - newMandatoryColumn("Nom", Client.PROPERTY_NAME); - newMandatoryColumn("Caracteristique1", Client.PROPERTY_CARACTERISTIC1, nullParser); - newMandatoryColumn("Caracteristique2", Client.PROPERTY_CARACTERISTIC2, nullParser); - newMandatoryColumn("Caracteristique3", Client.PROPERTY_CARACTERISTIC3, nullParser); - newMandatoryColumn("Numero_Fax", ClientImportBean.PROPERTY_FAX_NUMBER, faxParser); - newMandatoryColumn("Adresse_Mail", ClientImportBean.PROPERTY_EMAIL_ADDRESS, nullParser); - newMandatoryColumn("Code_Client", Client.PROPERTY_CODE); - - newIgnoredColumn("Client_Top"); - newIgnoredColumn("Objet_Message"); - newIgnoredColumn("Destination"); - } - - @Override - public ClientImportBean newEmptyInstance() { - return new ClientImportBean(); - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/DemandTypeImportModel.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/DemandTypeImportModel.java deleted file mode 100644 index df30b15..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/DemandTypeImportModel.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.franciaflex.faxtomail.services.service.imports; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.nuiton.csv.ext.AbstractImportModel; - -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.DemandTypeImpl; - -/** - * Modèle d'import des etat d'attente. - */ -public class DemandTypeImportModel extends AbstractImportModel<DemandType> { - - public DemandTypeImportModel(char separator) { - super(separator); - - newMandatoryColumn("demandetype", DemandType.PROPERTY_LABEL); - } - - @Override - public DemandType newEmptyInstance() { - return new DemandTypeImpl(); - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailAccountImportModel.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailAccountImportModel.java deleted file mode 100644 index 7c9c29b..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailAccountImportModel.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.franciaflex.faxtomail.services.service.imports; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.text.ParseException; - -import com.franciaflex.faxtomail.persistence.entities.EmailAccount; -import com.franciaflex.faxtomail.persistence.entities.EmailAccountImpl; -import com.franciaflex.faxtomail.persistence.entities.EmailProtocol; - -import org.nuiton.csv.ValueParser; -import org.nuiton.csv.ext.AbstractImportModel; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class EmailAccountImportModel extends AbstractImportModel<EmailAccount> { - - public EmailAccountImportModel(char separator) { - super(separator); - - newMandatoryColumn("protocol", EmailAccount.PROPERTY_PROTOCOL, new ValueParser<EmailProtocol>() { - - @Override - public EmailProtocol parse(String value) throws ParseException { - EmailProtocol protocol = EmailProtocol.valueOf(value.toUpperCase()); - return protocol; - } - - }); - newMandatoryColumn("host", EmailAccount.PROPERTY_HOST); - newMandatoryColumn("port", EmailAccount.PROPERTY_PORT, new ValueParser<Integer>() { - - @Override - public Integer parse(String value) throws ParseException { - Integer result = Integer.valueOf(value); - return result; - } - - }); - newMandatoryColumn("user", EmailAccount.PROPERTY_LOGIN); - newMandatoryColumn("password", EmailAccount.PROPERTY_PASSWORD); - } - - @Override - public EmailAccount newEmptyInstance() { - return new EmailAccountImpl(); - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailFilterImportModel.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailFilterImportModel.java deleted file mode 100644 index f4402e7..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailFilterImportModel.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.franciaflex.faxtomail.services.service.imports; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.MailFilter; -import com.franciaflex.faxtomail.persistence.entities.MailFilterImpl; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import org.nuiton.csv.ValueParser; -import org.nuiton.csv.ext.AbstractImportModel; - -import java.text.ParseException; -import java.util.Map; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class EmailFilterImportModel extends AbstractImportModel<MailFilter> { - - public EmailFilterImportModel(char separator, final Map<String, MailFolder> foldersByName) { - super(separator); - - newMandatoryColumn("recipient", MailFilter.PROPERTY_EXPRESSION); - newMandatoryColumn("folder", MailFilter.PROPERTY_MAIL_FOLDER, new ValueParser<Object>() { - @Override - public Object parse(String value) throws ParseException { - return foldersByName.get(value); - } - }); - newMandatoryColumn("position", MailFilter.PROPERTY_POSITION, new ValueParser<Object>() { - @Override - public Object parse(String value) throws ParseException { - return Integer.parseInt(value); - } - }); - } - - @Override - public MailFilter newEmptyInstance() { - return new MailFilterImpl(); - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/PriorityImportModel.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/PriorityImportModel.java deleted file mode 100644 index f14bf0d..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/PriorityImportModel.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.franciaflex.faxtomail.services.service.imports; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.nuiton.csv.ext.AbstractImportModel; - -import com.franciaflex.faxtomail.persistence.entities.Priority; -import com.franciaflex.faxtomail.persistence.entities.PriorityImpl; - -/** - * Modèle d'import des etat d'attente. - */ -public class PriorityImportModel extends AbstractImportModel<Priority> { - - public PriorityImportModel(char separator) { - super(separator); - - newMandatoryColumn("priorite", Priority.PROPERTY_LABEL); - } - - @Override - public Priority newEmptyInstance() { - return new PriorityImpl(); - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/RangeImportModel.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/RangeImportModel.java deleted file mode 100644 index 9e7177c..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/RangeImportModel.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.franciaflex.faxtomail.services.service.imports; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.nuiton.csv.ext.AbstractImportModel; - -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.persistence.entities.RangeImpl; - -/** - * Modèle d'import des etat d'attente. - */ -public class RangeImportModel extends AbstractImportModel<Range> { - - public RangeImportModel(char separator) { - super(separator); - - newMandatoryColumn("gamme", Range.PROPERTY_LABEL); - } - - @Override - public Range newEmptyInstance() { - return new RangeImpl(); - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/WaitingStateImportModel.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/WaitingStateImportModel.java deleted file mode 100644 index 944908d..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/WaitingStateImportModel.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.franciaflex.faxtomail.services.service.imports; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.nuiton.csv.ext.AbstractImportModel; - -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.persistence.entities.WaitingStateImpl; - -/** - * Modèle d'import des etat d'attente. - */ -public class WaitingStateImportModel extends AbstractImportModel<WaitingState> { - - public WaitingStateImportModel(char separator) { - super(separator); - - newMandatoryColumn("etatattente", WaitingState.PROPERTY_LABEL); - } - - @Override - public WaitingState newEmptyInstance() { - return new WaitingStateImpl(); - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/AuthenticationException.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/AuthenticationException.java deleted file mode 100644 index da32b23..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/AuthenticationException.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.franciaflex.faxtomail.services.service.ldap; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -public class AuthenticationException extends Exception { - - public AuthenticationException(String message, Throwable cause) { - super(message, cause); - } - - public AuthenticationException(String message) { - super(message); - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java deleted file mode 100644 index acf22db..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.franciaflex.faxtomail.services.service.ldap; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.List; - -import com.franciaflex.faxtomail.services.service.LdapServiceImpl; -import org.apache.commons.collections4.CollectionUtils; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupImpl; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserImpl; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; - -/** - * Surcharge les methodes qui utilisent le serveur ldap pour pouvoir fonctionner sans serveur ldap. - * - * @author Eric Chatellier - */ -public class LdapServiceMock extends LdapServiceImpl { - - protected FaxToMailUser getFakeFaxToMailUser() { - FaxToMailUserTopiaDao userDao = getPersistenceContext().getFaxToMailUserDao(); - FaxToMailUserGroupTopiaDao groupDao = getPersistenceContext().getFaxToMailUserGroupDao(); - - FaxToMailUser fakeUser = userDao.forAll().setOrderByArguments(FaxToMailUser.PROPERTY_TOPIA_ID).findFirstOrNull(); - - // create user - if (fakeUser == null) { - fakeUser = new FaxToMailUserImpl(); - fakeUser.setTrigraph("fkr"); - fakeUser.setFirstName("Test ldap"); - fakeUser.setLastName("Test ldap"); - fakeUser.setLogin("test"); - fakeUser = userDao.create(fakeUser); - } - - // add user to fake group - FaxToMailUserGroup fakeGroup = null; - List<String> adminGroups = getApplicationConfig().getLdapAdminGroups(); - if (CollectionUtils.isNotEmpty(adminGroups)) { - fakeGroup = groupDao.forCompleteNameEquals(adminGroups.get(0)).findAnyOrNull(); - if (fakeGroup == null) { - fakeGroup = new FaxToMailUserGroupImpl(); - fakeGroup.setName("fake group"); - fakeGroup.setCompleteName(adminGroups.get(0)); - fakeGroup = groupDao.create(fakeGroup); - } - - if (!fakeUser.containsUserGroups(fakeGroup)) { - fakeUser.addUserGroups(fakeGroup); - } - } - - getPersistenceContext().commit(); - return fakeUser; - } - - @Override - public void updateLdapData() { - // do nothing here - } - - @Override - public FaxToMailUser getUserBean(String userTopiaId) { - FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao(); - FaxToMailUser result = faxtomailUserDao.forTopiaIdEquals(userTopiaId).findUnique(); - // force collection loading to force non lazy collections - result.isAffectedFoldersEmpty(); - result.isUserGroupsEmpty(); - return result; - } - - @Override - public FaxToMailUser authenticateUser(String login, String password) throws AuthenticationException { - return getUserFromPrincipal(login); - } - - @Override - public FaxToMailUser getUserFromPrincipal(String principal) throws AuthenticationException { - FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao(); - FaxToMailUser result = faxtomailUserDao.forLoginEquals(principal.toLowerCase()).findUniqueOrNull(); - if (result == null) { - result = getFakeFaxToMailUser(); - } - // force collection loading to force non lazy collections - result.isAffectedFoldersEmpty(); - result.isUserGroupsEmpty(); - return result; - } -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/migration/FaxtomailFlywayMigrationService.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/migration/FaxtomailFlywayMigrationService.java deleted file mode 100644 index 92220a7..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/migration/FaxtomailFlywayMigrationService.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.franciaflex.faxtomail.services.service.migration; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.commons.lang3.StringUtils; -import org.flywaydb.core.Flyway; -import org.hibernate.cfg.Environment; -import org.nuiton.topia.flyway.TopiaFlywayServiceImpl; -import org.nuiton.topia.persistence.TopiaApplicationContext; - -/** - * Surcharge du service de migration flayway par default pour pouvoir définir des scripts pour - * plusieurs type de base de données. - * - * @author Eric Chatellier - */ -public class FaxtomailFlywayMigrationService extends TopiaFlywayServiceImpl { - - @Override - protected void setLocations(Flyway flyway, TopiaApplicationContext topiaApplicationContext) { - - String specificDirectory; - String dialect = (String)topiaApplicationContext.getConfiguration().get(Environment.DIALECT); - if (StringUtils.startsWith(dialect, "org.hibernate.dialect.SQLServer")) { - specificDirectory = "db/migration/sqlserver"; - } else if (StringUtils.startsWith(dialect, "org.hibernate.dialect.PostgreSQL")) { - specificDirectory = "db/migration/postgres"; - } else { - specificDirectory = "db/migration/h2"; - } - - flyway.setLocations(specificDirectory); - } - -} diff --git a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/validators/FaxToMailEmailValidator.java b/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/validators/FaxToMailEmailValidator.java deleted file mode 100644 index 79fd5df..0000000 --- a/trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/validators/FaxToMailEmailValidator.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.franciaflex.faxtomail.services.validators; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.opensymphony.xwork2.validator.validators.EmailValidator; - -/** - * Surcharge du validateur d'email par default de struts pour autoriser en plus le domaine ".fax". - */ -public class FaxToMailEmailValidator extends EmailValidator { - - // see XW-371 - public static final String EMAIL_ADDRESS_PATTERN = - "\\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|nato|net|org|pro|tel|travel|xxx|fax)$\\b"; - - public FaxToMailEmailValidator() { - setRegex(EMAIL_ADDRESS_PATTERN); - } - -} diff --git a/trunk/faxtomail-service/src/main/resources/com/franciaflex/faxtomail/persistence/entities/Email-error-validation.xml b/trunk/faxtomail-service/src/main/resources/com/franciaflex/faxtomail/persistence/entities/Email-error-validation.xml deleted file mode 100644 index 4d578d0..0000000 --- a/trunk/faxtomail-service/src/main/resources/com/franciaflex/faxtomail/persistence/entities/Email-error-validation.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: Service - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - - -<!DOCTYPE validators PUBLIC - "-//Apache Struts//XWork Validator 1.0.3//EN" - "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> - -<validators> - - <field name="clientCode"> - <field-validator type="requiredstring" short-circuit="true"> - <message>faxtomail.validator.error.email.clientCode.required</message> - </field-validator> - </field> - - <field name="demandType"> - <field-validator type="required" short-circuit="true"> - <message>faxtomail.validator.error.email.demandType.required</message> - </field-validator> - </field> - - <field name="projectReference"> - <field-validator type="required" short-circuit="true"> - <message>faxtomail.validator.error.email.projectReference.required</message> - </field-validator> - </field> - -</validators> diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_442__move_object_to_folder_configuration.sql b/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_442__move_object_to_folder_configuration.sql deleted file mode 100644 index fc9e1da..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_442__move_object_to_folder_configuration.sql +++ /dev/null @@ -1,60 +0,0 @@ - --- move lock out of business model and to his own table -alter table email drop column lockedby; -create table mailLock ( - topiaId varchar(255) not null, - topiaVersion bigint not null, - topiaCreateDate timestamp, - lockOn varchar(255) not null, - lockBy varchar(255) not null, - primary key (topiaId) -); -alter table mailLock - add constraint UK_cebqxr5mtsd4wmm0x0nwaa5km unique (lockOn); -alter table mailLock - add constraint FK_cebqxr5mtsd4wmm0x0nwaa5km - foreign key (lockOn) - references email; -alter table mailLock - add constraint FK_gwxpc59s0wjg60djbk5xa4d5d - foreign key (lockBy) - references faxToMailUser; - --- edi transfer for each folder -alter table demandtype drop column editransfer; -alter table mailfolder add editransfer boolean; -update mailfolder set editransfer = 'f' where parent is null; - --- reject allowed for email account -alter table EmailAccount add rejectAllowed boolean; -update EmailAccount set rejectAllowed = 'f'; - --- demandtype per folder -create table demandtypes_mailfolder ( - mailFolder varchar(255) not null, - demandTypes varchar(255) not null -); -alter table demandtypes_mailfolder - add constraint FK_apld4ycj71ouug7vmg5wtr1y9 - foreign key (demandTypes) - references demandType; -alter table demandtypes_mailfolder - add constraint FK_pmybd6fsyapv8ygtn7pjw258k - foreign key (mailFolder) - references mailFolder; -CREATE INDEX idx_MailFolder_demandTypes ON demandtypes_mailfolder(mailFolder); - --- range per folder -create table mailfolder_ranges ( - mailFolder varchar(255) not null, - ranges varchar(255) not null -); -alter table mailfolder_ranges - add constraint FK_kiolyiaeicw5he7xlima0ugbb - foreign key (ranges) - references range; -alter table mailfolder_ranges - add constraint FK_h78fwd9gc92wh7vw612q48xrr - foreign key (mailFolder) - references mailFolder; -CREATE INDEX idx_MailFolder_ranges ON mailfolder_ranges(mailFolder); diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_448__add_mail_folder_level_configuration.sql b/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_448__add_mail_folder_level_configuration.sql deleted file mode 100644 index 0beaf63..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_448__add_mail_folder_level_configuration.sql +++ /dev/null @@ -1,6 +0,0 @@ - --- add mail folder level configuration -alter table mailfolder add useCurrentLevelDemandType boolean; -alter table mailfolder add useCurrentLevelRange boolean; -update mailfolder set useCurrentLevelDemandType = 'f'; -update mailfolder set useCurrentLevelRange = 'f'; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_454__add_ldap_config.sql b/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_454__add_ldap_config.sql deleted file mode 100644 index 23a9b49..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_454__add_ldap_config.sql +++ /dev/null @@ -1,6 +0,0 @@ - --- add user and group hidden configuration -alter table FaxToMailUserGroup add hidden boolean; -alter table FaxToMailUser add hidden boolean; -update FaxToMailUserGroup set hidden = 'f'; -update FaxToMailUser set hidden = 'f'; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_480__remove_faxtomailusergroup_loop_association_and_add_idx.sql b/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_480__remove_faxtomailusergroup_loop_association_and_add_idx.sql deleted file mode 100644 index f232090..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_480__remove_faxtomailusergroup_loop_association_and_add_idx.sql +++ /dev/null @@ -1,39 +0,0 @@ - --- remove unused association -ALTER TABLE faxtomailusergroup DROP COLUMN faxtomailusergroup; - --- add column faxAccountType on emailAccount -ALTER TABLE emailAccount add faxAccountType boolean; -update emailAccount set faxAccountType = 'f'; - --- add email_idx on attachment -ALTER TABLE attachment ADD email_idx integer; - -UPDATE attachment SET email_idx = ( - SELECT COUNT(topiaid) FROM attachment sub - WHERE sub.email = attachment.email AND (sub.topiacreatedate || sub.topiaid) < (attachment.topiacreatedate || attachment.topiaid) -); - --- add email_idx on history -ALTER TABLE history ADD COLUMN email_idx integer; - -UPDATE history SET email_idx = ( - SELECT COUNT(topiaid) FROM history sub - WHERE sub.email = history.email AND (sub.topiacreatedate || sub.topiaid) < (history.topiacreatedate || history.topiaid) -); - --- add email_idx on rangeRow -ALTER TABLE rangeRow ADD email_idx integer; - -UPDATE rangeRow SET email_idx = ( - SELECT COUNT(topiaid) FROM rangeRow sub - WHERE sub.email = rangeRow.email AND (sub.topiacreatedate || sub.topiaid) < (rangeRow.topiacreatedate || rangeRow.topiaid) -); - --- add email_idx on reply -ALTER TABLE reply ADD email_idx integer; - -UPDATE reply SET email_idx = ( - SELECT COUNT(topiaid) FROM reply sub - WHERE sub.email = reply.email AND (sub.topiacreatedate || sub.topiaid) < (reply.topiacreatedate || reply.topiaid) -); diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_520__add_performance_indexes.sql b/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_520__add_performance_indexes.sql deleted file mode 100644 index 190f409..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_520__add_performance_indexes.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE INDEX email_receptionDate_idx ON email(receptionDate ASC); -CREATE INDEX email_archiveDate_idx ON email(archiveDate NULLS FIRST); -CREATE INDEX email_mailFolder_idx ON email(mailFolder); -CREATE INDEX email_demandStatus_idx ON email(demandStatus); - -CREATE INDEX email_takenBy_idx ON email(takenBy); -CREATE INDEX email_client_idx ON email(client); -CREATE INDEX email_etatAttente_idx ON email(etatAttente); -CREATE INDEX email_priority_idx ON email(priority); -CREATE INDEX email_demandType_idx ON email(demandType); - -CREATE INDEX demandType_fields_OWNER_idx ON demandType_fields(OWNER); -CREATE INDEX rangeRow_range_idx ON rangeRow(range); -CREATE INDEX history_faxToMailUser_idx ON history(faxToMailUser); -CREATE INDEX history_fields_OWNER_idx ON history_fields(OWNER); - -CREATE INDEX mailfolder_readrightusers_readRightUsers_idx ON mailfolder_readrightusers(readRightUsers); -CREATE INDEX mailfolder_readrightgroups_readRightGroups_idx ON mailfolder_readrightgroups(readRightGroups); diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_580__transform_enum_set_to_lists.sql b/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_580__transform_enum_set_to_lists.sql deleted file mode 100644 index 5d07eac..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_580__transform_enum_set_to_lists.sql +++ /dev/null @@ -1,25 +0,0 @@ --- configuration -alter table configuration_invalidFormDisabledActions drop constraint FK_fj3yycjetl6acpiybfsg4v0yq; -alter table configuration_searchDisplayColumns drop constraint FK_9ffmpp0utfad26oxe70efo1da; -drop table configuration_invalidFormDisabledActions; -drop table configuration_searchDisplayColumns; -alter table configuration add searchDisplayColumns longvarchar; -alter table configuration add invalidFormDisabledActions longvarchar; - --- demande type -alter table demandType_fields drop constraint FK_c44wglsh0xpua19f1ps9vn24i; -drop table demandType_fields; -alter table demandType add requiredFields longvarchar; - --- etat attente -alter table etatAttente_invalidFormDisabledActions drop constraint FK_221gjt0dyjtbndk8v7tr85ta6 ; -alter table etatAttente_validFormDisabledActions drop constraint FK_86hqc0dxhqyca7rbx7b3bfydr; -drop table etatAttente_invalidFormDisabledActions; -drop table etatAttente_validFormDisabledActions; -alter table etatAttente add invalidFormDisabledActions longvarchar; -alter table etatAttente add validFormDisabledActions longvarchar; - --- mail folder -alter table mailFolder_folderTableColumns drop constraint FK_ap7lwii8to9wlxefnu3pn0goe; -drop table mailFolder_folderTableColumns; -alter table mailFolder add folderTableColumns longvarchar; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_583__readd_editranfer_on_demandtype.sql b/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_583__readd_editranfer_on_demandtype.sql deleted file mode 100644 index 8174f75..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_583__readd_editranfer_on_demandtype.sql +++ /dev/null @@ -1,4 +0,0 @@ - --- demandtype -alter table demandtype add editransfer boolean; -update demandtype set editransfer = 'f'; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_597__mise_a_jour_performances.sql b/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_597__mise_a_jour_performances.sql deleted file mode 100644 index e3ad011..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_597__mise_a_jour_performances.sql +++ /dev/null @@ -1,81 +0,0 @@ --- remove contraints -alter table email drop constraint FK_4q69gdpfr96aqig9ephikqxxr; -alter table etatAttente drop constraint UK_e1mte18x0rh5akvjfbi5ljse9; -alter table etatattentes_mailfolder drop constraint FK_3gi1yi1o932oe5t8ikcnsd3ef; -alter table etatattentes_mailfolder drop constraint FK_hsynjnyke7heuntkxkks9voxy; -alter table history_fields drop constraint FK_qoup2jo9smmju8hgou9sq5108; -DROP INDEX idx_MailFolder_etatAttentes; -DROP INDEX email_etatAttente_idx; - --- renommage etat attente -ALTER TABLE email ALTER COLUMN etatAttente RENAME TO waitingState; -ALTER TABLE etatAttente RENAME TO waitingState; -ALTER TABLE etatattentes_mailfolder RENAME TO mailfolder_waitingstates; -ALTER TABLE mailfolder_waitingstates ALTER COLUMN etatAttentes RENAME TO waitingStates; -ALTER TABLE mailFolder ALTER COLUMN useCurrentLevelEtatAttente RENAME TO useCurrentLevelWaitingState; - --- migration des topia id -update waitingState set topiaId = replace(topiaId, 'EtatAttente', 'WaitingState'); -update email set waitingState = replace(waitingState, 'EtatAttente', 'WaitingState'); -update mailfolder_waitingstates set waitingStates = replace(waitingStates, 'EtatAttente', 'WaitingState') where waitingStates is not null; - --- migration des champs obligatoire (enum) -update configuration set searchDisplayColumns = replace(searchDisplayColumns, 'ETAT_ATTENTE', 'WAITING_STATE') where searchDisplayColumns is not null; -update mailfolder set folderTableColumns = replace(folderTableColumns, 'ETAT_ATTENTE', 'WAITING_STATE') where folderTableColumns is not null; -update DemandType set requiredFields = replace(requiredFields, 'ETAT_ATTENTE', 'WAITING_STATE') where requiredFields is not null; - --- restore constraints -alter table waitingState add constraint UK_ccllv66h9tle79mgklh1kpicn unique (label); -alter table email - add constraint FK_nfplqi5mxyfuxgkpe3rb83put - foreign key (waitingState) - references waitingState; -alter table mailfolder_waitingstates - add constraint FK_tb0qx61jwbtopp4xjv089syt2 - foreign key (waitingStates) - references waitingState; -alter table mailfolder_waitingstates - add constraint FK_3ucrlum12s7ivskvvdgykxq7d - foreign key (mailFolder) - references mailFolder; -CREATE INDEX idx_MailFolder_waitingStates ON mailfolder_waitingstates(mailFolder); -CREATE INDEX email_waitingState_idx ON email(waitingState); - --- Reply -delete from reply; -ALTER TABLE reply ALTER sentDate SET NOT NULL; -ALTER TABLE reply ALTER subject SET NOT NULL; -ALTER TABLE reply ADD sender longvarchar not null; -ALTER TABLE reply ADD recipient longvarchar not null; -ALTER TABLE reply ADD replyContent varchar(255) not null; -ALTER TABLE reply ADD sentBy varchar(255) not null; - -create table replyContent ( - topiaId varchar(255) not null, - topiaVersion bigint not null, - topiaCreateDate timestamp, - source binary(9999999) not null, - primary key (topiaId) -); - -alter table reply add constraint UK_7xjte6c6h2lltfpu6ot1bel8k unique (replyContent); -alter table reply - add constraint FK_7xjte6c6h2lltfpu6ot1bel8k - foreign key (replyContent) - references replyContent; - -alter table reply - add constraint FK_9m87oooqhsbf1wbad9h4jcwm3 - foreign key (sentBy) - references faxToMailUser; - --- Last opener -ALTER TABLE email ADD lastAttachmentOpener varchar(255); -alter table email - add constraint FK_pu5j5vh83354jhoikyvb22jru - foreign key (lastAttachmentOpener) - references faxToMailUser; - --- Champs hitory fields en json -DROP TABLE history_fields; -ALTER TABLE history ADD fieldsJson longvarchar; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_620__modification_newclient_edireturn.sql b/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_620__modification_newclient_edireturn.sql deleted file mode 100644 index 30be2c7..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_620__modification_newclient_edireturn.sql +++ /dev/null @@ -1,43 +0,0 @@ - --- remove topia from newclient -drop table newclient; -create table newClient ( - name longvarchar, - emailAddress longvarchar, - faxNumber longvarchar, - caracteristic1 longvarchar, - caracteristic2 longvarchar, - caracteristic3 longvarchar, - code longvarchar not null, - company longvarchar not null, - brand longvarchar, - personInCharge longvarchar, - unique (code, company, emailAddress, faxNumber) -); - --- remove topia from edireturn -drop table edireturn; -create table ediReturn ( - rangeRowTopiaId longvarchar not null, - commandNumber longvarchar, - error longvarchar, - unique (rangeRowTopiaId) -); - --- clear client table -update email set client = null; -delete from client; - --- add company in client ---drop constraint UK_b4ck8pelycojqmbrd8n36mdfw; - -alter table client drop emailAddress; -alter table client drop faxNumber; -alter table client drop id; - -alter table client add company longvarchar not NULL; -alter table client add emailAddressesJson longvarchar; -alter table client add faxNumbersJson longvarchar; -alter table client alter brand SET NULL; - -alter table client add constraint UK_kqpy7y2f4onck5julevr0hfg1 unique (code, company); diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_662__add_company_in_mailfolder.sql b/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_662__add_company_in_mailfolder.sql deleted file mode 100644 index 0ee93f9..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_662__add_company_in_mailfolder.sql +++ /dev/null @@ -1,5 +0,0 @@ - --- add mail folder level configuration -alter table mailfolder add useCurrentLevelCompany boolean; -alter table mailfolder add company longvarchar; -update mailfolder set useCurrentLevelCompany = 'f'; \ No newline at end of file diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_442__move_object_to_folder_configuration.sql b/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_442__move_object_to_folder_configuration.sql deleted file mode 100644 index 8b0e553..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_442__move_object_to_folder_configuration.sql +++ /dev/null @@ -1,60 +0,0 @@ - --- move lock out of business model and to his own table -alter table email drop column lockedby; -create table mailLock ( - topiaId varchar(255) not null, - topiaVersion int8 not null, - topiaCreateDate timestamp, - lockOn varchar(255) not null, - lockBy varchar(255) not null, - primary key (topiaId) -); -alter table mailLock - add constraint UK_cebqxr5mtsd4wmm0x0nwaa5km unique (lockOn); -alter table mailLock - add constraint FK_cebqxr5mtsd4wmm0x0nwaa5km - foreign key (lockOn) - references email; -alter table mailLock - add constraint FK_gwxpc59s0wjg60djbk5xa4d5d - foreign key (lockBy) - references faxToMailUser; - --- edi transfer for each folder -alter table demandtype drop column editransfer; -alter table mailfolder add editransfer boolean; -update mailfolder set editransfer = 'f' where parent is null; - --- reject allowed for email account -alter table EmailAccount add rejectAllowed boolean; -update EmailAccount set rejectAllowed = 'f'; - --- demandtype per folder -create table demandtypes_mailfolder ( - mailFolder varchar(255) not null, - demandTypes varchar(255) not null -); -alter table demandtypes_mailfolder - add constraint FK_apld4ycj71ouug7vmg5wtr1y9 - foreign key (demandTypes) - references demandType; -alter table demandtypes_mailfolder - add constraint FK_pmybd6fsyapv8ygtn7pjw258k - foreign key (mailFolder) - references mailFolder; -CREATE INDEX idx_MailFolder_demandTypes ON demandtypes_mailfolder(mailFolder); - --- range per folder -create table mailfolder_ranges ( - mailFolder varchar(255) not null, - ranges varchar(255) not null -); -alter table mailfolder_ranges - add constraint FK_kiolyiaeicw5he7xlima0ugbb - foreign key (ranges) - references range; -alter table mailfolder_ranges - add constraint FK_h78fwd9gc92wh7vw612q48xrr - foreign key (mailFolder) - references mailFolder; -CREATE INDEX idx_MailFolder_ranges ON mailfolder_ranges(mailFolder); diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_448__add_mail_folder_level_configuration.sql b/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_448__add_mail_folder_level_configuration.sql deleted file mode 100644 index 0beaf63..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_448__add_mail_folder_level_configuration.sql +++ /dev/null @@ -1,6 +0,0 @@ - --- add mail folder level configuration -alter table mailfolder add useCurrentLevelDemandType boolean; -alter table mailfolder add useCurrentLevelRange boolean; -update mailfolder set useCurrentLevelDemandType = 'f'; -update mailfolder set useCurrentLevelRange = 'f'; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_454__add_ldap_config.sql b/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_454__add_ldap_config.sql deleted file mode 100644 index 23a9b49..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_454__add_ldap_config.sql +++ /dev/null @@ -1,6 +0,0 @@ - --- add user and group hidden configuration -alter table FaxToMailUserGroup add hidden boolean; -alter table FaxToMailUser add hidden boolean; -update FaxToMailUserGroup set hidden = 'f'; -update FaxToMailUser set hidden = 'f'; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_480__remove_faxtomailusergroup_loop_association_and_add_idx.sql b/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_480__remove_faxtomailusergroup_loop_association_and_add_idx.sql deleted file mode 100644 index 93a0be5..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_480__remove_faxtomailusergroup_loop_association_and_add_idx.sql +++ /dev/null @@ -1,39 +0,0 @@ - --- remove unused association -ALTER TABLE faxtomailusergroup DROP COLUMN faxtomailusergroup; - --- add column faxAccountType on emailAccount -ALTER TABLE emailAccount add faxAccountType boolean; -update emailAccount set faxAccountType = 'f'; - --- add email_idx on attachment -ALTER TABLE attachment ADD email_idx int4; - -UPDATE attachment SET email_idx = ( - SELECT COUNT(topiaid) FROM attachment sub - WHERE sub.email = attachment.email AND (sub.topiacreatedate || sub.topiaid) < (attachment.topiacreatedate || attachment.topiaid) -); - --- add email_idx on history -ALTER TABLE history ADD COLUMN email_idx int4; - -UPDATE history SET email_idx = ( - SELECT COUNT(topiaid) FROM history sub - WHERE sub.email = history.email AND (sub.topiacreatedate || sub.topiaid) < (history.topiacreatedate || history.topiaid) -); - --- add email_idx on rangeRow -ALTER TABLE rangeRow ADD email_idx int4; - -UPDATE rangeRow SET email_idx = ( - SELECT COUNT(topiaid) FROM rangeRow sub - WHERE sub.email = rangeRow.email AND (sub.topiacreatedate || sub.topiaid) < (rangeRow.topiacreatedate || rangeRow.topiaid) -); - --- add email_idx on reply -ALTER TABLE reply ADD email_idx int4; - -UPDATE reply SET email_idx = ( - SELECT COUNT(topiaid) FROM reply sub - WHERE sub.email = reply.email AND (sub.topiacreatedate || sub.topiaid) < (reply.topiacreatedate || reply.topiaid) -); diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_520__add_performance_indexes.sql b/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_520__add_performance_indexes.sql deleted file mode 100644 index 190f409..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_520__add_performance_indexes.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE INDEX email_receptionDate_idx ON email(receptionDate ASC); -CREATE INDEX email_archiveDate_idx ON email(archiveDate NULLS FIRST); -CREATE INDEX email_mailFolder_idx ON email(mailFolder); -CREATE INDEX email_demandStatus_idx ON email(demandStatus); - -CREATE INDEX email_takenBy_idx ON email(takenBy); -CREATE INDEX email_client_idx ON email(client); -CREATE INDEX email_etatAttente_idx ON email(etatAttente); -CREATE INDEX email_priority_idx ON email(priority); -CREATE INDEX email_demandType_idx ON email(demandType); - -CREATE INDEX demandType_fields_OWNER_idx ON demandType_fields(OWNER); -CREATE INDEX rangeRow_range_idx ON rangeRow(range); -CREATE INDEX history_faxToMailUser_idx ON history(faxToMailUser); -CREATE INDEX history_fields_OWNER_idx ON history_fields(OWNER); - -CREATE INDEX mailfolder_readrightusers_readRightUsers_idx ON mailfolder_readrightusers(readRightUsers); -CREATE INDEX mailfolder_readrightgroups_readRightGroups_idx ON mailfolder_readrightgroups(readRightGroups); diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_580__transform_enum_set_to_lists.sql b/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_580__transform_enum_set_to_lists.sql deleted file mode 100644 index ba627fc..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_580__transform_enum_set_to_lists.sql +++ /dev/null @@ -1,25 +0,0 @@ --- configuration -alter table configuration_invalidFormDisabledActions drop constraint FK_fj3yycjetl6acpiybfsg4v0yq; -alter table configuration_searchDisplayColumns drop constraint FK_9ffmpp0utfad26oxe70efo1da; -drop table configuration_invalidFormDisabledActions; -drop table configuration_searchDisplayColumns; -alter table configuration add searchDisplayColumns text; -alter table configuration add invalidFormDisabledActions text; - --- demande type -alter table demandType_fields drop constraint FK_c44wglsh0xpua19f1ps9vn24i; -drop table demandType_fields; -alter table demandType add requiredFields text; - --- etat attente -alter table etatAttente_invalidFormDisabledActions drop constraint FK_221gjt0dyjtbndk8v7tr85ta6 ; -alter table etatAttente_validFormDisabledActions drop constraint FK_86hqc0dxhqyca7rbx7b3bfydr; -drop table etatAttente_invalidFormDisabledActions; -drop table etatAttente_validFormDisabledActions; -alter table etatAttente add invalidFormDisabledActions text; -alter table etatAttente add validFormDisabledActions text; - --- mail folder -alter table mailFolder_folderTableColumns drop constraint FK_ap7lwii8to9wlxefnu3pn0goe; -drop table mailFolder_folderTableColumns; -alter table mailFolder add folderTableColumns text; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_583__readd_editranfer_on_demandtype.sql b/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_583__readd_editranfer_on_demandtype.sql deleted file mode 100644 index 8174f75..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_583__readd_editranfer_on_demandtype.sql +++ /dev/null @@ -1,4 +0,0 @@ - --- demandtype -alter table demandtype add editransfer boolean; -update demandtype set editransfer = 'f'; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_597__mise_a_jour_performances.sql b/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_597__mise_a_jour_performances.sql deleted file mode 100644 index c827750..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_597__mise_a_jour_performances.sql +++ /dev/null @@ -1,81 +0,0 @@ --- remove contraints -alter table email drop constraint FK_4q69gdpfr96aqig9ephikqxxr; -alter table etatAttente drop constraint UK_e1mte18x0rh5akvjfbi5ljse9; -alter table etatattentes_mailfolder drop constraint FK_3gi1yi1o932oe5t8ikcnsd3ef; -alter table etatattentes_mailfolder drop constraint FK_hsynjnyke7heuntkxkks9voxy; -alter table history_fields drop constraint FK_qoup2jo9smmju8hgou9sq5108; -DROP INDEX idx_MailFolder_etatAttentes; -DROP INDEX email_etatAttente_idx; - --- renommage etat attente -ALTER TABLE email RENAME etatAttente TO waitingState; -ALTER TABLE etatAttente RENAME TO waitingState; -ALTER TABLE etatattentes_mailfolder RENAME TO mailfolder_waitingstates; -ALTER TABLE mailfolder_waitingstates RENAME etatAttentes TO waitingStates; -ALTER TABLE mailFolder RENAME useCurrentLevelEtatAttente TO useCurrentLevelWaitingState; - --- migration des topia id -update waitingState set topiaId = replace(topiaId, 'EtatAttente', 'WaitingState'); -update email set waitingState = replace(waitingState, 'EtatAttente', 'WaitingState'); -update mailfolder_waitingstates set waitingStates = replace(waitingStates, 'EtatAttente', 'WaitingState') where waitingStates is not null; - --- migration des champs obligatoire (enum) -update configuration set searchDisplayColumns = replace(searchDisplayColumns, 'ETAT_ATTENTE', 'WAITING_STATE') where searchDisplayColumns is not null; -update mailfolder set folderTableColumns = replace(folderTableColumns, 'ETAT_ATTENTE', 'WAITING_STATE') where folderTableColumns is not null; -update DemandType set requiredFields = replace(requiredFields, 'ETAT_ATTENTE', 'WAITING_STATE') where requiredFields is not null; - --- restore constraints -alter table waitingState add constraint UK_ccllv66h9tle79mgklh1kpicn unique (label); -alter table email - add constraint FK_nfplqi5mxyfuxgkpe3rb83put - foreign key (waitingState) - references waitingState; -alter table mailfolder_waitingstates - add constraint FK_tb0qx61jwbtopp4xjv089syt2 - foreign key (waitingStates) - references waitingState; -alter table mailfolder_waitingstates - add constraint FK_3ucrlum12s7ivskvvdgykxq7d - foreign key (mailFolder) - references mailFolder; -CREATE INDEX idx_MailFolder_waitingStates ON mailfolder_waitingstates(mailFolder); -CREATE INDEX email_waitingState_idx ON email(waitingState); - --- Reply -delete from reply; -ALTER TABLE reply ALTER sentDate SET NOT NULL; -ALTER TABLE reply ALTER subject SET NOT NULL; -ALTER TABLE reply ADD sender text not null; -ALTER TABLE reply ADD recipient text not null; -ALTER TABLE reply ADD replyContent varchar(255) not null; -ALTER TABLE reply ADD sentBy varchar(255) not null; - -create table replyContent ( - topiaId varchar(255) not null, - topiaVersion int8 not null, - topiaCreateDate timestamp, - source bytea not null, - primary key (topiaId) -); - -alter table reply add constraint UK_7xjte6c6h2lltfpu6ot1bel8k unique (replyContent); -alter table reply - add constraint FK_7xjte6c6h2lltfpu6ot1bel8k - foreign key (replyContent) - references replyContent; - -alter table reply - add constraint FK_9m87oooqhsbf1wbad9h4jcwm3 - foreign key (sentBy) - references faxToMailUser; - --- Last opener -ALTER TABLE email ADD lastAttachmentOpener varchar(255); -alter table email - add constraint FK_pu5j5vh83354jhoikyvb22jru - foreign key (lastAttachmentOpener) - references faxToMailUser; - --- Champs hitory fields en json -DROP TABLE history_fields; -ALTER TABLE history ADD fieldsJson text; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_620__modification_newclient_edireturn.sql b/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_620__modification_newclient_edireturn.sql deleted file mode 100644 index bc62a7a..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_620__modification_newclient_edireturn.sql +++ /dev/null @@ -1,43 +0,0 @@ - --- remove topia from newclient -drop table newclient; -create table newClient ( - name text, - emailAddress text, - faxNumber text, - caracteristic1 text, - caracteristic2 text, - caracteristic3 text, - code text not null, - company text not null, - brand text, - personInCharge text, - unique (code, company, emailAddress, faxNumber) -); - --- remove topia from edireturn -drop table edireturn; -create table ediReturn ( - rangeRowTopiaId text not null, - commandNumber text, - error text, - unique (rangeRowTopiaId) -); - --- clear client table -update email set client = null; -delete from client; - --- add company in client ---drop constraint UK_b4ck8pelycojqmbrd8n36mdfw; - -alter table client drop emailAddress; -alter table client drop faxNumber; -alter table client drop id; - -alter table client add company text not NULL; -alter table client add emailAddressesJson text; -alter table client add faxNumbersJson text; -alter table client alter brand drop not NULL; - -alter table client add constraint UK_kqpy7y2f4onck5julevr0hfg1 unique (code, company); diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_662__add_company_in_mailfolder.sql b/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_662__add_company_in_mailfolder.sql deleted file mode 100644 index 96072bc..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_662__add_company_in_mailfolder.sql +++ /dev/null @@ -1,5 +0,0 @@ - --- add mail folder level configuration -alter table mailfolder add useCurrentLevelCompany boolean; -alter table mailfolder add company text; -update mailfolder set useCurrentLevelCompany = 'f'; \ No newline at end of file diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_442__move_object_to_folder_configuration.sql b/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_442__move_object_to_folder_configuration.sql deleted file mode 100644 index 2b12ac1..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_442__move_object_to_folder_configuration.sql +++ /dev/null @@ -1,66 +0,0 @@ - --- move lock out of business model and to his own table -alter table email drop constraint FK_970tl3l0qssnsrvvb3m1n6ivp; -GO -alter table email drop column lockedby; -GO -create table mailLock ( - topiaId varchar(255) not null, - topiaVersion bigint not null, - topiaCreateDate datetime2, - lockOn varchar(255) not null, - lockBy varchar(255) not null, - primary key (topiaId) -); -alter table mailLock - add constraint UK_cebqxr5mtsd4wmm0x0nwaa5km unique (lockOn); -alter table mailLock - add constraint FK_cebqxr5mtsd4wmm0x0nwaa5km - foreign key (lockOn) - references email; -alter table mailLock - add constraint FK_gwxpc59s0wjg60djbk5xa4d5d - foreign key (lockBy) - references faxToMailUser; - --- edi transfer for each folder -alter table demandtype drop column editransfer; -alter table mailfolder add editransfer bit; -GO -update mailfolder set editransfer = 0 where parent is null; - --- reject allowed for email account -alter table EmailAccount add rejectAllowed bit; -GO -update EmailAccount set rejectAllowed = 0; - --- demandtype per folder -create table demandtypes_mailfolder ( - mailFolder varchar(255) not null, - demandTypes varchar(255) not null -); -alter table demandtypes_mailfolder - add constraint FK_apld4ycj71ouug7vmg5wtr1y9 - foreign key (demandTypes) - references demandType; -alter table demandtypes_mailfolder - add constraint FK_pmybd6fsyapv8ygtn7pjw258k - foreign key (mailFolder) - references mailFolder; -CREATE INDEX idx_MailFolder_demandTypes ON demandtypes_mailfolder(mailFolder); - --- range per folder -create table mailfolder_ranges ( - mailFolder varchar(255) not null, - ranges varchar(255) not null -); -alter table mailfolder_ranges - add constraint FK_kiolyiaeicw5he7xlima0ugbb - foreign key (ranges) - references range; -alter table mailfolder_ranges - add constraint FK_h78fwd9gc92wh7vw612q48xrr - foreign key (mailFolder) - references mailFolder; -CREATE INDEX idx_MailFolder_ranges ON mailfolder_ranges(mailFolder); -GO \ No newline at end of file diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_448__add_mail_folder_level_configuration.sql b/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_448__add_mail_folder_level_configuration.sql deleted file mode 100644 index 2edec41..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_448__add_mail_folder_level_configuration.sql +++ /dev/null @@ -1,7 +0,0 @@ - --- add mail folder level configuration -alter table mailfolder add useCurrentLevelDemandType bit; -alter table mailfolder add useCurrentLevelRange bit; -GO -update mailfolder set useCurrentLevelDemandType = 0; -update mailfolder set useCurrentLevelRange = 0; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_454__add_ldap_config.sql b/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_454__add_ldap_config.sql deleted file mode 100644 index 5208744..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_454__add_ldap_config.sql +++ /dev/null @@ -1,7 +0,0 @@ - --- add user and group hidden configuration -alter table FaxToMailUserGroup add hidden bit; -alter table FaxToMailUser add hidden bit; -GO -update FaxToMailUserGroup set hidden = 0; -update FaxToMailUser set hidden = 0; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_480__remove_faxtomailusergroup_loop_association_and_add_idx.sql b/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_480__remove_faxtomailusergroup_loop_association_and_add_idx.sql deleted file mode 100644 index 3375f08..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_480__remove_faxtomailusergroup_loop_association_and_add_idx.sql +++ /dev/null @@ -1,47 +0,0 @@ - --- remove unused association -ALTER TABLE faxtomailusergroup DROP constraint FK_8efs0kgau1bt0iifrn8bdbecy; -ALTER TABLE faxtomailusergroup DROP COLUMN faxtomailusergroup; - --- add column faxAccountType on emailAccount -ALTER TABLE emailAccount add faxAccountType bit; -GO -update emailAccount set faxAccountType = 0; - --- see http://www.sql-server-helper.com/tips/date-formats.aspx for convert - --- add email_idx on attachment -ALTER TABLE attachment ADD email_idx integer; -GO -UPDATE attachment SET email_idx = ( - SELECT COUNT(topiaid) FROM attachment sub - WHERE sub.email = attachment.email - AND (CONVERT(VARCHAR(23), sub.topiacreatedate, 126) + sub.topiaid) < (CONVERT(VARCHAR(23), attachment.topiacreatedate, 126) + attachment.topiaid) -); - --- add email_idx on history -ALTER TABLE history ADD email_idx integer; -GO -UPDATE history SET email_idx = ( - SELECT COUNT(topiaid) FROM history sub - WHERE sub.email = history.email - AND (CONVERT(VARCHAR(23), sub.topiacreatedate, 126) + sub.topiaid) < (CONVERT(VARCHAR(23), history.topiacreatedate, 126) + history.topiaid) -); - --- add email_idx on rangeRow -ALTER TABLE rangeRow ADD email_idx integer; -GO -UPDATE rangeRow SET email_idx = ( - SELECT COUNT(topiaid) FROM rangeRow sub - WHERE sub.email = rangeRow.email - AND (CONVERT(VARCHAR(23), sub.topiacreatedate, 126) + sub.topiaid) < (CONVERT(VARCHAR(23), rangeRow.topiacreatedate, 126) + rangeRow.topiaid) -); - --- add email_idx on reply -ALTER TABLE reply ADD email_idx integer; -GO -UPDATE reply SET email_idx = ( - SELECT COUNT(topiaid) FROM reply sub - WHERE sub.email = reply.email - AND (CONVERT(VARCHAR(23), sub.topiacreatedate, 126) + sub.topiaid) < (CONVERT(VARCHAR(23), reply.topiacreatedate, 126) + reply.topiaid) -); diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_520__add_performance_indexes.sql b/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_520__add_performance_indexes.sql deleted file mode 100644 index 5686835..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_520__add_performance_indexes.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE INDEX email_receptionDate_idx ON email(receptionDate ASC); -CREATE INDEX email_archiveDate_idx ON email(archiveDate); -CREATE INDEX email_mailFolder_idx ON email(mailFolder); -CREATE INDEX email_demandStatus_idx ON email(demandStatus); - -CREATE INDEX email_takenBy_idx ON email(takenBy); -CREATE INDEX email_client_idx ON email(client); -CREATE INDEX email_etatAttente_idx ON email(etatAttente); -CREATE INDEX email_priority_idx ON email(priority); -CREATE INDEX email_demandType_idx ON email(demandType); - -CREATE INDEX demandType_fields_OWNER_idx ON demandType_fields(OWNER); -CREATE INDEX rangeRow_range_idx ON rangeRow(range); -CREATE INDEX history_faxToMailUser_idx ON history(faxToMailUser); -CREATE INDEX history_fields_OWNER_idx ON history_fields(OWNER); - -CREATE INDEX mailfolder_readrightusers_readRightUsers_idx ON mailfolder_readrightusers(readRightUsers); -CREATE INDEX mailfolder_readrightgroups_readRightGroups_idx ON mailfolder_readrightgroups(readRightGroups); diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_580__transform_enum_set_to_lists.sql b/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_580__transform_enum_set_to_lists.sql deleted file mode 100644 index 3ebe0b4..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_580__transform_enum_set_to_lists.sql +++ /dev/null @@ -1,33 +0,0 @@ --- configuration -alter table configuration_invalidFormDisabledActions drop constraint FK_fj3yycjetl6acpiybfsg4v0yq; -alter table configuration_searchDisplayColumns drop constraint FK_9ffmpp0utfad26oxe70efo1da; -GO -drop table configuration_invalidFormDisabledActions; -drop table configuration_searchDisplayColumns; -alter table configuration add searchDisplayColumns varchar(MAX); -alter table configuration add invalidFormDisabledActions varchar(MAX); -GO - --- demande type -alter table demandType_fields drop constraint FK_c44wglsh0xpua19f1ps9vn24i; -GO -drop table demandType_fields; -alter table demandType add requiredFields varchar(MAX); -GO - --- etat attente -alter table etatAttente_invalidFormDisabledActions drop constraint FK_221gjt0dyjtbndk8v7tr85ta6 ; -alter table etatAttente_validFormDisabledActions drop constraint FK_86hqc0dxhqyca7rbx7b3bfydr; -GO -drop table etatAttente_invalidFormDisabledActions; -drop table etatAttente_validFormDisabledActions; -alter table etatAttente add invalidFormDisabledActions varchar(MAX); -alter table etatAttente add validFormDisabledActions varchar(MAX); -GO - --- mail folder -alter table mailFolder_folderTableColumns drop constraint FK_ap7lwii8to9wlxefnu3pn0goe; -GO -drop table mailFolder_folderTableColumns; -alter table mailFolder add folderTableColumns varchar(MAX); -GO \ No newline at end of file diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_583__readd_editranfer_on_demandtype.sql b/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_583__readd_editranfer_on_demandtype.sql deleted file mode 100644 index ae61f4b..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_583__readd_editranfer_on_demandtype.sql +++ /dev/null @@ -1,5 +0,0 @@ - --- demandtype -alter table demandtype add editransfer bit; -GO -update demandtype set editransfer = 0; diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_597__mise_a_jour_performances.sql b/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_597__mise_a_jour_performances.sql deleted file mode 100644 index 9ce2165..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_597__mise_a_jour_performances.sql +++ /dev/null @@ -1,90 +0,0 @@ --- remove contraints -alter table email drop constraint FK_4q69gdpfr96aqig9ephikqxxr; ---sql serveur n'utilise pas le nom donne :( ---alter table etatAttente drop constraint UK_e1mte18x0rh5akvjfbi5ljse9; -alter table etatattentes_mailfolder drop constraint FK_3gi1yi1o932oe5t8ikcnsd3ef; -alter table etatattentes_mailfolder drop constraint FK_hsynjnyke7heuntkxkks9voxy; -alter table history_fields drop constraint FK_qoup2jo9smmju8hgou9sq5108; -DROP INDEX etatattentes_mailfolder.idx_MailFolder_etatAttentes; -DROP INDEX email.email_etatAttente_idx; -GO - --- renommage etat attente -EXEC sp_rename 'etatAttente', 'waitingState'; -EXEC sp_rename 'etatattentes_mailfolder', 'mailfolder_waitingstates'; -GO -EXEC sp_rename 'email.etatAttente', 'waitingState', 'COLUMN'; -EXEC sp_rename 'mailfolder_waitingstates.etatAttentes', 'waitingStates', 'COLUMN'; -EXEC sp_rename 'mailFolder.useCurrentLevelEtatAttente', 'useCurrentLevelWaitingState', 'COLUMN'; -GO - --- migration des topia id -update waitingState set topiaId = replace(topiaId, 'EtatAttente', 'WaitingState'); -update email set waitingState = replace(waitingState, 'EtatAttente', 'WaitingState'); -update mailfolder_waitingstates set waitingStates = replace(waitingStates, 'EtatAttente', 'WaitingState') where waitingStates is not null; - --- migration des champs obligatoire (enum) -update configuration set searchDisplayColumns = replace(searchDisplayColumns, 'ETAT_ATTENTE', 'WAITING_STATE') where searchDisplayColumns is not null; -update mailfolder set folderTableColumns = replace(folderTableColumns, 'ETAT_ATTENTE', 'WAITING_STATE') where folderTableColumns is not null; -update DemandType set requiredFields = replace(requiredFields, 'ETAT_ATTENTE', 'WAITING_STATE') where requiredFields is not null; - --- restore constraints ---sql serveur n'utilise pas le nom donne :( ---alter table waitingState add constraint UK_ccllv66h9tle79mgklh1kpicn unique (label); -alter table email - add constraint FK_nfplqi5mxyfuxgkpe3rb83put - foreign key (waitingState) - references waitingState; -alter table mailfolder_waitingstates - add constraint FK_tb0qx61jwbtopp4xjv089syt2 - foreign key (waitingStates) - references waitingState; -alter table mailfolder_waitingstates - add constraint FK_3ucrlum12s7ivskvvdgykxq7d - foreign key (mailFolder) - references mailFolder; -CREATE INDEX idx_MailFolder_waitingStates ON mailfolder_waitingstates(mailFolder); -CREATE INDEX email_waitingState_idx ON email(waitingState); -GO - --- Reply -delete from reply; -ALTER TABLE reply ALTER COLUMN sentDate datetime2 NOT NULL; -ALTER TABLE reply ALTER COLUMN subject varchar(MAX) NOT NULL; -ALTER TABLE reply ADD sender varchar(MAX) not null; -ALTER TABLE reply ADD recipient varchar(MAX) not null; -ALTER TABLE reply ADD replyContent varchar(255) not null; -ALTER TABLE reply ADD sentBy varchar(255) not null; - -create table replyContent ( - topiaId varchar(255) not null, - topiaVersion bigint not null, - topiaCreateDate datetime2, - source varbinary(MAX) not null, - primary key (topiaId) -); - -alter table reply add constraint UK_7xjte6c6h2lltfpu6ot1bel8k unique (replyContent); -alter table reply - add constraint FK_7xjte6c6h2lltfpu6ot1bel8k - foreign key (replyContent) - references replyContent; - -alter table reply - add constraint FK_9m87oooqhsbf1wbad9h4jcwm3 - foreign key (sentBy) - references faxToMailUser; -GO - --- Last opener -ALTER TABLE email ADD lastAttachmentOpener varchar(255); -alter table email - add constraint FK_pu5j5vh83354jhoikyvb22jru - foreign key (lastAttachmentOpener) - references faxToMailUser; -GO - --- Champs hitory fields en json -DROP TABLE history_fields; -ALTER TABLE history ADD fieldsJson varchar(MAX); -GO diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_620__modification_newclient_edireturn.sql b/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_620__modification_newclient_edireturn.sql deleted file mode 100644 index 73922a6..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_620__modification_newclient_edireturn.sql +++ /dev/null @@ -1,50 +0,0 @@ - --- remove topia from newclient -drop table newclient; -GO -create table newClient ( - name varchar(MAX), - emailAddress varchar(255), - faxNumber varchar(255), - caracteristic1 varchar(MAX), - caracteristic2 varchar(MAX), - caracteristic3 varchar(MAX), - code varchar(255) not null, - company varchar(255) not null, - brand varchar(MAX), - personInCharge varchar(MAX), - unique (code, company, emailAddress, faxNumber) -); -GO - --- remove topia from edireturn -drop table edireturn; -GO -create table ediReturn ( - rangeRowTopiaId varchar(255) not null, - commandNumber varchar(MAX), - error varchar(MAX), - unique (rangeRowTopiaId) -); -GO - --- clear client table -update email set client = null; -delete from client; - --- add company in client ---drop constraint UK_b4ck8pelycojqmbrd8n36mdfw; - -alter table client drop column emailAddress; -alter table client drop column faxNumber; -alter table client drop column id; - -alter table client add company varchar(255) not NULL; -alter table client add emailAddressesJson varchar(MAX); -alter table client add faxNumbersJson varchar(MAX); - -alter table client alter column code varchar(255) not NULL; -alter table client alter column brand varchar(MAX) not NULL; - -alter table client add constraint UK_kqpy7y2f4onck5julevr0hfg1 unique (code, company); -GO diff --git a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_662__add_company_in_mailfolder.sql b/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_662__add_company_in_mailfolder.sql deleted file mode 100644 index d2fce5f..0000000 --- a/trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_662__add_company_in_mailfolder.sql +++ /dev/null @@ -1,6 +0,0 @@ - --- add mail folder level configuration -alter table mailfolder add useCurrentLevelCompany bit; -alter table mailfolder add company varchar(MAX); -GO -update mailfolder set useCurrentLevelCompany = 0; \ No newline at end of file diff --git a/trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties b/trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties deleted file mode 100644 index 0428445..0000000 --- a/trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties +++ /dev/null @@ -1,6 +0,0 @@ -faxtomail.attachment.demand.filename=Détail de la demande -faxtomail.email.projectReference.default=Votre demande du %s -faxtomail.service.email.save.clientCode.error=Impossible de trouver le client %s \! -faxtomail.validator.error.email.clientCode.required= -faxtomail.validator.error.email.demandType.required= -faxtomail.validator.error.email.projectReference.required= diff --git a/trunk/faxtomail-service/src/main/resources/pdf/demande.mustache b/trunk/faxtomail-service/src/main/resources/pdf/demande.mustache deleted file mode 100644 index 92ebc45..0000000 --- a/trunk/faxtomail-service/src/main/resources/pdf/demande.mustache +++ /dev/null @@ -1,124 +0,0 @@ -<html> - <head> - <style> - body { - font-family: "Trebuchet MS", Helvetica, sans-serif; - } - .title { - text-align:center; - } - .footer { - position: running(footer); - font-size: small; - } - table { - margin-bottom: 20px; - } - @page { - @bottom-center { content: element(footer) } - } - </style> - </head> - <body> - <h1 class="title">Détail de l'élément {{title}}</h1> - - <table> - <tr> - <td>Reçu le :</td> - <td colspan="3">{{receivedDate}}</td> - </tr> - <tr> - <td>Emetteur :</td> - <td colspan="3">{{sender}}</td> - </tr> - <tr> - <td>Objet :</td> - <td colspan="3">{{object}}</td> - </tr> - <tr> - <td>Client :</td> - <td colspan="3">{{#client}}{{client.code}} ({{client.brand}}){{/client}}</td> - </tr> - <tr> - <td>Type :</td> - <td colspan="3">{{demandType.label}}</td> - </tr> - <tr> - <td>Priorité :</td> - <td colspan="3">{{priority.label}}</td> - </tr> - <tr> - <td>Référence chantier :</td> - <td colspan="3">{{projectReference}}</td> - </tr> - <tr> - <td>Notre référence :</td> - <td colspan="3">{{companyReference}}</td> - </tr> - <tr> - <td>Etat d'attente :</td> - <td colspan="3">{{waitingState.label}}</td> - </tr> - <tr> - <td>Statut :</td> - <td colspan="3">{{status.label}}</td> - </tr> - <tr> - <td>Pris par :</td> - <td colspan="3">{{takenBy}}</td> - </tr> - <tr> - <td>Première ouverture par :</td> - <td>{{firstOpeningUser}}</td> - <td>le :</td> - <td>{{firstOpeningDate}}</td> - </tr> - <tr> - <td>Dernière modification par :</td> - <td>{{lastModificationUser}}</td> - <td>le :</td> - <td>{{lastModificationDate}}</td> - </tr> - <tr> - <td>Dernière ouverture de pièce jointe par :</td> - <td>{{lastAttachmentOpeningInFolderUser}}</td> - <td>le :</td> - <td>{{lastAttachmentOpeningInFolderDate}}</td> - </tr> - <tr> - <td>Message :</td> - <td colspan="3">{{message}}</td> - </tr> - </table> - - {{#hasRangeRows}} - <table> - <caption></caption> - <thead> - <tr> - <th>Gammes</th> - <th>N° commande/devis</th> - <th>Quantitié de devis</th> - <th>Quantitié de PF</th> - <th>Quantitié de SAV</th> - </tr> - </thead> - <tbody> - {{#rangeRows}} - <tr> - <td>{{range.label}}</td> - <td>{{commandNumber}}</td> - <td>{{quotationQuantity}}</td> - <td>{{productQuantity}}</td> - <td>{{savQuantity}}</td> - </tr> - {{/rangeRows}} - </tbody> - </table> - {{/hasRangeRows}} - - <div class="footer"> - Date d'impression : {{date}} - </div> - </body> -</html> \ No newline at end of file diff --git a/trunk/faxtomail-service/src/main/resources/validators.xml b/trunk/faxtomail-service/src/main/resources/validators.xml deleted file mode 100644 index d357f1b..0000000 --- a/trunk/faxtomail-service/src/main/resources/validators.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: Service - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - -<!DOCTYPE validators PUBLIC - "-//Apache Struts//XWork Validator Config 1.0//EN" - "http://struts.apache.org/dtds/xwork-validator-config-1.0.dtd"> -<validators> - - <!-- les validateurs fournis par XWork --> - <validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/> - <validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/> - <validator name="regex" class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/> - <validator name="stringlength" class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/> - <validator name="int" class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/> - <validator name="long" class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/> - <validator name="short" class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/> - <validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/> - <validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/> - <validator name="fieldexpression" class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/> - - <!-- les validateurs fournis par nuiton-validator --> - <validator name="collectionUniqueKey" class="org.nuiton.validator.xwork2.field.CollectionUniqueKeyValidator"/> - <validator name="fieldexpressionwithparams" class="org.nuiton.validator.xwork2.field.FieldExpressionWithParamsValidator"/> - <validator name="skipablefieldexpression" class="org.nuiton.validator.xwork2.field.NuitonFieldExpressionValidator"/> - <validator name="existingFile" class="org.nuiton.validator.xwork2.field.ExistingFileFieldValidator"/> - - <!-- les validateur specifiques --> - <validator name="email" class="com.franciaflex.faxtomail.services.validators.FaxToMailEmailValidator"/> -</validators> diff --git a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java b/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java deleted file mode 100644 index db4c9cb..0000000 --- a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.File; -import java.io.IOException; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.SystemUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.hibernate.cfg.Environment; -import org.hibernate.dialect.H2Dialect; -import org.junit.After; -import org.nuiton.topia.persistence.support.TopiaSqlSupport; -import org.nuiton.topia.persistence.support.TopiaSqlWork; - -import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaApplicationContext; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; -import com.franciaflex.faxtomail.services.FaxToMailService; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; - -public class AbstractFaxToMailServiceTest { - - private static final Log log = LogFactory.getLog(AbstractFaxToMailServiceTest.class); - - protected static final String DATABASE_REF = "DataBaseRef"; - - protected static FaxToMailConfiguration applicationConfig; - - protected FaxToMailServiceContext serviceContext; - - protected FaxToMailTopiaApplicationContext applicationContext; - - protected List<FaxToMailTopiaPersistenceContext> openedTransactions = new LinkedList<>(); - - protected File databaseFile; - - protected FaxToMailUser currentUser; - - protected Map<String, String> getDatabaseConfiguration(String dataBase) { - Map<String, String> hibernateH2Config = new HashMap<String, String>(); - - hibernateH2Config.putAll(getApplicationConfig().getTopiaProperties()); - - hibernateH2Config.put(Environment.DIALECT, H2Dialect.class.getName()); - hibernateH2Config.put(Environment.DRIVER, org.h2.Driver.class.getName()); - hibernateH2Config.put(Environment.USER, "sa"); - hibernateH2Config.put(Environment.PASS, ""); - hibernateH2Config.put(Environment.HBM2DDL_AUTO, ""); // default validate won't work with h2 - - File tempDirFile = SystemUtils.getJavaIoTmpDir(); - - databaseFile = new File(tempDirFile, dataBase); - - // Set test data in MSSQLServer mode (like production database) - String h2dataPath = databaseFile.getAbsolutePath() + File.separator + "h2data-test;MODE=MSSQLServer"; - - String jdbcUrl = "jdbc:h2:file:" + h2dataPath; - - hibernateH2Config.put(Environment.URL, jdbcUrl); - - if (log.isTraceEnabled()) { - log.trace("will store H2 data in " + h2dataPath); - log.trace("allJpaParameters = " + hibernateH2Config); - } - - if (log.isDebugEnabled()) { - log.debug("jdbc url is\n" + jdbcUrl); - } - - return hibernateH2Config; - } - - protected FaxToMailTopiaApplicationContext getApplicationContext() { - - if (applicationContext == null) { - String databaseName = UUID.randomUUID().toString(); - Map<String, String> hibernateH2Config = getDatabaseConfiguration(databaseName); - - applicationContext = new FaxToMailTopiaApplicationContext(hibernateH2Config); - addMissingTable(applicationContext); - - if (log.isTraceEnabled()) { - log.trace("created root context " + applicationContext); - } - } - - return applicationContext; - } - - /** - * Ajoute manuellement les tables qui ne sont pas gérées par Topia. - * - * @param applicationContext application context - */ - protected void addMissingTable(FaxToMailTopiaApplicationContext applicationContext) { - FaxToMailTopiaPersistenceContext persistenceContext = applicationContext.newPersistenceContext(); - TopiaSqlSupport sqlSupport = persistenceContext.getSqlSupport(); - sqlSupport.doSqlWork(new TopiaSqlWork() { - @Override - public void execute(Connection connection) throws SQLException { - - Statement stat = connection.createStatement(); - - stat.executeUpdate("create table newClient ( " + - "name longvarchar, " + - "emailAddress longvarchar, " + - "faxNumber longvarchar, " + - "caracteristic1 longvarchar, " + - "caracteristic2 longvarchar, " + - "caracteristic3 longvarchar, " + - "code longvarchar not null, " + - "company longvarchar not null, " + - "brand longvarchar, " + - "personInCharge longvarchar, " + - "unique (code, company, emailAddress, faxnumber)" + - "); "); - - stat.executeUpdate("create table ediReturn ( " + - "rangeRowTopiaId longvarchar not null," + - "commandNumber longvarchar, " + - "error longvarchar, " + - "unique (rangeRowTopiaId) " + - ")"); - - connection.commit(); - - } - }); - - persistenceContext.close(); - } - - protected FaxToMailTopiaPersistenceContext newPersistenceContext() { - - FaxToMailTopiaPersistenceContext persistenceContext; - - persistenceContext = getApplicationContext().newPersistenceContext(); - - if (log.isTraceEnabled()) { - log.trace("opened transaction " + persistenceContext); - } - - openedTransactions.add(persistenceContext); - - return persistenceContext; - - } - - @After - public void tearDown() throws IOException { - - for (FaxToMailTopiaPersistenceContext openedTransaction : openedTransactions) { - - if (log.isTraceEnabled()) { - log.trace("closing transaction " + openedTransaction); - } - - openedTransaction.close(); - - } - - if (applicationContext != null) { - - if (log.isTraceEnabled()) { - log.trace("closing transaction " + applicationContext); - } - - applicationContext.close(); - - } - - // clear full directory - if (databaseFile != null) { - FileUtils.deleteDirectory(databaseFile); - } - } - - protected static FaxToMailConfiguration getApplicationConfig() { - - if (applicationConfig == null) { - - applicationConfig = new FaxToMailConfiguration("faxToMail.properties"); - - } - - return applicationConfig; - - } - - protected FaxToMailServiceContext getServiceContext() { - - if (serviceContext == null) { - - FaxToMailServiceContext serviceContext = FaxToMailServiceContext.newDirectServiceContext(getApplicationContext()); - - serviceContext.setApplicationConfig(getApplicationConfig()); - - this.serviceContext = serviceContext; - } - - return serviceContext; - - } - - protected <E extends FaxToMailService> E newService(Class<E> serviceClass) { - - return getServiceContext().newService(serviceClass); - - } - - protected FaxToMailUser getCurrentUser() { - if (currentUser == null) { - FaxToMailUserTopiaDao faxToMailUserTopiaDao = serviceContext.getPersistenceContext().getFaxToMailUserDao(); - currentUser = faxToMailUserTopiaDao.forLoginEquals("mlefebvre").findUnique(); - } - return currentUser; - } -} diff --git a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/ClientServiceTest.java b/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/ClientServiceTest.java deleted file mode 100644 index d170a5c..0000000 --- a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/ClientServiceTest.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.IOException; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.List; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.nuiton.topia.persistence.support.TopiaSqlSupport; -import org.nuiton.topia.persistence.support.TopiaSqlWork; - -import com.franciaflex.faxtomail.persistence.entities.Client; -import com.franciaflex.faxtomail.persistence.entities.ClientTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.NewClient; - -/** - * Test de client service. - * - * @author Eric Chatellier - */ -public class ClientServiceTest extends AbstractFaxToMailServiceTest { - - @Before - public void setUp() throws IOException { - newService(InitTestData.class).initTestData(); - } - - /** - * Test le nombre de client importés. - */ - @Test - public void testImportClientCount() { - ClientTopiaDao clientDao = getServiceContext().getPersistenceContext().getClientDao(); - - // asserts - Assert.assertEquals(4, clientDao.count()); - // les emails et les fax ont une gestion particuliere - Assert.assertFalse(clientDao.forEmailAddressesJsonLike("gerard.menvussa@code.com").isEmpty()); - Assert.assertFalse(clientDao.forFaxNumbersJsonLike("0498877665").isEmpty()); - } - - /** - * Ajout des clients dans la table temporaire et appel le service de traitement de cette table. - */ - @Test - public void testAddNewClientInTmpTable() { - - ClientService clientService = newService(ClientService.class); - ClientTopiaDao clientDao = getServiceContext().getPersistenceContext().getClientDao(); - - // asserts - Assert.assertTrue(clientDao.forEmailAddressesJsonLike("gerard.menvussa@lutin.com").isEmpty()); - - // add new clients - TopiaSqlSupport sqlSupport = getServiceContext().getPersistenceContext().getSqlSupport(); - sqlSupport.doSqlWork(new TopiaSqlWork() { - @Override - public void execute(Connection connection) throws SQLException { - - String query = String.format("INSERT INTO %s(%s,%s,%s,%s,%s) VALUES(?, ?, ?, ?, ?)", - NewClient.class.getSimpleName(), - NewClient.PROPERTY_CODE, - NewClient.PROPERTY_COMPANY, - NewClient.PROPERTY_BRAND, - NewClient.PROPERTY_EMAIL_ADDRESS, - NewClient.PROPERTY_NAME); - - PreparedStatement stat = connection.prepareStatement(query); - stat.setString(1, "99154"); - stat.setString(2, "FX"); - stat.setString(3, "FX"); - stat.setString(4, "gerard.menvussa@lutin.com"); - stat.setString(5, "Gerard"); - int result = stat.executeUpdate(); - Assert.assertEquals(1, result); - - stat.setString(1, "99154"); - stat.setString(2, "FX"); - stat.setString(3, "FX"); - stat.setString(4, "gerard.menvussa+test@lutin.com"); - stat.setString(5, "Gerard"); - result = stat.executeUpdate(); - Assert.assertEquals(1, result); - } - }); - - // precedure de mise à jour - clientService.updateNewClients(); - - // asserts - List<Client> clients = clientDao.forEmailAddressesJsonLike("gerard.menvussa@lutin.com"); - Assert.assertEquals(1, clients.size()); - Assert.assertEquals(2, clients.get(0).getEmailAddresses().size()); - - } -} diff --git a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java b/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java deleted file mode 100644 index 5a2b3e0..0000000 --- a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java +++ /dev/null @@ -1,217 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Collections; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.franciaflex.faxtomail.persistence.entities.EmailFilter; -import com.franciaflex.faxtomail.persistence.entities.SearchFilter; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.nuiton.topia.persistence.TopiaEntities; -import org.nuiton.util.pagination.PaginationParameter; -import org.nuiton.util.pagination.PaginationResult; - -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.google.common.collect.Iterables; -import com.google.common.collect.Sets; - -/** - * Email service tests. - * - * @author Eric Chatellier - */ -public class EmailServiceTest extends AbstractFaxToMailServiceTest { - - protected EmailService service; - - protected ReferentielService referentielService; - - protected UserService userService; - - @Before - public void setUp() throws IOException { - service = newService(EmailService.class); - referentielService = newService(ReferentielService.class); - userService = newService(UserService.class); - newService(InitTestData.class).initTestData(); - } - - @Test - public void testSearch() { - - PaginationParameter paginationParameter = PaginationParameter.of(0, 50); - - // empty filter - SearchFilter filter = new SearchFilter(); - PaginationResult<Email> emails = service.search(filter, getCurrentUser(), paginationParameter); - Assert.assertEquals(10, emails.getCount()); - - // client code filter - filter.setClientCode("9915"); - emails = service.search(filter, getCurrentUser(), paginationParameter); - Assert.assertEquals(10, emails.getCount()); - - // client code filter + subject filter - filter.setDemandObject("A+"); - emails = service.search(filter, getCurrentUser(), paginationParameter); - Assert.assertEquals(0, emails.getCount()); - - // some other fields just to test query syntax - filter.setMinReceptionDate(getServiceContext().getNow()); - filter.setMaxReceptionDate(getServiceContext().getNow()); - filter.setTakenBy(userService.getUserByLogin("cmarquis")); - filter.setMinModificationDate(getServiceContext().getNow()); - filter.setMaxModificationDate(getServiceContext().getNow()); - filter.setModifiedBy(userService.getUserByLogin("cmarquis")); - filter.setMinTransferDate(getServiceContext().getNow()); - filter.setMaxTransferDate(getServiceContext().getNow()); - filter.setTransferBy(userService.getUserByLogin("cmarquis")); - filter.setMinArchivedDate(getServiceContext().getNow()); - filter.setMaxArchivedDate(getServiceContext().getNow()); - filter.setArchivedBy(userService.getUserByLogin("cmarquis")); - filter.setMinPrintingDate(getServiceContext().getNow()); - filter.setMaxPrintingDate(getServiceContext().getNow()); - filter.setPrintingBy(userService.getUserByLogin("cmarquis")); - - filter.setSender("test"); - filter.setBody("test"); - filter.setDemandStatus(Collections.singletonList(DemandStatus.ARCHIVED)); - filter.setGamme(Collections.singletonList(referentielService.getAllRange().get(0))); - filter.setPriority(referentielService.getAllPriority()); - filter.setWaitingStates(Collections.singletonList(referentielService.getAllWaitingState().get(0))); - filter.setEdiCodeNumber("test"); - filter.setLocalReference("test"); - filter.setMessage("test"); - filter.setProjectReference("test"); - emails = service.search(filter, getCurrentUser(), paginationParameter); - Assert.assertEquals(0, emails.getCount()); - } - - /** - * Generate email detail as pdf test. - * @throws InterruptedException - */ - @Test - public void testEmailDetailsPdf() throws InterruptedException { - - // select a random test email - PaginationParameter paginationParameter = PaginationParameter.of(0, 1); - SearchFilter filter = new SearchFilter(); - PaginationResult<Email> emails = service.search(filter, getCurrentUser(), paginationParameter); - Email testEmail = emails.getElements().get(0); - - // test pdf generation - AttachmentFile attachmentFile = service.getEmailDetailAsAttachment(testEmail); - Assert.assertNotNull(attachmentFile); - } - - /** - * Test que le contenu textuel du pdf généré. - */ - @Test - public void testEmailDetails() { - // select a random test email - PaginationParameter paginationParameter = PaginationParameter.of(0, 1); - SearchFilter filter = new SearchFilter(); - PaginationResult<Email> emails = service.search(filter, getCurrentUser(), paginationParameter); - Email testEmail = emails.getElements().get(0); - - // get html content - String content = ((EmailServiceImpl)service).getEmailDetailAsHtml(testEmail); - Assert.assertTrue(content.contains(testEmail.getObject())); - } - - @Test - public void testGetEmailForFolder() { - - // tests fetch + pagination - - PaginationParameter page = PaginationParameter.of(0, 7, Email.PROPERTY_RECEPTION_DATE, false); - MailFolderTopiaDao mailFolderDao = getServiceContext().getPersistenceContext().getMailFolderDao(); - MailFolder cyril = mailFolderDao.forNameEquals("Cyril").findUnique(); - - // FIXME required for getEmailForFolder security check - cyril.setFolderReadable(true); - - PaginationResult<Email> page1 = service.getEmailForFolder(cyril, getCurrentUser(), new EmailFilter(), page); - Assert.assertEquals(10, page1.getCount()); - Assert.assertEquals(7, page1.getElements().size()); - - PaginationResult<Email> page2 = service.getEmailForFolder(cyril, getCurrentUser(), new EmailFilter(), page1.getNextPage()); - Assert.assertEquals(10, page2.getCount()); - Assert.assertEquals(3, page2.getElements().size()); - - Set<String> page1Ids = Sets.newHashSet(Iterables.transform(page1.getElements(), TopiaEntities.getTopiaIdFunction())); - Set<String> page2Ids = Sets.newHashSet(Iterables.transform(page2.getElements(), TopiaEntities.getTopiaIdFunction())); - Assert.assertTrue(Sets.intersection(page1Ids, page2Ids).isEmpty()); - - } - - /** - * Test de l'import de la reprise des archives. - * - * @throws IOException - */ - @Test - public void testImportArchive() throws IOException { - try (InputStream is = EmailServiceTest.class.getResourceAsStream("/archives/archives.csv")) { - File attachmentBase = new File("src/test/resources/archives"); - service.importArchive(is, attachmentBase); - } - } - - /** - * Test le la fonction de calcul des quantités par gammes qui fesait une erreur de groupBy en - * 1.0.0-rc-3. - */ - @Test - public void testComputeQuantititesByRange() { - MailFolderTopiaDao mailFolderDao = getServiceContext().getPersistenceContext().getMailFolderDao(); - MailFolder cyril = mailFolderDao.forNameEquals("Cyril").findUnique(); - - Map<Range, Long[]> quantitiesByRange = service.computeQuantitiesByRange(cyril); - Assert.assertEquals(4, quantitiesByRange.size()); - - // recupere la premiere lignes - Entry<Range, Long[]> entry = quantitiesByRange.entrySet().iterator().next(); - Assert.assertEquals("Bas de gamme", entry.getKey().getLabel()); - Assert.assertEquals(500, entry.getValue()[0].longValue()); - Assert.assertEquals(600, entry.getValue()[1].longValue()); - // NPE : Assert.assertEquals(600, entry.getValue()[2].longValue()); - } -} diff --git a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestData.java b/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestData.java deleted file mode 100644 index 9cbccd3..0000000 --- a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestData.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.IOException; - -import com.franciaflex.faxtomail.services.FaxToMailService; - -/** - * @author Arnaud Thimel (Code Lutin) - */ -public interface InitTestData extends FaxToMailService { - - void initTestData() throws IOException; - -} diff --git a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestDataImpl.java b/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestDataImpl.java deleted file mode 100644 index 3c660f8..0000000 --- a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestDataImpl.java +++ /dev/null @@ -1,354 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.decorator.Decorator; - -import com.franciaflex.faxtomail.persistence.entities.Client; -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.History; -import com.franciaflex.faxtomail.persistence.entities.HistoryTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.HistoryType; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Priority; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import com.franciaflex.faxtomail.persistence.entities.RangeRowTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.services.DecoratorService; -import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; -import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; -import com.franciaflex.faxtomail.services.service.exceptions.InvalidClientException; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; - -/** - * Test service to manage test data. - * - * @author Eric Chatellier - */ -public class InitTestDataImpl extends FaxToMailServiceSupport implements InitTestData { - - private static final Log log = LogFactory.getLog(InitTestDataImpl.class); - - /** - * Import all test data. - * - * @throws IOException - */ - @Override - public void initTestData() throws IOException { - if (log.isDebugEnabled()) { - log.debug("Init test data"); - } - ReferentielService referentielService = newService(ReferentielService.class); - - // import etat attentes - List<WaitingState> waitingStates = null; - try (InputStream is = InitTestDataImpl.class.getResourceAsStream("/csv/etatattentes.csv")) { - waitingStates = referentielService.importWaitingStates(is); - } - - // create test groups and users - FaxToMailUserGroupTopiaDao faxToMailUserGroupDao = getPersistenceContext().getFaxToMailUserGroupDao(); - FaxToMailUserGroup group1 = faxToMailUserGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "group1"); - FaxToMailUserGroup group2 = faxToMailUserGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "group2"); - FaxToMailUserGroup group3 = faxToMailUserGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "group3"); - Collection<FaxToMailUserGroup> groups12 = Lists.newArrayList(group1, group2); - Collection<FaxToMailUserGroup> groups23 = Lists.newArrayList(group3, group2); - - FaxToMailUserTopiaDao userDao = getPersistenceContext().getFaxToMailUserDao(); - FaxToMailUser marc = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Lefèbvre", - FaxToMailUser.PROPERTY_FIRST_NAME, "Marc", - FaxToMailUser.PROPERTY_LOGIN, "mlefebvre", - FaxToMailUser.PROPERTY_TRIGRAPH, "MLE", - FaxToMailUser.PROPERTY_USER_GROUPS, groups12); - FaxToMailUser cyril = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Baillet", - FaxToMailUser.PROPERTY_FIRST_NAME, "Cyril", - FaxToMailUser.PROPERTY_LOGIN, "cbaillet", - FaxToMailUser.PROPERTY_TRIGRAPH, "CBA", - FaxToMailUser.PROPERTY_USER_GROUPS, groups12); - FaxToMailUser frederic = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Viala", - FaxToMailUser.PROPERTY_FIRST_NAME, "Frédéric", - FaxToMailUser.PROPERTY_LOGIN, "fviala", - FaxToMailUser.PROPERTY_TRIGRAPH, "FVI", - FaxToMailUser.PROPERTY_USER_GROUPS, groups12); - FaxToMailUser claire = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Marquis", - FaxToMailUser.PROPERTY_FIRST_NAME, "Claire", - FaxToMailUser.PROPERTY_LOGIN, "cmarquis", - FaxToMailUser.PROPERTY_TRIGRAPH, "CMA", - FaxToMailUser.PROPERTY_USER_GROUPS, groups12); - FaxToMailUser agathe = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Borde", - FaxToMailUser.PROPERTY_FIRST_NAME, "Agathe", - FaxToMailUser.PROPERTY_LOGIN, "aborde", - FaxToMailUser.PROPERTY_TRIGRAPH, "ABO", - FaxToMailUser.PROPERTY_USER_GROUPS, groups12); - FaxToMailUser jeanne = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Bourgoin", - FaxToMailUser.PROPERTY_FIRST_NAME, "Jeanne", - FaxToMailUser.PROPERTY_LOGIN, "jbourgoin", - FaxToMailUser.PROPERTY_TRIGRAPH, "JBO", - FaxToMailUser.PROPERTY_USER_GROUPS, groups12); - - // create folders - MailFolderTopiaDao folderDao = getPersistenceContext().getMailFolderDao(); - Map<String, MailFolder> foldersByName = new HashMap<>(); - MailFolder franciaflex = folderDao.create(MailFolder.PROPERTY_NAME, "Franciaflex"); - - // categories - MailFolder chargesClientelle = folderDao.create(MailFolder.PROPERTY_NAME, "Chargés de clientèle", - MailFolder.PROPERTY_PARENT, franciaflex, - MailFolder.PROPERTY_REPLY_ADDRESSES, Lists.newArrayList("no-reply@franciaflex.com")); - franciaflex.addChildren(chargesClientelle); - foldersByName.put(chargesClientelle.getName(), chargesClientelle); - - MailFolder sav = folderDao.create(MailFolder.PROPERTY_NAME, "SAV", - MailFolder.PROPERTY_PARENT, franciaflex, - MailFolder.PROPERTY_WAITING_STATES, waitingStates.subList(0, 1), - MailFolder.PROPERTY_READ_RIGHT_GROUPS, groups23); - franciaflex.addChildren(sav); - foldersByName.put(sav.getName(), sav); - - // user folders - MailFolder cyrilFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Cyril", - MailFolder.PROPERTY_PARENT, chargesClientelle, - MailFolder.PROPERTY_WAITING_STATES, waitingStates.subList(1, 2), - MailFolder.PROPERTY_READ_RIGHT_USERS, Lists.newArrayList(cyril)); - chargesClientelle.addChildren(cyrilFolder); - foldersByName.put(cyrilFolder.getName(), cyrilFolder); - - MailFolder claireFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Claire", - MailFolder.PROPERTY_PARENT, chargesClientelle); - chargesClientelle.addChildren(claireFolder); - foldersByName.put(claireFolder.getName(), claireFolder); - - MailFolder agatheFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Agathe", - MailFolder.PROPERTY_PARENT, chargesClientelle, - MailFolder.PROPERTY_WAITING_STATES, waitingStates.subList(2, 3)); - chargesClientelle.addChildren(agatheFolder); - foldersByName.put(agatheFolder.getName(), agatheFolder); - - MailFolder marcFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Marc", - MailFolder.PROPERTY_PARENT, sav); - sav.addChildren(marcFolder); - foldersByName.put(marcFolder.getName(), marcFolder); - - MailFolder fredericFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Frédéric", - MailFolder.PROPERTY_PARENT, sav); - sav.addChildren(fredericFolder); - foldersByName.put(fredericFolder.getName(), fredericFolder); - - MailFolder jeanneFolder = folderDao.create(MailFolder.PROPERTY_NAME, "Jeanne", - MailFolder.PROPERTY_PARENT, sav); - sav.addChildren(jeanneFolder); - foldersByName.put(jeanneFolder.getName(), jeanneFolder); - - // droits global à marc pour tout - franciaflex.addReadRightUsers(marc); - franciaflex = folderDao.update(franciaflex); - - // import test csv - List<Range> ranges = null; - try (InputStream is = InitTestDataImpl.class.getResourceAsStream("/csv/ranges.csv")) { - ranges = referentielService.importRanges(is); - } - List<Priority> priorities = null; - try (InputStream is = InitTestDataImpl.class.getResourceAsStream("/csv/priorities.csv")) { - priorities = referentielService.importPriorities(is); - } - try (InputStream is = InitTestDataImpl.class.getResourceAsStream("/csv/email_accounts.csv")) { - referentielService.importEmailAccounts(is); - } - List<Client> clients = null; - try (InputStream is = InitTestDataImpl.class.getResourceAsStream("/csv/clients.csv")) { - clients = referentielService.importClients(is); - } - List<DemandType> types = null; - try (InputStream is = InitTestDataImpl.class.getResourceAsStream("/csv/demandtypes.csv")) { - types = referentielService.importDemandTypes(is); - - // ajoute le champ GAMME en champ obligatoire pour tester les quantités par gammes - types.get(0).setRequiredFields(EnumSet.of(MailField.CLIENT, MailField.RANGE_ROW)); - } - try (InputStream is = InitTestDataImpl.class.getResourceAsStream("/csv/email_filters.csv")) { - referentielService.importEmailFilters(is, foldersByName); - } - - // create test mail - HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao(); - RangeRowTopiaDao rangeRowDao = getPersistenceContext().getRangeRowDao(); - EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); - createEmails(historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, cyrilFolder, cyril); - } - - protected void createEmails(HistoryTopiaDao historyDao, RangeRowTopiaDao rangeRowDao, EmailTopiaDao emailDao, List<Range> ranges, - List<Client> clients, List<DemandType> types, List<Priority> priorities, MailFolder folder, FaxToMailUser user) - throws InvalidClientException { - for (int i = 0; i < 5; i++) { - createEmail(historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, folder, user); - } - } - - protected void createEmail(HistoryTopiaDao historyDao, RangeRowTopiaDao rangeRowDao, EmailTopiaDao emailDao, List<Range> ranges, - List<Client> clients, List<DemandType> types, List<Priority> priorities, MailFolder folder, FaxToMailUser user) - throws InvalidClientException { - - List<RangeRow> rangeRows = new ArrayList<>(); - - Client client = clients.get(0); - boolean fax = false; - List<String> senders = client.getEmailAddresses(); - List<String> faxNumbers = client.getFaxNumbers(); - if (CollectionUtils.isEmpty(senders) && CollectionUtils.isNotEmpty(faxNumbers)) { - senders = Collections.singletonList(client.getFaxNumbers().get(0)); - fax = true; - } - String sender = null; - if (CollectionUtils.isNotEmpty(senders)) { - sender = senders.get(0); - } - String faxNumber = null; - if (CollectionUtils.isNotEmpty(faxNumbers)) { - faxNumber = faxNumbers.get(0); - } - - boolean opened = true; //random.nextBoolean(); - - Decorator<Date> dateDecorator = getDecoratorService().getDecoratorByType(Date.class, DecoratorService.DATE); - - Date now = new Date(); - History history = historyDao.create( - History.PROPERTY_TYPE, HistoryType.CREATION, - History.PROPERTY_MODIFICATION_DATE, now); - history.setFields(Sets.newHashSet( - Email.PROPERTY_SENDER, Email.PROPERTY_CLIENT, - Email.PROPERTY_PROJECT_REFERENCE, Email.PROPERTY_OBJECT, Email.PROPERTY_RECEPTION_DATE, - Email.PROPERTY_MAIL_FOLDER, Email.PROPERTY_DEMAND_STATUS)); - - String projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(now)); - - Email email = emailDao.create( - Email.PROPERTY_SENDER, sender, - Email.PROPERTY_FAX, fax, - Email.PROPERTY_CLIENT, client, - Email.PROPERTY_PROJECT_REFERENCE, projectRef, - Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " - + client.getName() + " / " + faxNumber + " / " + dateDecorator.toString(now), - Email.PROPERTY_RECEPTION_DATE, now, - Email.PROPERTY_MAIL_FOLDER, folder, - Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED, - Email.PROPERTY_HISTORY, Lists.newArrayList(history), - Email.PROPERTY_ORIGINAL_EMAIL, "test"); - - if (opened) { - - getEmailService().addToHistory(email.getTopiaId(), HistoryType.OPENING, user, now); - DemandType demandType = types.get(0); // types.get(0) à des gammes obligatoires - if (FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.RANGE_ROW)) { - for (int j = 0; j < 4; j++) { - RangeRow rangeRow = rangeRowDao.create( - RangeRow.PROPERTY_RANGE, ranges.get(j), - RangeRow.PROPERTY_COMMAND_NUMBER, RandomStringUtils.randomNumeric(6), - RangeRow.PROPERTY_PRODUCT_QUANTITY, 50, - RangeRow.PROPERTY_SAV_QUANTITY, 60); - rangeRows.add(rangeRow); - } - email.setRangeRow(rangeRows); - } - - email.setDemandType(demandType); - email.setPriority(priorities.get(0)); - email.setRangeRow(rangeRows); - getEmailService().saveEmail(email, user, Email.PROPERTY_DEMAND_TYPE, Email.PROPERTY_PRIORITY, Email.PROPERTY_RANGE_ROW); - } - - Calendar cal = Calendar.getInstance(); - cal.add(Calendar.DAY_OF_MONTH, -1); - Date yesterday = cal.getTime(); - history = historyDao.create(History.PROPERTY_TYPE, HistoryType.CREATION, - History.PROPERTY_MODIFICATION_DATE, yesterday); - history.setFields(Sets.newHashSet(Email.PROPERTY_SENDER, - Email.PROPERTY_CLIENT, Email.PROPERTY_PROJECT_REFERENCE, Email.PROPERTY_OBJECT, Email.PROPERTY_RECEPTION_DATE, - Email.PROPERTY_MAIL_FOLDER, Email.PROPERTY_DEMAND_STATUS)); - projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(yesterday)); - - email = emailDao.create( - Email.PROPERTY_SENDER, sender, - Email.PROPERTY_FAX, fax, - Email.PROPERTY_CLIENT,client, - Email.PROPERTY_PROJECT_REFERENCE, projectRef, Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " - + client.getName() + " / " + faxNumber + " / " + dateDecorator.toString(yesterday), - Email.PROPERTY_RECEPTION_DATE, yesterday, - Email.PROPERTY_MAIL_FOLDER, folder, - Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED, - Email.PROPERTY_HISTORY, Lists.newArrayList(history), - Email.PROPERTY_ORIGINAL_EMAIL, "test"); - - if (opened) { - getEmailService().addToHistory(email.getTopiaId(), HistoryType.OPENING, user, now); - DemandType demandType = types.get(0); // types.get(0) à des gammes obligatoires - if (FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.RANGE_ROW)) { - for (int j = 0; j < 4; j++) { - RangeRow rangeRow = rangeRowDao.create(RangeRow.PROPERTY_RANGE, ranges.get(j), - RangeRow.PROPERTY_COMMAND_NUMBER, RandomStringUtils.randomNumeric(6), RangeRow.PROPERTY_PRODUCT_QUANTITY, - 50, RangeRow.PROPERTY_SAV_QUANTITY, 60); - rangeRows.add(rangeRow); - } - email.setRangeRow(rangeRows); - } - email.setDemandType(demandType); - email.setPriority(priorities.get(0)); - email.setRangeRow(rangeRows); - getEmailService().saveEmail(email, null, null, email.getClient().getCode(), user, Email.PROPERTY_DEMAND_TYPE, Email.PROPERTY_PRIORITY, - Email.PROPERTY_RANGE_ROW); - } - } -} diff --git a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MailFolderServiceTest.java b/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MailFolderServiceTest.java deleted file mode 100644 index 2bb2ca7..0000000 --- a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MailFolderServiceTest.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.IOException; -import java.util.List; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class MailFolderServiceTest extends AbstractFaxToMailServiceTest { - - private static final Log log = LogFactory.getLog(MailFolderServiceTest.class); - - protected MailFolderService service; - protected UserService userService; - - @Before - public void setUp() throws IOException { - service = newService(MailFolderService.class); - newService(InitTestData.class).initTestData(); - userService = newService(UserService.class); - } - - @Test - public void testFindFilter() { - MailFolder folder = service.getFolderForRecipient("fx.savtest@franciaflex.com"); - Assert.assertNotNull(folder); - } - - @Test - public void testRootFolders() { - FaxToMailUser cyril = userService.getUserByLogin("cbaillet"); - List<MailFolder> mailFolders = service.getRootMailFoldersWithReadingRights(cyril); - log.info(mailFolders.size() + " readable folders "); - for (MailFolder folder : mailFolders) { - printTree(folder, " "); - } - } - - protected void printTree(MailFolder folder, String prefix) { - log.info(prefix + folder.getName()); - if (folder.getChildren() != null) { - for (MailFolder f : folder.getChildren()) { - printTree(f, "-" + prefix); - } - } - } - -} diff --git a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java b/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java deleted file mode 100644 index 0b4bdcd..0000000 --- a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.franciaflex.faxtomail.services.service; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.HashMap; -import java.util.Map; - -import org.hibernate.cfg.Environment; -import org.junit.Ignore; -import org.junit.Test; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaApplicationContext; - -/** - * Class utilitaire permettant de générer facilement les schemas pour différentes base de données. - * - * @author Eric Chatellier - */ -@Ignore -public class MiscTest extends AbstractFaxToMailServiceTest { - - @Override - protected Map<String, String> getDatabaseConfiguration(String dataBase) { - Map<String, String> hibernateH2Config = new HashMap<String, String>(); - - // sqlserver config - hibernateH2Config.put(Environment.DIALECT, "org.hibernate.dialect.H2Dialect"); - hibernateH2Config.put(Environment.DRIVER, "org.h2.Driver"); - hibernateH2Config.put(Environment.USER, "sa"); - hibernateH2Config.put(Environment.PASS, ""); - hibernateH2Config.put(Environment.HBM2DDL_AUTO, ""); - hibernateH2Config.put(Environment.URL, "jdbc:h2:file:/tmp/faxtomail/h2data"); - - // sqlserver config - /*hibernateH2Config.put(Environment.DIALECT, "org.hibernate.dialect.SQLServer2008Dialect"); - hibernateH2Config.put(Environment.DRIVER, "org.h2.Driver"); - hibernateH2Config.put(Environment.USER, "sa"); - hibernateH2Config.put(Environment.PASS, ""); - hibernateH2Config.put(Environment.HBM2DDL_AUTO, ""); - hibernateH2Config.put(Environment.URL, "jdbc:h2:file:/tmp/faxtomail/h2data;MODE=MSSQLServer");*/ - - // postgres configuration - /*hibernateH2Config.put(Environment.DIALECT, "org.hibernate.dialect.PostgreSQL9Dialect"); - hibernateH2Config.put(Environment.DRIVER, "org.postgresql.Driver"); - hibernateH2Config.put(Environment.USER, "postgres"); - hibernateH2Config.put(Environment.PASS, "postgres"); - hibernateH2Config.put(Environment.HBM2DDL_AUTO, ""); - hibernateH2Config.put(Environment.URL, "jdbc:postgresql:faxtomail");*/ - return hibernateH2Config; - } - - @Override - protected void addMissingTable(FaxToMailTopiaApplicationContext applicationContext) { - // not needed here (and not working) - } - - @Test - public void getSqlServerSchema() { - getApplicationContext().showCreateSchema(); - } -} diff --git a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/migration/FlywayMigrationTest.java b/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/migration/FlywayMigrationTest.java deleted file mode 100644 index 607f4e3..0000000 --- a/trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/migration/FlywayMigrationTest.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.franciaflex.faxtomail.services.service.migration; - -/* - * #%L - * FaxToMail :: Service - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.File; -import java.io.IOException; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.SystemUtils; -import org.hibernate.cfg.Environment; -import org.junit.Assert; -import org.junit.Test; -import org.nuiton.topia.flyway.TopiaFlywayService; -import org.nuiton.topia.persistence.support.TopiaSqlQuery; -import org.nuiton.util.FileUtil; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaApplicationContext; -import com.franciaflex.faxtomail.services.service.AbstractFaxToMailServiceTest; - -/** - * Restore la base de test dans src/test/resources/db et test que les migrations flyway fonctionnent bien. - */ -public class FlywayMigrationTest extends AbstractFaxToMailServiceTest { - - @Override - protected Map<String, String> getDatabaseConfiguration(String dataBase) { - Map<String, String> hibernateH2Config = new HashMap<String, String>(); - - // copy database to test it outside source directory - File tempDirFile = SystemUtils.getJavaIoTmpDir(); - databaseFile = new File(tempDirFile, dataBase); - try { - File db100rc2File = new File("src/test/resources/db/h2data-1_0_0_rc2.h2.db"); - FileUtils.copyFileToDirectory(db100rc2File, databaseFile); - } catch (IOException ex) { - Assert.fail("Can't copy db file to test dir"); - - } - - // sqlserver config - hibernateH2Config.put(Environment.DIALECT, "org.hibernate.dialect.H2Dialect"); - hibernateH2Config.put(Environment.DRIVER, "org.h2.Driver"); - hibernateH2Config.put(Environment.USER, "sa"); - hibernateH2Config.put(Environment.PASS, ""); - hibernateH2Config.put(Environment.HBM2DDL_AUTO, ""); - hibernateH2Config.put(Environment.URL, "jdbc:h2:file:" + databaseFile.getAbsolutePath() + "/h2data-1_0_0_rc2;MODE=MSSQLServer"); - - // flyway config - hibernateH2Config.put("topia.service.migration", FaxtomailFlywayMigrationService.class.getName()); - hibernateH2Config.put("topia.service.migration." + TopiaFlywayService.USE_MODEL_VERSION, "false"); - hibernateH2Config.put("topia.service.migration." + TopiaFlywayService.FLYWAY_INIT_VERSION, "1.0.0.438"); - - return hibernateH2Config; - } - - @Override - protected void addMissingTable(FaxToMailTopiaApplicationContext applicationContext) { - // on desactive la creation des tables dans ce cas car la base est existante - } - - /** - * Vérifie la version de la base de données après les migrations qui sont sensées être passée. - */ - @Test - public void testFlywayMigrations() { - - // recupere le nombre de fichier de migration - List<File> migrationFiles = FileUtil.find(new File("src/main/resources/db/migration/h2"), ".*\\.sql", false); - - // recupere dans la base le nombre de migration qui sont passée - Integer migrationCount = getServiceContext().getPersistenceContext().getSqlSupport().findSingleResult(new TopiaSqlQuery<Integer>() { - @Override - public PreparedStatement prepareQuery(Connection connection) throws SQLException { - return connection.prepareStatement("select count(*) from \"schema_version\""); - } - - @Override - public Integer prepareResult(ResultSet set) throws SQLException { - return set.getInt(1); - } - }); - - // il y en a au moins 4 depuis la version 1.0.0-rc-3 - Assert.assertTrue(migrationCount >= 4); - // +1 car il y a l'init en plus - Assert.assertEquals(migrationFiles.size() + 1, migrationCount.intValue()); - } -} diff --git a/trunk/faxtomail-service/src/test/resources/archives/archives.csv b/trunk/faxtomail-service/src/test/resources/archives/archives.csv deleted file mode 100644 index e687f0d..0000000 --- a/trunk/faxtomail-service/src/test/resources/archives/archives.csv +++ /dev/null @@ -1,2 +0,0 @@ -receptionDate;projectReference;sender;fax;recipient;object;archiveDate;companyReference;originalEmail;comment;etatAttente;demandType;priority;mailFolder;client-code;client-brand;attachments -30/07/1984 23:10:00;naissance de l'élu;dieu@skysupport.com;non;humanity@populasse.fr;Une nouvelle ere commence;30/07/2014 12:00:00;osef;"Ha la la, je te raconte pas...";"no comment";Pris;Retour;Haut;Franciaflex/Chargés de clientèle/Agathe;99153;FX;att1.txt,att2.txt diff --git a/trunk/faxtomail-service/src/test/resources/archives/att1.txt b/trunk/faxtomail-service/src/test/resources/archives/att1.txt deleted file mode 100644 index 8318c86..0000000 --- a/trunk/faxtomail-service/src/test/resources/archives/att1.txt +++ /dev/null @@ -1 +0,0 @@ -Test \ No newline at end of file diff --git a/trunk/faxtomail-service/src/test/resources/archives/att2.txt b/trunk/faxtomail-service/src/test/resources/archives/att2.txt deleted file mode 100644 index 35d17df..0000000 --- a/trunk/faxtomail-service/src/test/resources/archives/att2.txt +++ /dev/null @@ -1 +0,0 @@ -Re test \ No newline at end of file diff --git a/trunk/faxtomail-service/src/test/resources/csv/clients.csv b/trunk/faxtomail-service/src/test/resources/csv/clients.csv deleted file mode 100644 index 782c08f..0000000 --- a/trunk/faxtomail-service/src/test/resources/csv/clients.csv +++ /dev/null @@ -1,5 +0,0 @@ -Id_Correspondance;Societe;Marque;Nom;Caracteristique1;Caracteristique2;Caracteristique3;Numero_Fax;Adresse_Mail;Code_Client -253042;FX;FX;John Doe;A;71 Allo;NULL;03 12 34 56 78;john@doe.fr;99153 -253142;FX;;Gerard Menvussa;A+;40 Nabi;NULL;05 12 23 34 45;gerard.menvussa@code.com;99154 -253242;FX;FX;Ella Elli;NULL;38 LA;NULL;04 98 87 76 65;NULL;99184 -253243;FX;;Cossé David;NULL;38 LA;NULL;04 98 87 76 65;david.cosse@sfr.fr;22152 \ No newline at end of file diff --git a/trunk/faxtomail-service/src/test/resources/csv/demandtypes.csv b/trunk/faxtomail-service/src/test/resources/csv/demandtypes.csv deleted file mode 100644 index 9ae50b2..0000000 --- a/trunk/faxtomail-service/src/test/resources/csv/demandtypes.csv +++ /dev/null @@ -1,4 +0,0 @@ -demandetype -Devis -Commande -Retour \ No newline at end of file diff --git a/trunk/faxtomail-service/src/test/resources/csv/email_accounts.csv b/trunk/faxtomail-service/src/test/resources/csv/email_accounts.csv deleted file mode 100644 index 75b8987..0000000 --- a/trunk/faxtomail-service/src/test/resources/csv/email_accounts.csv +++ /dev/null @@ -1,2 +0,0 @@ -protocol;host;port;user;password -pop3;test.franciaflex.fr;110;testuser;password diff --git a/trunk/faxtomail-service/src/test/resources/csv/email_filters.csv b/trunk/faxtomail-service/src/test/resources/csv/email_filters.csv deleted file mode 100644 index d1f7b50..0000000 --- a/trunk/faxtomail-service/src/test/resources/csv/email_filters.csv +++ /dev/null @@ -1,8 +0,0 @@ -recipient;folder;position -fx.01test@franciaflex.com;Cyril;0 -fx.02test@franciaflex.com;Agathe;1 -fx.03test@franciaflex.com;Claire;2 -fx.adv%@franciaflex.com;Cyril;3 -fx.savFFEtest@franciaflex.com;Marc;4 -fx.savFMEtest@franciaflex.com;Jeanne;5 -fx.sav%@franciaflex.com;Frédéric;6 \ No newline at end of file diff --git a/trunk/faxtomail-service/src/test/resources/csv/etatattentes.csv b/trunk/faxtomail-service/src/test/resources/csv/etatattentes.csv deleted file mode 100644 index 2a521fb..0000000 --- a/trunk/faxtomail-service/src/test/resources/csv/etatattentes.csv +++ /dev/null @@ -1,6 +0,0 @@ -etatattente -Non traité -Pris -En cours -Transmit -Terminé diff --git a/trunk/faxtomail-service/src/test/resources/csv/fx_clients.csv b/trunk/faxtomail-service/src/test/resources/csv/fx_clients.csv deleted file mode 100644 index 57e1b3f..0000000 --- a/trunk/faxtomail-service/src/test/resources/csv/fx_clients.csv +++ /dev/null @@ -1,5 +0,0 @@ -Id_Correspondance;Societe;Nom;Caracteristique1;Caracteristique2;Caracteristique3;Client_Top;Numero_Fax;Adresse_Mail;Code_Client;Objet_Message;Destination -253042;FX;John Doe;A;71 Allo;NULL;NULL;03 12 34 56 78;john@doe.fr;99153;NULL; -253142;FX;Gerard Menvussa;A+;40 Nabi;NULL;NULL;05 12 23 34 45;gerard.menvussa@code.com;99154;NULL; -253242;FX;Ella Elli;NULL;38 LA;NULL;NULL;04 98 87 76 65;NULL;99184;NULL; - diff --git a/trunk/faxtomail-service/src/test/resources/csv/priorities.csv b/trunk/faxtomail-service/src/test/resources/csv/priorities.csv deleted file mode 100644 index abeff6d..0000000 --- a/trunk/faxtomail-service/src/test/resources/csv/priorities.csv +++ /dev/null @@ -1,5 +0,0 @@ -priorite -Bas -Normal -Haut -Urgent diff --git a/trunk/faxtomail-service/src/test/resources/csv/ranges.csv b/trunk/faxtomail-service/src/test/resources/csv/ranges.csv deleted file mode 100644 index 549ae31..0000000 --- a/trunk/faxtomail-service/src/test/resources/csv/ranges.csv +++ /dev/null @@ -1,6 +0,0 @@ -gamme -Bas de gamme -Normal de gamme -Haut de gamme -Très haut de gamme -C'est de la gamme diff --git a/trunk/faxtomail-service/src/test/resources/db/h2data-1_0_0_rc2.h2.db b/trunk/faxtomail-service/src/test/resources/db/h2data-1_0_0_rc2.h2.db deleted file mode 100644 index e393761..0000000 Binary files a/trunk/faxtomail-service/src/test/resources/db/h2data-1_0_0_rc2.h2.db and /dev/null differ diff --git a/trunk/faxtomail-service/src/test/resources/log4j2.xml b/trunk/faxtomail-service/src/test/resources/log4j2.xml deleted file mode 100644 index 280883b..0000000 --- a/trunk/faxtomail-service/src/test/resources/log4j2.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: Service - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - -<Configuration> - - <Appenders> - <Console name="Console" target="SYSTEM_OUT"> - <PatternLayout pattern="%d{yyyy/MM/dd HH:mm:ss} %5p (%c:%L) - %m%n" /> - </Console> - </Appenders> - - <Loggers> - <Logger name="com.franciaflex.faxtomail.services.service" level="info"/> - <Logger name="org.hibernate.tool.hbm2ddl.SchemaExport" level="fatal"/> - - <Root level="error"> - <AppenderRef ref="Console" /> - </Root> - </Loggers> -</Configuration> diff --git a/trunk/faxtomail-ui-swing/LICENSE.txt b/trunk/faxtomail-ui-swing/LICENSE.txt deleted file mode 100644 index 94a9ed0..0000000 --- a/trunk/faxtomail-ui-swing/LICENSE.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/trunk/faxtomail-ui-swing/README.txt b/trunk/faxtomail-ui-swing/README.txt deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/faxtomail-ui-swing/pom.xml b/trunk/faxtomail-ui-swing/pom.xml deleted file mode 100644 index d871a75..0000000 --- a/trunk/faxtomail-ui-swing/pom.xml +++ /dev/null @@ -1,764 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>com.franciaflex</groupId> - <artifactId>faxtomail</artifactId> - <version>1.0</version> - </parent> - - <groupId>com.franciaflex.faxtomail</groupId> - <artifactId>faxtomail-ui-swing</artifactId> - - <name>FaxToMail :: UI</name> - <properties> - - <!-- jaxx configuration --> - <jaxx.addProjectClassPath>true</jaxx.addProjectClassPath> - <jaxx.addSourcesToClassPath>true</jaxx.addSourcesToClassPath> - <jaxx.defaultErrorUIFQN> - jaxx.runtime.validator.swing.ui.ImageValidationUI - </jaxx.defaultErrorUIFQN> - <!--<jaxx.useUIManagerForIcon>true</jaxx.useUIManagerForIcon>--> - <jaxx.generateHelp>true</jaxx.generateHelp> - <jaxx.generateSearch>false</jaxx.generateSearch> - <jaxx.autoImportCss>true</jaxx.autoImportCss> - <jaxx.autoRecurseInCss>false</jaxx.autoRecurseInCss> - <jaxx.addAutoHandlerUI>true</jaxx.addAutoHandlerUI> - <jaxx.commonCss>${project.basedir}/src/main/java/com/franciaflex/faxtomail/ui/swing/content/Common.css</jaxx.commonCss> - - <i18n.bundleOutputName>faxtomail-i18n</i18n.bundleOutputName> - <i18n.generateCsvFile>true</i18n.generateCsvFile> - <i18n.bundleCsvFile> - ${maven.gen.dir}/resources/META-INF/${i18n.bundleOutputName}.csv - </i18n.bundleCsvFile> - - <!-- generate license bundled files --> - <license.generateBundle>true</license.generateBundle> - <license.bundleThirdPartyPath> - META-INF/faxtomail-THIRD-PARTY.txt - </license.bundleThirdPartyPath> - <license.bundleLicensePath> - META-INF/faxtomail-LICENSE.txt - </license.bundleLicensePath> - - <maven.jar.main.class> - com.franciaflex.faxtomail.ui.swing.RunFaxToMail - </maven.jar.main.class> - - <bundlePrefix>faxtomail-${project.version}</bundlePrefix> - - <faxtomail.log.file> - \$\{java.io.tmpdir\}/faxtomail-${project.version}.log - </faxtomail.log.file> - - <!-- Post Release configuration --> - <skipPostRelease>false</skipPostRelease> - - </properties> - - <dependencies> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>faxtomail-persistence</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>faxtomail-service</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.nuiton.topia</groupId> - <artifactId>topia-persistence</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-decorator</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.i18n</groupId> - <artifactId>nuiton-i18n</artifactId> - </dependency> - - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-collections4</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-validator</artifactId> - </dependency> - - <!-- librairie Jaxx --> - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-validator</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-widgets-extra</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-widgets</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-application-api</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-application-swing</artifactId> - </dependency> - - <!-- swing widgets --> - - <dependency> - <groupId>org.swinglabs.swingx</groupId> - <artifactId>swingx-core</artifactId> - </dependency> - - <dependency> - <groupId>org.swinglabs.swingx</groupId> - <artifactId>swingx-common</artifactId> - </dependency> - - <dependency> - <groupId>org.swinglabs.swingx</groupId> - <artifactId>swingx-autocomplete</artifactId> - </dependency> - - <!-- Logging --> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-jcl</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>com.itextpdf</groupId> - <artifactId>itextpdf</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.pdfbox</groupId> - <artifactId>pdfbox</artifactId> - </dependency> - - <dependency> - <groupId>javax.media.jai</groupId> - <artifactId>com.springsource.javax.media.jai.core</artifactId> - <version>1.1.3</version> - </dependency> - - <dependency> - <groupId>javax.media.jai</groupId> - <artifactId>com.springsource.javax.media.jai.codec</artifactId> - <version>1.1.3</version> - </dependency> - - <dependency> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - </dependency> - - <dependency> - <groupId>javax.activation</groupId> - <artifactId>activation</artifactId> - </dependency> - - </dependencies> - - <!-- TODO --> - <repositories> - <repository> - <id>com.springsource.repository.bundles.external</id> - <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name> - <url>http://repository.springsource.com/maven/bundles/external</url> - </repository> - </repositories> - - <build> - <resources> - <resource> - <directory>src/main/filtered-resources</directory> - <filtering>true</filtering> - <includes> - <include>*.config</include> - <include>*.properties</include> - </includes> - </resource> - <resource> - <directory>src/main/resources</directory> - <includes> - <include>**/*</include> - </includes> - </resource> - </resources> - - <plugins> - - <plugin> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.nuiton.i18n</groupId> - <artifactId>i18n-maven-plugin</artifactId> - <executions> - <execution> - <id>scan-sources</id> - <configuration> - <entries> - <entry> - <specificGoal>parserValidation</specificGoal> - <basedir>${maven.src.dir}/main/java/</basedir> - <includes> - <param>**/**-validation.xml</param> - </includes> - </entry> - <entry> - <basedir>${maven.gen.dir}/java/</basedir> - </entry> - </entries> - </configuration> - <goals> - <goal>parserJava</goal> - <goal>parserValidation</goal> - <goal>gen</goal> - </goals> - </execution> - <execution> - <id>make-bundle</id> - <goals> - <goal>bundle</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>license-maven-plugin</artifactId> - <executions> - <execution> - <id>attach-licenses</id> - <goals> - <goal>update-project-license</goal> - <goal>add-third-party</goal> - </goals> - <configuration> - <licenseMerges> - <licenseMerge>The Apache Software License, Version 2.0| - Apache License, Version 2.0 - </licenseMerge> - <licenseMerge>General Public License (GPL)| - GNU LESSER GENERAL PUBLIC LICENSE - </licenseMerge> - <licenseMerge>General Public License (GPL)| - GNU Lesser General Public License - </licenseMerge> - <licenseMerge> - Common Development and Distribution License (CDDL) v1.0| - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - </licenseMerge> - <licenseMerge>BSD License|BSD</licenseMerge> - </licenseMerges> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>copy-dependencies</id> - <goals> - <goal>copy-dependencies</goal> - </goals> - <phase>prepare-package</phase> - <configuration> - <overWriteReleases>false</overWriteReleases> - <overWriteSnapshots>true</overWriteSnapshots> - <overWriteIfNewer>true</overWriteIfNewer> - <outputDirectory>${project.build.directory}/lib</outputDirectory> - <silent>true</silent> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <useUniqueVersions>false</useUniqueVersions> - <addClasspath>true</addClasspath> - <classpathPrefix>./lib/</classpathPrefix> - </manifest> - </archive> - </configuration> - </plugin> - - </plugins> - </build> - - <profiles> - - <profile> - <id>jar-only</id> - <build> - <defaultGoal>package</defaultGoal> - <plugins> - - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <archive> - <manifest> - <mainClass>com.franciaflex.faxtomail.ui.swing.RunFaxToMail</mainClass> - </manifest> - </archive> - <descriptorRefs> - <descriptorRef>jar-with-dependencies</descriptorRef> - </descriptorRefs> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - - <profile> - <id>default-bundle</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - <properties> - <redmine.releaseFiles> - target/${project.build.finalName}-standalone.zip - </redmine.releaseFiles> - </properties> - <build> - <defaultGoal>package</defaultGoal> - <plugins> - - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>assembly-standalone</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <attach>true</attach> - <descriptors> - <descriptor> - src/main/assembly/standalone.xml - </descriptor> - <!-- <descriptor> - src/main/assembly/i18n.xml - </descriptor> --> - </descriptors> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - - <profile> - <id>prepare-full-release</id> - <!--<activation> - <property> - <name>performFullRelease</name> - <value>true</value> - </property> - </activation>--> - <properties> - - <redmine.releaseFiles> - target/${bundlePrefix}-full-windows-i586.zip, - target/${bundlePrefix}-full-linux-i586.zip - <!--target/${bundlePrefix}-full-windows-x64.zip,--> - <!--target/${bundlePrefix}-full-linux-x64.zip--> - </redmine.releaseFiles> - </properties> - <build> - - </build> - </profile> - - <profile> - <id>linux-x64-bundle</id> - <!--activation> - <property> - <name>performFullRelease</name> - <value>true</value> - </property> - </activation--> - <build> - <defaultGoal>package</defaultGoal> - <plugins> - - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>get-linux-x64-jre</id> - <phase>prepare-package</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <outputDirectory> - ${project.build.directory}/jre-linux-x64 - </outputDirectory> - <artifactItems> - <artifactItem> - <groupId>com.oracle</groupId> - <artifactId>jre</artifactId> - <version>${jreVersion}</version> - <type>zip</type> - <classifier>linux-x64</classifier> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <finalName>${bundlePrefix}</finalName> - </configuration> - <executions> - <execution> - <id>assembly-full-linux-x64</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <attach>false</attach> - <descriptors> - <descriptor> - src/main/assembly/full-linux-x64.xml - </descriptor> - </descriptors> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - - <profile> - <id>linux-i586-bundle</id> - <!--<activation> - <property> - <name>performFullRelease</name> - <value>true</value> - </property> - </activation>--> - <build> - <defaultGoal>package</defaultGoal> - <plugins> - - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>get-linux-i586-jre</id> - <phase>prepare-package</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <outputDirectory> - ${project.build.directory}/jre-linux-i586 - </outputDirectory> - <artifactItems> - <artifactItem> - <groupId>com.oracle</groupId> - <artifactId>jre</artifactId> - <version>${jreVersion}</version> - <type>zip</type> - <classifier>linux-i586</classifier> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <finalName>${bundlePrefix}</finalName> - </configuration> - <executions> - <execution> - <id>assembly-full-linux-i586</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <attach>false</attach> - <descriptors> - <descriptor> - src/main/assembly/full-linux-i586.xml - </descriptor> - </descriptors> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - - <profile> - <id>windows-i586-bundle</id> - <!--<activation> - <property> - <name>performFullRelease</name> - <value>true</value> - </property> - </activation>--> - <build> - <defaultGoal>package</defaultGoal> - <plugins> - - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>get-windows-i586-jre</id> - <phase>prepare-package</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <outputDirectory> - ${project.build.directory}/jre-windows-i586 - </outputDirectory> - <artifactItems> - <artifactItem> - <groupId>com.oracle</groupId> - <artifactId>jre</artifactId> - <version>${jreVersion}</version> - <type>zip</type> - <classifier>windows-i586</classifier> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <finalName>${bundlePrefix}</finalName> - </configuration> - <executions> - <execution> - <id>assembly-full-windows-i586</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <attach>false</attach> - <descriptors> - <descriptor> - src/main/assembly/full-windows-i586.xml - </descriptor> - </descriptors> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - - <profile> - <id>windows-x64-bundle</id> - <!--activation> - <property> - <name>performFullRelease</name> - <value>true</value> - </property> - </activation--> - <build> - <defaultGoal>package</defaultGoal> - <plugins> - - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>get-windows-x64-jre</id> - <phase>prepare-package</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <outputDirectory> - ${project.build.directory}/jre-windows-x64 - </outputDirectory> - <artifactItems> - <artifactItem> - <groupId>com.oracle</groupId> - <artifactId>jre</artifactId> - <version>${jreVersion}</version> - <type>zip</type> - <classifier>windows-x64</classifier> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <finalName>${bundlePrefix}</finalName> - </configuration> - <executions> - <execution> - <id>assembly-full-windows-x64</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <attach>false</attach> - <descriptors> - <descriptor> - src/main/assembly/full-windows-x64.xml - </descriptor> - </descriptors> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> -</project> diff --git a/trunk/faxtomail-ui-swing/src/license/THIRD-PARTY.properties b/trunk/faxtomail-ui-swing/src/license/THIRD-PARTY.properties deleted file mode 100644 index cd77df2..0000000 --- a/trunk/faxtomail-ui-swing/src/license/THIRD-PARTY.properties +++ /dev/null @@ -1,69 +0,0 @@ -### -# #%L -# FaxToMail :: UI -# %% -# Copyright (C) 2014 Mac-Groupe, Code Lutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### -# Generated by org.codehaus.mojo.license.AddThirdPartyMojo -#------------------------------------------------------------------------------- -# Already used licenses in project : -# - AL 2.0 -# - Apache License -# - Apache License 2.0 -# - Apache License, version 2.0 -# - BSD License -# - CDDL -# - Common Development and Distribution License -# - Common Development and Distribution License (CDDL) v1.0 -# - Common Public License Version 1.0 -# - Eclipse Distribution License (EDL), Version 1.0 -# - Eclipse Public License (EPL), Version 1.0 -# - Eclipse Public License, Version 1.0 -# - GNU Affero General Public License v3 -# - GNU GENERAL PUBLIC LICENSE version 2 or higher -# - GNU General Public License - Version 2 with the class path exception -# - GNU General Public License version 2 (GPLv2) -# - GNU General Public License, Version 2 with the Classpath Exception -# - GNU Lesser General Public License (LGPL), version 2.1 -# - GNU Lesser General Public License version 2.1 (LGPLv2.1) -# - GNU Lesser General Public License, Version 2.1 -# - GNU Library or Lesser General Public License -# - GPLv2+CE -# - General Public License (GPL) -# - LGPL -# - LGPL 2.1 -# - Lesser General Public License (LGPL) -# - Lesser General Public License (LGPL) v 3.0 -# - MIT License -# - MPL 1.1 -# - Modified BSD License -# - New BSD License -# - Public Domain -# - The Apache Software License, Version 2.0 -# - The H2 License, Version 1.0 -# - UnboundID LDAP SDK Free Use License -#------------------------------------------------------------------------------- -# Please fill the missing licenses for dependencies : -# -# -#Wed Oct 01 15:25:35 CEST 2014 -commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 -dom4j--dom4j--1.6.1=BSD License -javax.media.jai--com.springsource.javax.media.jai.codec--1.1.3=Apache License -javax.media.jai--com.springsource.javax.media.jai.core--1.1.3=Apache License -org.nuiton.thirdparty--sdoc--0.5.0-beta-patchcl=Lesser General Public License (LGPL) v 3.0 diff --git a/trunk/faxtomail-ui-swing/src/main/assembly/faxtomail-full-component.xml b/trunk/faxtomail-ui-swing/src/main/assembly/faxtomail-full-component.xml deleted file mode 100644 index 14fe924..0000000 --- a/trunk/faxtomail-ui-swing/src/main/assembly/faxtomail-full-component.xml +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - - -<component - xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2 http://maven.apache.org/xsd/component-1.1.2.xsd"> - - <fileSets> - - <fileSet> - <directory>src/main/assembly/full</directory> - <outputDirectory/> - <filtered>true</filtered> - <fileMode>0755</fileMode> - <includes> - <include>faxtomail.sh</include> - <include>faxtomail.bat</include> - <include>README*</include> - <include>report/**</include> - </includes> - </fileSet> - - <fileSet> - <includes> - <include>LICENSE*</include> - </includes> - </fileSet> - - <!-- TUTTI component --> - - <fileSet> - <directory>target</directory> - <outputDirectory>faxtomail</outputDirectory> - <includes> - <include>${project.build.finalName}.${project.packaging}</include> - </includes> - </fileSet> - - <fileSet> - <directory>target/lib</directory> - <outputDirectory>faxtomail/lib</outputDirectory> - <includes> - <include>*.jar</include> - </includes> - <excludes> - <exclude>junit-*.jar</exclude> - </excludes> - </fileSet> - - <fileSet> - <directory>src/main/assembly/min</directory> - <outputDirectory>faxtomail</outputDirectory> - <filtered>true</filtered> - <fileMode>0755</fileMode> - <includes> - <include>*.sh</include> - <include>*.bat</include> - </includes> - </fileSet> - - <fileSet> - <directory>src/main/assembly/min</directory> - <outputDirectory>faxtomail</outputDirectory> - <filtered>true</filtered> - <includes> - <include>*</include> - </includes> - <excludes> - <exclude>*.sh</exclude> - <exclude>*.bat</exclude> - <exclude>faxtomail.config</exclude> - </excludes> - </fileSet> - - <!-- I18N component --> - <fileSet> - <directory>target/classes/META-INF</directory> - <outputDirectory>i18n</outputDirectory> - <includes> - <include>faxtomail-i18n*.properties</include> - <include>faxtomail-i18n*.csv</include> - </includes> - </fileSet> - - </fileSets> -</component> diff --git a/trunk/faxtomail-ui-swing/src/main/assembly/full-linux-i586.xml b/trunk/faxtomail-ui-swing/src/main/assembly/full-linux-i586.xml deleted file mode 100644 index b9d014b..0000000 --- a/trunk/faxtomail-ui-swing/src/main/assembly/full-linux-i586.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - - -<assembly - xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> - - <id>full-linux-i586</id> - <formats> - <format>zip</format> - </formats> - - <componentDescriptors> - <componentDescriptor> - src/main/assembly/faxtomail-full-component.xml - </componentDescriptor> - </componentDescriptors> - - <fileSets> - - <fileSet> - <directory>${project.build.directory}/jre-linux-i586/jre</directory> - <outputDirectory>jre</outputDirectory> - <includes> - <include>**/*</include> - </includes> - </fileSet> - - </fileSets> - -</assembly> diff --git a/trunk/faxtomail-ui-swing/src/main/assembly/full-linux-x64.xml b/trunk/faxtomail-ui-swing/src/main/assembly/full-linux-x64.xml deleted file mode 100644 index 81db2a6..0000000 --- a/trunk/faxtomail-ui-swing/src/main/assembly/full-linux-x64.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - - -<assembly - xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> - - <id>full-linux-x64</id> - <formats> - <format>zip</format> - </formats> - - <componentDescriptors> - <componentDescriptor> - src/main/assembly/faxtomail-full-component.xml - </componentDescriptor> - </componentDescriptors> - - <fileSets> - - <fileSet> - <directory>${project.build.directory}/jre-linux-x64/jre</directory> - <outputDirectory>/jre</outputDirectory> - <includes> - <include>**/*</include> - </includes> - </fileSet> - - </fileSets> - -</assembly> diff --git a/trunk/faxtomail-ui-swing/src/main/assembly/full-windows-i586.xml b/trunk/faxtomail-ui-swing/src/main/assembly/full-windows-i586.xml deleted file mode 100644 index 424b62d..0000000 --- a/trunk/faxtomail-ui-swing/src/main/assembly/full-windows-i586.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - - -<assembly - xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> - - <id>full-windows-i586</id> - <formats> - <format>zip</format> - </formats> - - <componentDescriptors> - <componentDescriptor> - src/main/assembly/faxtomail-full-component.xml - </componentDescriptor> - </componentDescriptors> - - <fileSets> - - <fileSet> - <directory>${project.build.directory}/jre-windows-i586/jre</directory> - <outputDirectory>jre</outputDirectory> - <includes> - <include>**/*</include> - </includes> - </fileSet> - - </fileSets> - -</assembly> diff --git a/trunk/faxtomail-ui-swing/src/main/assembly/full-windows-x64.xml b/trunk/faxtomail-ui-swing/src/main/assembly/full-windows-x64.xml deleted file mode 100644 index 9d5fccc..0000000 --- a/trunk/faxtomail-ui-swing/src/main/assembly/full-windows-x64.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - - -<assembly - xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> - - <id>full-windows-x64</id> - <formats> - <format>zip</format> - </formats> - - <componentDescriptors> - <componentDescriptor> - src/main/assembly/faxtomail-full-component.xml - </componentDescriptor> - </componentDescriptors> - - <fileSets> - - <fileSet> - <directory>${project.build.directory}/jre-windows-x64/jre</directory> - <outputDirectory>jre</outputDirectory> - <includes> - <include>**/*</include> - </includes> - </fileSet> - - </fileSets> -</assembly> diff --git a/trunk/faxtomail-ui-swing/src/main/assembly/full/faxtomail.bat b/trunk/faxtomail-ui-swing/src/main/assembly/full/faxtomail.bat deleted file mode 100644 index cd1c3e8..0000000 --- a/trunk/faxtomail-ui-swing/src/main/assembly/full/faxtomail.bat +++ /dev/null @@ -1,27 +0,0 @@ -@echo off - -set OLDDIR=%CD% -cd /d %~dp0% - -set FAXTOMAIL_BASEDIR="%CD%" -set FAXTOMAIL_HOME=%FAXTOMAIL_BASEDIR%\faxtomail -set JAVA_HOME=%FAXTOMAIL_BASEDIR%\jre -set JAVA_COMMAND=%JAVA_HOME%\bin\java -set FAXTOMAIL_LOG_FILE=%FAXTOMAIL_BASEDIR%\data\faxtomail-${project.version}.log - -echo FaxToMail basedir: %FAXTOMAIL_BASEDIR% -echo FaxToMail app home: %FAXTOMAIL_HOME% -echo FaxToMail jre home: %JAVA_HOME% -echo FaxToMail log file: %FAXTOMAIL_LOG_FILE% - -:start - -if exist "faxtomail.config" copy faxtomail.config faxtomail -echo FaxToMail ${project.version} is starting... -call faxtomail\launch.bat --option faxtomail.launch.mode full --option faxtomail.basedir %FAXTOMAIL_BASEDIR% -if errorlevel 88 goto start - -goto quit - -:quit -cd %OLDDIR% diff --git a/trunk/faxtomail-ui-swing/src/main/assembly/full/faxtomail.sh b/trunk/faxtomail-ui-swing/src/main/assembly/full/faxtomail.sh deleted file mode 100644 index 80f950f..0000000 --- a/trunk/faxtomail-ui-swing/src/main/assembly/full/faxtomail.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -### -# #%L -# FaxToMail :: UI -# %% -# Copyright (C) 2014 Mac-Groupe, Code Lutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### - -export FAXTOMAIL_BASEDIR=$(pwd) -export FAXTOMAIL_HOME=$FAXTOMAIL_BASEDIR/faxtomail -export JAVA_HOME=$FAXTOMAIL_BASEDIR/jre -export JAVA_COMMAND=$JAVA_HOME/bin/java -export FAXTOMAIL_LOG_FILE=$FAXTOMAIL_BASEDIR/data/faxtomail-${project.version}.log - -cd $FAXTOMAIL_BASEDIR - -echo "FaxToMail basedir: $FAXTOMAIL_BASEDIR" -echo "FaxToMail app home: $FAXTOMAIL_HOME" -echo "FaxToMail jre home: $JAVA_HOME" -echo "FaxToMail log file: $FAXTOMAIL_LOG_FILE" - -while true; do - - if [ -f $FAXTOMAIL_BASEDIR/faxtomail.config ]; then - cp -rfv $FAXTOMAIL_BASEDIR/faxtomail.config $FAXTOMAIL_HOME - fi - echo "FaxToMail ${project.version} is starting..." - ./faxtomail/launch.sh --option faxtomail.launch.mode full --option faxtomail.basedir $FAXTOMAIL_BASEDIR - exitcode=$? - - if [ ! "$exitcode" -eq "88" ]; then - # quit now! - exit $exitcode - fi -done diff --git a/trunk/faxtomail-ui-swing/src/main/assembly/i18n.xml b/trunk/faxtomail-ui-swing/src/main/assembly/i18n.xml deleted file mode 100644 index 92c04ee..0000000 --- a/trunk/faxtomail-ui-swing/src/main/assembly/i18n.xml +++ /dev/null @@ -1,53 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - -<assembly - xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> - <id>i18n</id> - <formats> - <format>zip</format> - </formats> - - <fileSets> - - <fileSet> - <directory>target/classes/META-INF</directory> - <outputDirectory/> - <includes> - <include>faxtomail-i18n*.properties</include> - <include>faxtomail-i18n*.csv</include> - </includes> - </fileSet> - - <fileSet> - <directory>src/main/assembly/min</directory> - <outputDirectory/> - <filtered>true</filtered> - <includes> - <include>version.appup</include> - </includes> - </fileSet> - - </fileSets> -</assembly> diff --git a/trunk/faxtomail-ui-swing/src/main/assembly/min/README.txt b/trunk/faxtomail-ui-swing/src/main/assembly/min/README.txt deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/faxtomail-ui-swing/src/main/assembly/min/launch.bat b/trunk/faxtomail-ui-swing/src/main/assembly/min/launch.bat deleted file mode 100644 index 8c61e61..0000000 --- a/trunk/faxtomail-ui-swing/src/main/assembly/min/launch.bat +++ /dev/null @@ -1,10 +0,0 @@ -@echo off - -set OLDDIR=%CD% -cd /d %~dp0% - -java -Xmx1024M -XX:MaxPermSize=128M -Dfaxtomail.log.file=%FAXTOMAIL_LOG_FILE% -jar ${project.build.finalName}.${project.packaging} %1 %2 %3 %4 %5 %6 %7 %8 %9 -set exitcode=%ERRORLEVEL% -echo Stop FaxToMail with exitcode: %exitcode% -cd %OLDDIR% -exit /b %exitcode% diff --git a/trunk/faxtomail-ui-swing/src/main/assembly/min/launch.sh b/trunk/faxtomail-ui-swing/src/main/assembly/min/launch.sh deleted file mode 100755 index d138817..0000000 --- a/trunk/faxtomail-ui-swing/src/main/assembly/min/launch.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -### -# #%L -# FaxToMail :: UI -# %% -# Copyright (C) 2014 Mac-Groupe, Code Lutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### - -MEMORY="-Xmx1024M -XX:MaxPermSize=128M" -#FAXTOMAIL_JVM_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000" - -REP=$(dirname $0) - -cd $REP - -java $MEMORY $FAXTOMAIL_JVM_OPTS -Dfaxtomail.log.file=$FAXTOMAIL_LOG_FILE -jar ${project.build.finalName}.${project.packaging} $* -exitcode=$? -echo "Stop FaxToMail with exitcode: $exitcode" -exit $exitcode diff --git a/trunk/faxtomail-ui-swing/src/main/assembly/standalone.xml b/trunk/faxtomail-ui-swing/src/main/assembly/standalone.xml deleted file mode 100644 index ffbacfb..0000000 --- a/trunk/faxtomail-ui-swing/src/main/assembly/standalone.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - - -<assembly - xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> - <id>standalone</id> - <formats> - <format>zip</format> - </formats> - - <fileSets> - - <fileSet> - <directory>target</directory> - <outputDirectory/> - <includes> - <include>${project.build.finalName}.${project.packaging}</include> - </includes> - </fileSet> - - <fileSet> - <directory>target/lib</directory> - <outputDirectory>lib</outputDirectory> - <includes> - <include>*.jar</include> - </includes> - <excludes> - <exclude>junit-*.jar</exclude> - </excludes> - </fileSet> - - <fileSet> - <directory>src/main/assembly/min</directory> - <outputDirectory/> - <filtered>true</filtered> - <fileMode>0755</fileMode> - <includes> - <include>launch.sh</include> - <include>launch.bat</include> - </includes> - </fileSet> - - <fileSet> - <includes> - <include>README*</include> - <include>LICENSE*</include> - </includes> - </fileSet> - - </fileSets> -</assembly> diff --git a/trunk/faxtomail-ui-swing/src/main/filtered-resources/faxToMail.properties b/trunk/faxtomail-ui-swing/src/main/filtered-resources/faxToMail.properties deleted file mode 100644 index 33f00c3..0000000 --- a/trunk/faxtomail-ui-swing/src/main/filtered-resources/faxToMail.properties +++ /dev/null @@ -1,25 +0,0 @@ -### -# #%L -# FaxToMail :: UI -# %% -# Copyright (C) 2014 Mac-Groupe, Code Lutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### -faxtomail.version=${project.version} -faxtomail.site.url=${project.url} -faxtomail.inceptionYear=${project.inceptionYear} -faxtomail.organizationName=${license.organizationName} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailActionFactory.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailActionFactory.java deleted file mode 100644 index 12e65f4..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailActionFactory.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.actions.AbstractMainUIFaxToMailAction; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; -import org.apache.commons.lang3.reflect.ConstructorUtils; -import org.nuiton.jaxx.application.ApplicationTechnicalException; -import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler; -import org.nuiton.jaxx.application.swing.action.AbstractApplicationAction; -import org.nuiton.jaxx.application.swing.action.ApplicationActionFactory; - -import static org.nuiton.i18n.I18n.t; - -/** - * - * @author Tony Chemit - chemit@codelutin.com - */ -public class FaxToMailActionFactory extends ApplicationActionFactory { - - @Override - public <A extends AbstractApplicationAction> A createLogicAction(AbstractApplicationUIHandler handler, - Class<A> actionName) { - FaxToMailUIContext context = (FaxToMailUIContext) handler.getContext(); - if (AbstractMainUIFaxToMailAction.class.isAssignableFrom(actionName) && context.getMainUI() != null) { - handler = context.getMainUI().getHandler(); - } - - try { - // create action - A result = ConstructorUtils.invokeConstructor(actionName, (AbstractFaxToMailUIHandler) handler); - return result; - - } catch (Exception e) { - throw new ApplicationTechnicalException(t("application.action.create.error", actionName), e); - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailScreen.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailScreen.java deleted file mode 100644 index c681509..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailScreen.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * Enumeration of any internal screen of application. - * - * @author kmorin - morin@codelutin.com - */ -public enum FaxToMailScreen { - - SEARCH, - - DEMANDE, - - LIST -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java deleted file mode 100644 index 31f7a16..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java +++ /dev/null @@ -1,768 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.awt.Color; -import java.awt.Component; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.Closeable; -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import javax.swing.JFrame; -import javax.swing.JOptionPane; - -import jaxx.runtime.swing.editor.bean.BeanDoubleList; -import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox; -import jaxx.runtime.swing.session.BeanDoubleListState; -import jaxx.runtime.swing.session.BeanFilterableComboBoxState; -import jaxx.runtime.swing.session.State; -import jaxx.runtime.swing.session.SwingSession; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.beans.AbstractBean; -import org.jdesktop.swingx.JXLoginPane; -import org.jdesktop.swingx.JXLoginPane.Status; -import org.jdesktop.swingx.auth.LoginService; -import org.jdesktop.swingx.error.ErrorInfo; -import org.nuiton.i18n.I18n; -import org.nuiton.i18n.init.ClassPathI18nInitializer; -import org.nuiton.i18n.init.DefaultI18nInitializer; -import org.nuiton.jaxx.application.ApplicationBusinessException; -import org.nuiton.jaxx.application.ApplicationConfiguration; -import org.nuiton.jaxx.application.swing.ApplicationUIContext; -import org.nuiton.jaxx.application.swing.action.ApplicationActionEngine; -import org.nuiton.jaxx.application.swing.action.ApplicationActionFactory; -import org.nuiton.jaxx.application.swing.action.ApplicationActionUI; -import org.nuiton.jaxx.application.swing.action.ApplicationUIAction; -import org.nuiton.jaxx.application.swing.util.ApplicationErrorHelper; -import org.nuiton.util.converter.ConverterUtil; - -import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.persistence.RessourceClassLoader; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaApplicationContext; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.Priority; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.InitFaxToMailService; -import com.franciaflex.faxtomail.services.service.ReferentielService; -import com.franciaflex.faxtomail.services.service.UserService; -import com.franciaflex.faxtomail.services.service.ldap.AuthenticationException; -import com.franciaflex.faxtomail.ui.swing.content.MainUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.search.SearchUIModel; -import com.franciaflex.faxtomail.ui.swing.util.UIMessageNotifier; -import com.google.common.base.Preconditions; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import org.nuiton.util.pagination.PaginationParameter; - -/** - * UI application context. - * - * @author kmorin - morin@codelutin.com - * - */ -public class FaxToMailUIContext extends AbstractBean implements Closeable, UIMessageNotifier, ApplicationUIContext { - - /** Logger. */ - private static final Log log = LogFactory.getLog(FaxToMailUIContext.class); - - public static final String PROPERTY_SCREEN = "screen"; - - public static final String PROPERTY_LOCALE = "locale"; - - public static final Set<String> PROPERTIES_TO_SAVE = Sets.newHashSet(PROPERTY_LOCALE); - - public static final String PROPERTY_BUSY = "busy"; - - public static final String PROPERTY_HIDE_BODY = "hideBody"; - - public static final String PROPERTY_ACTION_IN_PROGRESS = "actionInProgress"; - - /** - * Application context (only one for all the application). - */ - private static FaxToMailUIContext applicationContext; - - /** - * Application global configuration. - */ - protected final FaxToMailConfiguration config; - - /** - * ClassLoader ressource. - */ - protected final RessourceClassLoader resourceLoader; - - /** - * Topia application context. - */ - protected FaxToMailTopiaApplicationContext topiaApplicationContext; - - /** - * Swing session used to save ui states. - */ - protected final SwingSession swingSession; - - /** - * Error helper. - */ - protected final ApplicationErrorHelper errorHelper; - - /** - * Current screen displayed in ui. - */ - protected FaxToMailScreen screen; - - /** - * Current locale used in application. - */ - protected Locale locale; - - /** - * Busy state ({@code true} when a blocking action is running). - */ - protected boolean busy; - - /** - * Flag to hide (or not) the body of application. - */ - protected boolean hideBody; - - /** - * Flag to know if an action is already in progress. - */ - protected boolean actionInProgress; - - /** - * Message notifiers. - */ - protected final Set<UIMessageNotifier> messageNotifiers; - - private MainUI mainUI; - - private ApplicationActionUI actionUI; - - private JFrame secondaryFrame; - - private final ApplicationActionFactory faxToMailActionFactory; - - private final ApplicationActionEngine faxToMailActionEngine; - - /** L'utilisateur actuellement connecté. */ - protected FaxToMailUser currentUser; - - /** Le dossier courant (pour ???). */ - protected MailFolder currentMailFolder; - - protected PaginationParameter currentPaginationParameter; - - /** L'email courant (pour quoi faire ?). */ - protected DemandeUIModel currentEmail; - - /** Les dossiers étendus (pour pouvoir les étendres encore au rechargement de l'UI). */ - protected List<MailFolder> expandedFolders = new ArrayList<MailFolder>(); - - protected SearchUIModel search; - - /** Active user cache. */ - protected List<FaxToMailUser> faxtomailUserCache; - /** Waiting state cache. */ - protected List<WaitingState> waitingStateCache; - /** Demand type cache. */ - protected List<DemandType> demandTypeCache; - /** Priority cache. */ - protected List<Priority> priorityCache; - /** Range cache. */ - protected List<Range> rangeCache; - - public static FaxToMailUIContext newContext(FaxToMailConfiguration config) { - Preconditions.checkNotNull(config); - Preconditions.checkState(applicationContext == null, - "Application context was already opened!"); - applicationContext = new FaxToMailUIContext(config); - return applicationContext; - } - - public static FaxToMailUIContext getApplicationContext() { - return applicationContext; - } - - public ApplicationErrorHelper getErrorHelper() { - return applicationContext.errorHelper; - } - - @Override - public String getI18nPrefix() { - return "faxtomail.property."; - } - - @Override - public String getDateFormat() { - return getConfig().getDateFormat(); - } - - protected FaxToMailUIContext(FaxToMailConfiguration config) { - this.config = config; - this.resourceLoader = new RessourceClassLoader(Thread.currentThread().getContextClassLoader()); - topiaApplicationContext = new FaxToMailTopiaApplicationContext(config.getTopiaProperties()); - - FaxToMailServiceContext serviceContext = newServiceContext(); - InitFaxToMailService initFaxToMailService = - serviceContext.getInitFaxToMailService(); - initFaxToMailService.init(); - - Map<Class, State> additionalStates = Maps.newHashMap(); - additionalStates.put(BeanFilterableComboBox.class, new BeanFilterableComboBoxState()); - additionalStates.put(BeanDoubleList.class, new BeanDoubleListState()); - File uiConfigFile = getConfig().getUIConfigFile(); - this.swingSession = new SwingSession(uiConfigFile, false, additionalStates); - if (!uiConfigFile.exists()) { - swingSession.loadSafeStates(); - } - - this.errorHelper = new ApplicationErrorHelper(this) { - - @Override - public void showWarningDialog(String message) { - - JOptionPane.showMessageDialog(context.getActionUI(), "<html><body>" + message + "</body></html>", - t("application.error.ui.business.warning"), - JOptionPane.WARNING_MESSAGE); - } - - @Override - public void showErrorDialog(String message, Throwable cause) { - if (log.isErrorEnabled()) { - log.error(message, cause); - } - super.showErrorDialog(message, cause); - } - - @Override - public void reportError(ErrorInfo errorInfo) throws NullPointerException { - // empeche la fenetre d'erreur de boucler déjà - } - }; - - UIMessageNotifier logMessageNotifier = new UIMessageNotifier() { - - @Override - public void showInformationMessage(String message) { - if (StringUtils.isNotBlank(message)) { - message = message.replaceAll("\\<strong\\>", ""); - message = message.replaceAll("\\<.strong\\>", ""); - message = message.replaceAll("\\<li\\>", ""); - message = message.replaceAll("\\<.li\\>", ""); - message = message.replaceAll("\\<ul\\>", ""); - message = message.replaceAll("\\<.ul\\>", ""); - if (log.isInfoEnabled()) { - log.info(message); - } - } - } - }; - - this.messageNotifiers = Sets.newHashSet(); - addMessageNotifier(logMessageNotifier); - - faxToMailActionFactory = new FaxToMailActionFactory(); - faxToMailActionEngine = new ApplicationActionEngine(faxToMailActionFactory); - } - - @Override - public ApplicationConfiguration getConfiguration() { - return config; - } - - @Override - public Component getBodyUI() { - MainUI mainUI = getMainUI(); - return mainUI == null ? null : mainUI.getBody(); - } - - @Override - public Component getStatusUI() { - MainUI mainUI = getMainUI(); - return mainUI == null ? null : mainUI.getStatus(); - } - - //------------------------------------------------------------------------// - //-- Open / close methods --// - //------------------------------------------------------------------------// - - public void init() { - - config.prepareDirectories(); - - // use our special classLoader (which will read some files from resources from a configuration directory) - Thread.currentThread().setContextClassLoader(getResourceLoader()); - - // converters are stored in current classloader, we need then to rescan them - // each time we change current classloader - ConverterUtil.deregister(); - ConverterUtil.initConverters(); - - // Use shutdownHook to close context on System.exit - Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { - - @Override - public void run() { - if (log.isInfoEnabled()) { - log.info("Close context on shutdown"); - } - close(); - } - })); - - //--------------------------------------------------------------------// - // init i18n - //--------------------------------------------------------------------// - - Locale i18nLocale = config.getI18nLocale(); - - if (log.isInfoEnabled()) { - log.info(String.format("Starts i18n with locale [%s]", i18nLocale)); - } - - try { - // production case - I18n.init(new DefaultI18nInitializer("faxtomail-i18n"), i18nLocale); - } catch (RuntimeException ex) { - // fallback case : strange ide behaviour (eclipse) - I18n.init(new ClassPathI18nInitializer(), i18nLocale); - } - - // try to autologin user from username of current X session - autologinUser(); - - // init cache - initContextCache(); - - //--------------------------------------------------------------------// - // init action UI - //--------------------------------------------------------------------// - setActionUI(new ApplicationActionUI(null, this)); - } - - /** - * Init list used in application wide scope and put it in cache. - */ - protected void initContextCache() { - if (log.isInfoEnabled()) { - log.info("Adding referentiel in cache"); - } - FaxToMailServiceContext serviceContext = newServiceContext(); - // referentiel - ReferentielService referentielService = serviceContext.getReferentielService(); - setRangeCache(referentielService.getAllRange()); - setDemandTypeCache(referentielService.getAllDemandType()); - setWaitingStateCache(referentielService.getAllWaitingState()); - setPriorityCache(referentielService.getAllPriority()); - // users - UserService userService = serviceContext.getUserService(); - setFaxtomailUserCache(userService.getAllActiveUsers()); - } - - /** - * Recupere l'utilisateur connecté ou demande les identifiants à l'utilisateur. - */ - protected void autologinUser() { - - String principal = getLoggedInUsername(); - - // l'authentification par defaut se fait par trigramme - final FaxToMailServiceContext serviceContext = newServiceContext(); - try { - try { - FaxToMailUser currentUser = serviceContext.getLdapService().getUserFromPrincipal(principal); - if (log.isInfoEnabled()) { - log.info("Connected as " + currentUser.getFirstName() + " " + currentUser.getLastName()); - } - setCurrentUser(currentUser); - } catch (AuthenticationException ex) { - if (log.isWarnEnabled()) { - log.warn("Can't anthenticate user", ex); - } - - } - - // si ca n'a pas fonctionné, on retente par login mot de passe - while (getCurrentUser() == null) { - JXLoginPane pane = new JXLoginPane(); - pane.setLoginService(new LoginService() { - @Override - public boolean authenticate(String name, char[] password, String server) throws Exception { - boolean result = false; - try { - FaxToMailUser user = serviceContext.getLdapService().authenticateUser(name, String.valueOf(password)); - setCurrentUser(user); - result = true; - } catch (AuthenticationException ex) { - if (log.isWarnEnabled()) { - log.warn("Can't anthenticate user", ex); - } - } - return result; - } - }); - - // show login dialog - Status loginStatus = JXLoginPane.showLoginDialog(null, pane); - if (loginStatus == Status.CANCELLED) { - throw new ApplicationBusinessException("Authentication canceled"); - } - } - - } finally { - IOUtils.closeQuietly(serviceContext); - } - } - - /** - * Retourne l'utilsateur connecté sur la session utilisateur (ou a defaut un utilisateur de test). - * - * @return trigramme - */ - protected String getLoggedInUsername() { - String result = getConfig().getLdapTestPrincipal(); - if (StringUtils.isBlank(result)) { - result = System.getProperty("user.name"); - } - return result; - } - - public void open() { - - setLocale(config.getI18nLocale()); - - // save back to config - saveContextToConfig(); - - // list when programId or campaingId change to save the configuration - addPropertyChangeListener(new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent evt) { - - if (PROPERTIES_TO_SAVE.contains(evt.getPropertyName())) { - saveContextToConfig(); - } - } - }); - } - - @Override - public void close() { - -// // Clear data references - messageNotifiers.clear(); -// validationContext = null; -// IOUtils.closeQuietly(dataContext); - - setScreen(null); - -// IOUtils.closeQuietly(serviceContext); - -// // remove listeners - PropertyChangeListener[] listeners = getPropertyChangeListeners(); - for (PropertyChangeListener listener : listeners) { - if (log.isDebugEnabled()) { - log.debug("Remove listener: " + listener); - } - removePropertyChangeListener(listener); - } - setMainUI(null); - if (actionUI != null) { - - // close action ui - actionUI.getModel().clear(); - } - setActionUI(null); - } - - //------------------------------------------------------------------------// - //-- Service methods --// - //------------------------------------------------------------------------// - - public FaxToMailServiceContext newServiceContext() { - FaxToMailServiceContext serviceContext = FaxToMailServiceContext.newServiceContext(topiaApplicationContext); - serviceContext.setApplicationConfig(config); - return serviceContext; - } - - //------------------------------------------------------------------------// - //-- Config methods --// - //------------------------------------------------------------------------// - - public FaxToMailConfiguration getConfig() { - return config; - } - - protected void saveContextToConfig() { - config.setI18nLocale(getLocale()); - config.save(); - } - - //------------------------------------------------------------------------// - //-- UI methods --// - //------------------------------------------------------------------------// - - public MainUI getMainUI() { - return mainUI; - } - - public void setMainUI(MainUI mainUI) { - this.mainUI = mainUI; - } - - public JFrame getSecondaryFrame() { - return secondaryFrame; - } - - public void setSecondaryFrame(JFrame secondaryFrame) { - this.secondaryFrame = secondaryFrame; - } - - @Override - public ApplicationActionUI getActionUI() { - return actionUI; - } - - @Override - public ApplicationActionUI getExistingActionUI() { - while (actionUI == null) { - - try { - Thread.sleep(50); - } catch (InterruptedException e) { - // ignore this one - } - } - return actionUI; - } - - public void setActionUI(ApplicationActionUI actionUI) { - this.actionUI = actionUI; - } - - public SwingSession getSwingSession() { - return swingSession; - } - - public FaxToMailScreen getScreen() { - return screen; - } - - public void setScreen(FaxToMailScreen screen) { - Object oldValue = getScreen(); - this.screen = screen; - firePropertyChange(PROPERTY_SCREEN, oldValue, screen); - } - - @Override - public boolean isBusy() { - return busy; - } - - @Override - public void setBusy(boolean busy) { - this.busy = busy; - firePropertyChange(PROPERTY_BUSY, null, busy); - } - - @Override - public boolean isHideBody() { - return hideBody; - } - - @Override - public void setHideBody(boolean hideBody) { - this.hideBody = hideBody; - firePropertyChange(PROPERTY_HIDE_BODY, null, hideBody); - } - - @Override - public boolean isActionInProgress(ApplicationUIAction action) { - return actionInProgress; - } - - @Override - public void setActionInProgress(ApplicationUIAction action, boolean actionInProgress) { - this.actionInProgress = actionInProgress; - firePropertyChange(PROPERTY_ACTION_IN_PROGRESS, null, actionInProgress); - } - - @Override - public Color getColorBlockingLayer() { - return getConfig().getColorBlockingLayer(); - } - - @Override - public ApplicationActionFactory getActionFactory() { - return faxToMailActionFactory; - } - - @Override - public ApplicationActionEngine getActionEngine() { - return faxToMailActionEngine; - } - //------------------------------------------------------------------------// - //-- UIMessageNotifier methods --// - //------------------------------------------------------------------------// - - public void addMessageNotifier(UIMessageNotifier messageNotifier) { - this.messageNotifiers.add(messageNotifier); - } - - public void removeMessageNotifier(UIMessageNotifier messageNotifier) { - this.messageNotifiers.remove(messageNotifier); - } - - @Override - public void showInformationMessage(String message) { - for (UIMessageNotifier messageNotifier : messageNotifiers) { - messageNotifier.showInformationMessage(message); - } - } - - public RessourceClassLoader getResourceLoader() { - return resourceLoader; - } - - //------------------------------------------------------------------------// - //-- Other methods --// - //------------------------------------------------------------------------// - - public Locale getLocale() { - return locale; - } - - public void setLocale(Locale locale) { - this.locale = locale; - firePropertyChange(PROPERTY_LOCALE, null, locale); - } - - public FaxToMailUser getCurrentUser() { - return currentUser; - } - - public void setCurrentUser(FaxToMailUser currentUser) { - this.currentUser = currentUser; - } - - public MailFolder getCurrentMailFolder() { - return currentMailFolder; - } - - public void setCurrentMailFolder(MailFolder currentMailFolder) { - this.currentMailFolder = currentMailFolder; - } - - public PaginationParameter getCurrentPaginationParameter() { - return currentPaginationParameter; - } - - public void setCurrentPaginationParameter(PaginationParameter currentPaginationParameter) { - this.currentPaginationParameter = currentPaginationParameter; - } - - public DemandeUIModel getCurrentEmail() { - return currentEmail; - } - - public void setCurrentEmail(DemandeUIModel currentEmail) { - this.currentEmail = currentEmail; - } - - public List<MailFolder> getExpandedFolders() { - return expandedFolders; - } - - public void setExpandedFolders(List<MailFolder> expandedFolders) { - this.expandedFolders = expandedFolders; - } - - public SearchUIModel getSearch() { - return search; - } - - public void setSearch(SearchUIModel search) { - this.search = search; - } - - public List<FaxToMailUser> getFaxtomailUserCache() { - return faxtomailUserCache; - } - - public void setFaxtomailUserCache(List<FaxToMailUser> faxtomailUserCache) { - this.faxtomailUserCache = faxtomailUserCache; - } - - public List<WaitingState> getWaitingStateCache() { - return waitingStateCache; - } - - public void setWaitingStateCache(List<WaitingState> waitingStateCache) { - this.waitingStateCache = waitingStateCache; - } - - public List<DemandType> getDemandTypeCache() { - return demandTypeCache; - } - - public void setDemandTypeCache(List<DemandType> demandTypeCache) { - this.demandTypeCache = demandTypeCache; - } - - public List<Priority> getPriorityCache() { - return priorityCache; - } - - public void setPriorityCache(List<Priority> priorityCache) { - this.priorityCache = priorityCache; - } - - public List<Range> getRangeCache() { - return rangeCache; - } - - public void setRangeCache(List<Range> rangeCache) { - this.rangeCache = rangeCache; - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/RunFaxToMail.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/RunFaxToMail.java deleted file mode 100644 index 05636d7..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/RunFaxToMail.java +++ /dev/null @@ -1,181 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.ui.swing.content.MainUI; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailExceptionHandler; - -import jaxx.runtime.SwingUtil; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.jaxx.widgets.extra.SplashScreen; - -import javax.swing.*; -import javax.swing.plaf.BorderUIResource; -import javax.swing.plaf.FontUIResource; - -import java.awt.*; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Arrays; - -/** - * @author kmorin - kmorin@codelutin.com - * - */ -public class RunFaxToMail { - - /** Logger. */ - private static final Log log = LogFactory.getLog(RunFaxToMail.class); - - public static final int NORMAL_EXIT_CODE = 0; - - public static final int UPATE_EXIT_CODE = 88; - - public static void main(String... args) { - - if (log.isInfoEnabled()) { - log.info("Starting FaxToMail with arguments: " + Arrays.toString(args)); - } - - // Create configuration - FaxToMailConfiguration config = - new FaxToMailConfiguration("faxToMail.properties", args); - - Font font; - try { - InputStream fontStream = RunFaxToMail.class.getResourceAsStream("/PoetsenOne-Regular.ttf"); - font = FontUIResource.createFont(Font.TRUETYPE_FONT, fontStream).deriveFont(30f); - - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("error while loading font, use the default one", e); - } - font = new Font("Verdana", Font.BOLD, 20); - } - SplashScreen.Title title = new SplashScreen.Title("FaxToMail " + config.getVersion(), - font, - new Point(20, 40), - new Color(200, 20, 40)); - final SplashScreen splashScreen = new SplashScreen("/splashscreen.png", title); - splashScreen.setRemanence(500); - - try { - // Create application context - FaxToMailUIContext context = FaxToMailUIContext.newContext(config); - - // override default exception management (after config init) - Thread.setDefaultUncaughtExceptionHandler(new FaxToMailExceptionHandler(context.getErrorHelper())); - // See http://forge.codelutin.com/issues/2055 - //System.setProperty("sun.awt.exception.handler", TuttiExceptionHandler.class.getName()); - - // prepare context (mainly init configs, i18n) - context.init(); - - // Prepare ui look&feel and load ui properties - try { - SwingUtil.initNimbusLoookAndFeel(); - } catch (Exception e) { - // could not find nimbus look-and-feel - if (log.isWarnEnabled()) { - log.warn("Failed to init nimbus look and feel", e); - } - } - - boolean reload = false; - - if (config.isFullLaunchMode()) { - - if (log.isInfoEnabled()) { - log.info("Full launch mode, try to update."); - } - - } - - if (!reload) { - if (log.isInfoEnabled()) { - log.info("Will start FaxToMail..."); - } - startFaxToMail(context, true); - } - - } finally { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - splashScreen.complete(); - } - }); - } - } - - public static void startFaxToMail(FaxToMailUIContext context, boolean openContext) { - - if (openContext) { - context.open(); - } - -// UIManager.put("Table.alternateRowColor", context.getConfig().getColorAlternateRow()); -// UIManager.put("Table[Disabled+Selected].textBackground", context.getConfig().getColorSelectedRow()); -// UIManager.put("Table[Enabled+Selected].textBackground", context.getConfig().getColorSelectedRow()); - UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource.LineBorderUIResource(Color.BLACK)); - - final MainUI mainUI = new MainUI(context); - context.addMessageNotifier(mainUI.getHandler()); - - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - mainUI.setVisible(true); - } - }); - } - - public static void closeFaxToMail(MainUIHandler handler, Integer exitCode) { - - FaxToMailUIContext context = handler.getContext(); - - // close ui - handler.onCloseUI(); - - //close context - try { - context.getSwingSession().save(); - - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("error while saving the swing session", e); - } - } - context.close(); - - if (exitCode != null) { - System.exit(exitCode); - } - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java deleted file mode 100644 index 4bd702b..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractChangeScreenAction.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.content.MainUI; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import jaxx.runtime.SwingUtil; -import jaxx.runtime.context.JAXXContextEntryDef; - -/** - * Action to change the screen. - * - * Will just check that the current screen can be quit via - * the {@link com.franciaflex.faxtomail.ui.swing.content.MainUIHandler#quitCurrentScreen()}. - * - * @author kmorin - kmorin@codelutin.com - */ -public abstract class AbstractChangeScreenAction extends AbstractMainUIFaxToMailAction { - - /** - * Context entry to keep previous screen. - */ - protected static final JAXXContextEntryDef<FaxToMailScreen> PREVIOUS_SCREEN = - SwingUtil.newContextEntryDef("previousScreen", FaxToMailScreen.class); - - /** - * Screen where to go. - */ - protected FaxToMailScreen screen; - - /** - * Flag to skip the check of current screen. - */ - protected boolean skipCheckCurrentScreen; - - protected AbstractChangeScreenAction(MainUIHandler handler, - boolean hideBody, - FaxToMailScreen screen) { - super(handler, hideBody); - this.screen = screen; - } - - public void setSkipCheckCurrentScreen(boolean skipCheckCurrentScreen) { - this.skipCheckCurrentScreen = skipCheckCurrentScreen; - } - - protected void setScreen(FaxToMailScreen screen) { - this.screen = screen; - } - - @Override - public boolean prepareAction() throws Exception { - boolean result = super.prepareAction(); - - result &= skipCheckCurrentScreen || getHandler().quitCurrentScreen(); - return result; - } - - @Override - public void doAction() throws Exception { - - FaxToMailUIContext context = getContext(); - - FaxToMailScreen previousScreen = context.getScreen(); - if (getUI() != null) { - if (previousScreen == null) { - PREVIOUS_SCREEN.removeContextValue(getUI()); - - } else if (screen != previousScreen) { - PREVIOUS_SCREEN.setContextValue(getUI(), previousScreen); - } - } - - // clean current screen - context.setScreen(null); - - // change screen - context.setScreen(screen); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - - if (screen == FaxToMailScreen.LIST) { - MailFolder currentMailFolder = getContext().getCurrentMailFolder(); - DemandeUIModel currentEmail = getContext().getCurrentEmail(); - - if (currentMailFolder == null && currentEmail != null) { - currentMailFolder = currentEmail.getMailFolder(); - } - DemandeListUI listUI = (DemandeListUI) getHandler().getCurrentBody(); - listUI.getModel().setSelectedFolder(currentMailFolder); - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractFaxToMailAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractFaxToMailAction.java deleted file mode 100644 index c5daf06..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractFaxToMailAction.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.persistence.ProgressionModel; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; -import org.jdesktop.beans.AbstractBean; -import org.nuiton.jaxx.application.swing.action.AbstractApplicationAction; - -/** - * FaxToMail base action. - * - * @author kmorin - morin@codelutin.com - */ -public abstract class AbstractFaxToMailAction <M extends AbstractBean, UI extends FaxToMailUI<M, ?>, H extends AbstractFaxToMailUIHandler<M, UI>> - extends AbstractApplicationAction<M, UI, H> { - - public abstract void doAction() throws Exception; - - protected AbstractFaxToMailAction(H handler, boolean hideBody) { - super(handler, hideBody); - } - - @Override - public FaxToMailUIContext getContext() { - return handler.getContext(); - } - - @Override - protected ProgressionModel getProgressionModel() { - return (ProgressionModel) getContext().getActionUI().getModel().getProgressionModel(); - } - - @Override - protected FaxToMailConfiguration getConfig() { - return getContext().getConfig(); - } - - @Override - protected void sendMessage(String message) { - getContext().showInformationMessage(message); - } - - @Override - protected void createProgressionModelIfRequired(int total) { - ProgressionModel progressionModel = getProgressionModel(); - if (progressionModel == null) { - progressionModel = new ProgressionModel(); - progressionModel.setTotal(total); - progressionModel.setMessage(""); - progressionModel.setCurrent(0); - setProgressionModel(progressionModel); - } else { - progressionModel.adaptTotal(total); - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractMainUIFaxToMailAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractMainUIFaxToMailAction.java deleted file mode 100644 index c23b032..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AbstractMainUIFaxToMailAction.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.content.MainUI; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; - -/** - * @author kmorin - morin@codelutin.com - */ -public abstract class AbstractMainUIFaxToMailAction extends AbstractFaxToMailAction<FaxToMailUIContext, MainUI, MainUIHandler> { - - protected AbstractMainUIFaxToMailAction(MainUIHandler handler, - boolean hideBody) { - super(handler, hideBody); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AddAttachmentAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AddAttachmentAction.java deleted file mode 100644 index 4799119..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AddAttachmentAction.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIModel; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - */ -public class AddAttachmentAction extends AbstractFaxToMailAction<AttachmentEditorUIModel, AttachmentEditorUI, AttachmentEditorUIHandler> { - - public AddAttachmentAction(AttachmentEditorUIHandler handler) { - super(handler, false); - } - - @Override - public void doAction() throws Exception { - Attachment attachment = new AttachmentImpl(); - attachment.setAddedByUser(true); - File file = getUI().getFile().getSelectedFile(); - if (file != null) { - try { - // warning, this not NOT be closed (will be by blob on commit) - InputStream is = new FileInputStream(file); - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - AttachmentFile attachmentFile = serviceContext.getEmailService().getAttachmentFileFromStream(is); - attachmentFile.setFilename(file.getName()); - attachment.setOriginalFile(attachmentFile); - - } catch (Exception e) { - getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.copy.file"), e); - } - - getModel().addAttachment(attachment); - getUI().getFile().setSelectedFilePath(null); - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AddAttachmentToReplyAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AddAttachmentToReplyAction.java deleted file mode 100644 index caaad82..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/AddAttachmentToReplyAction.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyAttachmentModel; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel; - -/** - * @author Kevin Morin (Code Lutin) - */ -public class AddAttachmentToReplyAction extends AbstractFaxToMailAction<ReplyFormUIModel, ReplyFormUI, ReplyFormUIHandler> { - - protected ReplyAttachmentModel replyAttachmentModel; - - public AddAttachmentToReplyAction(ReplyFormUIHandler handler) { - super(handler, false); - setActionDescription("faxtomail.action.addAttachmentToReply.tip"); - } - - public ReplyAttachmentModel getReplyAttachmentModel() { - return replyAttachmentModel; - } - - public void setReplyAttachmentModel(ReplyAttachmentModel replyAttachmentModel) { - this.replyAttachmentModel = replyAttachmentModel; - } - - @Override - public void doAction() throws Exception { - Attachment attachment = replyAttachmentModel.getAttachment(); - if (replyAttachmentModel.getAttachmentFile() == null && attachment.isPersisted()) { - EmailService service = getContext().newServiceContext().getEmailService(); - boolean original = replyAttachmentModel.isOriginal(); - AttachmentFile file = service.getAttachmentFile(attachment.getTopiaId(), - original); - if (original) { - attachment.setOriginalFile(file); - } else { - attachment.setEditedFile(file); - } - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java deleted file mode 100644 index 9e8f40f..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.util.Date; - -import javax.swing.JOptionPane; - -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.google.common.base.Optional; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -/** - * Action d'archivage d'un mail. - * - * Passe le mail et statut archivé et déplace le mail dans le dossier d'archive le plus proche. - * - * @author Kevin Morin (Code Lutin) - */ -public class ArchiveAction extends SaveDemandeAndExitAction { - - public ArchiveAction(DemandeUIHandler handler) { - super(handler); - setActionDescription(t("faxtomail.action.archive.tip")); - } - - @Override - public boolean prepareAction() throws Exception { - int i = JOptionPane.showConfirmDialog( - null, - t("faxtomail.alert.archiveConfirmation.message"), - t("faxtomail.alert.archiveConfirmation.title"), - JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE); - - boolean result = i == JOptionPane.YES_OPTION; - return result; - } - - @Override - public void doAction() throws Exception { - DemandeUIModel model = getModel(); - model.setArchiveDate(new Date()); - model.setDemandStatus(DemandStatus.ARCHIVED); - model.setTakenBy(null); - - // déplacement du mail dans le dossier d'archive le plus proche - // cela permet de déplacer les archives dans d'autre dossier pour leur appliquer - // des droits différents - // les dossiers d'archive ne sont pas visible dans l'arbre des dossiers, mais les archives - // peuvent être consultées dans la recherche - MailFolder folder = model.getMailFolder(); - MailFolder archiveChild = null; - do { - if (folder.getChildren() != null) { - Optional<MailFolder> optArchiveChild = Iterables.tryFind(folder.getChildren(), new Predicate<MailFolder>() { - @Override - public boolean apply(MailFolder mailFolder) { - return mailFolder.isArchiveFolder(); - } - }); - if (optArchiveChild.isPresent()) { - archiveChild = optArchiveChild.get(); - } - } - folder = folder.getParent(); - - } while (archiveChild == null && folder != null); - - // le dossier d'archive peut ne pas exister. Dans ce cas on laisse le mail dans le dossier - // d'origine - if (archiveChild != null) { - model.setMailFolder(archiveChild); - } - - super.doAction(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveFromListAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveFromListAction.java deleted file mode 100644 index 6cd18bf..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveFromListAction.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.MailAction; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.google.common.base.Optional; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -import javax.swing.*; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class ArchiveFromListAction extends SaveDemandeFromListAction { - - protected List<DemandeUIModel> demandsToArchive; - - public ArchiveFromListAction(DemandeListUIHandler handler) { - super(handler); - setActionDescription(t("faxtomail.action.archive.tip")); - } - - @Override - public boolean prepareAction() throws Exception { - boolean result = super.prepareAction(); - - demandsToArchive = new ArrayList<DemandeUIModel>(); - List<DemandeUIModel> currentEmails = getModel().getSelectedEmails(); - - String notArchivableDemandTitles = ""; - for (DemandeUIModel demandeUIModel : currentEmails) { - // is the demand archivable? - if (!demandeUIModel.isEditable() || - !handler.isActionEnabled(demandeUIModel, MailAction.ARCHIVE, handler.getConfiguration())) { - notArchivableDemandTitles += "- " + demandeUIModel.getTitle() + "<br/>"; - - } else { - demandsToArchive.add(demandeUIModel); - } - } - - if (demandsToArchive.isEmpty()) { - displayWarningMessage(t("faxtomail.alert.noDemandToArchive.title"), - t("faxtomail.alert.noDemandToArchive.message", notArchivableDemandTitles)); - result = false; - - } else { - String message; - if (!notArchivableDemandTitles.isEmpty()) { - message = t("faxtomail.alert.archivesWithNotArchivableConfirmation.message", notArchivableDemandTitles); - - } else if (demandsToArchive.size() == 1) { - message = t("faxtomail.alert.archiveConfirmation.message"); - - } else { - message = t("faxtomail.alert.archivesConfirmation.message"); - } - int i = JOptionPane.showConfirmDialog(null, - message, - t("faxtomail.alert.archiveConfirmation.title"), - JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE); - - result = i == JOptionPane.YES_OPTION; - } - - return result; - } - - @Override - public void doAction() throws Exception { - - // déplacement du mail dans le dossier d'archive le plus proche - // cela permet de déplacer les archives dans d'autre dossier pour leur appliquer - // des droits différents - // les dossiers d'archive ne sont pas visible dans l'arbre des dossiers, mais les archives - // peuvent être consultées dans la recherche - MailFolder folder = demandsToArchive.get(0).getMailFolder(); - MailFolder archiveChild = null; - do { - if (folder.getChildren() != null) { - Optional<MailFolder> optArchiveChild = Iterables.tryFind(folder.getChildren(), new Predicate<MailFolder>() { - @Override - public boolean apply(MailFolder mailFolder) { - return mailFolder.isArchiveFolder(); - } - }); - if (optArchiveChild.isPresent()) { - archiveChild = optArchiveChild.get(); - } - } - folder = folder.getParent(); - - } while (archiveChild == null && folder != null); - - for (DemandeUIModel email : demandsToArchive) { - email.setArchiveDate(new Date()); - email.setDemandStatus(DemandStatus.ARCHIVED); - email.setTakenBy(null); - // le dossier d'archive peut ne pas exister. Dans ce cas on laisse le mail dans le dossier - // d'origine - if (archiveChild != null) { - email.setMailFolder(archiveChild); - } - } - - modifiedProperties = new String[] { Email.PROPERTY_ARCHIVE_DATE }; - super.doAction(); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - getModel().removeEmails(getModel().getSelectedEmails()); - getModel().setSelectedEmails(null); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/CloseApplicationAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/CloseApplicationAction.java deleted file mode 100644 index dc6341e..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/CloseApplicationAction.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.RunFaxToMail; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; - -import static org.nuiton.i18n.I18n.t; - -/** - * To close FaxToMail Application. - * - * @author kmorin - morin@codelutin.com - */ -public class CloseApplicationAction extends AbstractChangeScreenAction { - - protected int exitCode = RunFaxToMail.NORMAL_EXIT_CODE; - - public CloseApplicationAction(MainUIHandler handler) { - super(handler, false, null); - setActionDescription(t("faxtomail.action.exit.tip")); - } - - @Override - public void doAction() throws Exception { - super.doAction(); - RunFaxToMail.closeFaxToMail(getHandler(), exitCode); - } - - @Override - public void releaseAction() { - exitCode = RunFaxToMail.NORMAL_EXIT_CODE; - super.releaseAction(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ComputeQuantitiesByRangeAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ComputeQuantitiesByRangeAction.java deleted file mode 100644 index 06b466c..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ComputeQuantitiesByRangeAction.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.ui.swing.content.demande.QuantitiesByRangeUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.QuantitiesByRangeUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.QuantitiesByRangeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.demande.RangeRowModel; - -import java.awt.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class ComputeQuantitiesByRangeAction extends AbstractFaxToMailAction<QuantitiesByRangeUIModel, QuantitiesByRangeUI, QuantitiesByRangeUIHandler> { - - public ComputeQuantitiesByRangeAction(QuantitiesByRangeUIHandler handler) { - super(handler, false); - setActionDescription(t("faxtomail.action.computeQuantitiesByRange.tip")); - } - - @Override - public void doAction() throws Exception { - MailFolder folder = getModel().getRootFolder(); - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - Map<Range, Long[]> quantitiesByRange = serviceContext.getEmailService().computeQuantitiesByRange(folder); - - List<RangeRowModel> rangeRows = new ArrayList<>(); - for (Range range : quantitiesByRange.keySet()) { - RangeRowModel row = new RangeRowModel(); - row.setRange(range); - - Long[] quantities = quantitiesByRange.get(range); - - Long productQuantity = quantities[0]; - if (productQuantity == null) { - productQuantity = 0L; - } - row.setProductQuantity(productQuantity.intValue()); - - Long savQuantity = quantities[1]; - if (savQuantity == null) { - savQuantity = 0L; - } - row.setSavQuantity(savQuantity.intValue()); - - Long quotationQuantity = quantities[2]; - if (quotationQuantity == null) { - quotationQuantity = 0L; - } - row.setQuotationQuantity(quotationQuantity.intValue()); - - rangeRows.add(row); - } - getModel().setRangeRows(rangeRows); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - handler.openDialog(getUI(), t("faxtomail.quantitiesByRange.title"), new Dimension(350, 300)); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java deleted file mode 100644 index 8178a2c..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.ui.swing.content.MainUI; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIModel; -import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUI; -import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIModel; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; - -import javax.swing.*; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class EditAttachmentAction extends AbstractFaxToMailAction<AttachmentEditorUIModel, AttachmentEditorUI, AttachmentEditorUIHandler> { - - protected Attachment attachment; - protected PDFEditorUI dialogContent; - protected JFrame frame; - - public EditAttachmentAction(AttachmentEditorUIHandler handler) { - super(handler, false); - } - - public void setAttachment(Attachment attachment) { - this.attachment = attachment; - String attachmentName = attachment.getEditedFileName() != null ? attachment.getEditedFileName() : attachment.getOriginalFileName(); - setActionDescription(t("faxtomail.action.attachment.edit.tip", attachmentName)); - } - - @Override - public void doAction() throws Exception { - getModel().fireAttachmentOpened(attachment, false); - - FaxToMailUIUtil.forceAttachmentFileLoading(getContext(), attachment); - - dialogContent = new PDFEditorUI(getUI()); - PDFEditorUIModel pdfEditorUIModel = dialogContent.getModel(); - pdfEditorUIModel.fromEntity(attachment); - pdfEditorUIModel.setDemand(getContext().getCurrentEmail()); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - MainUI mainUI = getContext().getMainUI(); - frame = getHandler().openModalFrame(dialogContent, attachment.getOriginalFileName(), mainUI.getSize()); - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - } - - @Override - public void windowClosed(WindowEvent e) { - dialogContent.getModel().toEntity(attachment); - } - }); - } - - @Override - protected void releaseAction() { - super.releaseAction(); - if (frame != null) { - frame.toFront(); - frame = null; - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java deleted file mode 100644 index 23fe0a0..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java +++ /dev/null @@ -1,337 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.awt.*; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.InputStream; - -import javax.swing.JTextArea; - -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; -import com.itextpdf.text.DocumentException; -import com.itextpdf.text.Element; -import com.itextpdf.text.ExceptionConverter; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXUtil; - -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI; -import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorCrossUI; -import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorHighlighterUI; -import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorLineUI; -import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorNoteUI; -import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUI; -import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUIModel; -import com.itextpdf.text.BaseColor; -import com.itextpdf.text.Document; -import com.itextpdf.text.Font; -import com.itextpdf.text.Phrase; -import com.itextpdf.text.pdf.BaseFont; -import com.itextpdf.text.pdf.ColumnText; -import com.itextpdf.text.pdf.PdfAction; -import com.itextpdf.text.pdf.PdfContentByte; -import com.itextpdf.text.pdf.PdfGState; -import com.itextpdf.text.pdf.PdfReader; -import com.itextpdf.text.pdf.PdfStamper; -import com.itextpdf.text.pdf.PdfWriter; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class GenerateAnnotatedAttachmentAction extends AbstractFaxToMailAction<PDFEditorUIModel, PDFEditorUI, PDFEditorUIHandler> { - - public GenerateAnnotatedAttachmentAction(PDFEditorUIHandler handler) { - super(handler, true); - setActionDescription(t("faxtomail.action.generateAnnotatedAttachment.tip")); - } - - @Override - public void doAction() throws Exception { - - PDFEditorUIModel model = getModel(); - AttachmentFile attachmentFile = model.getNotNullFile(); - File file = attachmentFile.getFile(); - - InputStream inputStream = new FileInputStream(file); - - PdfReader pdfReader = new PdfReader(inputStream); - - //File target = new File(FileUtils.getTempDirectory(), getModel().getOriginalFile().getName() + "-annoté.pdf"); - File target = File.createTempFile("faxtomail-", ".tmp"); - target.deleteOnExit(); - - FileOutputStream fos = new FileOutputStream(target); - PdfStamper pdfStamper = new PdfStamper(pdfReader, fos); - - int pageNb = model.getPages().length; - float zoom = model.getZoom(); - int rotation = model.getRotation(); - - - for (int i = 0 ; i < pageNb ; i++) { - PdfContentByte cb = pdfStamper.getOverContent(i + 1); - - for (PDFEditorNoteUI note : model.getPages()[i].getNotes()) { - - int[] coordinates = computeCoordinates(note, rotation, zoom); - int width = coordinates[0]; - int height = coordinates[1]; - int x = coordinates[2]; - int y = coordinates[3]; - - Insets insets = note.getInsets(); - - cb.saveState(); - cb.setColorFill(BaseColor.YELLOW); - cb.rectangle(x, y, width, height); - cb.fill(); - cb.restoreState(); - - cb.saveState(); - JTextArea textArea = note.getNoteText(); - float fontSize = textArea.getFont().getSize2D() / zoom; - BaseFont titleFont = BaseFont.createFont(BaseFont.HELVETICA_OBLIQUE, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); - BaseFont font = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); - - String text = note.getText(); - String[] rows = text.split("\n"); - int rowHeight = (int) ((textArea.getHeight() / rows.length) / zoom); - - int xxx = x; - int yyy = y; - if (rotation == 0) { - xxx += insets.left; - yyy += height - rowHeight - insets.top / zoom; - - } else if (rotation == 90) { - xxx += rowHeight + insets.top / zoom; - yyy += insets.left; - - } else if (rotation == 180) { - xxx += width - insets.right / zoom; - yyy += rowHeight - insets.top / zoom; - - } else if (rotation == 270) { - xxx += width - rowHeight - insets.left / zoom; - yyy += height - insets.top / zoom; - } - - showTextAligned(cb, note.getTitle(), xxx, yyy, rotation, titleFont, fontSize); - - for (String s : rows) { - if (s.isEmpty()) { - s = " "; - } - if (rotation == 0) { - yyy -= rowHeight; - - } else if (rotation == 90) { - xxx += rowHeight; - - } else if (rotation == 180) { - yyy += rowHeight; - - } else if (rotation == 270) { - xxx -= rowHeight; - } - showTextAligned(cb, s, xxx, yyy, rotation, font, fontSize); - } - - cb.restoreState(); - - } - - for (PDFEditorCrossUI panel : model.getPages()[i].getCrosses()) { - - int[] coordinates = computeCoordinates(panel, rotation, zoom); - int width = coordinates[0]; - int height = coordinates[1]; - int x = coordinates[2]; - int y = coordinates[3]; - - cb.saveState(); - cb.setColorStroke(BaseColor.BLUE); - cb.moveTo(x, y); - cb.lineTo(x + width, y + height); - cb.stroke(); - cb.moveTo(x + width, y); - cb.lineTo(x, y + height); - cb.stroke(); - cb.restoreState(); - } - - for (PDFEditorLineUI panel : model.getPages()[i].getLines()) { - - int[] coordinates = computeCoordinates(panel, rotation, zoom); - int width = coordinates[0]; - int height = coordinates[1]; - int x = coordinates[2]; - int y = coordinates[3]; - - if (rotation % 180 == 0 ^ !panel.isHorizontal()) { - y += height / 2; - } else { - x += width / 2; - } - - cb.saveState(); - cb.setColorStroke(BaseColor.BLUE); - cb.moveTo(x, y); - if (rotation % 180 == 0 ^ !panel.isHorizontal()) { - cb.lineTo(x + width, y); - } else { - cb.lineTo(x, y + height); - } - cb.stroke(); - cb.restoreState(); - } - - for (PDFEditorHighlighterUI panel : model.getPages()[i].getHighlighters()) { - - int[] coordinates = computeCoordinates(panel, rotation, zoom); - int width = coordinates[0]; - int height = coordinates[1]; - int x = coordinates[2]; - int y = coordinates[3]; - - cb.saveState(); - PdfGState gs1 = new PdfGState(); - gs1.setFillOpacity(0.4f); - cb.setGState(gs1); - - cb.setColorFill(BaseColor.YELLOW); - cb.rectangle(x, y, width, height); - cb.fill(); - cb.restoreState(); - } - } - - pdfStamper.close(); - pdfReader.close(); - - Document document = new Document(); - PdfWriter writer = PdfWriter.getInstance(document, fos); - PdfAction action = new PdfAction(PdfAction.PRINTDIALOG); - writer.setOpenAction(action); - - // convert content to blob - InputStream is = new BufferedInputStream(new FileInputStream(target)); - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - AttachmentFile attachmentFileNew = serviceContext.getEmailService().getAttachmentFileFromStream(is); - attachmentFileNew.setRotation(rotation); - String fileName = model.getNotNullFile().getFilename(); - attachmentFileNew.setFilename(FaxToMailUIUtil.getEditedFileName(fileName)); - model.setEditedFile(attachmentFileNew); - - AttachmentEditorUI parentUI = (AttachmentEditorUI) getUI().getContextValue(JAXXContext.class, JAXXUtil.PARENT); - parentUI.getModel().fireAttachmentEdited(model.toEntity()); - - model.setModify(false); - } - - protected int[] computeCoordinates(Component panel, int rotation, float zoom) { - Point location = panel.getLocation(); - - int width = rotation % 180 == 0 ? panel.getWidth() : panel.getHeight(); - int height = rotation % 180 == 0 ? panel.getHeight() : panel.getWidth(); - - width = (int) (width / zoom); - height = (int) (height / zoom); - - int x = 0; - int y = 0; - - if (rotation == 0) { - x = (int) (location.x / zoom); - y = (int) ((getUI().getContainer().getHeight() - location.y) / zoom) - height; - - } else if (rotation == 180) { - x = (int) ((getUI().getContainer().getWidth() - location.x) / zoom) - width; - y = (int) (location.y / zoom); - - } else if (rotation == 90) { - x = (int) (location.y / zoom); - y = (int) (location.x / zoom); - - } else if (rotation == 270) { - x = (int) ((getUI().getContainer().getHeight() - location.y) / zoom) - width; - y = (int) ((getUI().getContainer().getWidth() - location.x) / zoom) - height; - } - - int[] result = new int[] { width, height, x, y }; - return result; - } - - protected void showTextAligned(PdfContentByte canvas, String text, float x, float y, float rotation, BaseFont baseFont, float fontSize) { - canvas.saveState(); - - ColumnText ct = new ColumnText(canvas); - - float lly = -1; - float ury = 2; - float llx = 0; - float urx = 20000; - - if (rotation == 0) { - llx += x; - lly += y; - urx += x; - ury += y; - - } else { - double alpha = rotation * Math.PI / 180.0; - float cos = (float)Math.cos(alpha); - float sin = (float)Math.sin(alpha); - canvas.concatCTM(cos, sin, -sin, cos, x, y); - } - - Font font = new Font(baseFont, fontSize); - ct.setSimpleColumn(new Phrase(text, font), llx, lly, urx, ury, 0, Element.ALIGN_LEFT); - ct.setAlignment(Element.ALIGN_LEFT); - - try { - ct.go(); - } - catch (DocumentException e) { - throw new ExceptionConverter(e); - } - canvas.restoreState(); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - getHandler().closeFrame(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GoToPreviousScreenAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GoToPreviousScreenAction.java deleted file mode 100644 index bf7c69a..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GoToPreviousScreenAction.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; - -import static org.nuiton.i18n.I18n.t; - -/** - * To return on previous screen. - * - * @author kmorin - morin@codelutin.com - */ -public class GoToPreviousScreenAction extends AbstractChangeScreenAction { - - public GoToPreviousScreenAction(MainUIHandler handler) { - super(handler, - true, - PREVIOUS_SCREEN.getContextValue(handler.getUI()) - ); - setActionDescription(t("faxtomail.action.goto.previousScreen.tip")); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java deleted file mode 100644 index eb126a4..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.search.SearchToGroupUI; -import com.franciaflex.faxtomail.ui.swing.content.search.SearchToGroupUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.search.SearchUIModel; -import com.franciaflex.faxtomail.ui.swing.util.DemandeTableModel; -import org.jdesktop.swingx.JXTable; - -import javax.swing.*; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class GroupAction extends AbstractFaxToMailAction<SearchUIModel, SearchToGroupUI, SearchToGroupUIHandler> { - - public GroupAction(SearchToGroupUIHandler handler) { - super(handler, false); - setActionDescription(t("faxtomail.action.group.tip")); - } - - protected DemandeUIModel currentEmail; - protected DemandeUIModel selectedEmail; - - @Override - public boolean prepareAction() throws Exception { - - JXTable dataTable = getUI().getDataTable(); - int rowIndex = dataTable.getSelectedRow(); - rowIndex = dataTable.convertRowIndexToModel(rowIndex); - selectedEmail = ((DemandeTableModel) dataTable.getModel()).getEntry(rowIndex); - - currentEmail = getContext().getCurrentEmail(); - - int i = JOptionPane.showConfirmDialog( - null, - t("faxtomail.alert.groupConfirmation.message", currentEmail.getTitle(), selectedEmail.getTitle()), - t("faxtomail.alert.groupConfirmation.title"), - JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE); - - boolean result = i == JOptionPane.YES_OPTION; - return result; - } - - @Override - public void doAction() throws Exception { - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - EmailService emailService = serviceContext.getEmailService(); - - FaxToMailUser currentUser = getContext().getCurrentUser(); - Email email = emailService.groupEmails(currentEmail.getTopiaId(), selectedEmail.getTopiaId(), currentUser); - currentEmail.fromEntity(email); - currentEmail.setGroupedDemandes(email.getEmailGroup()); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - handler.showInformationMessage(t("faxtomail.demande.group.successful")); - handler.closeFrame(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/LoadFolderEmailsAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/LoadFolderEmailsAction.java deleted file mode 100644 index bb383b4..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/LoadFolderEmailsAction.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import jaxx.runtime.JAXXUtil; -import jaxx.runtime.swing.table.filter.TableRowFilterSupport; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.JXTable; -import org.nuiton.decorator.Decorator; -import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; -import org.nuiton.topia.persistence.TopiaEntities; -import org.nuiton.util.pagination.PaginationResult; - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIModel; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.demande.RangeRowModel; - -/** - * Action de chargement des demandes d'un dossier lors de la selection d'un dossier dans l'arbre - * des dossiers. - * - * @author Kevin Morin (Code Lutin) - */ -public class LoadFolderEmailsAction extends AbstractFaxToMailAction<DemandeListUIModel, DemandeListUI, DemandeListUIHandler> { - - private final static Log log = LogFactory.getLog(LoadFolderEmailsAction.class); - - public LoadFolderEmailsAction(DemandeListUIHandler handler) { - super(handler, false); - } - - @Override - public boolean prepareAction() throws Exception { - boolean result; - - DemandeListUIModel model = getModel(); - MailFolder folder = model.getSelectedFolder(); - - if (folder == null) { - result = false; - - } else { - final JXTable dataTable = getUI().getDataTable(); - - setActionDescription(t("faxtomail.action.loadFolderEmails.tip", folder.getName())); - - // change name to save the state of the column width for every folder - // (as every folder can have a different header) - getContext().getSwingSession().updateState(); - String columns = handler.populateColumnModel(dataTable, false); - dataTable.setName("dataTable" + columns); - getContext().getSwingSession().add(dataTable, true); - - // fixes #5528 filtre sur les colonnes : il manque l'icone qui indique que la colonne est filtrée - handler.initTableFilter(); - result = true; - } - - return result; - } - - @Override - public void doAction() throws Exception { - DemandeListUIHandler handler = getHandler(); - DemandeListUIModel model = getModel(); - MailFolder folder = model.getSelectedFolder(); - FaxToMailUser currentUser = getContext().getCurrentUser(); - - List<MailField> columns = handler.getColumns(); - Collection<MailField> fields = new HashSet<MailField>(); - if (columns != null) { - fields.addAll(columns); - } - fields.add(MailField.TAKEN_BY); - - PaginationResult<Email> paginationResult = getContext().newServiceContext().getEmailService() - .getEmailForFolder(folder, - currentUser, - getModel().getEmailFilter(), - model.getPaginationParameter()); - List<Email> emails = paginationResult.getElements(); - if (log.isDebugEnabled()) { - log.debug(emails.size() + " emails in folder " + folder.getName()); - } - - Map<String, WaitingState> waitingStateById = Maps.uniqueIndex(getContext().getWaitingStateCache(), TopiaEntities.getTopiaIdFunction()); - - List<DemandeUIModel> demands = new ArrayList<DemandeUIModel>(); - for (Email email : emails) { - DemandeUIModel demand = new DemandeUIModel(); - demand.fromEntityExcluding(email, Sets.newHashSet(Email.PROPERTY_MAIL_FOLDER, Email.PROPERTY_HISTORY)); - - // on ajoute toutes les lignes de rangeRow, - // qui sont toutes valides puisqu'on les récupère de la base et qu'on ne sauvegarde que les lignes valides - Collection<RangeRow> rangeRows = demand.getRangeRow(); - if (rangeRows != null) { - for (RangeRow rangeRow : rangeRows) { - if (rangeRow != null) { - RangeRowModel rangeRowModel = new RangeRowModel(); - rangeRowModel.fromEntity(rangeRow); - if (rangeRowModel.isValid()) { - demand.addValidRangeRow(rangeRowModel); - } - } - } - } - - demand.setValid(handler.isDemandeValid(demand)); - demand.setMailFolder(folder); - demand.setEditable(folder.isFolderWritable() && demand.getDemandStatus().isEditableStatus()); - WaitingState waitingState = email.getWaitingState(); - if (waitingState != null) { - demand.setWaitingState(waitingStateById.get(waitingState.getTopiaId())); - } - demands.add(demand); - } - - model.setEmails(demands); - model.setPaginationParameter(paginationResult.getCurrentPage()); - model.setPaginationResult(paginationResult); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - - DemandeUIModel currentEmail = getContext().getCurrentEmail(); - - if (currentEmail != null) { - JXTable dataTable = getUI().getDataTable(); - AbstractApplicationTableModel<DemandeUIModel> dataTableModel = - (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel(); - int row = dataTableModel.getRowIndex(currentEmail); - if (row > 0) { - dataTable.setRowSelectionInterval(row, row); - dataTable.scrollRowToVisible(row); - } - } - } - - @Override - protected void releaseAction() { - super.releaseAction(); - getUI().getNavigationTree().setEnabled(true); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenAttachmentAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenAttachmentAction.java deleted file mode 100644 index 85c0b75..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenAttachmentAction.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIModel; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class OpenAttachmentAction extends AbstractFaxToMailAction<AttachmentEditorUIModel, AttachmentEditorUI, AttachmentEditorUIHandler> { - - protected Attachment attachment; - protected boolean original; - - public OpenAttachmentAction(AttachmentEditorUIHandler handler) { - super(handler, false); - } - - public void setAttachment(Attachment attachment, boolean original) { - this.attachment = attachment; - this.original = original; - String attachmentName = original ? attachment.getOriginalFileName() : attachment.getEditedFileName(); - setActionDescription(t("faxtomail.action.attachment.open.tip", attachmentName)); - } - - @Override - public void doAction() throws Exception { - getModel().fireAttachmentOpened(attachment, original); - FaxToMailUIUtil.forceAttachmentFileLoading(getContext(), attachment); - AttachmentFile attachmentFile = original ? attachment.getOriginalFile() : attachment.getEditedFile(); - FaxToMailUIUtil.openFile(getContext(), attachmentFile); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenGroupedDemandAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenGroupedDemandAction.java deleted file mode 100644 index 9e9b513..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenGroupedDemandAction.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.services.service.exceptions.AlreadyLockedMailException; -import com.franciaflex.faxtomail.services.service.exceptions.FolderNotReadableException; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup.DemandGroupUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup.DemandGroupUIHandler; -import org.apache.commons.lang3.StringUtils; -import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler; - -import javax.swing.*; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - */ -public class OpenGroupedDemandAction extends AbstractFaxToMailAction<DemandeUIModel, DemandGroupUI, DemandGroupUIHandler> { - - protected DemandeUIModel demandToOpen; - protected boolean takeEmail; - - public OpenGroupedDemandAction(DemandGroupUIHandler handler, DemandeUIModel demandToOpen) { - super(handler, false); - this.demandToOpen = demandToOpen; - setActionDescription(t("faxtomail.action.goto.demand.tip")); - } - - @Override - public boolean prepareAction() throws Exception { - boolean result = super.prepareAction(); - - MainUIHandler mainUIHandler = getContext().getMainUI().getHandler(); - DemandesUI parentContainer = (DemandesUI) mainUIHandler.getCurrentBody(); - if (parentContainer.getModel().containsDemand(demandToOpen)) { - openDemandScreen(); - result = false; - - } else { - String topiaId = demandToOpen.getTopiaId(); - if (StringUtils.isNotBlank(topiaId)) { - FaxToMailUser currentUser = getContext().getCurrentUser(); - int answer = -1; - - try { - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - EmailService emailService = serviceContext.getEmailService(); - - // tentative de verrouillages des email existants - Email email = emailService.lockEmail(topiaId, currentUser); - - FaxToMailUser takenBy = email.getTakenBy(); - - // si le mail est pris par quelqu'un d'autre, le prend-on ou pas ? - if (takenBy != null && !currentUser.equals(takenBy)) { - String htmlMessage = String.format( - AbstractApplicationUIHandler.CONFIRMATION_FORMAT, - t("faxtomail.alert.alreadyTakenBy.message", decorate(takenBy)), - t("faxtomail.alert.alreadyTakenBy.help")); - - answer = JOptionPane.showConfirmDialog(getHandler().getTopestUI(), - htmlMessage, - t("faxtomail.alert.alreadyTakenBy.title"), - JOptionPane.YES_NO_CANCEL_OPTION, - JOptionPane.QUESTION_MESSAGE); - } - - // si on annule, on délock - if (answer == JOptionPane.CANCEL_OPTION) { - result = false; - emailService.unlockEmail(topiaId); - - } else { - // sinon on ouvre - - // si on ne prend pas, le mail est en readonly - if (answer == JOptionPane.NO_OPTION) { - demandToOpen.setEditable(false); - takeEmail = false; - } - // si on prend, on prend et on rend editable - else if (answer == JOptionPane.YES_OPTION) { - takeEmail = true; - demandToOpen.setEditable(true); - } - } - } - // le mail est locké, on ne fait rien - catch (AlreadyLockedMailException ex) { - result = false; - - String htmlMessage = t("faxtomail.alert.alreadyLockedBy.message", decorate(ex.getLockedBy())); - JOptionPane.showMessageDialog(getHandler().getTopestUI(), - htmlMessage, - t("faxtomail.alert.alreadyLockedBy.title"), - JOptionPane.ERROR_MESSAGE); - } - // l'utilisateur n'a pas les droits de lecture sur le dossier - catch (FolderNotReadableException e) { - result = false; - - String htmlMessage = t("faxtomail.alert.userNotAuthorizedToReadEmail.message", e.getForbiddenFolder().getName()); - JOptionPane.showMessageDialog(getHandler().getTopestUI(), - htmlMessage, - t("faxtomail.alert.userNotAuthorizedToReadEmail.title"), - JOptionPane.ERROR_MESSAGE); - } - } - } - return result; - } - - - @Override - public void doAction() throws Exception { - if (StringUtils.isNotBlank(demandToOpen.getTopiaId())) { - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - - Email email = serviceContext.getEmailService().openEmail(demandToOpen.getTopiaId(), - getContext().getCurrentUser(), - takeEmail); - - demandToOpen.fromEntity(email); - MailFolder folder = demandToOpen.getMailFolder(); - if (demandToOpen.getArchiveDate() != null - || !folder.isFolderWritable() - || !demandToOpen.getDemandStatus().isEditableStatus()) { - demandToOpen.setEditable(false); - } - demandToOpen.setCloseable(true); - } - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - openDemandScreen(); - } - - protected void openDemandScreen() { - MainUIHandler mainUIHandler = getContext().getMainUI().getHandler(); - DemandesUI parentContainer = (DemandesUI) mainUIHandler.getCurrentBody(); - parentContainer.getModel().addDemand(demandToOpen); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenMailFolderChooserFromListAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenMailFolderChooserFromListAction.java deleted file mode 100644 index 4744f56..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenMailFolderChooserFromListAction.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.MailAction; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIModel; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUI; -import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUIModel; - -import javax.swing.*; -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - */ -public class OpenMailFolderChooserFromListAction extends AbstractFaxToMailAction<DemandeListUIModel, DemandeListUI, DemandeListUIHandler> { - - protected List<DemandeUIModel> demandsToTransmit; - protected MailFolderChooserUI frameContent; - protected JFrame frame; - - public OpenMailFolderChooserFromListAction(DemandeListUIHandler handler) { - super(handler, false); - setActionDescription(t("faxtomail.action.openMailFolderChooser.tip")); - } - - @Override - public boolean prepareAction() throws Exception { - boolean result = super.prepareAction(); - - List<DemandeUIModel> selectedEmails = getModel().getSelectedEmails(); - demandsToTransmit = new ArrayList<DemandeUIModel>(); - - String notTransmitableDemandsTitle = ""; - for (DemandeUIModel demandeUIModel : selectedEmails) { - if (!demandeUIModel.isEditable() || - !handler.isActionEnabled(demandeUIModel, MailAction.TRANSMIT, handler.getConfiguration())) { - - notTransmitableDemandsTitle += "- " + demandeUIModel.getTitle() + "<br/>"; - } else { - demandsToTransmit.add(demandeUIModel); - } - } - - - if (demandsToTransmit.isEmpty()) { - displayWarningMessage(t("faxtomail.alert.noDemandToTransmit.title"), - t("faxtomail.alert.noDemandToTransmit.message", notTransmitableDemandsTitle)); - result = false; - - } else if (!notTransmitableDemandsTitle.isEmpty()) { - displayWarningMessage(t("faxtomail.alert.demandsNotTransmittable.title"), - t("faxtomail.alert.demandsNotTransmittable.message", notTransmitableDemandsTitle)); - } - - return result; - } - - @Override - public void doAction() throws Exception { - MailFolderChooserUIModel model = new MailFolderChooserUIModel(); - model.setDemandeUIModels(demandsToTransmit); - frameContent = new MailFolderChooserUI(getUI(), model); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - frame = getHandler().openModalFrame(frameContent, t("faxtomail.chooseMailFolder.title"), new Dimension(350, 500)); - } - - @Override - protected void releaseAction() { - super.releaseAction(); - if (frame != null) { - frame.toFront(); - frame = null; - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/PrintOnDefaultPrinterAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/PrintOnDefaultPrinterAction.java deleted file mode 100644 index e6baf7e..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/PrintOnDefaultPrinterAction.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.Configuration; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.HistoryType; -import com.franciaflex.faxtomail.persistence.entities.MailAction; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; -import com.google.common.base.Strings; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import org.apache.commons.io.Charsets; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.List; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class PrintOnDefaultPrinterAction extends AbstractFaxToMailAction { - - protected Multimap<DemandeUIModel, AttachmentFile> attachmentsToPrintByDemand; - protected boolean take; - protected boolean printDemandDetails; - protected List<DemandeUIModel> notPrintableDemands; - - public PrintOnDefaultPrinterAction(AbstractFaxToMailUIHandler handler, - Multimap<DemandeUIModel, AttachmentFile> attachmentsToPrintByDemand, - boolean take, - boolean printDemandDetails) { - - super(handler, false); - this.attachmentsToPrintByDemand = attachmentsToPrintByDemand; - this.take = take; - this.printDemandDetails = printDemandDetails; - - setActionDescription(t("faxtomail.action.print.tip")); - } - - @Override - public void doAction() throws Exception { - FaxToMailUser currentUser = getContext().getCurrentUser(); - AbstractFaxToMailUIHandler handler = (AbstractFaxToMailUIHandler) getHandler(); - Configuration config = getContext().newServiceContext().getConfigurationService().getConfiguration(); - - int printedFileNb = 0; - Multimap<DemandeUIModel, AttachmentFile> nonPrintedAttachment = HashMultimap.create(); - notPrintableDemands = new ArrayList<DemandeUIModel>(); - - for (DemandeUIModel demandeUIModel : attachmentsToPrintByDemand.keySet()) { - - if(!handler.isActionEnabled(demandeUIModel, MailAction.PRINT, config)) { - notPrintableDemands.add(demandeUIModel); - - } else { - if (take) { - demandeUIModel.setTakenBy(currentUser); - } - - List<String> printedFiles = new ArrayList<String>(); - - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - if (printDemandDetails) { - // generate details as pdf - EmailService emailService = serviceContext.getEmailService(); - Email email = demandeUIModel.toEntity(); - final AttachmentFile demandDetailAttachment = emailService.getEmailDetailAsAttachment(email); - // print details - if (FaxToMailUIUtil.print(demandDetailAttachment, true)) { - printedFiles.add(demandDetailAttachment.getFilename()); - - } else { - nonPrintedAttachment.put(demandeUIModel, demandDetailAttachment); - } - } - - for (AttachmentFile attachmentFile : attachmentsToPrintByDemand.get(demandeUIModel)) { - if (attachmentFile != null) { - boolean printable = FaxToMailUIUtil.isFileTypeEditable(attachmentFile.getFilename()); - if (printable && FaxToMailUIUtil.print(attachmentFile, true)) { - printedFiles.add(attachmentFile.getFilename()); - - } else { - nonPrintedAttachment.put(demandeUIModel, attachmentFile); - } - } - } - - Email email = serviceContext.getEmailService().addToHistory(demandeUIModel.getTopiaId(), - HistoryType.PRINTING, - getContext().getCurrentUser(), - new Date(), - printedFiles.toArray(new String[printedFiles.size()])); - printedFileNb += printedFiles.size(); - demandeUIModel.setHistory(email.getHistory()); - } - } - - // print another page for non printed attachments - if (!nonPrintedAttachment.isEmpty()) { - String errorPageContent = generateErrorPageStream(nonPrintedAttachment); - FaxToMailUIUtil.printText("nonprintedattachement", errorPageContent, true); - } - - handler.showInformationMessage(t("faxtomail.print.success.message", printedFileNb)); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - - if (!notPrintableDemands.isEmpty()) { - String notPrintableDemandTitles = ""; - for (DemandeUIModel demandeUIModel : notPrintableDemands) { - notPrintableDemandTitles += "- " + demandeUIModel.getTitle() + "<br/>"; - } - - displayWarningMessage(t("faxtomail.action.print.notPrintableDemands.title"), - t("faxtomail.action.print.notPrintableDemands.message", - notPrintableDemandTitles)); - } - } - - /** - * Retourne un flux de données qui correspond à une page de récapitulatif des pièces jointes - * non imprimées. - * - * @param nonPrintedAttachment not printed attachment list - * @return input stream with content - */ - protected String generateErrorPageStream(Multimap<DemandeUIModel, AttachmentFile> nonPrintedAttachment) { - - // generate text content - StringBuilder builder = new StringBuilder(); - builder.append("\nLes pièces-jointes suivantes n'ont pas pu être imprimées:\n"); - - for (DemandeUIModel email : nonPrintedAttachment.keySet()) { - Collection<AttachmentFile> attachments = nonPrintedAttachment.get(email); - - builder.append(" * "); - if (!Strings.isNullOrEmpty(email.getCompanyReference())) { - builder.append(email.getCompanyReference() + " - "); - } - builder.append(Strings.nullToEmpty(email.getObject()) + " : \n"); - for (AttachmentFile attachmentFile : attachments) { - builder.append(" - " + attachmentFile.getFilename() + "\n"); - } - } - return builder.toString(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReloadFaxToMailAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReloadFaxToMailAction.java deleted file mode 100644 index 4488947..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReloadFaxToMailAction.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.RunFaxToMail; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; - -import static org.nuiton.i18n.I18n.t; - -/** - * To reload FaxToMail application. - * - * @author kmorin - morin@codelutin.com - */ -public class ReloadFaxToMailAction extends AbstractChangeScreenAction { - - public ReloadFaxToMailAction(MainUIHandler handler) { - super(handler, true, null); - setActionDescription(t("faxtomail.action.reloadFaxToMail")); - } - - @Override - public void doAction() throws Exception { - - // Close the application, will exit and restart application - RunFaxToMail.closeFaxToMail(getHandler(), RunFaxToMail.UPATE_EXIT_CODE); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java deleted file mode 100644 index 5da6053..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyAttachmentModel; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel; -import com.google.common.base.Function; -import com.google.common.collect.Collections2; -import com.google.common.collect.Sets; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.Collection; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class ReplyAction extends AbstractFaxToMailAction<ReplyFormUIModel, ReplyFormUI, ReplyFormUIHandler> { - - private static final Log log = LogFactory.getLog(ReplyAction.class); - - public ReplyAction(ReplyFormUIHandler handler) { - super(handler, false); - setActionDescription(t("faxtomail.action.reply.tip")); - } - - @Override - public void doAction() throws Exception { - log.info("do reply"); - - ReplyFormUIModel model = getModel(); - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - EmailService emailService = serviceContext.getEmailService(); - DemandeUIModel originalDemand = getModel().getOriginalDemand(); - - Collection<AttachmentFile> attachmentFiles = Collections2.transform(model.getAttachments(), new Function<ReplyAttachmentModel, AttachmentFile>() { - @Override - public AttachmentFile apply(ReplyAttachmentModel replyAttachmentModel) { - return replyAttachmentModel.getAttachmentFile(); - } - }); - Email email = emailService.reply(model.getFrom(), - model.getTo(), - model.getCc(), - model.getCci(), - model.getSubject(), - model.getMessage(), - attachmentFiles, - originalDemand.getTopiaId(), - getContext().getCurrentUser()); - - originalDemand.fromEntityIncluding(email, Sets.newHashSet(Email.PROPERTY_REPLIES, Email.PROPERTY_HISTORY)); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - handler.closeFrame(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenChooseAttachmentToPrintAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenChooseAttachmentToPrintAction.java deleted file mode 100644 index dbb4a39..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenChooseAttachmentToPrintAction.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.print.AttachmentToPrintChooserUI; - -import java.awt.*; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - */ -public class SaveAndOpenChooseAttachmentToPrintAction extends SaveAndOpenModalFrameAction<AttachmentToPrintChooserUI> { - - public SaveAndOpenChooseAttachmentToPrintAction(DemandesUIHandler handler) { - super(handler); - } - - @Override - public String getTitle() { - return t("faxtomail.chooseAttachmentToPrint.title"); - } - - @Override - public Dimension getDimension() { - return new Dimension(350, 500); - } - - @Override - public void doAction() throws Exception { - MailFolder selectedFolder = getModel().getMailFolder(); - while (selectedFolder.getParent() != null && selectedFolder.getPrintActionEqualTakeAction() == null) { - selectedFolder = selectedFolder.getParent(); - } - boolean take = Boolean.TRUE.equals(selectedFolder.getPrintActionEqualTakeAction()); - setTakeIfNotTaken(take); - - super.doAction(); - - frameContent = new AttachmentToPrintChooserUI(getUI(), getModel()); - - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenMailFolderChooserAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenMailFolderChooserAction.java deleted file mode 100644 index c319c01..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenMailFolderChooserAction.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUI; -import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUIModel; - -import java.awt.*; -import java.util.*; -import java.util.List; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - */ -public class SaveAndOpenMailFolderChooserAction extends SaveAndOpenModalFrameAction<MailFolderChooserUI> { - - public SaveAndOpenMailFolderChooserAction(DemandesUIHandler handler) { - super(handler); - } - - @Override - public String getTitle() { - return t("faxtomail.chooseMailFolder.title"); - } - - @Override - public Dimension getDimension() { - return new Dimension(350, 500); - } - - @Override - public void doAction() throws Exception { - super.doAction(); - - List<DemandeUIModel> demandes = Collections.singletonList(getModel()); - - MailFolderChooserUIModel model = new MailFolderChooserUIModel(); - model.setDemandeUIModels(demandes); - - frameContent = new MailFolderChooserUI(getUI(), model); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenModalFrameAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenModalFrameAction.java deleted file mode 100644 index cf46284..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenModalFrameAction.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUIHandler; -import org.nuiton.jaxx.application.swing.ApplicationUI; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; - -/** - * @author Kevin Morin (Code Lutin) - */ -public abstract class SaveAndOpenModalFrameAction<FC extends ApplicationUI> extends SaveDemandeAction { - - protected FC frameContent; - protected JFrame frame; - - public SaveAndOpenModalFrameAction(DemandesUIHandler handler) { - super(handler.getCurrentDemandHandler()); - } - - public abstract String getTitle(); - - public abstract Dimension getDimension(); - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - frame = getHandler().openModalFrame(frameContent, getTitle(), getDimension()); - } - - @Override - protected void releaseAction() { - super.releaseAction(); - if (frame != null) { - frame.toFront(); - frame = null; - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenReplyFormAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenReplyFormAction.java deleted file mode 100644 index 7ac7a71..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenReplyFormAction.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel; -import jaxx.runtime.JAXXUtil; - -import java.awt.*; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - */ -public class SaveAndOpenReplyFormAction extends SaveAndOpenModalFrameAction<ReplyFormUI> { - - public SaveAndOpenReplyFormAction(DemandesUIHandler handler) { - super(handler); - setTakeIfNotTaken(true); - } - - @Override - public String getTitle() { - return t("faxtomail.reply.title", getModel().getTitle()); - } - - @Override - public Dimension getDimension() { - return new Dimension(800, 600); - } - - @Override - public void doAction() throws Exception { - super.doAction(); - - frameContent = new ReplyFormUI(getUI()); - ReplyFormUIModel model = frameContent.getModel(); - DemandeUIModel currentDemand = getModel(); - - model.setOriginalDemand(currentDemand); - - String sender = JAXXUtil.getStringValue(currentDemand.getSender()); - if (currentDemand.isFax()) { - MailFolder selectedFolder = getContext().getCurrentMailFolder(); - sender = FaxToMailServiceUtils.addFaxDomainToFaxNumber(sender, selectedFolder); - } - model.setTo(sender); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenSearchToGroupAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenSearchToGroupAction.java deleted file mode 100644 index 0865ccc..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveAndOpenSearchToGroupAction.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.search.SearchToGroupUI; - -import java.awt.*; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - */ -public class SaveAndOpenSearchToGroupAction extends SaveAndOpenModalFrameAction<SearchToGroupUI> { - - public SaveAndOpenSearchToGroupAction(DemandesUIHandler handler) { - super(handler); - } - - @Override - public String getTitle() { - return t("faxtomail.searchToGroup.title", getModel().getTitle()); - } - - @Override - public Dimension getDimension() { - return getContext().getMainUI().getSize(); - } - - @Override - public void doAction() throws Exception { - super.doAction(); - - frameContent = new SearchToGroupUI(getUI()); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java deleted file mode 100644 index 3c215d6..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import org.apache.commons.lang3.StringUtils; -import org.nuiton.topia.persistence.TopiaEntities; -import org.nuiton.util.beans.BeanMonitor; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.EmailImpl; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import com.franciaflex.faxtomail.persistence.entities.Reply; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.exceptions.InvalidClientException; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.demande.RangeRowModel; -import com.google.common.collect.Maps; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class SaveDemandeAction extends AbstractFaxToMailAction<DemandeUIModel, DemandeUI, DemandeUIHandler> { - - protected boolean takeIfNotTaken; - - public SaveDemandeAction(DemandeUIHandler handler) { - super(handler, false); - setActionDescription(t("faxtomail.action.save.tip")); - } - - public boolean isTakeIfNotTaken() { - return takeIfNotTaken; - } - - public void setTakeIfNotTaken(boolean takeIfNotTaken) { - this.takeIfNotTaken = takeIfNotTaken; - } - - @Override - public void doAction() throws Exception { - DemandeUIModel model = getModel(); - FaxToMailUIContext context = getContext(); - - Email persistedEmail; - String topiaId = model.getTopiaId(); - FaxToMailServiceContext serviceContext = context.newServiceContext(); - if (!StringUtils.isBlank(topiaId)) { - persistedEmail = serviceContext.getEmailService().getFullEmailById(topiaId); - } else { - persistedEmail = new EmailImpl(); - } - - Collection<RangeRowModel> rows = model.getValidRangeRowModels(); - - //remove null range rows - boolean cont = true; - while (cont) { - try { - model.removeRangeRow(null); - } catch (IllegalArgumentException eee) { - cont = false; - } - } - Collection<RangeRow> rangeRows = model.getRangeRow(); - if (rangeRows == null) { - rangeRows = new ArrayList<>(); - } - - Map<String, RangeRow> rangeRowsById = Maps.uniqueIndex(rangeRows, TopiaEntities.getTopiaIdFunction()); - - model.setRangeRow(new ArrayList<RangeRow>()); - for (RangeRowModel rangeRowModel : rows) { - RangeRow rangeRow = rangeRowsById.get(rangeRowModel.getTopiaId()); - if (rangeRow == null) { - model.addRangeRow(rangeRowModel.toEntity()); - } else { - model.addRangeRow(rangeRowModel.toEntity(rangeRow)); - } - } - - FaxToMailUser currentUser = context.getCurrentUser(); - if (model.getDemandStatus() != DemandStatus.ARCHIVED && takeIfNotTaken && model.getTakenBy() == null) { - model.setTakenBy(getContext().getCurrentUser()); - } - - Email email = model.toEntity(persistedEmail); - Collection<Attachment> attachments = model.getAttachment(); - Collection<Reply> replies = model.getReplies(); - String clientCode = model.getClientCode(); - - BeanMonitor monitor = getHandler().getMonitor(); - String[] modifiedProperties = monitor.getModifiedProperties(); - email = serviceContext.getEmailService().saveEmail(email, attachments, replies, clientCode, currentUser, modifiedProperties); - - model.fromEntity(email); - - getModel().setModify(false); - monitor.clearModified(); - } - - public void postFailedAction(Throwable error) { - - if (error instanceof InvalidClientException) { - DemandeUIModel model = getModel(); -// BeanMonitor monitor = getHandler().getMonitor(); -// String previousClientCode = (String) monitor.getOriginalValues().get(DemandeUIModel.PROPERTY_CLIENT_CODE); - model.setClientCode(null); - - // reset the range rows of the model - BeanMonitor monitor = getHandler().getMonitor(); - List<RangeRow> rangeRows = (List<RangeRow>) monitor.getOriginalValues().get(Email.PROPERTY_RANGE_ROW); - model.setRangeRow(rangeRows); - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java deleted file mode 100644 index f9d0c28..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAndExitAction.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIHandler; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class SaveDemandeAndExitAction extends SaveDemandeAction { - - public SaveDemandeAndExitAction(DemandeUIHandler handler) { - super(handler); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - getActionEngine().runInternalAction(getContext().getMainUI().getHandler(), GoToPreviousScreenAction.class); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeFromListAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeFromListAction.java deleted file mode 100644 index 8a35175..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeFromListAction.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIModel; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class SaveDemandeFromListAction extends AbstractFaxToMailAction<DemandeListUIModel, DemandeListUI, DemandeListUIHandler> { - - protected String[] modifiedProperties; - - public SaveDemandeFromListAction(DemandeListUIHandler handler) { - super(handler, false); - } - - public void setModifiedProperties(String... properties) { - modifiedProperties = properties; - } - - @Override - public void doAction() throws Exception { - FaxToMailUIContext context = getContext(); - - FaxToMailServiceContext serviceContext = context.newServiceContext(); - EmailService emailService = serviceContext.getEmailService(); - - for (DemandeUIModel model : getModel().getSelectedEmails()) { - - String topiaId = model.getTopiaId(); - Email persistedEmail = emailService.getFullEmailById(topiaId); - - FaxToMailUser currentUser = context.getCurrentUser(); - Email email = model.toEntity(persistedEmail); - - email = emailService.saveEmail(email, currentUser, modifiedProperties); - model.fromEntity(email); - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchAction.java deleted file mode 100644 index 2cbb749..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchAction.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import com.franciaflex.faxtomail.persistence.entities.SearchFilter; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.ui.swing.content.demande.RangeRowModel; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import org.nuiton.topia.persistence.TopiaEntities; -import org.nuiton.util.pagination.PaginationResult; - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.search.SearchUI; -import com.franciaflex.faxtomail.ui.swing.content.search.SearchUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.search.SearchUIModel; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class SearchAction extends AbstractFaxToMailAction<SearchUIModel, SearchUI, SearchUIHandler> { - - public SearchAction(SearchUIHandler handler) { - super(handler, false); - setActionDescription(t("faxtomail.action.search.tip")); - } - - @Override - public void doAction() throws Exception { - SearchUIModel model = getModel(); - getContext().setSearch(model); - - SearchFilter searchFilter = model.toEntity(); - - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - PaginationResult<Email> paginationResult = serviceContext.getEmailService().search(searchFilter, - getContext().getCurrentUser(), getModel().getPaginationParameter()); - - List<Email> emails = paginationResult.getElements(); - List<DemandeUIModel> result = new ArrayList<>(); - - Map<String, WaitingState> waitingStateById = Maps.uniqueIndex(getContext().getWaitingStateCache(), TopiaEntities.getTopiaIdFunction()); - - for (Email email : emails) { - DemandeUIModel demand = new DemandeUIModel(); - demand.fromEntityExcluding(email, Sets.newHashSet(Email.PROPERTY_HISTORY)); - - // on ajoute toutes les lignes de rangeRow, - // qui sont toutes valides puisqu'on les récupère de la base et qu'on ne sauvegarde que les lignes valides - Collection<RangeRow> rangeRows = demand.getRangeRow(); - if (rangeRows != null) { - for (RangeRow rangeRow : rangeRows) { - if (rangeRow != null) { - RangeRowModel rangeRowModel = new RangeRowModel(); - rangeRowModel.fromEntity(rangeRow); - if (rangeRowModel.isValid()) { - demand.addValidRangeRow(rangeRowModel); - } - } - } - } - - demand.setValid(handler.isDemandeValid(demand)); - WaitingState waitingState = email.getWaitingState(); - if (waitingState != null) { - demand.setWaitingState(waitingStateById.get(waitingState.getTopiaId())); - } - - result.add(demand); - } - model.setResults(result); - model.setPaginationParameter(paginationResult.getCurrentPage()); - model.setPaginationResult(paginationResult); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchToGroupAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchToGroupAction.java deleted file mode 100644 index 11435e4..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchToGroupAction.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import com.franciaflex.faxtomail.persistence.entities.SearchFilter; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.demande.RangeRowModel; -import com.franciaflex.faxtomail.ui.swing.content.search.SearchToGroupUI; -import com.franciaflex.faxtomail.ui.swing.content.search.SearchToGroupUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.search.SearchUIModel; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import org.nuiton.topia.persistence.TopiaEntities; -import org.nuiton.util.pagination.PaginationResult; - -import javax.swing.*; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class SearchToGroupAction extends AbstractFaxToMailAction<SearchUIModel, SearchToGroupUI, SearchToGroupUIHandler> { - - public SearchToGroupAction(SearchToGroupUIHandler handler) { - super(handler, false); - setActionDescription(t("faxtomail.action.search.tip")); - } - - @Override - public void doAction() throws Exception { - SearchUIModel model = getModel(); - getContext().setSearch(model); - - SearchFilter searchFilter = model.toEntity(); - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - PaginationResult<Email> paginationResult = serviceContext.getEmailService().search(searchFilter, - getContext().getCurrentUser(), getModel().getPaginationParameter()); - - List<Email> emails = paginationResult.getElements(); - List<DemandeUIModel> result = new ArrayList<>(); - - Map<String, WaitingState> waitingStateById = Maps.uniqueIndex(getContext().getWaitingStateCache(), TopiaEntities.getTopiaIdFunction()); - - for (Email email : emails) { - DemandeUIModel demand = new DemandeUIModel(); - demand.fromEntityExcluding(email, Sets.newHashSet(Email.PROPERTY_HISTORY)); - - // on ajoute toutes les lignes de rangeRow, - // qui sont toutes valides puisqu'on les récupère de la base et qu'on ne sauvegarde que les lignes valides - Collection<RangeRow> rangeRows = demand.getRangeRow(); - if (rangeRows != null) { - for (RangeRow rangeRow : rangeRows) { - if (rangeRow != null) { - RangeRowModel rangeRowModel = new RangeRowModel(); - rangeRowModel.fromEntity(rangeRow); - if (rangeRowModel.isValid()) { - demand.addValidRangeRow(rangeRowModel); - } - } - } - } - - MailFolder mailFolder = email.getMailFolder(); - demand.setValid(handler.isDemandeValid(demand)); - WaitingState waitingState = email.getWaitingState(); - if (waitingState != null) { - demand.setWaitingState(waitingStateById.get(waitingState.getTopiaId())); - } - result.add(demand); - } - model.setResults(result); - model.setPaginationParameter(paginationResult.getCurrentPage()); - model.setPaginationResult(paginationResult); - } - - - @Override - protected void releaseAction() { - super.releaseAction(); - JFrame frame = getUI().getParentContainer(JFrame.class); - if (frame != null) { - frame.toFront(); - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowAboutAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowAboutAction.java deleted file mode 100644 index e5b5472..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowAboutAction.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; -import jaxx.runtime.swing.AboutPanel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import java.util.Calendar; - -import static org.nuiton.i18n.I18n.t; - -/** - * To show about panel. - * - * @author Kevin Morin - */ -public class ShowAboutAction extends AbstractMainUIFaxToMailAction { - - /** Logger. */ - private static final Log log = LogFactory.getLog(ShowAboutAction.class); - - protected AboutPanel about; - - public ShowAboutAction(MainUIHandler handler) { - super(handler, false); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - - about.showInDialog(getUI(), true); - } - - @Override - public void doAction() throws Exception { - - about = null; - - String name = "faxtomail"; -// String licensePath = "META-INF/" + name + "-LICENSE.txt"; -// String thirdPartyPath = "META-INF/" + name + "-THIRD-PARTY.txt"; - - about = new AboutPanel(); - about.setTitle(t("faxtomail.about.title")); - about.setAboutText(t("faxtomail.about.message")); - - FaxToMailConfiguration config = getConfig(); - int currentYear = Calendar.getInstance().get(Calendar.YEAR); - int inceptionYear = config.getInceptionYear(); - String years; - if (currentYear != inceptionYear) { - years = inceptionYear + "-" + currentYear; - } else { - years = inceptionYear + ""; - } - - about.setBottomText(t("faxtomail.about.bottomText", - config.getOrganizationName(), - years, - config.getVersion())); -// about.setLicenseFile(licensePath); -// about.setThirdpartyFile(thirdPartyPath); - about.buildTopPanel(); - - about.init(); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java deleted file mode 100644 index af75c95..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.services.service.exceptions.AlreadyLockedMailException; -import com.franciaflex.faxtomail.services.service.exceptions.FolderNotReadableException; -import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; - -import org.apache.commons.lang3.StringUtils; -import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler; - -import javax.swing.*; - -import static org.nuiton.i18n.I18n.t; - -/** - * To show demande screen. - * - * @author kmorin - morin@codelutin.com - */ -public class ShowDemandeAction extends AbstractChangeScreenAction { - - // if true, take the email when opening - protected boolean takeEmail; - - public ShowDemandeAction(MainUIHandler handler) { - super(handler, true, FaxToMailScreen.DEMANDE); - setActionDescription(t("faxtomail.action.goto.demand.tip")); - } - - @Override - public boolean prepareAction() throws Exception { - boolean result = super.prepareAction(); - - DemandeUIModel currentEmail = getContext().getCurrentEmail(); - - String topiaId = currentEmail.getTopiaId(); - if (StringUtils.isNotBlank(topiaId)) { - FaxToMailUser currentUser = getContext().getCurrentUser(); - int answer = -1; - - try { - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - EmailService emailService = serviceContext.getEmailService(); - - // tentative de verrouillages des email existants - Email email = emailService.lockEmail(topiaId, currentUser); - - FaxToMailUser takenBy = email.getTakenBy(); - - // si le mail est pris par quelqu'un d'autre, le prend-on ou pas ? - if (takenBy != null && !currentUser.equals(takenBy)) { - String htmlMessage = String.format( - AbstractApplicationUIHandler.CONFIRMATION_FORMAT, - t("faxtomail.alert.alreadyTakenBy.message", decorate(takenBy)), - t("faxtomail.alert.alreadyTakenBy.help")); - - answer = JOptionPane.showConfirmDialog(getHandler().getTopestUI(), - htmlMessage, - t("faxtomail.alert.alreadyTakenBy.title"), - JOptionPane.YES_NO_CANCEL_OPTION, - JOptionPane.QUESTION_MESSAGE); - } - - // si on annule, on délock - if (answer == JOptionPane.CANCEL_OPTION) { - result = false; - emailService.unlockEmail(topiaId); - - } else { - // sinon on ouvre - - // si on ne prend pas, le mail est en readonly - if (answer == JOptionPane.NO_OPTION) { - currentEmail.setEditable(false); - takeEmail = false; - } - // si on prend, on prend et on rend editable - else if (answer == JOptionPane.YES_OPTION) { - takeEmail = true; - currentEmail.setEditable(true); - } - } - } - // le mail est locké, on ne fait rien - catch (AlreadyLockedMailException ex) { - result = false; - - String htmlMessage = t("faxtomail.alert.alreadyLockedBy.message", decorate(ex.getLockedBy())); - JOptionPane.showMessageDialog(getHandler().getTopestUI(), - htmlMessage, - t("faxtomail.alert.alreadyLockedBy.title"), - JOptionPane.ERROR_MESSAGE); - - } - // l'utilisateur n'a pas les droits de lecture sur le dossier - catch (FolderNotReadableException e) { - result = false; - - String htmlMessage = t("faxtomail.alert.userNotAuthorizedToReadEmail.message", e.getForbiddenFolder().getName()); - JOptionPane.showMessageDialog(getHandler().getTopestUI(), - htmlMessage, - t("faxtomail.alert.userNotAuthorizedToReadEmail.title"), - JOptionPane.ERROR_MESSAGE); - } - } - return result; - } - - @Override - public void doAction() throws Exception { - DemandeUIModel currentEmail = getContext().getCurrentEmail(); - if (StringUtils.isNotBlank(currentEmail.getTopiaId())) { - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - - Email email = serviceContext.getEmailService().openEmail(currentEmail.getTopiaId(), - getContext().getCurrentUser(), - takeEmail); - - MailFolder currentFolder = currentEmail.getMailFolder(); - MailFolder actualFolder = email.getMailFolder(); - if (currentFolder != null && !currentFolder.equals(actualFolder)) { - displayWarningMessage(t("faxtomail.alert.emailMoved.title"), - t("faxtomail.alert.emailMoved.message", - currentFolder.getName(), - actualFolder.getName(), - currentEmail.getTitle())); - } - - currentEmail.fromEntity(email); - - MailFolder folder = currentEmail.getMailFolder(); - if (currentEmail.getArchiveDate() != null - || !folder.isFolderWritable() - || !currentEmail.getDemandStatus().isEditableStatus()) { - currentEmail.setEditable(false); - } - } - - super.doAction(); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeListAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeListAction.java deleted file mode 100644 index d7e4580..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeListAction.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; - -import static org.nuiton.i18n.I18n.t; - -/** - * To show demande screen. - * - * @author kmorin - morin@codelutin.com - */ -public class ShowDemandeListAction extends AbstractChangeScreenAction { - - public ShowDemandeListAction(MainUIHandler handler) { - super(handler, true, FaxToMailScreen.LIST); - setActionDescription(t("faxtomail.action.goto.demandList.tip")); - } - - @Override - public void doAction() throws Exception { - getContext().setSearch(null); - getContext().setCurrentPaginationParameter(null); - super.doAction(); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowRechercheAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowRechercheAction.java deleted file mode 100644 index 0a32182..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowRechercheAction.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; - -import static org.nuiton.i18n.I18n.t; - -/** - * To show demande screen. - * - * @author kmorin - morin@codelutin.com - */ -public class ShowRechercheAction extends AbstractChangeScreenAction { - - public ShowRechercheAction(MainUIHandler handler) { - super(handler, true, FaxToMailScreen.SEARCH); - setActionDescription(t("faxtomail.action.goto.search.tip")); - } - - @Override - public void doAction() throws Exception { - getContext().setCurrentPaginationParameter(null); - super.doAction(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java deleted file mode 100644 index 7d5bce2..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.actions; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIModel; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; -import com.google.common.base.Function; -import com.google.common.base.Predicate; -import com.google.common.collect.Collections2; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXUtil; - -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUI; -import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUIModel; - -import javax.swing.*; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class TransmitAction extends AbstractFaxToMailAction<MailFolderChooserUIModel, MailFolderChooserUI, MailFolderChooserUIHandler> { - - public TransmitAction(MailFolderChooserUIHandler handler) { - super(handler, false); - setActionDescription(t("faxtomail.action.transmit.tip")); - } - - @Override - public boolean prepareAction() throws Exception { - boolean result = super.prepareAction(); - - MailFolderChooserUIModel model = getModel(); - List<DemandeUIModel> demandeUIModels = new ArrayList<DemandeUIModel>(model.getDemandeUIModels()); - - for (final DemandeUIModel demandeUIModel : model.getDemandeUIModels()) { - - final MailFolder mailFolder = demandeUIModel.getMailFolder(); - List<DemandeUIModel> groupedDemandes = demandeUIModel.getGroupedDemandes(); - // on cherche les demandes groupées qui sont dans le même groupe, pour demander si on les déplace aussi - Collection<DemandeUIModel> sameFolderGroupedDemands = - Collections2.filter(groupedDemandes, new Predicate<DemandeUIModel>() { - @Override - public boolean apply(DemandeUIModel groupDemandeUIModel) { - return !demandeUIModel.equals(groupDemandeUIModel) - && groupDemandeUIModel.getDemandStatus().isEditableStatus() - && mailFolder.equals(groupDemandeUIModel.getMailFolder()); - } - }); - - if (!sameFolderGroupedDemands.isEmpty()) { - String groupedDemandTitles = ""; - for (DemandeUIModel groupedDemand : sameFolderGroupedDemands) { - groupedDemandTitles += "- " + groupedDemand.getTitle() + "<br/>"; - } - - int i = JOptionPane.showConfirmDialog(null, - t("faxtomail.alert.transmit.groupedDemandsInSameFolder.message", - demandeUIModel.getTitle(), - groupedDemandTitles), - t("faxtomail.alert.transmit.groupedDemandsInSameFolder.title"), - JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE); - if (i == JOptionPane.YES_OPTION) { - demandeUIModels.addAll(sameFolderGroupedDemands); - } - } - } - model.setDemandeUIModels(demandeUIModels); - - return result; - } - - @Override - public void doAction() throws Exception { - MailFolderChooserUIModel model = getModel(); - Collection<String> emailIds = Collections2.transform(model.getDemandeUIModels(), new Function<DemandeUIModel, String>() { - @Override - public String apply(DemandeUIModel demandeUIModel) { - return demandeUIModel.getTopiaId(); - } - }); - getContext().newServiceContext().getEmailService().transmit(emailIds, model.getMailFolder(), getContext().getCurrentUser()); - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - MailFolderChooserUIHandler handler = getHandler(); - - FaxToMailUI parentUI = (FaxToMailUI) getUI().getContextValue(JAXXContext.class, JAXXUtil.PARENT); - if (parentUI != null) { - if (DemandeUI.class.isAssignableFrom(parentUI.getClass())) { - getActionEngine().runInternalAction(handler, GoToPreviousScreenAction.class); - - } else if (DemandeListUI.class.isAssignableFrom(parentUI.getClass())) { - DemandeListUI demandeListUI = (DemandeListUI) parentUI; - DemandeListUIModel listModel = demandeListUI.getModel(); - List<DemandeUIModel> demandList = new ArrayList<DemandeUIModel>(listModel.getEmails()); - demandList.removeAll(getModel().getDemandeUIModels()); - listModel.setEmails(demandList); - } - } - - handler.closeFrame(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/Common.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/Common.css deleted file mode 100644 index 3a153f5..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/Common.css +++ /dev/null @@ -1,26 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id:$ - * $HeadURL:$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -BeanFilterableComboBox, BeanComboBox { - maximumRowCount: 20; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.css deleted file mode 100644 index d6c4c46..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.css +++ /dev/null @@ -1,86 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -/* -#busyBlockLayerUI { - useIcon:false; - blockingColor: {model.getConfig().getColorBlockingLayer()}; - block:{model.isBusy()}; -} -*/ -JSeparator { - border: { BorderFactory.createEmptyBorder(0, 5, 0, 5) }; -} - -#mainFrame { - title: "faxtomail.main.title.applicationName"; - defaultCloseOperation: {JFrame.DO_NOTHING_ON_CLOSE}; -} - -#topBar { - floatable: false; - margin: {new java.awt.Insets(5, 5, 5, 5)}; - borderPainted: false; -} - -#demandListButton { - actionIcon: list; - text: "faxtomail.main.action.demandeList"; - toolTipText: "faxtomail.main.action.demandeList.tip"; - selected: { model.getScreen() == FaxToMailScreen.LIST }; - _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeListAction.class}; -} - -#searchButton { - actionIcon: search; - text: "faxtomail.main.action.recherche"; - toolTipText: "faxtomail.main.action.recherche.tip"; - selected: { model.getScreen() == FaxToMailScreen.SEARCH }; - _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.ShowRechercheAction.class}; -} - -#exitButton { - actionIcon: exit; - text: "faxtomail.main.action.exit"; - toolTipText: "faxtomail.main.action.exit.tip"; - _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.CloseApplicationAction.class}; -} - -#aboutButton { - actionIcon: about; - toolTipText: "faxtomail.main.action.about.tip"; - _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.ShowAboutAction.class}; -} - -#bottomBar { - floatable: false; - margin: {new java.awt.Insets(0, 0, 0, 5)}; - borderPainted: false; -} - -#validatorMessageWidget { - focusPainted: false; -} - -#status { - showClock: false; - showMemoryStatus: false; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx deleted file mode 100644 index 83219c6..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx +++ /dev/null @@ -1,68 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JFrame id='mainFrame' - implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<FaxToMailUIContext, MainUIHandler>' - width='1024' height='780'> - - <import> - com.franciaflex.faxtomail.ui.swing.FaxToMailScreen - com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - com.franciaflex.faxtomail.ui.swing.actions.* - - jaxx.runtime.validator.swing.SwingValidatorMessageWidget - - org.jdesktop.swingx.JXTitledPanel - - javax.swing.Box - javax.swing.JFrame - javax.swing.SwingConstants - java.awt.BorderLayout - </import> - - <FaxToMailUIContext id='model' - initializer='getContextValue(FaxToMailUIContext.class)'/> - <script><![CDATA[ - - public MainUI(FaxToMailUIContext context) { - FaxToMailUIUtil.setApplicationContext(this, context); - } - ]]></script> - - <JToolBar id='topBar' constraints="BorderLayout.NORTH"> - <JToggleButton id='demandListButton'/> - <JToggleButton id='searchButton'/> - <Component initializer="Box.createHorizontalGlue()"/> - <!--<JButton id='exitButton'/>--> - </JToolBar> - - <JToolBar id='bottomBar'> - <SwingValidatorMessageWidget id='validatorMessageWidget'/> - <JButton id='aboutButton'/> - </JToolBar> - - <JXTitledPanel id='body' constraints='BorderLayout.CENTER' decorator='boxed'/> - - <!-- status message bar --> - <StatusMessagePanel id='status' constraints="BorderLayout.SOUTH"/> - -</JFrame> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java deleted file mode 100644 index 3fd2249..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java +++ /dev/null @@ -1,391 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.RunFaxToMail; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandesUI; -import com.franciaflex.faxtomail.ui.swing.content.search.SearchUI; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; -import org.nuiton.jaxx.application.swing.util.CloseableUI; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; -import com.franciaflex.faxtomail.ui.swing.util.RemoveablePropertyChangeListener; -import com.google.common.base.Preconditions; - -import jaxx.runtime.JAXXBinding; -import jaxx.runtime.SwingUtil; -import jaxx.runtime.swing.JAXXWidgetUtil; -import jaxx.runtime.swing.session.SwingSession; -import jaxx.runtime.validator.swing.SwingValidator; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.i18n.I18n; -import org.nuiton.jaxx.application.swing.action.ApplicationActionUI; - -import javax.swing.*; - -import java.awt.Cursor; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeListenerProxy; -import java.io.IOException; -import java.util.Locale; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author kmorin - morin@codelutin.com - * - */ -public class MainUIHandler extends AbstractFaxToMailUIHandler<FaxToMailUIContext, MainUI> { - - /** Logger. */ - private static final Log log = LogFactory.getLog(MainUIHandler.class); - - protected JComponent currentBody; - - //------------------------------------------------------------------------// - //-- AbstractTuttiUIHandler methods --// - //------------------------------------------------------------------------// - - @Override - public void beforeInit(MainUI ui) { - super.beforeInit(ui); - FaxToMailUIContext context = getContext(); - ui.setContextValue(context); - context.setMainUI(ui); - context.setActionUI(new ApplicationActionUI(ui, context)); - context.addPropertyChangeListener(new RemoveablePropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - String propertyName = evt.getPropertyName(); - if (propertyName.equals(FaxToMailUIContext.PROPERTY_SCREEN)) { - setScreen((FaxToMailScreen) evt.getNewValue()); - } - } - }); - ui.setContextValue(ui, MainUI.class.getName()); - - // ecoute des changements de l'état busy - context.addPropertyChangeListener(FaxToMailUIContext.PROPERTY_BUSY, new RemoveablePropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent evt) { - Boolean newvalue = (Boolean) evt.getNewValue(); - updateBusyState(newvalue != null && newvalue); - } - }); - - // ecoute des changements de l'état busy - context.addPropertyChangeListener(FaxToMailUIContext.PROPERTY_HIDE_BODY, new RemoveablePropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent evt) { - Boolean newvalue = (Boolean) evt.getNewValue(); - if (getUI() != null && getUI().getBody() != null) { - getUI().getBody().setVisible(newvalue != null && newvalue); - } - } - }); - } - - protected void updateBusyState(boolean busy) { - if (busy) { - // ui bloquee - if (log.isDebugEnabled()) { - log.debug("block ui in busy mode"); - } - ui.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - } else { - // ui debloquee - if (log.isDebugEnabled()) { - log.debug("unblock ui in none busy mode"); - } - ui.setCursor(Cursor.getDefaultCursor()); - } - } - - @Override - public void afterInit(MainUI ui) { - - initUI(ui); - - getUI().addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - if (quitCurrentScreen()) { - RunFaxToMail.closeFaxToMail(MainUIHandler.this, RunFaxToMail.NORMAL_EXIT_CODE); - } - } - }); - - // Init SwingSession - SwingSession swingSession = getContext().getSwingSession(); - swingSession.add(ui); - try { - swingSession.save(); - - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("error while saving the swing session", e); - } - } - -// SwingUtil.getLayer(ui.getBody()).setUI(new BetaLayerUI()); - - getContext().addPropertyChangeListener(FaxToMailUIContext.PROPERTY_ACTION_IN_PROGRESS, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - boolean inProgress = (boolean) evt.getNewValue(); - MainUI ui = getUI(); - ui.getSearchButton().setEnabled(!inProgress); - ui.getDemandListButton().setEnabled(!inProgress); -// ui.getExitButton().setEnabled(!inProgress); - } - }); - - changeTitle(); - - JToolBar bar = ui.getBottomBar(); - ui.getStatus().addWidget(bar, 0); - - getContext().setScreen(FaxToMailScreen.LIST); - - // affichage d'un message si l'utilisateur n'a aucun droit - DemandeListUI demandeListUI = (DemandeListUI) getCurrentBody(); - if (CollectionUtils.isEmpty(demandeListUI.getModel().getFolders())) { - JOptionPane.showMessageDialog(demandeListUI, t("faxtomail.demandeList.noRigthsFound"), - t("faxtomail.demandeList.title"), JOptionPane.ERROR_MESSAGE); - } - } - - @Override - protected JComponent getComponentToFocus() { - return currentBody; - } - - @Override - public void onCloseUI() { - - FaxToMailUIContext context = getContext(); - - // remove any screen - context.setScreen(null); - context.removeMessageNotifier(this); - - // clean context - - PropertyChangeListener[] propertyChangeListeners = - context.getPropertyChangeListeners(); - for (PropertyChangeListener listener : propertyChangeListeners) { - if (listener instanceof PropertyChangeListenerProxy) { - PropertyChangeListenerProxy proxy = (PropertyChangeListenerProxy) listener; - listener = proxy.getListener(); - } - if (listener instanceof RemoveablePropertyChangeListener) { - if (log.isDebugEnabled()) { - log.debug("Remove listener: " + listener); - } - context.removePropertyChangeListener(listener); - } - } - - if (ui != null) { - - // clean ui - - JAXXBinding[] bindings = ui.getDataBindings(); - for (JAXXBinding binding : bindings) { - SwingUtil.removeDataBinding(ui, binding.getId()); - } - ui.setVisible(false); - ui.dispose(); - } - } - - @Override - public SwingValidator<FaxToMailUIContext> getValidator() { - return null; - } - - //------------------------------------------------------------------------// - //-- Public methods --// - //------------------------------------------------------------------------// - - public void reloadUI() { - - //close ui - onCloseUI(); - - // restart ui - RunFaxToMail.startFaxToMail(getContext(), false); - } - - public boolean acceptLocale(Locale l, String expected) { - return l != null && l.toString().equals(expected); - } - - public void changeLocale(Locale locale) { - - // change locale (and save configuration) - getModel().setLocale(locale); - - // change i18n locale - I18n.setDefaultLocale(getConfig().getI18nLocale()); - - // close reload - reloadUI(); - } - - @Override - public final void showInformationMessage(String message) { - ui.getStatus().setStatus("<html><body>" + message + "</body></html>"); - } - - public void registerValidator(SwingValidator validator) { - ui.getValidatorMessageWidget().registerValidator(validator); - } - - @Override - public void clearValidators() { - ui.getValidatorMessageWidget().clearValidators(); - } - - public boolean quitCurrentScreen() { - - boolean canClose; - if (getContext().getScreen() == null || currentBody == null) { - - // no screen, surely can quit - canClose = true; - if (log.isWarnEnabled()) { - log.warn("=================================================="); - log.warn("No screen, Should then skipCheckCurrent in action."); - log.warn("=================================================="); - } - } else { - FaxToMailUI<?, ?> body = (FaxToMailUI<?, ?>) currentBody; - Preconditions.checkNotNull(currentBody); - AbstractFaxToMailUIHandler<?, ?> handler = body.getHandler(); - if (handler instanceof CloseableUI) { - - // try to quit UI - canClose = ((CloseableUI) handler).quitUI(); - } else { - - // can always close ui - canClose = true; - } - } - return canClose; - } - - //------------------------------------------------------------------------// - //-- Internal methods --// - //------------------------------------------------------------------------// - - protected void setScreen(FaxToMailScreen screen) { - - // close current body (if any) - if (currentBody != null) { - FaxToMailUI<?, ?> body = (FaxToMailUI<?, ?>) currentBody; - body.getHandler().onCloseUI(); - - try { - getContext().getSwingSession().save(); - - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("error while saving the swing session", e); - } - } - - ui.getBody().remove(currentBody); - - currentBody = null; - } - - if (screen != null) { - - // load new body - - JComponent screenUI; - JToolBar rightDecoration = null; - String screenTitle; - boolean validatorWidgetEnabled = false; - - Icon icon; - switch (screen) { - case SEARCH: - screenUI = new SearchUI(ui); - screenTitle = t("faxtomail.search.title"); - icon = ui.getSearchButton().getIcon(); - break; - - case DEMANDE: - screenUI = new DemandesUI(ui); - screenTitle = t("faxtomail.demand.title"); - icon = JAXXWidgetUtil.createActionIcon("email-group"); - rightDecoration = ((DemandesUI) screenUI).getTopToolBar(); - validatorWidgetEnabled = true; - break; - - default: - case LIST: - screenUI = new DemandeListUI(ui); - screenTitle = t("faxtomail.demandeList.title"); - icon = ui.getDemandListButton().getIcon(); - break; - } - - this.currentBody = screenUI; - getContext().getSwingSession().add(currentBody, true); - ui.getBody().setTitle(screenTitle); - ui.getBody().setLeftDecoration(new JLabel(icon)); - ui.getBody().setRightDecoration(rightDecoration); - ui.getBody().add(currentBody); - ui.getValidatorMessageWidget().setEnabled(validatorWidgetEnabled); - - } - } - - public void changeTitle() { - - ui.setTitle(t("faxtomail.main.title.application", - getConfig().getVersion())); - } - - public void setBodyTitle(String title) { - ui.getBody().setTitle(title); - } - - public JComponent getCurrentBody() { - return currentBody; - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java deleted file mode 100644 index e9ed7f2..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.attachment; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.HistoryType; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; -import com.google.common.base.Preconditions; -import com.google.common.collect.Sets; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; - -import javax.swing.*; -import javax.swing.border.LineBorder; -import javax.swing.event.CellEditorListener; -import javax.swing.event.ChangeEvent; -import javax.swing.table.TableCellEditor; -import java.awt.*; -import java.util.Date; -import java.util.EventObject; - -/** - * To edit attachments from a table cell. - * - * @author kmorin - morin@codelutin.com - */ -public class AttachmentCellEditor extends AbstractCellEditor implements TableCellEditor { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = LogFactory.getLog(AttachmentCellEditor.class); - - public static TableCellEditor newEditor(FaxToMailUI ui) { - - return new AttachmentCellEditor(FaxToMailUIContext.getApplicationContext()); - } - - protected final ButtonAttachment editorButton; - - protected FaxToMailUIContext context; - - protected AttachmentEditorUIModel.AttachmentListener listener; - - public AttachmentCellEditor(FaxToMailUIContext context) { - this.context = context; - - this.editorButton = new ButtonAttachment("faxtomail.attachmentCellRenderer.text", null); - this.editorButton.setBorder(new LineBorder(Color.BLACK)); - this.editorButton.setEditable(false); - addCellEditorListener(new CellEditorListener() { - @Override - public void editingStopped(ChangeEvent e) { - editorButton.setSelected(false); - } - - @Override - public void editingCanceled(ChangeEvent e) { - editorButton.setSelected(false); - } - }); - } - - @Override - public Component getTableCellEditorComponent(JTable table, - Object value, - boolean isSelected, - int row, - int column) { - AbstractApplicationTableModel<AbstractFaxToMailBeanUIModel> tableModel = - (AbstractApplicationTableModel<AbstractFaxToMailBeanUIModel>) table.getModel(); - - int modelRow = table.convertRowIndexToModel(row); - final DemandeUIModel model = (DemandeUIModel) tableModel.getEntry(modelRow); - - editorButton.init(model); - - listener = new AttachmentEditorUIModel.AttachmentListener() { - @Override - public void onAttachmentOpened(Attachment attachment, boolean original) { - String topiaId = model.getTopiaId(); - if (topiaId != null) { - String filename; - if (original) { - filename = attachment.getOriginalFileName(); - } else { - filename = FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFileName()); - } - - FaxToMailServiceContext serviceContext = context.newServiceContext(); - Email email = serviceContext.getEmailService().addToHistory(topiaId, - HistoryType.ATTACHMENT_OPENING, - context.getCurrentUser(), - new Date(), - filename); - - // different cas: - // depuis la liste, on doit mettre à jour Email.PROPERTY_LAST_ATTACHMENT_OPENER - // depuis l'edition d'une demande, Email.PROPERTY_HISTORY - model.fromEntityIncluding(email, Sets.newHashSet(Email.PROPERTY_HISTORY, Email.PROPERTY_LAST_ATTACHMENT_OPENER)); - } - } - - @Override - public void onAttachmentEdited(Attachment attachment) { - String topiaId = model.getTopiaId(); - FaxToMailServiceContext serviceContext = context.newServiceContext(); - Email email = serviceContext.getEmailService().addToHistory(topiaId, - HistoryType.ATTACHMENT_MODIFICATION, - context.getCurrentUser(), - new Date(), - FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFileName())); - - // different cas: - // depuis la liste, on doit mettre à jour Email.PROPERTY_LAST_ATTACHMENT_OPENER - // depuis l'edition d'une demande, Email.PROPERTY_HISTORY - model.fromEntityIncluding(email, Sets.newHashSet(Email.PROPERTY_HISTORY, Email.PROPERTY_LAST_ATTACHMENT_OPENER)); - } - }; - - editorButton.getBean().addAttachmentListener(listener); - - return editorButton; - } - - @Override - public boolean shouldSelectCell(EventObject anEvent) { - return true; - } - - @Override - public Object getCellEditorValue() { - - AttachmentEditorUIModel model = editorButton.getBean(); - Preconditions.checkNotNull(model, "No model found in editor."); - - Object result = model.getAttachment(); - if (log.isDebugEnabled()) { - log.debug("editor value: " + result); - } - - return result; - } - - @Override - public boolean stopCellEditing() { - boolean b = super.stopCellEditing(); - if (b) { - editorButton.getBean().removeAttachmentListener(listener); - editorButton.init(null); - } - return b; - } - - @Override - public void cancelCellEditing() { - editorButton.getBean().removeAttachmentListener(listener); - editorButton.init(null); - super.cancelCellEditing(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellRenderer.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellRenderer.java deleted file mode 100644 index 8f0edf8..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellRenderer.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.attachment; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import jaxx.runtime.SwingUtil; -import org.apache.commons.collections4.CollectionUtils; -import org.nuiton.decorator.Decorator; - -import javax.swing.*; -import javax.swing.table.DefaultTableCellRenderer; -import java.util.List; - -import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; - -/** - * Renderer of a attachement editor in a table cell. - * - * @author kmorin - morin@codelutin.com - */ -public class AttachmentCellRenderer extends DefaultTableCellRenderer { - - public static final String TEXT_PATTERN = "<html><body>%s</body></html>"; - - private static final long serialVersionUID = 1L; - - private final String noneText; - - private final Decorator<Attachment> decorator; - -// private Font defaulfFont; -// -// private Font selectedFont; - - public static AttachmentCellRenderer newRender(Decorator<Attachment> decorator) { - return new AttachmentCellRenderer(decorator); - } - - protected AttachmentCellRenderer(Decorator<Attachment> decorator) { - setHorizontalAlignment(CENTER); - setIcon(SwingUtil.createActionIcon("attachment")); - this.noneText = n("faxtomail.attachmentEditor.none.tip"); - this.decorator = decorator; - } - - @Override - protected void setValue(Object value) { - // do nothing - } - - @Override - public JComponent getTableCellRendererComponent(JTable table, - Object value, - boolean isSelected, - boolean hasFocus, - int row, - int column) { - - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - - List<Attachment> attachments = (List<Attachment>) value; - - String toolTipTextValue; - - if (CollectionUtils.isEmpty(attachments)) { - - // use HTML to show the tooltip in italic - toolTipTextValue = "<i>" + t(noneText) + "</i>"; - - - } else { - - StringBuilder sb = new StringBuilder(); - for (Attachment attachment : attachments) { - sb.append("<br/>").append(decorator.toString(attachment)); - } - // use html to display the tooltip on several lines - toolTipTextValue = sb.substring(5); - } - String textValue = t("faxtomail.attachmentCellRenderer.text", attachments != null ? attachments.size() : 0); - boolean editable = table.isCellEditable(row, column); - toolTipTextValue = String.format(TEXT_PATTERN, toolTipTextValue); - setEnabled(editable); - setText(textValue); - setToolTipText(toolTipTextValue); -// setBackground(null); -// setForeground(Color.BLACK); - -// if (isSelected) { -// setFont(selectedFont); -// } else { -// setFont(defaulfFont); -// } - - return this; - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.css deleted file mode 100644 index 2e4e5b2..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.css +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#attachmentDialog { - minimumSize: { new java.awt.Dimension(250, 0) }; -} - -#body { - title: "faxtomail.attachmentEditor.title"; -} - -#noAttachmentsLabel { - text: "faxtomail.attachmentEditor.attachments.empty"; - visible: { model.getAttachment().isEmpty() }; - border: { javax.swing.BorderFactory.createEmptyBorder(3, 3, 3, 3) }; - font-style: italic; -} - -#attachments { - editable: true; - visible: { !model.getAttachment().isEmpty() }; -} - -#formPanel { - visible: { model.isEditable() }; -} - -#fileLabel { - text: "faxtomail.attachmentEditor.field.file"; - labelFor: { file }; -} - -#addButton { - actionIcon: add; - toolTipText: "faxtomail.attachmentEditor.action.add.tip"; - enabled: { model.isEditable() }; - _applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.AddAttachmentAction.class }; -} - diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.jaxx deleted file mode 100644 index 672eb97..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUI.jaxx +++ /dev/null @@ -1,72 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI - superGenericType="AttachmentEditorUIModel, AttachmentEditorUIHandler" - id='attachmentDialog'> - - <import> - com.franciaflex.faxtomail.persistence.entities.Attachment - - jaxx.runtime.swing.editor.FileEditor - jaxx.runtime.swing.model.JaxxDefaultListModel - - org.jdesktop.swingx.JXTable - org.jdesktop.swingx.JXTitledPanel - javax.swing.JComponent - </import> - - <AttachmentEditorUIModel id='model' - initializer='new AttachmentEditorUIModel()'/> - - <JXTitledPanel id='body'> - <JScrollPane id='attachmentBodyScrollPane'> - <JPanel id='mainPanel' layout="{new BorderLayout()}"> - - <JLabel id='noAttachmentsLabel' constraints="BorderLayout.NORTH"/> - - <JXTable id='attachments' constraints="BorderLayout.CENTER"/> - - <Table id="formPanel" constraints="BorderLayout.SOUTH"> - <row fill='both'> - <cell fill='both' weightx='1' columns='3'> - <JSeparator/> - </cell> - </row> - <row fill='both'> - <cell fill='both' weightx='1'> - <JLabel id='fileLabel'/> - </cell> - <cell fill='both' weightx='1'> - <FileEditor id='file'/> - </cell> - <cell fill='both' rows='3'> - <JButton id='addButton'/> - </cell> - </row> - </Table> - - </JPanel> - </JScrollPane> - </JXTitledPanel> -</com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java deleted file mode 100644 index 97dbee6..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java +++ /dev/null @@ -1,262 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.attachment; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.ui.swing.actions.EditAttachmentAction; -import com.franciaflex.faxtomail.ui.swing.actions.OpenAttachmentAction; -import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; -import com.google.common.collect.Iterables; - -import jaxx.runtime.SwingUtil; -import jaxx.runtime.validator.swing.SwingValidator; - -import org.apache.commons.collections4.CollectionUtils; -import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.decorator.HighlighterFactory; - -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - -import javax.swing.AbstractCellEditor; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JTable; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import javax.swing.table.TableModel; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author kmorin - morin@codelutin.com - */ -public class AttachmentEditorUIHandler extends AbstractToolbarPopupHandler<AttachmentEditorUIModel, AttachmentEditorUI> { - - protected OpenAttachmentAction openAttachmentAction = new OpenAttachmentAction(this); - protected EditAttachmentAction editAttachmentAction = new EditAttachmentAction(this); - - @Override - public void afterInit(AttachmentEditorUI ui) { - - ui.getFile().setDialogOwner(ui); - super.afterInit(ui); - - initTable(ui.getAttachments()); - - getModel().addPropertyChangeListener(AttachmentModelAware.PROPERTY_ATTACHMENT, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - AbstractTableModel tableModel = (AbstractTableModel) getUI().getAttachments().getModel(); - tableModel.fireTableDataChanged(); - } - }); - } - - protected void initTable(JXTable table) { - - TableModel attachmentTableModel = new AbstractTableModel() { - @Override - public int getRowCount() { - return CollectionUtils.size(getModel().getAttachment()); - } - - @Override - public int getColumnCount() { - return 1; - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - return Iterables.get(getModel().getAttachment(), rowIndex); - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return true; - } - }; - - attachmentTableModel.addTableModelListener(new TableModelListener() { - @Override - public void tableChanged(TableModelEvent e) { - getUI().pack(); - } - }); - - TableColumnModel columnModel = new DefaultTableColumnModel(); - TableColumn column = new TableColumn(); - column.setCellRenderer(new AttachmentItemRenderer()); - column.setCellEditor(new AttachmentItemEditor()); - columnModel.addColumn(column); - - table.setModel(attachmentTableModel); - table.setColumnModel(columnModel); - table.addHighlighter(HighlighterFactory.createAlternateStriping()); - } - - @Override - protected JComponent getComponentToFocus() { - return getUI().getFile(); - } - - @Override - public void onCloseUI() { - } - - @Override - public SwingValidator<AttachmentEditorUIModel> getValidator() { - return null; - } - - public void openAttachment(Attachment attachment) { - openAttachmentAction.setAttachment(attachment, true); - - // run Internal to prevent multiple successive execution (#5668) - getContext().getActionEngine().runAction(openAttachmentAction); - } - - public void editAttachment(Attachment attachment) { - AttachmentEditorUIModel model = getModel(); - - if (model.isEditable() && FaxToMailUIUtil.isFileTypeEditable(attachment.getOriginalFileName())) { - editAttachmentAction.setAttachment(attachment); - // run Internal to prevent multiple successive execution (#5668) - getContext().getActionEngine().runAction(editAttachmentAction); - - } else if (attachment.getEditedFileName() != null) { - openAttachmentAction.setAttachment(attachment, false); - // run Internal to prevent multiple successive execution (#5668) - getContext().getActionEngine().runAction(openAttachmentAction); - } - } - - public void removeAttachment(AttachmentItem attachmentItem) { - Attachment attachment = attachmentItem.getAttachment(); - int answer = JOptionPane.showConfirmDialog(ui, - t("faxtomail.attachmentEditor.deleteAttachment.message", - attachment.getOriginalFileName()), - t("faxtomail.attachmentEditor.deleteAttachment.title"), - JOptionPane.YES_NO_OPTION - ); - - if (answer == JOptionPane.YES_OPTION) { - - ui.getAttachments().getCellEditor().stopCellEditing(); - getModel().removeAttachment(attachment); - - ui.pack(); - } - } - - public boolean isAttachmentEditable(Attachment attachment) { - return FaxToMailUIUtil.isFileTypeEditable(attachment.getOriginalFileName()) - && (getModel().isEditable() || attachment.getEditedFileName() != null); - } - - public boolean isAttachmentRemovable(Attachment attachment) { - return attachment != null && attachment.getTopiaId() == null; - } - - protected class AttachmentItemRenderer extends AttachmentItem implements TableCellRenderer { - - public AttachmentItemRenderer() { - setHandler(AttachmentEditorUIHandler.this); - } - - public Component getTableCellRendererComponent(JTable table, Object value, - boolean isSelected, boolean hasFocus, int row, int column) { - Attachment attachment = (Attachment) value; - setAttachment(attachment); - - if (attachment != null) { - JLabel label = getAttachmentNameLabel(); - String actionIconName = attachment.isAddedByUser() ? "user" : "email"; - Icon icon = SwingUtil.createActionIcon(actionIconName); - label.setIcon(icon); - } - - setEditable(getModel().isEditable()); - - return this; - } - } - - protected class AttachmentItemEditor extends AbstractCellEditor implements TableCellEditor, ActionListener { - - protected AttachmentItem attachmentItem; - - public AttachmentItemEditor() { - attachmentItem = new AttachmentItem(); - attachmentItem.setHandler(AttachmentEditorUIHandler.this); - - // add action listener to stopCellEditing when a button is clicked - // this prevent strange NPE with focus change - attachmentItem.getOpenAttachmentButton().addActionListener(this); - attachmentItem.getEditAttachmentButton().addActionListener(this); - } - - @Override - public void actionPerformed(ActionEvent e) { - // stop cell editing when open or edit button is clicked - stopCellEditing(); - } - - public Component getTableCellEditorComponent(JTable table, Object value, - boolean isSelected, int row, int column) { - Attachment attachment = (Attachment) value; - attachmentItem.setAttachment(attachment); - - if (attachment != null) { - JLabel label = attachmentItem.getAttachmentNameLabel(); - String actionIconName = attachment.isAddedByUser() ? "user" : "email"; - Icon icon = SwingUtil.createActionIcon(actionIconName); - label.setIcon(icon); - } - - attachmentItem.setEditable(getModel().isEditable()); - - return attachmentItem; - } - - @Override - public Object getCellEditorValue() { - return attachmentItem.getAttachment(); - } - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java deleted file mode 100644 index c7fbbfe..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.attachment; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class AttachmentEditorUIModel extends AbstractFaxToMailBeanUIModel<AttachmentModelAware, AttachmentEditorUIModel> { - - //public static final String PROPERTY_FILE = "file"; - public static final String PROPERTY_EDITABLE = "editable"; - - //protected File file; - protected boolean editable = true; - - protected final List<Attachment> attachments = new ArrayList<Attachment>(); - - protected List<AttachmentListener> openingListeners = new ArrayList<AttachmentListener>(); - - protected static Binder<AttachmentEditorUIModel, AttachmentModelAware> toBeanBinder = - BinderFactory.newBinder(AttachmentEditorUIModel.class, - AttachmentModelAware.class); - - protected static Binder<AttachmentModelAware, AttachmentEditorUIModel> fromBeanBinder = - BinderFactory.newBinder(AttachmentModelAware.class, AttachmentEditorUIModel.class); - - protected AttachmentEditorUIModel() { - super(fromBeanBinder, toBeanBinder); - } - - public boolean isEditable() { - return editable; - } - - public void setEditable(boolean editable) { - Object oldValue = isEditable(); - this.editable = editable; - firePropertyChange(PROPERTY_EDITABLE, oldValue, editable); - } - - public List<Attachment> getAttachment() { - return attachments; - } - - public void addAllAttachment(List<Attachment> attachments) { - Object oldValue = new ArrayList<Attachment>(getAttachment()); - this.attachments.addAll(attachments); - firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, oldValue, this.attachments); - } - - public void addAttachment(Attachment attachment) { - Object oldValue = new ArrayList<Attachment>(getAttachment()); - attachments.add(attachment); - firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, oldValue, attachments); - } - - public void removeAttachment(Attachment attachment) { - Object oldValue = new ArrayList<Attachment>(getAttachment()); - attachments.remove(attachment); - firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, oldValue, attachments); - } - - public void setAttachment(List<Attachment> attachments) { - Object oldValue = new ArrayList<Attachment>(getAttachment()); - this.attachments.clear(); - if (attachments != null) { - this.attachments.addAll(attachments); - } - firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, oldValue, this.attachments); - } - - @Override - protected AttachmentModelAware newEntity() { - return null; - } - - public void addAttachmentListener(AttachmentListener listener) { - openingListeners.add(listener); - } - - public void removeAttachmentListener(AttachmentListener listener) { - openingListeners.remove(listener); - } - - public void fireAttachmentOpened(Attachment attachment, boolean original) { - for (AttachmentListener listener : openingListeners) { - listener.onAttachmentOpened(attachment, original); - } - } - - public void fireAttachmentEdited(Attachment attachment) { - for (AttachmentListener listener : openingListeners) { - listener.onAttachmentEdited(attachment); - } - } - - public static interface AttachmentListener { - - public void onAttachmentOpened(Attachment attachment, boolean original); - - public void onAttachmentEdited(Attachment attachment); - - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css deleted file mode 100644 index 29a6dc4..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css +++ /dev/null @@ -1,61 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#attachmentPanel { - border: { BorderFactory.createEmptyBorder(2, 3, 2, 3) }; -} - -#attachmentNameLabel { - text: { attachment != null ? getAttachment().getOriginalFileName() : null }; -} - -#toolbar { - borderPainted: false; - floatable: false; -} - -#openAttachmentButton { - actionIcon: "open-file"; - toolTipText: "faxtomail.attachmentEditor.action.open.tip"; -} - -#editAttachmentButton { - actionIcon: "edit"; - toolTipText: "faxtomail.attachmentEditor.action.edit.tip"; - enabled: { handler != null && handler.isAttachmentEditable(getAttachment()) }; - visible: { isEditable() }; -} - -#openEditedAttachmentButton { - actionIcon: "folder_edit"; - toolTipText: "faxtomail.attachmentEditor.action.openedited.tip"; - enabled: { handler != null && handler.isAttachmentEditable(getAttachment()) }; - visible: { !isEditable() }; -} - -#removeAttachmentButton { - actionIcon: "delete"; - toolTipText: "faxtomail.attachmentEditor.action.remove.tip"; - enabled: { handler != null && handler.isAttachmentRemovable(getAttachment()) }; - visible: { isEditable() }; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.jaxx deleted file mode 100644 index b2477b1..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.jaxx +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='attachmentPanel' layout='{new BorderLayout()}'> - - <import> - com.franciaflex.faxtomail.persistence.entities.Attachment - static org.nuiton.i18n.I18n.t - static jaxx.runtime.JAXXUtil.getStringValue - </import> - - <Attachment id='attachment' javaBean='null'/> - - <AttachmentEditorUIHandler id='handler' javaBean='null'/> - - <Boolean id="editable" javaBean='null'/> - - <JLabel id='attachmentNameLabel' constraints='BorderLayout.CENTER'/> - - <JToolBar id='toolbar' constraints='BorderLayout.EAST'> - <JButton id='openAttachmentButton' - onActionPerformed='handler.openAttachment(attachment)'/> - <JButton id='openEditedAttachmentButton' - onActionPerformed='handler.editAttachment(attachment)'/> - <JButton id='editAttachmentButton' - onActionPerformed='handler.editAttachment(attachment)'/> - <JButton id='removeAttachmentButton' - onActionPerformed='handler.removeAttachment(this)'/> - </JToolBar> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java deleted file mode 100644 index e7c08b3..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.attachment; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Attachment; - -import java.io.Serializable; -import java.util.List; - -/** - * To place on model wich supports attachments. - * - * @author kmorin - morin@codelutin.com - */ -public interface AttachmentModelAware extends Serializable { - - String PROPERTY_ATTACHMENT = "attachment"; - - List<Attachment> getAttachment(); - - void addAllAttachment(List<Attachment> attachments); - - void addAttachment(Attachment attachment); - - void removeAttachment(Attachment attachment); - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java deleted file mode 100644 index 60999b5..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.attachment; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton; -import org.apache.commons.collections4.ListUtils; -import org.apache.commons.collections4.CollectionUtils; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.Collection; -import java.util.List; - -import static org.nuiton.i18n.I18n.t; -import static org.nuiton.i18n.I18n.n; - -/** - * Button to edit attachments. - * - * @author kmorin - morin@codelutin.com - */ -public class ButtonAttachment extends AbstractToolbarPopupButton<AttachmentEditorUI> { - - protected AttachmentModelAware attachmentModelAware; - - protected String textKey; - - private PropertyChangeListener listener = new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - List<Attachment> attachments = (List<Attachment>) evt.getNewValue(); - setText(getButtonText(attachments)); - - if (attachmentModelAware != null) { - List<Attachment> oldValue = (List<Attachment>) evt.getOldValue(); - List<Attachment> toAdd = ListUtils.subtract(attachments, oldValue); - attachmentModelAware.addAllAttachment(toAdd); - - Collection<Attachment> toRemove = CollectionUtils.subtract(oldValue, attachments); - for (Attachment attachment : toRemove) { - attachmentModelAware.removeAttachment(attachment); - } - } - } - }; - - public ButtonAttachment(AttachmentModelAware model) { - this(n("faxtomail.attachmentEditor.text"), model); - } - - public ButtonAttachment(String textKey, AttachmentModelAware model) { - this.textKey = textKey; - setToolTipText(t("faxtomail.attachmentEditor.action.tip")); - init(model); - } - - @Override - protected String getActionIcon() { - return "attachment"; - } - - @Override - protected AttachmentEditorUI createNewPopup() { - return new AttachmentEditorUI(FaxToMailUIContext.getApplicationContext()); - } - - public String getButtonText(Collection<Attachment> attachments) { - int attachmentNb = CollectionUtils.size(attachments); - return t(textKey, attachmentNb); - } - - public void init(AttachmentModelAware model) { - attachmentModelAware = model; - popup.getModel().removePropertyChangeListener(AttachmentModelAware.PROPERTY_ATTACHMENT, listener); - popup.getModel().fromEntity(model); - popup.getModel().addPropertyChangeListener(AttachmentModelAware.PROPERTY_ATTACHMENT, listener); - setText(getButtonText(model != null ? model.getAttachment() : null)); - } - - public AttachmentEditorUIModel getBean() { - return popup.getModel(); - } - - public void setEditable(boolean editable) { - popup.getModel().setEditable(editable); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListTableFilter.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListTableFilter.java deleted file mode 100644 index 9e1d985..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListTableFilter.java +++ /dev/null @@ -1,302 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande; - -/* - * #%L - * FaxToMail :: UI - * $Id:$ - * $HeadURL:$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Client; -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.EmailFilter; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.Priority; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.actions.LoadFolderEmailsAction; -import com.google.common.base.Function; -import com.google.common.base.Predicate; -import com.google.common.collect.Collections2; -import jaxx.runtime.JAXXUtil; -import jaxx.runtime.swing.table.filter.AbstractTableFilter; -import org.apache.commons.lang3.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.JXTable; -import org.nuiton.decorator.Decorator; -import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; -import org.nuiton.util.pagination.PaginationParameter; - -import javax.swing.table.TableModel; -import java.text.DateFormat; -import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.HashSet; -import java.util.Set; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * @since x.x - */ -public class DemandeListTableFilter extends AbstractTableFilter<JXTable> { - - private static final Log log = LogFactory.getLog(DemandeListTableFilter.class); - - protected DemandeListUIHandler handler; - - public DemandeListTableFilter(JXTable table, DemandeListUIHandler handler) { - super(table); - this.handler = handler; - } - - @Override - protected boolean execute(int col, Collection<Object> items) { - EmailFilter emailFilter = handler.getModel().getEmailFilter(); - String property = ((ColumnIdentifier) getTable().getColumn(col).getIdentifier()).getPropertyName(); - boolean filtered = isFiltered(col); - - switch (property) { - case Email.PROPERTY_DEMAND_STATUS: - emailFilter.setDemandStatus(!filtered ? null : new HashSet<DemandStatus>((Collection)items)); - break; - - case Email.PROPERTY_RECEPTION_DATE: - emailFilter.setReceptionDates(!filtered ? null : new HashSet<Date>((Collection)items)); - break; - - case Email.PROPERTY_RECIPIENT: - emailFilter.setRecipients(!filtered ? null : new HashSet<String>((Collection)items)); - break; - - case Email.PROPERTY_SENDER: - emailFilter.setSenders(!filtered ? null : new HashSet<String>((Collection)items)); - break; - - case Email.PROPERTY_OBJECT: - emailFilter.setDemandObjects(!filtered ? null : new HashSet<String>((Collection)items)); - break; - - case DemandeUIModel.PROPERTY_CLIENT_CODE: - emailFilter.setClientCodes(!filtered ? null : new HashSet<String>((Collection)items)); - break; - - case DemandeUIModel.PROPERTY_CLIENT_BRAND: - emailFilter.setClientBrands(!filtered ? null : new HashSet<String>((Collection)items)); - break; - - case Email.PROPERTY_DEMAND_TYPE: - emailFilter.setDemandTypes(!filtered ? null : new HashSet<DemandType>((Collection)items)); - break; - - case Email.PROPERTY_EDI_ERROR: - emailFilter.setEdiCodeNumbers(!filtered ? null : new HashSet<String>((Collection)items)); - break; - - case Email.PROPERTY_WAITING_STATE: - emailFilter.setWaitingStates(!filtered ? null : new HashSet<WaitingState>((Collection) items)); - break; - - case Email.PROPERTY_TAKEN_BY: - emailFilter.setTakenBys(!filtered ? null : new HashSet<FaxToMailUser>((Collection) items)); - break; - - case Email.PROPERTY_PRIORITY: - emailFilter.setPriorities(!filtered ? null : new HashSet<Priority>((Collection) items)); - break; - - case Email.PROPERTY_PROJECT_REFERENCE: - emailFilter.setProjectReferences(!filtered ? null : new HashSet<String>((Collection) items)); - break; - - case Email.PROPERTY_COMPANY_REFERENCE: - emailFilter.setLocalReferences(!filtered ? null : new HashSet<String>((Collection) items)); - break; - - case DemandeUIModel.PROPERTY_REFERENCE: - emailFilter.setReferences(!filtered ? null : new HashSet<String>((Collection) items)); - break; - - case DemandeUIModel.PROPERTY_PF_NB: - emailFilter.setProductsQuantities(!filtered ? null : new HashSet<Long>((Collection) items)); - break; - - case DemandeUIModel.PROPERTY_SAV_NB: - emailFilter.setSavQuantities(!filtered ? null : new HashSet<Long>((Collection) items)); - break; - - case DemandeUIModel.PROPERTY_QUOTATION_NB: - emailFilter.setQuotationQuantities(!filtered ? null : new HashSet<Long>((Collection) items)); - break; - - case Email.PROPERTY_LAST_ATTACHMENT_OPENER: - emailFilter.setLastAttachmentOpeners(!filtered ? null : new HashSet<FaxToMailUser>((Collection) items)); - break; - - case Email.PROPERTY_COMMENT: - emailFilter.setComments(!filtered ? null : new HashSet<String>((Collection) items)); - break; - } - - executeFilter(); - return true; - } - - @Override - public void modelChanged(TableModel model) { - fireFilterChange(); - } - - @Override - public Set<Object> distinctValuesForColumn(int i) { - MailFolder selectedFolder = handler.getModel().getSelectedFolder(); - if (selectedFolder == null) { - return null; - } - - JXTable dataTable = handler.getUI().getDataTable(); - EmailService emailService = handler.getContext().newServiceContext().getEmailService(); - String property = ((ColumnIdentifier) dataTable.getColumn(i).getIdentifier()).getPropertyName(); - - Set<Object> result = new HashSet<>(); - - boolean sum = false; - String[] properties; - switch (property) { - case DemandeUIModel.PROPERTY_CLIENT_CODE: - properties = new String[] { "client." + Client.PROPERTY_CODE }; - break; - - case DemandeUIModel.PROPERTY_CLIENT_BRAND: - properties = new String[] { "client." + Client.PROPERTY_BRAND }; - break; - - case DemandeUIModel.PROPERTY_REFERENCE: - properties = new String[] { "email." + Email.PROPERTY_COMPANY_REFERENCE, - "rangeRow." + RangeRow.PROPERTY_COMMAND_NUMBER }; - break; - - case DemandeUIModel.PROPERTY_PF_NB: - properties = new String[] { "rangeRow." + RangeRow.PROPERTY_PRODUCT_QUANTITY }; - sum = true; - break; - - case DemandeUIModel.PROPERTY_SAV_NB: - properties = new String[] { "rangeRow." + RangeRow.PROPERTY_SAV_QUANTITY }; - sum = true; - break; - - case DemandeUIModel.PROPERTY_QUOTATION_NB: - properties = new String[] { "rangeRow." + RangeRow.PROPERTY_QUOTATION_QUANTITY }; - sum = true; - break; - - case Email.PROPERTY_ATTACHMENT: - case Email.PROPERTY_REPLIES: - case Email.PROPERTY_EMAIL_GROUP: - return null; - - default: - properties = new String[] { "email." + property }; - } - - result.addAll(emailService.getDistinctValues(selectedFolder, - properties, - sum)); - - if (Email.PROPERTY_RECEPTION_DATE.equals(property)) { - Set<Object> filteredDates = new HashSet<>(); - if (log.isDebugEnabled()) { - log.debug("result size " + result.size() + " " + result); - } - for (Object o : result) { - - // le dao revoie toujours null, meme si le cas est impossible en theorie pour - // PROPERTY_RECEPTION_DATE, donc dans ce cas, on ignore le cas null - if (o != null) { - Date date = (Date) o; - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.set(Calendar.SECOND, 0); - cal.set(Calendar.MILLISECOND, 0); - filteredDates.add(cal.getTime()); - } - } - result = new HashSet<Object>(filteredDates); - } - - return result; - } - - @Override - public String toString(Object obj) { - String s = null; - if (obj != null) { - Decorator<?> decorator = handler.getDecorator(obj.getClass(), null); - if (decorator != null) { - s = decorator.toString(obj); - } - } - if (s == null) { - s = JAXXUtil.getStringValue(obj); - } - return s; - } - - @Override - public void clear() { - super.clear(); - handler.getModel().getEmailFilter().clear(); - executeFilter(); - } - - protected void executeFilter() { - FaxToMailUIContext context = handler.getContext(); - - // reset pagination when folder change - PaginationParameter currentPaginationParameter = context.getCurrentPaginationParameter(); - if (currentPaginationParameter != null) { - handler.getModel().setPaginationParameter(currentPaginationParameter); - context.setCurrentPaginationParameter(null); - - } else { - handler.getModel().resetPaginationParameter(); - } - - LoadFolderEmailsAction loadFolderEmailsAction = - context.getActionFactory().createLogicAction(handler, LoadFolderEmailsAction.class); - - if (context.isActionInProgress(null)) { - context.getActionEngine().runFullInternalAction(loadFolderEmailsAction); - } else { - context.getActionEngine().runAction(loadFolderEmailsAction); - } - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css deleted file mode 100644 index 6327495..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css +++ /dev/null @@ -1,156 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -.horizontal-separator { - text: " | "; -} - -.page-separator { - text: "/"; -} - -#mainSplitPane { - resizeWeight: 0.2; -} - -#navigationTree { - font-size: "11"; - rootVisible: false; - showsRootHandles: true; -} - -#computeQuantitiesByRangeMenu { - actionIcon: compute; - text: "faxtomail.demandeList.action.computeQuantitiesByRange"; - toolTipText: "faxtomail.demandeList.action.computeQuantitiesByRange.tip"; - enabled: { model.isComputeQuantitiesByRangeEnabled() }; -} - -#newDemandMenu { - actionIcon: new-demand; - text: "faxtomail.demandeList.action.newDemand"; - toolTipText: "faxtomail.demandeList.action.newDemand.tip"; - enabled: { model.isNewDemandEnabled() }; -} - -#demandNbLabel { - text: "faxtomail.demandeList.demandNbLabel"; - font-style: "italic"; -} - -#demandNbField { - text: { String.valueOf(model.getPaginationResult().getCount()) }; -} - -#quotationNbLabel { - text: "faxtomail.demandeList.quotationNbLabel"; - font-style: "italic"; -} - -#quotationNbField { - text: { String.valueOf(model.getQuotationNb()) }; -} - -#pfNbLabel { - text: "faxtomail.demandeList.pfNbLabel"; - font-style: "italic"; -} - -#pfNbField { - text: { String.valueOf(model.getPfNb()) }; -} - -#savNbLabel { - text: "faxtomail.demandeList.savNbLabel"; - font-style: "italic"; -} - -#savNbField { - text: { String.valueOf(model.getSavNb()) }; -} - -#dataTable { - editable: true; - autoCreateRowSorter: true; - sortable: false; -} - -#printMenu { - actionIcon: print; - text: "faxtomail.demandeList.action.print"; - toolTipText: "faxtomail.demandeList.action.print.tip"; - enabled: { model.isPrintEnabled() }; -} - -#replyMenu { - actionIcon: reply; - text: "faxtomail.demandeList.action.reply"; - toolTipText: "faxtomail.demandeList.action.reply.tip"; - enabled: { model.isReplyEnabled() }; -} - -#archiveMenu { - actionIcon: archive; - text: "faxtomail.demandeList.action.archive"; - toolTipText: "faxtomail.demandeList.action.archive.tip"; - enabled: { model.isArchiveEnabled() }; -} - -#moveMenu { - actionIcon: transmit; - text: "faxtomail.demandeList.action.transmit"; - toolTipText: "faxtomail.demandeList.action.transmit.tip"; - enabled: { model.isTransmitEnabled() }; -} - -#totalDemandCountLabel { - text: "faxtomail.demandeList.totalCount"; -} - -#totalDemandCountValue { - text: { String.valueOf(model.getPaginationResult().getCount()) }; -} - -#resultsPerPageLabel { - text: "faxtomail.demandeList.resultPerPage"; -} - -#pageNumberLabel { - text: "faxtomail.demandeList.pages"; -} - -#previousPageButton { - text: "faxtomail.demandeList.goToPreviousPage"; - enabled: { model.getPaginationResult().hasPreviousPage() }; -} - -#currentPageLabel { - text: { String.valueOf(getModel().getPaginationParameter().getPageNumber() + 1) }; -} - -#totalPageNumberLabel { - text: { String.valueOf(getModel().getPaginationResult().getLastPage().getPageNumber() + 1) }; -} - -#nextPageButton { - text: "faxtomail.demandeList.goToNextPage"; - enabled: { model.getPaginationResult().hasNextPage() }; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx deleted file mode 100644 index 81819a3..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx +++ /dev/null @@ -1,120 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='demandeListPanel' layout='{new BorderLayout()}' - implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<DemandeListUIModel, DemandeListUIHandler>'> - - <import> - com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - - jaxx.runtime.swing.editor.bean.BeanFilterableComboBox - - java.awt.FlowLayout - - org.jdesktop.swingx.JXTable - </import> - - <script><![CDATA[ - - public DemandeListUI(FaxToMailUI parentUI) { - FaxToMailUIUtil.setParentUI(this, parentUI); - } - - ]]></script> - - <DemandeListUIModel id='model' - initializer='getContextValue(DemandeListUIModel.class)'/> - - <!-- - Au dessus du tableau, mettre les totaux des quantités PF et SAV. Mettre à jour en fonction des éléments affichés (suivant le filtre) - Liste des éléments globale (de tous les dossiers accessibles). - --> - - <JPopupMenu id='treePopup'> - <JMenuItem id='computeQuantitiesByRangeMenu' - onActionPerformed='handler.computeQuantitiesByRange()'/> - <JMenuItem id='newDemandMenu' - onActionPerformed='handler.newDemand()'/> - </JPopupMenu> - - <JPopupMenu id='tablePopup'> - <JMenuItem id='printMenu' - onActionPerformed='handler.print()'/> - <JMenuItem id='replyMenu' - onActionPerformed='handler.reply()'/> - <JMenuItem id='archiveMenu' - onActionPerformed='handler.archive()'/> - <JMenuItem id='moveMenu' - onActionPerformed='handler.transmit()'/> - </JPopupMenu> - - <JSplitPane constraints='BorderLayout.CENTER' id="mainSplitPane"> - <JScrollPane> - <JTree id="navigationTree" - onMouseClicked='handler.autoSelectNodeInTree(event, treePopup)'/> - </JScrollPane> - - <JPanel layout='{new BorderLayout()}'> - <JPanel layout="{new FlowLayout(FlowLayout.LEADING)}" constraints='BorderLayout.NORTH'> - <JLabel id="demandNbLabel"/> - <JLabel id="demandNbField"/> - <JLabel styleClass="horizontal-separator"/> - <JLabel id="quotationNbLabel"/> - <JLabel id="quotationNbField"/> - <JLabel styleClass="horizontal-separator"/> - <JLabel id="pfNbLabel"/> - <JLabel id="pfNbField"/> - <JLabel styleClass="horizontal-separator"/> - <JLabel id="savNbLabel"/> - <JLabel id="savNbField"/> - </JPanel> - - <JScrollPane constraints='BorderLayout.CENTER'> - <JXTable id='dataTable' - onMouseClicked='handler.autoSelectRowInTable(event, tablePopup)' - onKeyPressed='handler.openRowMenu(event, tablePopup)'/> - </JScrollPane> - - <JPanel layout="{new FlowLayout(FlowLayout.LEADING)}" constraints='BorderLayout.SOUTH'> - <JLabel id="totalDemandCountLabel" /> - <JLabel id="totalDemandCountValue" /> - - <JLabel styleClass="horizontal-separator" /> - <JLabel id="resultsPerPageLabel" /> - <JComboBox id="resultPerPageCombo" genericType="Integer" /> - - <JLabel styleClass="horizontal-separator"/> - - <JLabel id="pageNumberLabel" /> - <JButton id="previousPageButton" - onActionPerformed="handler.goToPreviousPage()"/> - <JLabel id="currentPageLabel" /> - <JLabel styleClass="page-separator"/> - <JLabel id="totalPageNumberLabel" /> - <JButton id="nextPageButton" - onActionPerformed="handler.goToNextPage()" /> - </JPanel> - </JPanel> - </JSplitPane> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java deleted file mode 100644 index 9e6eefe..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java +++ /dev/null @@ -1,636 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.awt.*; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.Enumeration; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.swing.*; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.table.TableCellEditor; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; - -import com.franciaflex.faxtomail.persistence.entities.Configuration; -import com.franciaflex.faxtomail.persistence.entities.EmailFilter; -import com.franciaflex.faxtomail.persistence.entities.MailAction; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.actions.OpenMailFolderChooserFromListAction; -import jaxx.runtime.JAXXUtil; -import jaxx.runtime.swing.table.filter.TableFilter; -import jaxx.runtime.swing.table.filter.TableRowFilterSupport; -import jaxx.runtime.validator.swing.SwingValidator; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.decorator.ColorHighlighter; -import org.jdesktop.swingx.decorator.ComponentAdapter; -import org.jdesktop.swingx.decorator.HighlightPredicate; -import org.nuiton.decorator.Decorator; -import org.nuiton.jaxx.application.swing.action.ApplicationUIAction; -import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; -import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; -import org.nuiton.jaxx.application.swing.util.CloseableUI; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.History; -import com.franciaflex.faxtomail.persistence.entities.HistoryImpl; -import com.franciaflex.faxtomail.persistence.entities.HistoryType; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; -import com.franciaflex.faxtomail.ui.swing.actions.ArchiveFromListAction; -import com.franciaflex.faxtomail.ui.swing.actions.ComputeQuantitiesByRangeAction; -import com.franciaflex.faxtomail.ui.swing.actions.LoadFolderEmailsAction; -import com.franciaflex.faxtomail.ui.swing.actions.PrintOnDefaultPrinterAction; -import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeFromListAction; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailDemandListHandler; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; -import com.franciaflex.faxtomail.ui.swing.util.FolderTreeNode; -import com.franciaflex.faxtomail.ui.swing.util.PaginationComboModel; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import org.nuiton.util.pagination.PaginationParameter; - -/** - * Handler of UI {@link com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIHandler}. - * - * @author kmorin - morin@codelutin.com - */ -public class DemandeListUIHandler extends AbstractFaxToMailDemandListHandler<DemandeListUIModel, DemandeListUI> implements CloseableUI { - - /** Logger. */ - private static final Log log = LogFactory.getLog(DemandeListUIHandler.class); - public static final String REFRESH_KEY = "F5"; - public static final String REFRESH_FOLDER_ACTION = "refreshFolder"; - - protected Configuration config; - - protected TableFilter<JXTable> tableFilter; - - public TableFilter<JXTable> getTableFilter() { - return tableFilter; - } - - public final PropertyChangeListener selectedDemandeChangeListener = new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - - String propertyName = evt.getPropertyName(); - if (Email.PROPERTY_PRIORITY.equals(propertyName)) { - if (evt.getNewValue() != null || evt.getOldValue() != null) { - SaveDemandeFromListAction saveAction = - getContext().getActionFactory().createLogicAction(DemandeListUIHandler.this, - SaveDemandeFromListAction.class); - saveAction.setModifiedProperties(propertyName); - getContext().getActionEngine().runAction(saveAction); - } - } - - } - }; - - public Configuration getConfiguration() { - return config; - } - - @Override - public void beforeInit(DemandeListUI ui) { - super.beforeInit(ui); - - config = getContext().newServiceContext().getConfigurationService().getConfiguration(); - - DemandeListUIModel model = new DemandeListUIModel(); - Collection<MailFolder> folders = getContext().newServiceContext().getMailFolderService() - .getRootMailFoldersWithReadingRights(getContext().getCurrentUser()); - model.setFolders(new ArrayList<MailFolder>(folders)); - - this.ui.setContextValue(model); - } - - @Override - public void afterInit(DemandeListUI ui) { - - initUI(ui); - - DemandeListUIModel model = getModel(); - - // init table - final JXTable dataTable = getUI().getDataTable(); - - initDemandeTable(dataTable, false); - - tableFilter = new DemandeListTableFilter(dataTable, this); - - initTableFilter(); - - dataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { - - @Override - public void valueChanged(ListSelectionEvent e) { - ListSelectionModel source = (ListSelectionModel) e.getSource(); - - DemandeListUIModel model = getModel(); - if (source.isSelectionEmpty()) { - model.setSelectedEmails(null); - } else { - List<DemandeUIModel> selectedRows = new ArrayList<DemandeUIModel>(); - AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel(); - for (int i = source.getMinSelectionIndex(); i <= source.getMaxSelectionIndex(); i++) { - if (source.isSelectedIndex(i)) { - selectedRows.add(dataTableModel.getEntry(i)); - } - } - model.setSelectedEmails(selectedRows); - } - } - }); - - model.addPropertyChangeListener(DemandeListUIModel.PROPERTY_EMAILS, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - List<DemandeUIModel> emails = (List<DemandeUIModel>) evt.getNewValue(); - AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel(); - dataTableModel.setRows(emails); - - int quotationNb = 0; - int pfNb = 0; - int savNb = 0; - for (DemandeUIModel email : emails) { - quotationNb += email.getQuotationNb(); - pfNb += email.getPfNb(); - savNb += email.getSavNb(); - } - - DemandeListUIModel model = (DemandeListUIModel) evt.getSource(); - model.setQuotationNb(quotationNb); - model.setPfNb(pfNb); - model.setSavNb(savNb); - } - }); - - model.addPropertyChangeListener(DemandeListUIModel.PROPERTY_SELECTED_EMAILS, new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent evt) { - List<DemandeUIModel> oldDemands = (List<DemandeUIModel>) evt.getOldValue(); - if (oldDemands != null) { - for (DemandeUIModel demand : oldDemands) { - demand.removePropertyChangeListener(selectedDemandeChangeListener); - } - } - - List<DemandeUIModel> newDemands = (List<DemandeUIModel>) evt.getNewValue(); - if (newDemands != null) { - for (DemandeUIModel demand : newDemands) { - demand.addPropertyChangeListener(selectedDemandeChangeListener); - } - } - } - }); - - // init tree - final JTree navigationTree = ui.getNavigationTree(); - - final Map<MailFolder, FolderTreeNode> nodesByFolder = - FaxToMailUIUtil.initFolderTree(getContext(), navigationTree, model.getFolders(), true); - - getContext().addPropertyChangeListener(FaxToMailUIContext.PROPERTY_ACTION_IN_PROGRESS, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - boolean inProgress = (boolean) evt.getNewValue(); - navigationTree.setEnabled(!inProgress); - } - }); - - navigationTree.addTreeSelectionListener(new TreeSelectionListener() { - @Override - public void valueChanged(TreeSelectionEvent e) { - TableCellEditor cellEditor = dataTable.getCellEditor(); - if (cellEditor != null) { - cellEditor.stopCellEditing(); - } - - FolderTreeNode folderNode = (FolderTreeNode) e.getPath().getLastPathComponent(); - if (folderNode.isCanSelect()) { - MailFolder folder = folderNode.getMailFolder(); - - getModel().setSelectedFolder(folder); - } - } - }); - - model.addPropertyChangeListener(DemandeListUIModel.PROPERTY_SELECTED_FOLDER, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - MailFolder folder = (MailFolder) evt.getNewValue(); - getContext().setCurrentMailFolder(folder); - loadFolderDemands(folder, nodesByFolder); - - DefaultMutableTreeNode node = nodesByFolder.get(folder); - if (node != null) { - navigationTree.setSelectionPath(new TreePath(node.getPath())); - } - } - }); - - // int combo box for result per page - ui.getResultPerPageCombo().setModel(new PaginationComboModel()); - int resultPerPage = getConfig().getResultPerPage(); - ui.getModel().setResultPerPage(resultPerPage); - ui.getResultPerPageCombo().setSelectedItem(resultPerPage); - ui.getResultPerPageCombo().addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - updateResultPerPage(e); - } - }); - - // add refresh shortcut - JRootPane rootPane = getContext().getMainUI().getRootPane(); - rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(REFRESH_KEY), REFRESH_FOLDER_ACTION); - ApplicationUIAction<LoadFolderEmailsAction> refreshAction = getContext().getActionFactory().createUIAction(this, LoadFolderEmailsAction.class); - rootPane.getActionMap().put(REFRESH_FOLDER_ACTION, refreshAction); - - } - - public void initTableFilter() { - Decorator<Object> decorator = new Decorator<Object>(Object.class) { - @Override - public String toString(Object bean) { - String s = null; - if (bean != null) { - Decorator<?> decorator = getDecorator(bean.getClass(), null); - if (decorator != null) { - s = decorator.toString(bean); - } - } - if (s == null) { - s = JAXXUtil.getStringValue(bean); - } - return s; - } - }; - TableRowFilterSupport.forFilter(tableFilter) - .searchable(true) - .searchDecorator(decorator) - .useTableRenderers(true) - .setPopupDefaultSize(new Dimension(250, 290)) - .apply(); - } - - protected void loadFolderDemands(MailFolder folder, Map<MailFolder, FolderTreeNode> nodesByFolder) { - if (folder != null) { - FolderTreeNode folderNode = nodesByFolder.get(folder); - boolean readable = folderNode.isCanRead(); - - while (folder.getAllowCreateDemandIntoFolder() == null - && folder.getParent() != null) { - folder = folder.getParent(); - } - - DemandeListUIModel model = getModel(); - model.setComputeQuantitiesByRangeEnabled(readable); - model.setNewDemandEnabled(readable && folder != null && Boolean.TRUE.equals(folder.getAllowCreateDemandIntoFolder())); - } - - tableFilter.clear(); - } - - public void goToNextPage() { - getModel().setPaginationParameter(getModel().getPaginationResult().getNextPage()); - runListAction(); - } - - public void goToPreviousPage() { - getModel().setPaginationParameter(getModel().getPaginationResult().getPreviousPage()); - runListAction(); - } - - public void updateResultPerPage(ItemEvent event) { - if (event.getStateChange() == ItemEvent.SELECTED) { - int resultPerPage = (Integer)event.getItem(); - getModel().setResultPerPage(resultPerPage); - getConfig().setResultPerPage(resultPerPage); - getConfig().save(); - getModel().resetPaginationParameter(); - runListAction(); - } - } - - protected void runListAction() { - if (getModel().getSelectedFolder() != null) { // can be when update result per page - LoadFolderEmailsAction loadFolderEmailsAction = - getContext().getActionFactory().createLogicAction(DemandeListUIHandler.this, - LoadFolderEmailsAction.class); - getContext().getActionEngine().runAction(loadFolderEmailsAction); - } - } - - @Override - public void initDemandeTable(final JXTable table, boolean sortable) { - HighlightPredicate reportNotTakenPredicate = new HighlightPredicate() { - @Override - public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { - int viewRow = adapter.row; - int modelRow = adapter.convertRowIndexToModel(viewRow); - DemandeUIModel row = ((AbstractApplicationTableModel<DemandeUIModel>) table.getModel()).getEntry(modelRow); - MailFolder folder = getModel().getSelectedFolder(); - while (folder.getOpenAttachmentReportNoTaken() == null - && folder.getParent() != null) { - folder = folder.getParent(); - } - - return Boolean.TRUE.equals(folder.getOpenAttachmentReportNoTaken()) - && row.getLastAttachmentOpener() != null - && !row.getLastAttachmentOpener().equals(row.getTakenBy()); - } - }; - Color color = Color.ORANGE; - table.addHighlighter(new ColorHighlighter(reportNotTakenPredicate, color, Color.WHITE, color.darker(), Color.WHITE)); - - super.initDemandeTable(table, sortable); - } - - @Override - public List<MailField> getColumns() { - List<MailField> tableColumns = null; - MailFolder selectedFolder = getModel().getSelectedFolder(); - if (selectedFolder != null) { - while (!selectedFolder.isUseCurrentLevelTableColumns() && selectedFolder.getParent() != null) { - selectedFolder = selectedFolder.getParent(); - } - tableColumns = selectedFolder.getFolderTableColumns(); - } - return tableColumns; - } - - @Override - protected MailField[] getEditableTableProperties() { - MailField[] result; - if (getModel().getSelectedFolder() != null && getModel().getSelectedFolder().isFolderWritable()) { - result = new MailField[] { MailField.PRIORITY, MailField.ATTACHMENT, MailField.REPLIES }; - } else { - result = new MailField[] { MailField.ATTACHMENT, MailField.REPLIES }; - } - return result; - } - - @Override - protected void onDoubleClickOnDemande(DemandeUIModel selectedEmail) { - super.onDoubleClickOnDemande(selectedEmail); - selectedEmail.removePropertyChangeListener(selectedDemandeChangeListener); - getContext().setCurrentPaginationParameter(getModel().getPaginationParameter()); - } - - @Override - protected JComponent getComponentToFocus() { - return getUI().getNavigationTree(); - } - - @Override - public void onCloseUI() { - if (log.isDebugEnabled()) { - log.debug("closing: " + ui); - } - - JTree tree = getUI().getNavigationTree(); - TreeModel treeModel = tree.getModel(); - Enumeration<TreePath> paths = tree.getExpandedDescendants(new TreePath(treeModel.getRoot())); - List<MailFolder> folders = new ArrayList<MailFolder>(); - if (paths != null) { - while (paths.hasMoreElements()) { - TreePath path = paths.nextElement(); - Object lastPathComponent = path.getLastPathComponent(); - if (FolderTreeNode.class.isAssignableFrom(lastPathComponent.getClass())) { - folders.add(((FolderTreeNode) lastPathComponent).getMailFolder()); - } - } - } - getContext().setExpandedFolders(folders); - - // remove refresh shortcut - JRootPane rootPane = getContext().getMainUI().getRootPane(); - rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).remove(KeyStroke.getKeyStroke(REFRESH_KEY)); - rootPane.getActionMap().remove(REFRESH_FOLDER_ACTION); - - clearValidators(); - } - - @Override - public boolean quitUI() { - return true; - } - - @Override - public SwingValidator<DemandeListUIModel> getValidator() { - return null; - } - - @Override - protected void beforeOpenPopup(int rowIndex, int columnIndex) { - super.beforeOpenPopup(rowIndex, columnIndex); - - int selectedRowCount = getUI().getDataTable().getSelectedRowCount(); - - - DemandeListUIModel model = getModel(); - - model.setReplyEnabled(selectedRowCount == 1 - && model.getSelectedEmails().get(0).isEditable() - && isActionEnabled(model.getSelectedEmails().get(0), MailAction.REPLY, config)); - - model.setArchiveEnabled(selectedRowCount > 0); - model.setTransmitEnabled(selectedRowCount > 0); - model.setPrintEnabled(selectedRowCount > 0); - } - - /** - * During rigth clic, auto-select located under mouse position (not done by default by java) and - * display contextual menu. - * - * @param e event - * @param popup popup menu to display - */ - public void autoSelectNodeInTree(MouseEvent e, JPopupMenu popup) { - - boolean rightClick = SwingUtilities.isRightMouseButton(e); - - if (rightClick) { - - JTree source = (JTree) e.getSource(); - - // get the row index at this point - int rowIndex = source.getClosestRowForLocation(e.getX(), e.getY()); - - if (log.isDebugEnabled()) { - log.debug("At point [" + e.getPoint() + "] found Row " + rowIndex); - } - - // select row (could empty selection) - if (rowIndex == -1) { - source.clearSelection(); - } else { - // set selection - source.setSelectionRow(rowIndex); - } - - // on right click show popup - popup.show(source, e.getX(), e.getY()); - } - } - - public void computeQuantitiesByRange() { - QuantitiesByRangeUI dialogContent = new QuantitiesByRangeUI(ui); - getContext().getActionEngine().runAction(new ComputeQuantitiesByRangeAction(dialogContent.getHandler())); - } - - public void newDemand() { - FaxToMailUser currentUser = getContext().getCurrentUser(); - Date now = new Date(); - - List<History> histories = new ArrayList<History>(); - DemandeUIModel email = new DemandeUIModel(); - History history = new HistoryImpl(); - history.setFaxToMailUser(currentUser); - history.setType(HistoryType.CREATION); - history.setModificationDate(now); - histories.add(history); - - history = new HistoryImpl(); - history.setFaxToMailUser(currentUser); - history.setType(HistoryType.OPENING); - history.setModificationDate(now); - histories.add(history); - - email.setMailFolder(getModel().getSelectedFolder()); - email.setReceptionDate(now); - email.setTakenBy(currentUser); - email.setHistory(histories); - email.setDemandStatus(DemandStatus.UNTREATED); - email.setOriginalEmail(""); // can't be null - openDemand(email); - } - - public void print() { - DemandeListUIModel model = getModel(); - MailFolder selectedFolder = model.getSelectedFolder(); - while (selectedFolder.getParent() != null && selectedFolder.getPrintActionEqualTakeAction() == null) { - selectedFolder = selectedFolder.getParent(); - } - boolean take = Boolean.TRUE.equals(selectedFolder.getPrintActionEqualTakeAction()); - - Multimap<DemandeUIModel, AttachmentFile> attachmentToPrints = HashMultimap.create(); - - for (DemandeUIModel demandeUIModel : model.getSelectedEmails()) { - - List<Attachment> attachments = demandeUIModel.getAttachment(); - if (CollectionUtils.isEmpty(attachments)) { - attachmentToPrints.put(demandeUIModel, null); - - } else { - for (Attachment attachment : attachments) { - // force lazy loading - // TODO kmorin 20140813 action ? - FaxToMailUIUtil.forceAttachmentFileLoading(getContext(), attachment); - - AttachmentFile attachmentFile = attachment.getEditedFile(); - if (attachmentFile == null) { - attachmentFile = attachment.getOriginalFile(); - } - attachmentToPrints.put(demandeUIModel, attachmentFile); - } - } - } - - PrintOnDefaultPrinterAction action = new PrintOnDefaultPrinterAction(this, - attachmentToPrints, - take, - true); - getContext().getActionEngine().runAction(action); - } - - public void reply() { - DemandeUIModel demand = getModel().getSelectedEmails().get(0); - getContext().setCurrentEmail(demand); - - ReplyFormUI dialogContent = new ReplyFormUI(ui); - ReplyFormUIModel model = dialogContent.getModel(); - - model.setOriginalDemand(demand); - - String sender = JAXXUtil.getStringValue(demand.getSender()); - if (demand.isFax()) { - MailFolder selectedFolder = getModel().getSelectedFolder(); - sender = FaxToMailServiceUtils.addFaxDomainToFaxNumber(sender, selectedFolder); - } - model.setTo(sender); - - openFrame(dialogContent, t("faxtomail.reply.title", demand.getTitle()), new Dimension(800, 600)); - } - - public void archive() { - ArchiveFromListAction action = - getContext().getActionFactory().createLogicAction(this, - ArchiveFromListAction.class); - getContext().getActionEngine().runAction(action); - } - - /** - * Display move popup for user to chose where to move all selected demands. - */ - public void transmit() { - OpenMailFolderChooserFromListAction action = - getContext().getActionFactory().createLogicAction(this, - OpenMailFolderChooserFromListAction.class); - getContext().getActionEngine().runAction(action); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java deleted file mode 100644 index ee54b4c..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java +++ /dev/null @@ -1,290 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.ArrayList; -import java.util.List; - -import com.franciaflex.faxtomail.persistence.entities.EmailFilter; -import org.jdesktop.beans.AbstractSerializableBean; -import org.nuiton.util.pagination.PaginationParameter; -import org.nuiton.util.pagination.PaginationResult; - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; - -/** - * @author kmorin - kmorin@codelutin.com - * - */ -public class DemandeListUIModel extends AbstractSerializableBean { - - public static final String PROPERTY_FOLDERS = "folders"; - public static final String PROPERTY_EMAILS = "emails"; - public static final String PROPERTY_PAGINATION_PARAMETER = "paginationParameter"; - public static final String PROPERTY_PAGINATION_RESULT = "paginationResult"; - public static final String PROPERTY_SELECTED_EMAILS = "selectedEmails"; - public static final String PROPERTY_EMAIL_NB = "emailNb"; - public static final String PROPERTY_SELECTED_FOLDER = "selectedFolder"; - public static final String PROPERTY_QUOTATION_NB = "quotationNb"; - public static final String PROPERTY_PF_NB = "pfNb"; - public static final String PROPERTY_SAV_NB = "savNb"; - public static final String PROPERTY_REPLY_ENABLED = "replyEnabled"; - public static final String PROPERTY_ARCHIVE_ENABLED = "archiveEnabled"; - public static final String PROPERTY_TRANSMIT_ENABLED = "transmitEnabled"; - public static final String PROPERTY_PRINT_ENABLED = "printEnabled"; - public static final String PROPERTY_COMPUTE_QUANTITIES_BY_RANGE_ENABLED = "computeQuantitiesByRangeEnabled"; - public static final String PROPERTY_NEW_DEMAND_ENABLED = "newDemandEnabled"; - public static final String PROPERTY_RESULT_PER_PAGE = "resultPerPage"; - - protected List<MailFolder> folders; - - protected List<DemandeUIModel> emails; - - protected EmailFilter emailFilter = new EmailFilter(); - - protected int resultPerPage = 50; - - protected PaginationParameter paginationParameter = PaginationParameter.of(0, resultPerPage, Email.PROPERTY_RECEPTION_DATE, false); - - protected PaginationResult<Email> paginationResult = PaginationResult.of(null, 0, paginationParameter); - - /** Currently selected email in table. */ - protected List<DemandeUIModel> selectedEmails; - - protected MailFolder selectedFolder; - - protected boolean replyEnabled; - - protected boolean archiveEnabled; - - protected boolean transmitEnabled; - - protected boolean printEnabled; - - protected boolean computeQuantitiesByRangeEnabled; - - protected boolean newDemandEnabled; - - protected int quotationNb; - - protected int pfNb; - - protected int savNb; - - public List<MailFolder> getFolders() { - return folders; - } - - public void setFolders(List<MailFolder> folders) { - Object oldValue = getFolders(); - this.folders = folders; - firePropertyChange(PROPERTY_FOLDERS, oldValue, folders); - } - - public List<DemandeUIModel> getEmails() { - return emails; - } - - public void setEmails(List<DemandeUIModel> emails) { - this.emails = emails; - firePropertyChange(PROPERTY_EMAILS, null, emails); - } - - public EmailFilter getEmailFilter() { - return emailFilter; - } - - public void setEmailFilter(EmailFilter emailFilter) { - this.emailFilter = emailFilter; - } - - public void setPaginationParameter(PaginationParameter paginationParameter) { - PaginationParameter oldValue = this.paginationParameter; - this.paginationParameter = paginationParameter; - firePropertyChange(PROPERTY_PAGINATION_PARAMETER, oldValue, paginationParameter); - } - - public PaginationParameter getPaginationParameter() { - return paginationParameter; - } - - public void resetPaginationParameter() { - setPaginationParameter(PaginationParameter.of(0, resultPerPage, Email.PROPERTY_RECEPTION_DATE, false)); - } - - public void setPaginationResult(PaginationResult<Email> paginationResult) { - PaginationResult<Email> oldValue = this.paginationResult; - this.paginationResult = paginationResult; - firePropertyChange(PROPERTY_PAGINATION_RESULT, oldValue, paginationResult); - } - - public PaginationResult<Email> getPaginationResult() { - return paginationResult; - } - - public List<DemandeUIModel> getSelectedEmails() { - return selectedEmails; - } - - public void setSelectedEmails(List<DemandeUIModel> selectedEmails) { - Object oldValue = getSelectedEmails(); - this.selectedEmails = selectedEmails; - firePropertyChange(PROPERTY_SELECTED_EMAILS, oldValue, selectedEmails); - } - - public int getEmailNb() { - return emails == null ? 0 : emails.size(); - } - - public void addEmail(DemandeUIModel email) { - if (emails == null) { - emails = new ArrayList<DemandeUIModel>(); - } - Object oldValue = getEmailNb(); - emails.add(email); - Object newValue = getEmailNb(); - firePropertyChange(PROPERTY_EMAILS, null, emails); - firePropertyChange(PROPERTY_EMAIL_NB, oldValue, newValue); - } - - public void removeEmails(List<DemandeUIModel> emails) { - if (emails != null) { - Object oldValue = getEmailNb(); - this.emails.removeAll(emails); - Object newValue = getEmailNb(); - firePropertyChange(PROPERTY_EMAILS, null, this.emails); - firePropertyChange(PROPERTY_EMAIL_NB, oldValue, newValue); - } - } - - public MailFolder getSelectedFolder() { - return selectedFolder; - } - - public void setSelectedFolder(MailFolder selectedFolder) { - Object oldValue = getSelectedFolder(); - this.selectedFolder = selectedFolder; - firePropertyChange(PROPERTY_SELECTED_FOLDER, oldValue, selectedFolder); - } - - public boolean isReplyEnabled() { - return replyEnabled; - } - - public void setReplyEnabled(boolean replyEnabled) { - Object oldValue = isReplyEnabled(); - this.replyEnabled = replyEnabled; - firePropertyChange(PROPERTY_REPLY_ENABLED, oldValue, replyEnabled); - } - - public boolean isArchiveEnabled() { - return archiveEnabled; - } - - public void setArchiveEnabled(boolean archiveEnabled) { - Object oldValue = isArchiveEnabled(); - this.archiveEnabled = archiveEnabled; - firePropertyChange(PROPERTY_ARCHIVE_ENABLED, oldValue, archiveEnabled); - } - - public boolean isTransmitEnabled() { - return transmitEnabled; - } - - public void setPrintEnabled(boolean printEnabled) { - Object oldValue = this.printEnabled; - this.printEnabled = printEnabled; - firePropertyChange(PROPERTY_PRINT_ENABLED, oldValue, printEnabled); - } - - public boolean isPrintEnabled() { - return printEnabled; - } - - public void setTransmitEnabled(boolean transmitEnabled) { - Object oldValue = this.transmitEnabled; - this.transmitEnabled = transmitEnabled; - firePropertyChange(PROPERTY_TRANSMIT_ENABLED, oldValue, transmitEnabled); - } - - public boolean isComputeQuantitiesByRangeEnabled() { - return computeQuantitiesByRangeEnabled; - } - - public void setComputeQuantitiesByRangeEnabled(boolean computeQuantitiesByRangeEnabled) { - Object oldValue = isComputeQuantitiesByRangeEnabled(); - this.computeQuantitiesByRangeEnabled = computeQuantitiesByRangeEnabled; - firePropertyChange(PROPERTY_COMPUTE_QUANTITIES_BY_RANGE_ENABLED, oldValue, computeQuantitiesByRangeEnabled); - } - - public boolean isNewDemandEnabled() { - return newDemandEnabled; - } - - public void setNewDemandEnabled(boolean newDemandEnabled) { - Object oldValue = isNewDemandEnabled(); - this.newDemandEnabled = newDemandEnabled; - firePropertyChange(PROPERTY_NEW_DEMAND_ENABLED, oldValue, newDemandEnabled); - } - - public int getQuotationNb() { - return quotationNb; - } - - public void setQuotationNb(int quotationNb) { - Object oldValue = getPfNb(); - this.quotationNb = quotationNb; - firePropertyChange(PROPERTY_QUOTATION_NB, oldValue, quotationNb); - } - - public int getPfNb() { - return pfNb; - } - - public void setPfNb(int pfNb) { - Object oldValue = getPfNb(); - this.pfNb = pfNb; - firePropertyChange(PROPERTY_PF_NB, oldValue, pfNb); - } - - public int getSavNb() { - return savNb; - } - - public void setSavNb(int savNb) { - Object oldValue = getSavNb(); - this.savNb = savNb; - firePropertyChange(PROPERTY_SAV_NB, oldValue, savNb); - } - - public void setResultPerPage(int resultPerPage) { - int oldValue = this.resultPerPage; - this.resultPerPage = resultPerPage; - firePropertyChange(PROPERTY_RESULT_PER_PAGE, oldValue, resultPerPage); - } - - public int getResultPerPage() { - return resultPerPage; - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css deleted file mode 100644 index 93fc0ee..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css +++ /dev/null @@ -1,342 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -BeanFilterableComboBox { - showReset: false; - showDecorator: false; - bean: {model}; - enabled: { model.isEditable() }; -} - -JXDatePicker { - _selectOnFocus: { true }; -} - -JTextField, JXTable, BeanFilterableComboBox, #commentField, ButtonAttachment, ButtonDemandReplies { - editable: { model.isEditable() }; -} - -BeanFilterableComboBox { - enabled: { model.isEditable() }; -} - -.rightLabel { - horizontalAlignment: { SwingConstants.RIGHT }; - font-style: "italic"; -} - -#topToolBar { - floatable: false; - opaque: false; - borderPainted: false; -} - -#objectLabel { - text: "faxtomail.demande.object.label"; -} - -#objectField { - text: {model.getObject()}; - _validatorLabel: { t("faxtomail.demande.object.label") }; -} - -#receivedDateLabel { - text: "faxtomail.demande.receivedDate.label"; -} - -#receivedDateField { - text: { handler.decorate(model.getReceptionDate()) }; -} - -#senderLabel { - text: "faxtomail.demande.sender.label"; -} - -#senderField { - text: { model.getSender() }; -} - -#clientLabel { - text: "faxtomail.demande.clientCode.label"; -} - -#clientField { - text: { model.getClientCode() }; - _validatorLabel: { t("faxtomail.demande.clientCode.label") }; -} - -#brandLabel { - text: "faxtomail.demande.clientBrand.label"; -} - -#brandField { - text: {model.getClientBrand()}; -} - -#docTypeLabel { - text: "faxtomail.demande.demandType.label"; -} - -#docTypeComboBox { - property: demandType; - selectedItem: { model.getDemandType() }; - _validatorLabel: { t("faxtomail.demande.demandType.label") }; -} - -#priorityLabel { - text: "faxtomail.demande.priority.label"; -} - -#priorityComboBox { - property: priority; - selectedItem: { model.getPriority() }; - showReset: true; - _validatorLabel: { t("faxtomail.demande.priority.label") }; -} - -#statusLabel { - text: "faxtomail.demande.demandStatus.label"; -} - -#statusField { - text: { model.getDemandStatus().getLabel() }; - visible: { model.getTopiaId() != null }; -} - -#statusComboBox { - property: demandStatus; - selectedItem: { model.getDemandStatus() }; - visible: { model.getTopiaId() == null }; -} - -#waitingStateLabel { - text: "faxtomail.demande.waitingState.label"; -} - -#waitingStateComboBox { - property: waitingState; - selectedItem: { model.getWaitingState() }; - showReset: true; - _validatorLabel: { t("faxtomail.demande.waitingState.label") }; -} - -#projectReferenceLabel { - text: "faxtomail.demande.projectReference.label"; -} - -#projectReferenceField { - text: { model.getProjectReference() }; - _validatorLabel: { t("faxtomail.demande.projectReference.label") }; -} - -#companyReferenceLabel { - text: "faxtomail.demande.companyReference.label"; -} - -#companyReferenceField { - text: { model.getCompanyReference() }; - _validatorLabel: { t("faxtomail.demande.companyReference.label") }; -} - -#commentLabel { - text: "faxtomail.demande.comment.label"; - verticalAlignment: { SwingConstants.TOP }; -} - -#commentField { - text: { model.getComment() }; - _validatorLabel: { t("faxtomail.demande.comment.label") }; -} - -#toRecipientsLabel { - text: "faxtomail.demande.toRecipients.label"; -} - -#toRecipientsField { - text: {model.getToRecipients()}; -} - -#ccRecipientsLabel { - text: "faxtomail.demande.ccRecipients.label"; -} - -#ccRecipientsField { - text: {model.getCcRecipients()}; -} - -#subjectLabel { - text: "faxtomail.demande.subject.label"; -} - -#subjectField { - text: {model.getSubject()}; -} - -#mailBodyLabel { - text: "faxtomail.demande.mailBody.label"; - verticalAlignment: { SwingConstants.TOP }; -} - -#mailBodyField { - editable: false; -} - -.text-row { - layout: { new FlowLayout(FlowLayout.LEADING) }; -} - -#takenByLabel { - text: "faxtomail.demande.takenBy.label"; -} - -#takenByField { - text: { handler.decorateUser(model.getTakenBy(), false) }; -} - -#firstOpenedLabel { - text: "faxtomail.demande.firstOpened.label"; -} - -#firstOpenedByLabel { - text: "faxtomail.common.by.label"; -} - -#firstOpenedByField { - text: { handler.decorateUser(model.getFirstOpeningUser(), false) }; -} - -#firstOpeningDateLabel { - text: "faxtomail.common.on.label"; -} - -#firstOpeningDateField { - text: { handler.decorate(model.getFirstOpeningDate()) }; -} - -#lastModifiedLabel { - text: "faxtomail.demande.lastModified.label"; -} - -#lastModifiedByLabel { - text: "faxtomail.common.by.label"; -} - -#lastModifiedByField { - text: { handler.decorateUser(model.getLastModificationUser(), true) }; -} - -#lastModificationDateLabel { - text: "faxtomail.common.on.label"; -} - -#lastModificationDateField { - text: { handler.decorate(model.getLastModificationDate()) }; -} - -#lastAttachmentOpeningPanel { - visible: { model.getLastAttachmentOpeningInFolderUser() != null }; -} - -#lastAttachmentOpeningLabel { - text: "faxtomail.demande.lastAttachmentOpening.label"; -} - -#lastAttachmentOpenedByLabel { - text: "faxtomail.common.by.label"; -} - -#lastAttachmentOpenedByField { - text: { handler.decorateUser(model.getLastAttachmentOpeningInFolderUser(), true) }; -} - -#lastAttachmentOpeningDateLabel { - text: "faxtomail.common.on.label"; -} - -#lastAttachmentOpeningDateField { - text: { handler.decorate(model.getLastAttachmentOpeningInFolderDate()) }; -} - -#leftVerticalSplitPanel { - dividerSize : { FaxToMailUIUtil.isRangePanelVisible(model.getDemandType()) ? 10 : 0 }; - resizeWeight: 0.8; -} - -#rangePanel { - visible: { FaxToMailUIUtil.isRangePanelVisible(model.getDemandType()) }; - _validatorLabel: { t("faxtomail.demande.rangeRow.label") }; -} - -#ediErrorLabel { - text: "faxtomail.demande.ediError.label"; - visible: { model.getEdiError() != null }; - foreground: { Color.RED }; -} - -#ediErrorField { - text: { model.getEdiError() }; - visible: { model.getEdiError() != null }; - editable: false; - foreground: { Color.RED }; -} - -.horizontal-separator { - text: " | "; -} - -#quotationNbLabel { - text: "faxtomail.demandeList.quotationNbLabel"; - font-style: "italic"; -} - -#quotationNbField { - text: { String.valueOf(model.getQuotationNb()) }; -} - -#pfNbLabel { - text: "faxtomail.demandeList.pfNbLabel"; - font-style: "italic"; -} - -#pfNbField { - text: { String.valueOf(model.getPfNb()) }; -} - -#savNbLabel { - text: "faxtomail.demandeList.savNbLabel"; - font-style: "italic"; -} - -#savNbField { - text: { String.valueOf(model.getSavNb()) }; -} - -#rangeTable { - selectionMode: { ListSelectionModel.SINGLE_SELECTION }; -} - -#toolbarContainer { - rightDecoration: { topToolBar }; -} - -#rightVerticalSplitPanel { - resizeWeight: 0.8; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx deleted file mode 100644 index 82b420c..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx +++ /dev/null @@ -1,336 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel layout='{new BorderLayout()}' - id="demandPanel" - implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<DemandeUIModel, DemandeUIHandler>'> - - <import> - com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - com.franciaflex.faxtomail.ui.swing.content.attachment.ButtonAttachment - com.franciaflex.faxtomail.ui.swing.content.demande.history.ButtonHistory - com.franciaflex.faxtomail.ui.swing.content.demande.replies.ButtonDemandReplies - - com.franciaflex.faxtomail.persistence.entities.Email - com.franciaflex.faxtomail.persistence.entities.DemandType - com.franciaflex.faxtomail.persistence.entities.DemandStatus - com.franciaflex.faxtomail.persistence.entities.Range - com.franciaflex.faxtomail.persistence.entities.Priority - com.franciaflex.faxtomail.persistence.entities.WaitingState - - jaxx.runtime.swing.editor.bean.BeanFilterableComboBox - - org.jdesktop.swingx.JXTitledPanel - org.jdesktop.swingx.JXTable - - javax.swing.ListSelectionModel - javax.swing.SwingConstants - - java.awt.Color - java.awt.FlowLayout - - java.text.SimpleDateFormat - java.util.Date - </import> - - <script><![CDATA[ - - public DemandeUI(FaxToMailUI parentUI, DemandeUIModel demand) { - FaxToMailUIUtil.setParentUI(this, parentUI); - setContextValue(demand); - } - - ]]></script> - - <DemandeUIModel id='model' - initializer='getContextValue(DemandeUIModel.class)'/> - - <BeanValidator id='validator' bean='model' - uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'> - <field name='clientCode' component='clientField'/> - <field name='object' component='objectField'/> - <field name='demandType' component='docTypeComboBox'/> - <field name='projectReference' component='projectReferenceField'/> - <field name='validRangeRowModels' component='rangePanel'/> - <field name="priority" component="priorityComboBox"/> - <field name="waitingState" component="waitingStateComboBox"/> - <field name="companyReference" component="companyReferenceField"/> - <field name="comment" component="commentPane"/> - </BeanValidator> - - <JToolBar id='topToolBar'> - <ButtonDemandReplies id="demandRepliesButton" - constructorParams="model"/> - <ButtonHistory id="historyButton" - constructorParams="model"/> - <ButtonAttachment id="attachmentsButton" - constructorParams="model"/> - </JToolBar> - - <JSplitPane constraints='BorderLayout.CENTER' - orientation="{JSplitPane.HORIZONTAL_SPLIT}"> - - <JSplitPane orientation="{JSplitPane.VERTICAL_SPLIT}" - id="leftVerticalSplitPanel"> - - <JScrollPane id="demandForm"> - - <Table fill='horizontal'> - <row> - <cell> - <JLabel id='receivedDateLabel'/> - </cell> - <cell columns="3"> - <JLabel id='receivedDateField'/> - </cell> - </row> - <row> - <cell> - <JLabel id='senderLabel'/> - </cell> - <cell columns="3"> - <JLabel id='senderField'/> - </cell> - </row> - <row> - <cell> - <JLabel id='objectLabel'/> - </cell> - <cell weightx='1' columns="3"> - <JTextField id='objectField' - onKeyReleased='handler.setText(event, "object")'/> - </cell> - </row> - <row> - <cell> - <JLabel id='clientLabel'/> - </cell> - <cell weightx='1'> - <JTextField id='clientField' - onKeyReleased='handler.setText(event, "clientCode")'/> - </cell> - <cell> - <JLabel id='brandLabel'/> - </cell> - <cell weightx='1'> - <!--<JTextField id='brandField'--> - <!--onKeyReleased='handler.setText(event, "clientBrand")'/>--> - <JLabel id='brandField'/> - </cell> - </row> - <row> - <cell> - <JLabel id='docTypeLabel'/> - </cell> - <cell weightx='1' columns="3"> - <BeanFilterableComboBox id='docTypeComboBox' - constructorParams='this' - genericType="DemandType"/> - </cell> - </row> - <row> - <cell> - <JLabel id='priorityLabel'/> - </cell> - <cell weightx='1' columns="3"> - <BeanFilterableComboBox id='priorityComboBox' - constructorParams='this' - genericType="Priority"/> - </cell> - </row> - <row> - <cell> - <JLabel id='projectReferenceLabel'/> - </cell> - <cell weightx='1' columns="3"> - <JTextField id='projectReferenceField' - onKeyReleased='handler.setText(event, "projectReference")'/> - </cell> - </row> - <row> - <cell> - <JLabel id='companyReferenceLabel'/> - </cell> - <cell weightx='1' columns="3"> - <JTextField id='companyReferenceField' - onKeyReleased='handler.setText(event, "companyReference")'/> - </cell> - </row> - <row> - <cell> - <JLabel id='waitingStateLabel'/> - </cell> - <cell weightx='1' columns="3"> - <BeanFilterableComboBox id='waitingStateComboBox' - constructorParams='this' - genericType="WaitingState"/> - </cell> - </row> - <row> - <cell> - <JLabel id='statusLabel'/> - </cell> - <cell weightx='1' columns="3"> - <JPanel layout="{new BorderLayout()}"> - <JLabel id='statusField' constraints='BorderLayout.NORTH'/> - <BeanFilterableComboBox id='statusComboBox' - constructorParams='this' - genericType="DemandStatus" - constraints='BorderLayout.SOUTH'/> - </JPanel> - </cell> - </row> - <row> - <cell> - <JLabel id="takenByLabel"/> - </cell> - <cell weightx='1' columns="3"> - <JLabel id="takenByField"/> - </cell> - </row> - - <row> - <cell columns="4" insets="10"> - <JSeparator/> - </cell> - </row> - - <row> - <cell columns='4'> - <JPanel styleClass="text-row"> - <JLabel id="firstOpenedLabel"/> - <JLabel id="firstOpenedByLabel"/> - <JLabel id="firstOpenedByField"/> - <JLabel id="firstOpeningDateLabel"/> - <JLabel id="firstOpeningDateField"/> - </JPanel> - </cell> - </row> - <row> - <cell columns='4'> - <JPanel styleClass="text-row"> - <JLabel id="lastModifiedLabel"/> - <JLabel id="lastModifiedByLabel"/> - <JLabel id="lastModifiedByField"/> - <JLabel id="lastModificationDateLabel"/> - <JLabel id="lastModificationDateField"/> - </JPanel> - </cell> - </row> - <row> - <cell columns='4'> - <JPanel id="lastAttachmentOpeningPanel" - styleClass="text-row"> - <JLabel id="lastAttachmentOpeningLabel"/> - <JLabel id="lastAttachmentOpenedByLabel"/> - <JLabel id="lastAttachmentOpenedByField"/> - <JLabel id="lastAttachmentOpeningDateLabel"/> - <JLabel id="lastAttachmentOpeningDateField"/> - </JPanel> - </cell> - </row> - - </Table> - - </JScrollPane> - - <JPanel layout="{new BorderLayout()}" id="rangePanel"> - <JPanel layout="{new FlowLayout(FlowLayout.LEADING)}" constraints='BorderLayout.NORTH'> - <JLabel id='ediErrorLabel'/> - <JTextField id='ediErrorField'/> - </JPanel> - <JScrollPane constraints="BorderLayout.CENTER"> - <JXTable id='rangeTable'/> - </JScrollPane> - <JPanel layout="{new FlowLayout(FlowLayout.LEADING)}" constraints='BorderLayout.SOUTH'> - <JLabel id="quotationNbLabel"/> - <JLabel id="quotationNbField"/> - <JLabel styleClass="horizontal-separator"/> - <JLabel id="pfNbLabel"/> - <JLabel id="pfNbField"/> - <JLabel styleClass="horizontal-separator"/> - <JLabel id="savNbLabel"/> - <JLabel id="savNbField"/> - </JPanel> - </JPanel> - - </JSplitPane> - - <JXTitledPanel id="toolbarContainer"> - - <JSplitPane orientation="{JSplitPane.VERTICAL_SPLIT}" - id="rightVerticalSplitPanel"> - <Table fill="both"> - <row> - <cell> - <JLabel id='toRecipientsLabel'/> - </cell> - <cell weightx="1"> - <JLabel id='toRecipientsField'/> - </cell> - </row> - <row> - <cell> - <JLabel id='ccRecipientsLabel'/> - </cell> - <cell weightx="1"> - <JLabel id='ccRecipientsField'/> - </cell> - </row> - <row> - <cell> - <JLabel id='subjectLabel'/> - </cell> - <cell weightx="1"> - <JLabel id='subjectField'/> - </cell> - </row> - <!--<row>--> - <!--<cell columns="2">--> - <!--<JLabel id='mailBodyLabel'/>--> - <!--</cell>--> - <!--</row>--> - <row> - <cell weighty="1" columns="2"> - <JScrollPane id='mailBodyPane'> - <JTextPane id='mailBodyField'/> - </JScrollPane> - </cell> - </row> - </Table> - <JPanel layout="{new BorderLayout()}"> - <JLabel id='commentLabel' - constraints="BorderLayout.NORTH"/> - <JScrollPane id='commentPane' - constraints="BorderLayout.CENTER"> - <JEditorPane id='commentField' - onKeyReleased='handler.setText(event, "comment")'/> - </JScrollPane> - </JPanel> - </JSplitPane> - - </JXTitledPanel> - - </JSplitPane> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java deleted file mode 100644 index 660bc2d..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java +++ /dev/null @@ -1,535 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.awt.Color; -import java.awt.Component; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -import javax.swing.JComponent; -import javax.swing.JSplitPane; -import javax.swing.JTextPane; -import javax.swing.ListSelectionModel; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.TableCellEditor; - -import jaxx.runtime.validator.swing.SwingValidator; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.decorator.ColorHighlighter; -import org.jdesktop.swingx.decorator.ComponentAdapter; -import org.jdesktop.swingx.decorator.HighlightPredicate; -import org.jdesktop.swingx.table.DefaultTableColumnModelExt; -import org.jdesktop.swingx.table.TableColumnModelExt; -import org.nuiton.jaxx.application.swing.tab.TabHandler; -import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; -import org.nuiton.jaxx.application.swing.table.MoveToNextEditableCellAction; -import org.nuiton.jaxx.application.swing.table.MoveToNextEditableRowAction; -import org.nuiton.jaxx.application.swing.table.MoveToPreviousEditableCellAction; -import org.nuiton.jaxx.application.swing.table.MoveToPreviousEditableRowAction; -import org.nuiton.jaxx.application.swing.util.CloseableUI; -import org.nuiton.util.beans.BeanMonitor; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.HistoryType; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; -import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeAction; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; - -/** - * Handler of UI {@link DemandeUIHandler}. - * - * @author kmorin - morin@codelutin.com - * - */ -public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, DemandeUI> implements CloseableUI, TabHandler { - - /** Logger. */ - private static final Log log = LogFactory.getLog(DemandeUIHandler.class); - - protected BeanMonitor monitor; - - @Override - public void afterInit(DemandeUI ui) { - - initUI(ui); - - final DemandeUIModel model = getModel(); - Set<String> propertiesToIgnore = getPropertiesToIgnore(); - monitor = new BeanMonitor(true, propertiesToIgnore.toArray(new String[propertiesToIgnore.size()])); - monitor.setBean(model); - - model.addPropertyChangeListener(Email.PROPERTY_DEMAND_TYPE, new PropertyChangeListener() { - - private int dividerLocation = -1; - - @Override - public void propertyChange(PropertyChangeEvent evt) { - DemandType newType = (DemandType) evt.getNewValue(); - DemandType oldType = (DemandType) evt.getOldValue(); - - if (newType != null && (oldType == null - || !Objects.equals(FaxToMailServiceUtils.contains(oldType.getRequiredFields(), MailField.RANGE_ROW), - FaxToMailServiceUtils.contains(newType.getRequiredFields(), MailField.RANGE_ROW)))) { - JSplitPane leftVerticalSplitPanel = getUI().getLeftVerticalSplitPanel(); - - if (FaxToMailServiceUtils.contains(newType.getRequiredFields(), MailField.RANGE_ROW)) { - if (dividerLocation < 0) { - dividerLocation = leftVerticalSplitPanel.getLeftComponent().getPreferredSize().height + 10; - } - leftVerticalSplitPanel.setDividerLocation(dividerLocation); - - } else { - dividerLocation = leftVerticalSplitPanel.getDividerLocation(); - } - } - } - }); - - MailFolder folder = model.getMailFolder(); - - initBeanFilterableComboBox(ui.getPriorityComboBox(), getContext().getPriorityCache(), model.getPriority()); - initBeanFilterableComboBox(ui.getStatusComboBox(), Arrays.asList(DemandStatus.values()), model.getDemandStatus()); - - // utilisation des etats d'attente défini pour le dossier (si défini) - List<DemandType> demandTypes = new ArrayList<DemandType>(); - Collection<DemandType> folderDemandTypes = getDemandTypeForFolder(folder); - if (CollectionUtils.isEmpty(folderDemandTypes)) { - demandTypes.addAll(getContext().getDemandTypeCache()); - } else { - demandTypes.addAll(folderDemandTypes); - } - initBeanFilterableComboBox(ui.getDocTypeComboBox(), demandTypes, model.getDemandType()); - - // utilisation des etats d'attente défini pour le dossier (si défini) - List<WaitingState> waitingStates = new ArrayList<WaitingState>(); - Collection<WaitingState> folderWaitingStates = getWaitingStateForFolder(folder); - if (CollectionUtils.isEmpty(folderWaitingStates)) { - waitingStates.addAll(getContext().getWaitingStateCache()); - } else { - waitingStates.addAll(folderWaitingStates); - } - initBeanFilterableComboBox(ui.getWaitingStateComboBox(), waitingStates, model.getWaitingState()); - - JTextPane editor = ui.getMailBodyField(); - FaxToMailUIUtil.setEmailContentInTextPane(this, editor, model); - - // init table - final JXTable table = ui.getRangeTable(); - - // utilisation des gammes défini pour le dossier (si défini) - List<Range> ranges = new ArrayList<Range>(); - Collection<Range> folderRanges = getRangeForFolder(folder); - if (CollectionUtils.isEmpty(folderRanges)) { - ranges.addAll(getContext().getRangeCache()); - } else { - ranges.addAll(folderRanges); - } - TableColumnModelExt columnModel = new DefaultTableColumnModelExt(); - addComboDataColumnToModel(columnModel, - RangeTableModel.RANGE_COLUMN, - getDecorator(Range.class, null), - ranges); - addColumnToModel(columnModel, - RangeTableModel.COMMAND_NUMBER_COLUMN); - addIntegerColumnToModel(columnModel, - RangeTableModel.QUOTATION_QUANTITY_COLUMN, - null, - table); - addIntegerColumnToModel(columnModel, - RangeTableModel.PRODUCT_QUANTITY_COLUMN, - null, - table); - addIntegerColumnToModel(columnModel, - RangeTableModel.SAV_QUANTITY_COLUMN, - null, - table); - - // init range model - final RangeTableModel rangeTableModel = new RangeTableModel(columnModel); - List<RangeRowModel> rangeRowModels = new ArrayList<RangeRowModel>(model.getValidRangeRowModels()); - -// Collection<RangeRow> rangeRows = model.getRangeRow(); -// if (rangeRows != null) { -// for (RangeRow rangeRow : rangeRows) { -// RangeRowModel rangeRowModel = new RangeRowModel(); -// rangeRowModel.fromEntity(rangeRow); -// rangeRowModels.add(rangeRowModel); -// // on ajoute toutes les lignes de rangeRow, -// // qui sont toutes valides puisqu'on les récupère de la base et qu'on ne sauvegarde que les lignes valides -// model.getValidRangeRowModels().add(rangeRowModel); -// } -// } - rangeTableModel.setRows(rangeRowModels); - - Map<String, Integer> quantities = FaxToMailUIUtil.computeQuantities(rangeRowModels); - model.setQuotationNb(quantities.get(DemandeUIModel.PROPERTY_QUOTATION_NB)); - model.setPfNb(quantities.get(DemandeUIModel.PROPERTY_PF_NB)); - model.setSavNb(quantities.get(DemandeUIModel.PROPERTY_SAV_NB)); - - // add listener to update row validity and quantity totals - table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { - - protected PropertyChangeListener listener = new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - DemandeUIModel model = getModel(); - String propertyName = evt.getPropertyName(); - - if (RangeRowModel.PROPERTY_VALID.equals(propertyName)) { - RangeRowModel row = (RangeRowModel) evt.getSource(); - Boolean valid = (Boolean) evt.getNewValue(); - if (Boolean.TRUE.equals(valid)) { - model.addValidRangeRow(row); - } else { - model.removeValidRangeRow(row); - } - } - - if (RangeRowModel.PROPERTY_VALID.equals(propertyName) - || RangeRow.PROPERTY_QUOTATION_QUANTITY.equals(propertyName) - || RangeRow.PROPERTY_PRODUCT_QUANTITY.equals(propertyName) - || RangeRow.PROPERTY_SAV_QUANTITY.equals(propertyName)) { - - List<RangeRowModel> rangeRows = rangeTableModel.getRows(); - Map<String, Integer> quantities = FaxToMailUIUtil.computeQuantities(rangeRows); - model.setQuotationNb(quantities.get(DemandeUIModel.PROPERTY_QUOTATION_NB)); - model.setPfNb(quantities.get(DemandeUIModel.PROPERTY_PF_NB)); - model.setSavNb(quantities.get(DemandeUIModel.PROPERTY_SAV_NB)); - } - - } - }; - - protected RangeRowModel currentRow; - - @Override - public void valueChanged(ListSelectionEvent e) { - ListSelectionModel source = (ListSelectionModel) e.getSource(); - if (currentRow != null) { - currentRow.removePropertyChangeListener(listener); - } - - if (source.isSelectionEmpty()) { - currentRow = null; - } else { - int rowIndex = source.getLeadSelectionIndex(); - currentRow = rangeTableModel.getEntry(rowIndex); - currentRow.addPropertyChangeListener(listener); - } - } - }); - - table.setModel(rangeTableModel); - table.setColumnModel(columnModel); - table.getTableHeader().setReorderingAllowed(false); - - final MoveToNextEditableCellAction nextCellAction = - MoveToNextEditableCellAction.newAction(rangeTableModel, table); - final MoveToPreviousEditableCellAction previousCellAction = - MoveToPreviousEditableCellAction.newAction(rangeTableModel, table); - - final MoveToNextEditableRowAction nextRowAction = - MoveToNextEditableRowAction.newAction(rangeTableModel, table); - final MoveToPreviousEditableRowAction previousRowAction = - MoveToPreviousEditableRowAction.newAction(rangeTableModel, table); - - KeyAdapter keyAdapter = new KeyAdapter() { - - @Override - public void keyPressed(KeyEvent e) { - TableCellEditor editor = table.getCellEditor(); - - int keyCode = e.getKeyCode(); - if (keyCode == KeyEvent.VK_LEFT || - (keyCode == KeyEvent.VK_TAB && e.isShiftDown())) { - e.consume(); - if (editor != null) { - editor.stopCellEditing(); - } - previousCellAction.actionPerformed(null); - - } else if (keyCode == KeyEvent.VK_RIGHT || - keyCode == KeyEvent.VK_TAB) { - e.consume(); - if (editor != null) { - editor.stopCellEditing(); - } - nextCellAction.actionPerformed(null); - - } else if (keyCode == KeyEvent.VK_UP || - (keyCode == KeyEvent.VK_ENTER && e.isShiftDown())) { - e.consume(); - if (editor != null) { - editor.stopCellEditing(); - } - previousRowAction.actionPerformed(null); - - } else if (e.getKeyCode() == KeyEvent.VK_ENTER || - keyCode == KeyEvent.VK_DOWN) { - e.consume(); - if (editor != null) { - editor.stopCellEditing(); - } - nextRowAction.actionPerformed(null); - } - } - }; - - table.addKeyListener(keyAdapter); - HighlightPredicate rowIsInvalidPredicate = new HighlightPredicate() { - @Override - public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { - boolean result = false; - AbstractApplicationTableModel model = (AbstractApplicationTableModel) table.getModel(); - int viewRow = adapter.row; - int modelRow = adapter.convertRowIndexToModel(viewRow); - RangeRowModel row = (RangeRowModel) model.getEntry(modelRow); - result = !row.isValid(); - return result; - } - }; - Color color = new Color(255, 51, 51); - table.addHighlighter(new ColorHighlighter(rowIsInvalidPredicate, color, Color.WHITE, color.darker(), Color.WHITE)); - - SwingValidator validator = getValidator(); - listenValidatorValid(validator, model); - - // if new fishingOperation can already cancel his creation - model.setModify(false); - - registerValidators(validator); - - ui.getAttachmentsButton().getBean().addAttachmentListener( - new AttachmentEditorUIModel.AttachmentListener() { - - @Override - public void onAttachmentOpened(Attachment attachment, boolean original) { - String topiaId = getModel().getTopiaId(); - if (topiaId != null && attachment.isPersisted()) { - String filename; - if (original) { - filename = attachment.getOriginalFileName(); - } else { - filename = FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFileName()); - } - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - Email email = serviceContext.getEmailService().addToHistory(topiaId, - HistoryType.ATTACHMENT_OPENING, - getContext().getCurrentUser(), - new Date(), - filename); - getModel().setHistory(email.getHistory()); - } - } - - @Override - public void onAttachmentEdited(Attachment attachment) { - String topiaId = getModel().getTopiaId(); - if (topiaId != null && attachment.isPersisted()) { - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - Email email = serviceContext.getEmailService().addToHistory(topiaId, - HistoryType.ATTACHMENT_MODIFICATION, - getContext().getCurrentUser(), - new Date(), - FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFileName())); - getModel().setHistory(email.getHistory()); - } - getModel().setModify(true); - } - - } - ); - - final JSplitPane leftVerticalSplitPanel = getUI().getLeftVerticalSplitPanel(); - model.addPropertyChangeListener(Email.PROPERTY_DEMAND_TYPE, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - boolean oldRangePanelVisible = FaxToMailUIUtil.isRangePanelVisible((DemandType) evt.getOldValue()); - boolean newRangePanelVisible = FaxToMailUIUtil.isRangePanelVisible((DemandType) evt.getNewValue()); - - if (oldRangePanelVisible != newRangePanelVisible) { - leftVerticalSplitPanel.setName("leftVerticalSplitPanel" + newRangePanelVisible); - getContext().getSwingSession().add(leftVerticalSplitPanel, true); - if (oldRangePanelVisible) { - leftVerticalSplitPanel.setDividerLocation(leftVerticalSplitPanel.getHeight()); - } else { - leftVerticalSplitPanel.setDividerLocation(getUI().getDemandForm().getPreferredSize().height); - } - } - } - }); - - leftVerticalSplitPanel.setName("leftVerticalSplitPanel" + FaxToMailUIUtil.isRangePanelVisible(model.getDemandType())); - getContext().getSwingSession().add(leftVerticalSplitPanel, true); - - listModelIsModify(getModel()); - } - - @Override - protected JComponent getComponentToFocus() { - return getUI().getObjectField(); - } - - @Override - protected Set<String> getPropertiesToIgnore() { - Set<String> result = super.getPropertiesToIgnore(); - result.add(DemandeUIModel.PROPERTY_EDITABLE); - result.add(Email.PROPERTY_HISTORY); - result.add(DemandeUIModel.PROPERTY_GROUPED_DEMANDES); - result.add(Email.PROPERTY_REPLIES); - result.add(DemandeUIModel.PROPERTY_VALID_RANGE_ROW_MODELS); - return result; - } - - @Override - public void onCloseUI() { - if (log.isDebugEnabled()) { - log.debug("closing: " + ui); - } - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - serviceContext.getEmailService().unlockEmail(getModel().getTopiaId()); - - clearValidators(); - } - - public void closeButtonPopups() { - ui.getAttachmentsButton().setSelected(false); - ui.getHistoryButton().setSelected(false); - ui.getDemandRepliesButton().setSelected(false); - } - - @Override - public boolean quitUI() { - boolean result = quitScreen2( - true, - getModel().isModify(), - t("faxtomail.demande.askCancelEditBeforeLeaving.cancelSave"), - t("faxtomail.demande.askSaveBeforeLeaving.save"), - getContext().getActionFactory().createLogicAction(this, SaveDemandeAction.class) - ); - - return result; - } - - @Override - public SwingValidator<DemandeUIModel> getValidator() { - return ui.getValidator(); - } - - /** - * Récupère recursivement jusqu'au parent, les etats d'attentes définis pour un dossier. - * - * @param folder base folder - * @return etat d'attente to use - */ - protected Collection<WaitingState> getWaitingStateForFolder(MailFolder folder) { - Collection<WaitingState> result = null; - while (CollectionUtils.isEmpty(result) && folder != null) { - result = folder.getWaitingStates(); - folder = folder.getParent(); - } - return result; - } - - /** - * Récupère recursivement jusqu'au parent, les types de demande définies pour un dossier. - * - * @param folder base folder - * @return etat d'attente to use - */ - protected Collection<DemandType> getDemandTypeForFolder(MailFolder folder) { - Collection<DemandType> result = null; - while (CollectionUtils.isEmpty(result) && folder != null) { - result = folder.getDemandTypes(); - folder = folder.getParent(); - } - return result; - } - - /** - * Récupère recursivement jusqu'au parent, les gammes définies pour un dossier. - * - * @param folder base folder - * @return etat d'attente to use - */ - protected Collection<Range> getRangeForFolder(MailFolder folder) { - Collection<Range> result = null; - while (CollectionUtils.isEmpty(result) && folder != null) { - result = folder.getRanges(); - folder = folder.getParent(); - } - return result; - } - - public BeanMonitor getMonitor() { - return monitor; - } - - @Override - public boolean onHideTab(int currentIndex, int newIndex) { - closeButtonPopups(); - return true; - } - - @Override - public void onShowTab(int currentIndex, int newIndex) { - } - - @Override - public boolean onRemoveTab() { - boolean result = quitUI(); - if (result) { - onCloseUI(); - } - return result; - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java deleted file mode 100644 index dbd7ffb..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java +++ /dev/null @@ -1,969 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.ByteArrayInputStream; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.Set; - -import javax.activation.DataSource; -import javax.mail.Address; -import javax.mail.BodyPart; -import javax.mail.Message; -import javax.mail.Part; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMultipart; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.jaxx.application.swing.tab.TabContentModel; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl; -import com.franciaflex.faxtomail.persistence.entities.Client; -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.EmailGroup; -import com.franciaflex.faxtomail.persistence.entities.EmailImpl; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.History; -import com.franciaflex.faxtomail.persistence.entities.HistoryType; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.Priority; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import com.franciaflex.faxtomail.persistence.entities.Reply; -import com.franciaflex.faxtomail.persistence.entities.ReplyImpl; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentModelAware; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; -import com.google.common.base.Function; -import com.google.common.base.Predicate; -import com.google.common.base.Strings; -import com.google.common.collect.Collections2; - -/** - * @author kmorin - kmorin@codelutin.com - * - */ -public class DemandeUIModel extends AbstractFaxToMailBeanUIModel<Email, DemandeUIModel> implements AttachmentModelAware, TabContentModel { - - private static final Log log = LogFactory.getLog(DemandeUIModel.class); - - public static final String PROPERTY_QUOTATION_NB = "quotationNb"; - public static final String PROPERTY_PF_NB = "pfNb"; - public static final String PROPERTY_SAV_NB = "savNb"; - public static final String PROPERTY_CLIENT_CODE = "clientCode"; - public static final String PROPERTY_CLIENT_BRAND = "clientBrand"; - public static final String PROPERTY_REFERENCE = "reference"; - public static final String PROPERTY_EDITABLE = "editable"; - public static final String PROPERTY_LAST_ATTACHMENT_OPENING_IN_THIS_FOLDER_USER = "lastAttachmentOpeningInThisFolderUser"; - public static final String PROPERTY_GROUPED_DEMANDES = "groupedDemandes"; - public static final String PROPERTY_VALID_RANGE_ROW_MODELS = "validRangeRowModels"; - - protected final Email editObject = new EmailImpl(); - - protected final List<Attachment> attachments = new ArrayList<Attachment>(); - - protected final List<Reply> replies = new ArrayList<Reply>(); - - protected final List<DemandeUIModel> groupedDemandes = new ArrayList<DemandeUIModel>(); - - protected final List<RangeRowModel> validRangeRowModels = new ArrayList<RangeRowModel>(); - - protected int quotationNb; - - protected int pfNb; - - protected int savNb; - - protected String clientCode; - - protected String clientBrand; - - protected boolean editable = true; - - protected String htmlContent; - - protected String plainContent; - - protected String subject; - - protected List<String> toRecipients; - - protected List<String> ccRecipients; - - protected boolean closeable; - - protected static Binder<DemandeUIModel, Email> toBeanBinder = - BinderFactory.newBinder(DemandeUIModel.class, - Email.class); - - protected static Binder<Email, DemandeUIModel> fromBeanBinder = - BinderFactory.newBinder(Email.class, DemandeUIModel.class); - - protected static Binder<Attachment, Attachment> fromAttachmentBinder = - BinderFactory.newBinder(Attachment.class); - - protected static Binder<Reply, Reply> fromReplyBinder = BinderFactory.newBinder(Reply.class); - - public DemandeUIModel() { - super(fromBeanBinder, toBeanBinder); -// addPropertyChangeListener(Email.PROPERTY_HISTORY, new PropertyChangeListener() { -// @Override -// public void propertyChange(PropertyChangeEvent evt) { -// findFirstOpeningHistory(); -// findLastModificationHistory(); -// findLastAttachmentOpeningInThisFolderHistory(); -// } -// }); - - addPropertyChangeListener(Email.PROPERTY_RANGE_ROW, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - Collection<RangeRow> rangeRows = (Collection<RangeRow>) evt.getNewValue(); - int quotationNb = 0; - int pfNb = 0; - int savNb = 0; - if (rangeRows != null) { - for (RangeRow rangeRow : rangeRows) { - if (rangeRow != null) { - Integer quotationQuantity = rangeRow.getQuotationQuantity(); - if (quotationQuantity != null) { - quotationNb += quotationQuantity; - } - - Integer productQuantity = rangeRow.getProductQuantity(); - if (productQuantity != null) { - pfNb += productQuantity; - } - - Integer savQuantity = rangeRow.getSavQuantity(); - if (savQuantity != null) { - savNb += savQuantity; - } - } - } - } - setQuotationNb(quotationNb); - setPfNb(pfNb); - setSavNb(savNb); - } - }); - - } - - /** - * Surcharge pour dupliquer correctement les pieces jointes sans charger le contenu binaire en mémoire. - */ - @Override - public void fromEntity(Email entity) { - fromBeanBinder.copyExcluding(entity, this, Email.PROPERTY_ATTACHMENT, Email.PROPERTY_REPLIES, Email.PROPERTY_EMAIL_GROUP); - loadAttachments(entity); - setGroupedDemandes(entity.getEmailGroup()); - loadReplies(entity); - } - - public void fromEntityExcluding(Email entity, Set<String> properties) { - // on ajoute les exclusions par defaut - // si les exclusions étaient déjà exclue par l'appelant les boolean seront faux - // et on a pas besoin de faire un chargement specifique de ces entités. - boolean includeAttachment = properties.add(Email.PROPERTY_ATTACHMENT); - boolean includeDemandGroup = properties.add(Email.PROPERTY_EMAIL_GROUP); - boolean includeReply = properties.add(Email.PROPERTY_REPLIES); - fromBeanBinder.copyExcluding(entity, this, properties.toArray(new String[properties.size()])); - if (includeAttachment) { - loadAttachments(entity); - } - if (includeDemandGroup) { - setGroupedDemandes(entity.getEmailGroup()); - } - if (includeReply) { - loadReplies(entity); - } - } - - public void fromEntityIncluding(Email entity, Set<String> properties) { - fromBeanBinder.copy(entity, this, properties.toArray(new String[properties.size()])); - if (properties.isEmpty() || properties.contains(Email.PROPERTY_ATTACHMENT)) { - loadAttachments(entity); - } - if (properties.isEmpty() || properties.contains(Email.PROPERTY_EMAIL_GROUP)) { - setGroupedDemandes(entity.getEmailGroup()); - } - if (properties.isEmpty() || properties.contains(Email.PROPERTY_REPLIES)) { - loadReplies(entity); - } - } - - protected void loadAttachments(Email entity) { - // On ne copie pas entierrement les attachments pour ne pas force le chargement du contenu binaire du fichier en mémoire. - List<Attachment> attachmentCopy = new ArrayList<Attachment>(); - if (entity.getAttachment() != null) { - for (Attachment attachment : entity.getAttachment()) { - Attachment clone = new AttachmentImpl(); - fromAttachmentBinder.copyExcluding(attachment, clone, Attachment.PROPERTY_EDITED_FILE, Attachment.PROPERTY_ORIGINAL_FILE); - attachmentCopy.add(clone); - } - } - setAttachment(attachmentCopy); - } - - /** - * On ne copie pas entierrement les réponses pour ne pas forcer le chargement du contenu binaire du fichier en mémoire. - * - * @param entity entity - */ - protected void loadReplies(Email entity) { - - List<Reply> replyCopy = new ArrayList<Reply>(); - if (entity.getReplies() != null) { - for (Reply reply : entity.getReplies()) { - Reply clone = new ReplyImpl(); - fromReplyBinder.copyExcluding(reply, clone, Reply.PROPERTY_REPLY_CONTENT); - replyCopy.add(clone); - } - } - setReplies(replyCopy); - } - - @Override - public Email toEntity() { - Email result = newEntity(); - toBeanBinder.copyExcluding(this, result, Email.PROPERTY_ATTACHMENT); - return result; - } - - @Override - public Email toEntity(Email entity) { - toBeanBinder.copyExcluding(this, entity, Email.PROPERTY_ATTACHMENT); - return entity; - } - - public String getTopiaId() { - return editObject.getTopiaId(); - } - - public void setTopiaId(String id) { - editObject.setTopiaId(id); - } - - public void setSender(String sender) { - Object oldValue = getSender(); - editObject.setSender(sender); - firePropertyChanged(Email.PROPERTY_SENDER, oldValue, sender); - } - - public String getSender() { - String sender = editObject.getSender(); - if (sender == null) { - sender = t("faxtomail.demande.sender.manualCreation"); - } - return sender; - } - - public void setRecipient(String recipient) { - Object oldValue = getRecipient(); - editObject.setRecipient(recipient); - firePropertyChanged(Email.PROPERTY_RECIPIENT, oldValue, recipient); - } - - public String getRecipient() { - return editObject.getRecipient(); - } - - public void setObject(String object) { - Object oldValue = getObject(); - editObject.setObject(object); - firePropertyChanged(Email.PROPERTY_OBJECT, oldValue, object); - } - - public String getObject() { - return editObject.getObject(); - } - - public String getSubject() { - if (subject == null) { - decomposeEmail(); - } - return subject; - } - - public String getToRecipients() { - if (toRecipients == null) { - decomposeEmail(); - } - return StringUtils.join(toRecipients, ", "); - } - - public String getCcRecipients() { - if (ccRecipients == null) { - decomposeEmail(); - } - return StringUtils.join(ccRecipients, ", "); - } - - public String getPlainContent() { - if (plainContent == null) { - decomposeEmail(); - } - return plainContent; - } - - public String getHtmlContent() { - if (htmlContent == null) { - decomposeEmail(); - } - return htmlContent; - } - - public void setOriginalEmail(String originalEmail) { - editObject.setOriginalEmail(originalEmail); - } - - public String getOriginalEmail() { - return editObject.getOriginalEmail(); - } - - public void setClientCode(String clientCode) { - Object oldValue = getClientCode(); - this.clientCode = clientCode; - firePropertyChanged(PROPERTY_CLIENT_CODE, oldValue, clientCode); - } - - public boolean isFax() { - return editObject.isFax(); - } - - public void setFax(boolean fax) { - Object oldValue = isFax(); - editObject.setFax(fax); - firePropertyChanged(Email.PROPERTY_FAX, oldValue, fax); - } - - public void setClient(Client client) { - Object oldValue = getClient(); - editObject.setClient(client); - if (client != null) { - this.clientCode = client.getCode(); - this.clientBrand = client.getBrand(); - } - firePropertyChanged(Email.PROPERTY_CLIENT, oldValue, client); - } - - public Client getClient() { - return editObject.getClient(); - } - - public String getClientCode() { - return clientCode; - } - - public void setClientBrand(String clientBrand) { - Object oldValue = getClientBrand(); - this.clientBrand = clientBrand; - firePropertyChanged(PROPERTY_CLIENT_BRAND, oldValue, clientBrand); - } - - public String getClientBrand() { - return clientBrand; - } - - public void setWaitingState(WaitingState waitingState) { - Object oldValue = getWaitingState(); - editObject.setWaitingState(waitingState); - firePropertyChanged(Email.PROPERTY_WAITING_STATE, oldValue, waitingState); - } - - public WaitingState getWaitingState() { - return editObject.getWaitingState(); - } - - public void setTakenBy(FaxToMailUser faxToMailUser) { - Object oldValue = getTakenBy(); - editObject.setTakenBy(faxToMailUser); - firePropertyChanged(Email.PROPERTY_TAKEN_BY, oldValue, faxToMailUser); - } - - public FaxToMailUser getTakenBy() { - return editObject.getTakenBy(); - } - - public Priority getPriority() { - return editObject.getPriority(); - } - - public void setPriority(Priority priority) { - Object oldValue = getPriority(); - editObject.setPriority(priority); - firePropertyChanged(Email.PROPERTY_PRIORITY, oldValue, priority); - } - - public DemandType getDemandType() { - return editObject.getDemandType(); - } - - public void setDemandType(DemandType demandType) { - Object oldValue = getDemandType(); - editObject.setDemandType(demandType); - firePropertyChanged(Email.PROPERTY_DEMAND_TYPE, oldValue, demandType); - } - - public DemandStatus getDemandStatus() { - return editObject.getDemandStatus(); - } - - public void setDemandStatus(DemandStatus demandStatus) { - Object oldValue = getDemandStatus(); - editObject.setDemandStatus(demandStatus); - firePropertyChanged(Email.PROPERTY_DEMAND_STATUS, oldValue, demandStatus); - } - - public void setReceptionDate(Date receptionDate) { - Object oldValue = getReceptionDate(); - editObject.setReceptionDate(receptionDate); - firePropertyChanged(Email.PROPERTY_RECEPTION_DATE, oldValue, receptionDate); - } - - public Date getReceptionDate() { - return editObject.getReceptionDate(); - } - - public void setEdiError(String ediCodeNumber) { - Object oldValue = getEdiError(); - editObject.setEdiError(ediCodeNumber); - firePropertyChanged(Email.PROPERTY_EDI_ERROR, oldValue, ediCodeNumber); - } - - public String getEdiError() { - return editObject.getEdiError(); - } - - public void setProjectReference(String projectReference) { - Object oldValue = getProjectReference(); - editObject.setProjectReference(projectReference); - firePropertyChanged(Email.PROPERTY_PROJECT_REFERENCE, oldValue, projectReference); - } - - public String getProjectReference() { - return editObject.getProjectReference(); - } - - public void setCompanyReference(String companyReference) { - Object oldValue = getCompanyReference(); - Object refOldValue = getReference(); - editObject.setCompanyReference(companyReference); - firePropertyChanged(Email.PROPERTY_COMPANY_REFERENCE, oldValue, companyReference); - firePropertyChanged(PROPERTY_REFERENCE, refOldValue, getReference()); - } - - public String getCompanyReference() { - return editObject.getCompanyReference(); - } - - public String getReference() { - return editObject.getReference(); - } - - public void setHistory(List<History> history) { - editObject.setHistory(history); - firePropertyChanged(Email.PROPERTY_HISTORY, null, history); - } - - public List<History> getHistory() { - return editObject.getHistory(); - } - - public int sizeHistory() { - return editObject.sizeHistory(); - } - - public FaxToMailUser getFirstOpeningUser() { - return editObject.getFirstOpeningUser(); - } - - public Date getFirstOpeningDate() { - return editObject.getFirstOpeningDate(); - } - - public FaxToMailUser getLastModificationUser() { - return editObject.getLastModificationUser(); - } - - public Date getLastModificationDate() { - return editObject.getLastModificationDate(); - } - - /** - * Utilisé depuis la liste des mails seulement pour des raisons de performances sans charger - * l'historique. - * - * Contient la même information que {@code #lastAttachmentOpeningInThisFolderHistory} normalement. - * - * @return lastAttachmentOpener - */ - public FaxToMailUser getLastAttachmentOpener() { - return editObject.getLastAttachmentOpener(); - } - - public void setLastAttachmentOpener(FaxToMailUser lastAttachmentOpener) { - editObject.setLastAttachmentOpener(lastAttachmentOpener); - } - - public FaxToMailUser getLastAttachmentOpeningInFolderUser() { - return editObject.getLastAttachmentOpeningInFolderUser(); - } - - public Date getLastAttachmentOpeningInFolderDate() { - return editObject.getLastAttachmentOpeningInFolderDate(); - } - - @Override - public List<Attachment> getAttachment() { - return new ArrayList<Attachment>(attachments); - } - - @Override - public void addAllAttachment(List<Attachment> attachment) { - Object oldValue = new ArrayList<Attachment>(getAttachment()); - attachments.addAll(attachment); - firePropertyChange(Email.PROPERTY_ATTACHMENT, oldValue, getAttachment()); - } - - @Override - public void addAttachment(Attachment attachment) { - Object oldValue = new ArrayList<Attachment>(getAttachment()); - attachments.add(attachment); - firePropertyChange(Email.PROPERTY_ATTACHMENT, oldValue, getAttachment()); - } - - @Override - public void removeAttachment(Attachment attachment) { - Object oldValue = new ArrayList<Attachment>(getAttachment()); - attachments.remove(attachment); - firePropertyChange(Email.PROPERTY_ATTACHMENT, oldValue, getAttachment()); - } - - public void setAttachment(List<Attachment> attachment) { - Object oldValue = new ArrayList<Attachment>(getAttachment()); - attachments.clear(); - if (attachment != null) { - attachments.addAll(attachment); - } - firePropertyChange(Email.PROPERTY_ATTACHMENT, oldValue, getAttachment()); - } - - public List<RangeRow> getRangeRow() { - return editObject.getRangeRow(); - } - - public void addRangeRow(RangeRow rangeRow) { - Object oldValue = null; - if (getRangeRow() != null) { - oldValue = new ArrayList<RangeRow>(getRangeRow()); - } - String refOldValue = getReference(); - editObject.addRangeRow(rangeRow); - firePropertyChange(Email.PROPERTY_RANGE_ROW, oldValue, getRangeRow()); - firePropertyChanged(PROPERTY_REFERENCE, refOldValue, getReference()); - } - - public void addAllRangeRow(List<RangeRow> rangeRow) { - Object oldValue = null; - if (getRangeRow() != null) { - oldValue = new ArrayList<RangeRow>(getRangeRow()); - } - String refOldValue = getReference(); - editObject.addAllRangeRow(rangeRow); - firePropertyChange(Email.PROPERTY_RANGE_ROW, oldValue, getRangeRow()); - firePropertyChanged(PROPERTY_REFERENCE, refOldValue, getReference()); - } - - public void removeRangeRow(RangeRow rangeRow) { - Object oldValue = null; - if (getRangeRow() != null) { - oldValue = new ArrayList<RangeRow>(getRangeRow()); - } - // on met à jour la référence, qui est la concaténation des numéros de commande et de "notre" référence - String refOldValue = getReference(); - editObject.removeRangeRow(rangeRow); - firePropertyChange(Email.PROPERTY_RANGE_ROW, oldValue, getRangeRow()); - firePropertyChanged(PROPERTY_REFERENCE, refOldValue, getReference()); - } - - public void setRangeRow(List<RangeRow> rangeRow) { - ArrayList<RangeRow> oldValue = new ArrayList<RangeRow>(); - if (getRangeRow() != null) { - oldValue.addAll(getRangeRow()); - } - if (rangeRow == null) { - rangeRow = new ArrayList<RangeRow>(); - } - // on met à jour la référence, qui est la concaténation des numéros de commande et de "notre" référence - String refOldValue = getReference(); - editObject.setRangeRow(rangeRow); - firePropertyChange(Email.PROPERTY_RANGE_ROW, oldValue, getRangeRow()); - firePropertyChanged(PROPERTY_REFERENCE, refOldValue, getReference()); - } - - public MailFolder getMailFolder() { - return editObject.getMailFolder(); - } - - public void setMailFolder(MailFolder mailFolder) { - Object oldValue = getMailFolder(); - editObject.setMailFolder(mailFolder); - firePropertyChanged(Email.PROPERTY_MAIL_FOLDER, oldValue, mailFolder); - } - - public Date getArchiveDate() { - return editObject.getArchiveDate(); - } - - public void setArchiveDate(Date archiveDate) { - Object oldValue = getArchiveDate(); - editObject.setArchiveDate(archiveDate); - firePropertyChanged(Email.PROPERTY_ARCHIVE_DATE, oldValue, archiveDate); - } - - public int getQuotationNb() { - return quotationNb; - } - - public void setQuotationNb(int quotationNb) { - Object oldValue = getQuotationNb(); - this.quotationNb = quotationNb; - firePropertyChange(PROPERTY_QUOTATION_NB, oldValue, quotationNb); - } - - public int getPfNb() { - return pfNb; - } - - public void setPfNb(int pfNb) { - Object oldValue = getPfNb(); - this.pfNb = pfNb; - firePropertyChange(PROPERTY_PF_NB, oldValue, pfNb); - } - - public int getSavNb() { - return savNb; - } - - public void setSavNb(int savNb) { - Object oldValue = getSavNb(); - this.savNb = savNb; - firePropertyChange(PROPERTY_SAV_NB, oldValue, savNb); - } - - public boolean isEditable() { - return editable; - } - - public void setEditable(boolean editable) { - Object oldValue = isEditable(); - this.editable = editable; - firePropertyChange(PROPERTY_EDITABLE, oldValue, editable); - } - - public void setComment(String comment) { - Object oldValue = getComment(); - editObject.setComment(comment); - firePropertyChange(Email.PROPERTY_COMMENT, oldValue, comment); - } - - public String getComment() { - return editObject.getComment(); - } - - public void setGroupedDemandes(EmailGroup emailGroup) { - Object oldValue = new ArrayList<DemandeUIModel>(getGroupedDemandes()); - groupedDemandes.clear(); - if (emailGroup != null) { - Collection<Email> emails = emailGroup.getEmail(); - if (emails != null) { - for (Email email : emails) { - DemandeUIModel demandeUIModel = new DemandeUIModel(); - demandeUIModel.setObject(email.getObject()); - demandeUIModel.setCompanyReference(email.getCompanyReference()); - demandeUIModel.setTopiaId(email.getTopiaId()); - demandeUIModel.setMailFolder(email.getMailFolder()); - demandeUIModel.setDemandStatus(email.getDemandStatus()); - groupedDemandes.add(demandeUIModel); - } - } - } else { - groupedDemandes.add(this); - } - firePropertyChange(PROPERTY_GROUPED_DEMANDES, oldValue, getGroupedDemandes()); - } - - public void addGroupedDemande(DemandeUIModel demand) { - Object oldValue = new ArrayList<DemandeUIModel>(getGroupedDemandes()); - groupedDemandes.add(demand); - firePropertyChange(PROPERTY_GROUPED_DEMANDES, oldValue, getGroupedDemandes()); - - } - - public List<DemandeUIModel> getGroupedDemandes() { - return groupedDemandes; - } - - public int sizeGroupedDemandes() { - return groupedDemandes.size(); - } - - public void addAllReplies(List<Reply> replies) { - Object oldValue = new ArrayList<Reply>(getReplies()); - editObject.addAllReplies(replies); - firePropertyChange(Email.PROPERTY_REPLIES, oldValue, getAttachment()); - } - - public void addReplies(Reply reply) { - editObject.addReplies(reply); - firePropertyChange(Email.PROPERTY_REPLIES, null, getReplies()); - } - - public void removeReply(Reply reply) { - Object oldValue = new ArrayList<Reply>(getReplies()); - editObject.removeReplies(reply); - firePropertyChange(Email.PROPERTY_REPLIES, oldValue, getReplies()); - } - - public void setReplies(List<Reply> replies) { - editObject.setReplies(replies); - firePropertyChange(Email.PROPERTY_REPLIES, null, getReplies()); - } - - public List<Reply> getReplies() { - return editObject.getReplies(); - } - - public int sizeReplies() { - return editObject.sizeReplies(); - } - - - public List<RangeRowModel> getValidRangeRowModels() { - return validRangeRowModels; - } - - public void setValidRangeRowModels(List<RangeRowModel> validRangeRowModels) { - Object oldValue = new ArrayList<RangeRowModel>(validRangeRowModels); - this.validRangeRowModels.clear(); - this.validRangeRowModels.addAll(validRangeRowModels); - firePropertyChanged(PROPERTY_VALID_RANGE_ROW_MODELS, oldValue, validRangeRowModels); - } - - public void addValidRangeRow(RangeRowModel row) { - Object oldValue = new ArrayList<RangeRowModel>(validRangeRowModels); - if (!validRangeRowModels.contains(row)) { - validRangeRowModels.add(row); - } - firePropertyChanged(PROPERTY_VALID_RANGE_ROW_MODELS, oldValue, validRangeRowModels); - } - - public void removeValidRangeRow(RangeRowModel row) { - Object oldValue = new ArrayList<RangeRowModel>(validRangeRowModels); - validRangeRowModels.remove(row); - firePropertyChanged(PROPERTY_VALID_RANGE_ROW_MODELS, oldValue, validRangeRowModels); - } - - /** - * Appelée par la validation. - * - * Voir le fichier src/main/resources/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel-error-validation.xml - * - * @param field field to validate - * @return validity - */ - public boolean isValid(String field) { - DemandType demandType = getDemandType(); - boolean result = demandType == null; - if (!result) { - if (PROPERTY_CLIENT_CODE.equals(field)) { - result = !FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.CLIENT) - || StringUtils.isNotBlank(getClientCode()); - - } else if (PROPERTY_VALID_RANGE_ROW_MODELS.equals(field)) { - result = !FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.RANGE_ROW) - || CollectionUtils.isNotEmpty(getValidRangeRowModels()); - - } else if (Email.PROPERTY_PROJECT_REFERENCE.equals(field)) { - result = !FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.PROJECT_REFERENCE) - || StringUtils.isNotBlank(getProjectReference()); - - } else if (Email.PROPERTY_OBJECT.equals(field)) { - result = !FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.OBJECT) - || StringUtils.isNotBlank(getObject()); - - } else if (Email.PROPERTY_COMMENT.equals(field)) { - result = !FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.COMMENT) - || StringUtils.isNotBlank(getComment()); - - } else if (Email.PROPERTY_COMPANY_REFERENCE.equals(field)) { - result = !FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.COMPANY_REFERENCE) - || StringUtils.isNotBlank(getCompanyReference()); - - } else if (Email.PROPERTY_PRIORITY.equals(field)) { - result = !FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.PRIORITY) - || getPriority() != null; - - } else if (Email.PROPERTY_WAITING_STATE.equals(field)) { - result = !FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.WAITING_STATE) - || getWaitingState() != null; - } - } - return result; - } - - @Override - protected Email newEntity() { - return new EmailImpl(); - } - - @Override - public boolean equals(Object obj) { - if (obj == null || !obj.getClass().isAssignableFrom(DemandeUIModel.class)) { - return false; - } - DemandeUIModel other = (DemandeUIModel) obj; - return editObject.equals(other.editObject); - } - - protected void decomposeEmail() { - try { - // ce code peut provoquer une NPE avec les données de test - Message message = new MimeMessage(null, new ByteArrayInputStream(getOriginalEmail().getBytes(StandardCharsets.UTF_8))); - subject = message.getSubject(); - - toRecipients = new ArrayList<String>(); - ccRecipients = new ArrayList<String>(); - Address[] recipients = message.getRecipients(Message.RecipientType.TO); - if (recipients != null) { - for (Address address : recipients) { - toRecipients.add(address.toString()); - } - } - recipients = message.getRecipients(Message.RecipientType.CC); - if (recipients != null) { - for (Address address : recipients) { - ccRecipients.add(address.toString()); - } - } - - if (message.isMimeType("multipart/*")) { - decomposeMultipartEmail(message); - - } else { - String content = IOUtils.toString(message.getInputStream()); - plainContent = content; - } - - } catch (Exception e) { - //TODO kmorin 20140516 do something when we use the real data - if (log.isErrorEnabled()) { - log.error("", e); - } - } - } - - /** - * Decompose a multipart part. - * - sets the email content if the part contains a text bodypart - * - adds attachments to the email - * - * @param part the part to decompose - * @throws Exception - */ - protected void decomposeMultipartEmail(Part part) throws Exception { - DataSource dataSource = part.getDataHandler().getDataSource(); - MimeMultipart mimeMultipart = new MimeMultipart(dataSource); - int multiPartCount = mimeMultipart.getCount(); - - for (int j = 0; j < multiPartCount; j++) { - BodyPart bp = mimeMultipart.getBodyPart(j); - - // if it is a text part, the,n this is the email content - String disposition = bp.getDisposition(); - if (bp.isMimeType("text/*") && !Part.ATTACHMENT.equals(disposition)) { - Charset charset = FaxToMailServiceUtils.getCharset(bp); - String content = IOUtils.toString(bp.getInputStream(), charset); - if (bp.isMimeType("text/plain")) { - plainContent = content; - } else { - htmlContent = content; - } - - // if it is multipart part, decompose it - } else if (bp.isMimeType("multipart/*")) { - decomposeMultipartEmail(bp); - } - } - } - - @Override - public boolean isEmpty() { - return false; - } - - @Override - public String getTitle() { - String result = getObject(); - String ref = getReference(); - if (!ref.isEmpty()) { - result = ref + " - " + result; - } - return Strings.nullToEmpty(result); - } - - @Override - public String getIcon() { - return "email"; - } - - @Override - public boolean isCloseable() { - return closeable; - } - - public void setCloseable(boolean closeable) { - this.closeable = closeable; - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css deleted file mode 100644 index dca54e7..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css +++ /dev/null @@ -1,71 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#topToolBar { - floatable: false; - opaque: false; - borderPainted: false; -} - -#backButton { - text: "faxtomail.demande.back.button.label"; - actionIcon: cancel; - toolTipText: "faxtomail.action.goto.previousScreen.tip"; - _applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.GoToPreviousScreenAction.class }; -} - -#saveButton { - text: "faxtomail.demande.save.button.label"; - actionIcon: save; - enabled: { model.getCurrentDemand().isEditable() }; -} - -#transmitButton { - text: "faxtomail.demande.transmit.button.label"; - actionIcon: transmit; - enabled: { model.isTransmitEnabled() }; -} - -#printButton { - text: "faxtomail.demande.print.button.label"; - actionIcon: print; - enabled: { model.isPrintEnabled() }; -} - -#archiveButton { - actionIcon: archive; - text: "faxtomail.demande.archive.button.label"; - enabled: { model.isArchiveEnabled() }; -} - -#replyButton { - text: "faxtomail.demande.reply.button.label"; - actionIcon: reply; - enabled: { model.isReplyEnabled() }; -} - -#groupButton { - text: "faxtomail.demande.group.button.label"; - actionIcon: group; - enabled: { model.isGroupEnabled() }; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx deleted file mode 100644 index f6032ad..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.jaxx +++ /dev/null @@ -1,66 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='demandsPanel' layout="{ new BorderLayout() }" - implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<DemandesUIModel, DemandesUIHandler>'> - - <import> - com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup.ButtonEmailGroup - </import> - - <script><![CDATA[ - - public DemandesUI(FaxToMailUI parentUI) { - FaxToMailUIUtil.setParentUI(this, parentUI); - } - - ]]></script> - - <DemandesUIModel id='model' - initializer='getContextValue(DemandesUIModel.class)'/> - - <JToolBar id='topToolBar'> - <ButtonEmailGroup id="demandGroupButton"/> - </JToolBar> - - <JTabbedPane id="demandsTabPane" constraints="BorderLayout.CENTER"> - <!--<tab id="mainDemandTab">--> - <!--<DemandeUI id="mainDemand" constructorParams="this"/>--> - <!--</tab>--> - </JTabbedPane> - - <JPanel layout='{new GridLayout(1,0)}' - constraints='BorderLayout.SOUTH'> - <JButton id="backButton"/> - <JButton id="saveButton" onActionPerformed="handler.save()"/> - <JButton id="transmitButton" onActionPerformed="handler.transmitDemande()"/> - <JButton id="printButton" onActionPerformed="handler.print()"/> - <JButton id="archiveButton" onActionPerformed="handler.archive()"/> - <JButton id="replyButton" onActionPerformed="handler.reply()"/> - <JButton id="groupButton" onActionPerformed="handler.group()"/> - </JPanel> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java deleted file mode 100644 index f583efd..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java +++ /dev/null @@ -1,346 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.awt.Component; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - -import javax.swing.DefaultSingleSelectionModel; -import javax.swing.JComponent; -import javax.swing.JTabbedPane; - -import com.franciaflex.faxtomail.ui.swing.actions.GoToPreviousScreenAction; -import com.franciaflex.faxtomail.ui.swing.actions.SaveAndOpenChooseAttachmentToPrintAction; -import com.franciaflex.faxtomail.ui.swing.actions.SaveAndOpenMailFolderChooserAction; -import com.franciaflex.faxtomail.ui.swing.actions.SaveAndOpenReplyFormAction; -import com.franciaflex.faxtomail.ui.swing.actions.SaveAndOpenSearchToGroupAction; -import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeAction; -import jaxx.runtime.validator.swing.SwingValidator; - -import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler; -import org.nuiton.jaxx.application.swing.ApplicationUI; -import org.nuiton.jaxx.application.swing.action.AbstractApplicationAction; -import org.nuiton.jaxx.application.swing.tab.CustomTab; -import org.nuiton.jaxx.application.swing.tab.DelegateTabContainerHandler; -import org.nuiton.jaxx.application.swing.tab.TabContainerHandler; -import org.nuiton.jaxx.application.swing.tab.TabContentModel; -import org.nuiton.jaxx.application.swing.tab.TabHandler; -import org.nuiton.jaxx.application.swing.util.CloseableUI; - -import com.franciaflex.faxtomail.persistence.entities.Configuration; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.MailAction; -import com.franciaflex.faxtomail.ui.swing.actions.ArchiveAction; -import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeAndExitAction; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class DemandesUIHandler extends AbstractFaxToMailUIHandler<DemandesUIModel, DemandesUI> implements TabContainerHandler, CloseableUI { - - protected DelegateTabContainerHandler delegateTabHandler; - protected Configuration config; - protected SaveDemandeAction saveDemandeAction; - - @Override - public void beforeInit(DemandesUI ui) { - super.beforeInit(ui); - - DemandeUIModel currentEmail = getContext().getCurrentEmail(); - currentEmail.setCloseable(false); - - DemandesUIModel model = new DemandesUIModel(); - - config = getContext().newServiceContext().getConfigurationService().getConfiguration(); - - this.ui.setContextValue(model); - } - - @Override - public void afterInit(DemandesUI demandesUI) { - initUI(ui); - - DemandesUIModel model = getModel(); -// setCustomTab(0, getModel().getDemands().get(0)); - - final PropertyChangeListener demandEnabledAndValidListener = new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - - if (evt.getPropertyName().equals(DemandeUIModel.PROPERTY_VALID) - || evt.getPropertyName().equals(DemandeUIModel.PROPERTY_EDITABLE) - || evt.getPropertyName().equals(Email.PROPERTY_ARCHIVE_DATE)) { - - DemandesUI ui = getUI(); - ui.processDataBinding(DemandesUI.BINDING_ARCHIVE_BUTTON_ENABLED); - ui.processDataBinding(DemandesUI.BINDING_GROUP_BUTTON_ENABLED); - ui.processDataBinding(DemandesUI.BINDING_REPLY_BUTTON_ENABLED); - ui.processDataBinding(DemandesUI.BINDING_SAVE_BUTTON_ENABLED); - ui.processDataBinding(DemandesUI.BINDING_TRANSMIT_BUTTON_ENABLED); - - } - - if (evt.getPropertyName().equals(DemandeUIModel.PROPERTY_VALID) - || evt.getPropertyName().equals(DemandeUIModel.PROPERTY_EDITABLE) - || evt.getPropertyName().equals(Email.PROPERTY_WAITING_STATE)) { - - updateButtonEnability(); - } - } - }; - - model.addDemandsListener(new DemandesUIModel.DemandsListener() { - @Override - public void onDemandAdded(DemandeUIModel demand, int index, boolean added) { - - JTabbedPane tabPanel = getTabPanel(); - if (added) { - DemandeUI demandeUI = new DemandeUI(getUI(), demand); - demandeUI.setName("demandPanel" + index); - getContext().getSwingSession().add(demandeUI, true); - demand.addPropertyChangeListener(demandEnabledAndValidListener); - tabPanel.add(demandeUI); - setCustomTab(index, demand); - } - - tabPanel.setSelectedIndex(index); - } - - @Override - public void onDemandRemoved(DemandeUIModel demand, int index) { - demand.removePropertyChangeListener(demandEnabledAndValidListener); - } - }); - - DemandeUIModel currentEmail = getContext().getCurrentEmail(); - model.addDemand(currentEmail); - } - - protected void updateButtonEnability() { - DemandeUIModel model = getModel().getCurrentDemand(); - boolean editable = model.isEditable(); - boolean archived = model.getArchiveDate() != null; - - boolean transmitEnabled = editable && isActionEnabled(model, MailAction.TRANSMIT, config); - getModel().setTransmitEnabled(transmitEnabled); - - boolean archiveEnabled = editable && isActionEnabled(model, MailAction.ARCHIVE, config); - getModel().setArchiveEnabled(archiveEnabled); - - boolean groupEnabled = isActionEnabled(model, MailAction.GROUP, config); - getModel().setGroupEnabled(groupEnabled); - - boolean printEnabled = isActionEnabled(model, MailAction.PRINT, config); - getModel().setPrintEnabled(printEnabled); - - boolean replyEnabled = (editable || archived) && isActionEnabled(model, MailAction.REPLY, config); - getModel().setReplyEnabled(replyEnabled); - } - - @Override - public boolean quitUI() { - closeButtonPopups(); - JTabbedPane tabPanel = getTabPanel(); - int tabCount = tabPanel.getTabCount(); - boolean quit = true; - int i = 0; - while (quit && i < tabCount) { - tabPanel.setSelectedIndex(i); - DemandeUIHandler tabHandler = (DemandeUIHandler) getTabHandler(i++); - quit = tabHandler.quitUI(); - } - return quit; - } - - @Override - public void onCloseUI() { -// closeButtonPopups(); - int tabCount = getTabPanel().getTabCount(); - for (int i = 0 ; i < tabCount ; i++) { - DemandeUIHandler tabHandler = (DemandeUIHandler) getTabHandler(i); - tabHandler.onCloseUI(); - } - } - - @Override - public SwingValidator<DemandesUIModel> getValidator() { - return null; - } - - @Override - protected JComponent getComponentToFocus() { - return null; - } - - /** - * Returns the tab handler of the tab i. - * - * @param index the index of the tab - * @return the tab handler of the index i if the handler implements - * the {@link org.nuiton.jaxx.application.swing.tab.TabHandler} interface, - * <code>null</code> otherwise - */ - @Override - public TabHandler getTabHandler(int index) { - TabHandler tabHandler = null; - JTabbedPane tabPanel = getTabPanel(); - if (index >= 0 && index < tabPanel.getTabCount()) { - Component tab = tabPanel.getComponentAt(index); - if (ApplicationUI.class.isInstance(tab)) { - ApplicationUI faxToMailTab = (ApplicationUI) tabPanel.getComponentAt(index); - AbstractApplicationUIHandler handler = faxToMailTab.getHandler(); - if (TabHandler.class.isInstance(handler)) { - tabHandler = (TabHandler) handler; - } - } - } - return tabHandler; - } - - @Override - public void setCustomTab(int index, TabContentModel model) { - JTabbedPane tabPanel = getTabPanel(); - tabPanel.setTabComponentAt(index, new CustomTab(model, this)); - } - - @Override - public boolean removeTab(int i) { - TabHandler tabHandler = getTabHandler(i); - boolean remove = tabHandler.onRemoveTab(); - if (remove) { - getTabPanel().removeTabAt(i); - getModel().removeDemand(i); - } - return remove; - } - - @Override - protected void initUI(DemandesUI ui) { - super.initUI(ui); - init(); - } - - @Override - public JTabbedPane getTabPanel() { - return getUI().getDemandsTabPane(); - } - - @Override - public void init() { - getTabPanel().setModel(new DefaultSingleSelectionModel() { - - private static final long serialVersionUID = 1L; - - @Override - public void setSelectedIndex(int index) { - int currentIndex = getTabPanel().getSelectedIndex(); - boolean mustChangeTab = onTabChanged(currentIndex, index); - - if (mustChangeTab) { - super.setSelectedIndex(index); - } - updateButtonEnability(); - } - - }); - } - - @Override - public boolean onTabChanged(int currentIndex, int newIndex) { - boolean change = true; - if (currentIndex != newIndex) { - TabHandler handler = getTabHandler(currentIndex); - if (handler != null) { - change = handler.onHideTab(currentIndex, newIndex); - } - - handler = getTabHandler(newIndex); - if (handler != null) { - handler.onShowTab(currentIndex, newIndex); - saveDemandeAction = getContext().getActionFactory().createLogicAction((AbstractApplicationUIHandler) handler, - SaveDemandeAction.class); - } - } - if (change) { - getModel().setCurrentIndex(newIndex); - getContext().setCurrentEmail(getModel().getCurrentDemand()); - } - return change; - } - - protected void closeButtonPopups() { - DemandeUI demandeUI = (DemandeUI) getTabPanel().getSelectedComponent(); - demandeUI.getHandler().closeButtonPopups(); - ui.getDemandGroupButton().setSelected(false); - } - - public void save() { - closeButtonPopups(); - DemandeUI demandeUI = (DemandeUI) getTabPanel().getSelectedComponent(); - SaveDemandeAndExitAction action = new SaveDemandeAndExitAction(demandeUI.getHandler()); - action.setTakeIfNotTaken(true); - getContext().getActionEngine().runAction(action); - } - - public void transmitDemande() { - closeButtonPopups(); - runAction(SaveAndOpenMailFolderChooserAction.class); - } - - public void print() { - closeButtonPopups(); - runAction(SaveAndOpenChooseAttachmentToPrintAction.class); - } - - public void archive() { - closeButtonPopups(); - DemandeUI demandeUI = (DemandeUI) getTabPanel().getSelectedComponent(); - ArchiveAction action = new ArchiveAction(demandeUI.getHandler()); - getContext().getActionEngine().runAction(action); - } - - public void reply() { - closeButtonPopups(); - runAction(SaveAndOpenReplyFormAction.class); - } - - public void group() { - closeButtonPopups(); - runAction(SaveAndOpenSearchToGroupAction.class); - } - - public DemandeUIHandler getCurrentDemandHandler() { - DemandeUI demandeUI = (DemandeUI) getTabPanel().getSelectedComponent(); - return demandeUI.getHandler(); - } - - public void runAction(Class<? extends AbstractApplicationAction> actionClass) { - AbstractApplicationAction action = getContext().getActionFactory().createLogicAction(this, actionClass); - getContext().getActionEngine().runAction(action); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java deleted file mode 100644 index 930ef4d..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.jdesktop.beans.AbstractBean; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class DemandesUIModel extends AbstractBean { - - public static final String PROPERTY_CURRENT_DEMAND = "currentDemand"; - public static final String PROPERTY_TRANSMIT_ENABLED = "transmitEnabled"; - public static final String PROPERTY_ARCHIVE_ENABLED = "archiveEnabled"; - public static final String PROPERTY_GROUP_ENABLED = "groupEnabled"; - public static final String PROPERTY_PRINT_ENABLED = "printEnabled"; - public static final String PROPERTY_REPLY_ENABLED = "replyEnabled"; - - protected boolean transmitEnabled; - protected boolean archiveEnabled; - protected boolean groupEnabled; - protected boolean printEnabled; - protected boolean replyEnabled; - - protected List<DemandeUIModel> demands = new ArrayList<DemandeUIModel>(); - - protected List<DemandsListener> listeners = new ArrayList<DemandsListener>(); - - protected int currentIndex = -1; - - public boolean isTransmitEnabled() { - return transmitEnabled; - } - - public void setTransmitEnabled(boolean transmitEnabled) { - Object oldValue = isTransmitEnabled(); - this.transmitEnabled = transmitEnabled; - firePropertyChange(PROPERTY_TRANSMIT_ENABLED, oldValue, transmitEnabled); - } - - public boolean isArchiveEnabled() { - return archiveEnabled; - } - - public void setArchiveEnabled(boolean archiveEnabled) { - Object oldValue = isArchiveEnabled(); - this.archiveEnabled = archiveEnabled; - firePropertyChange(PROPERTY_ARCHIVE_ENABLED, oldValue, archiveEnabled); - } - - public boolean isGroupEnabled() { - return groupEnabled; - } - - public void setGroupEnabled(boolean groupEnabled) { - Object oldValue = isGroupEnabled(); - this.groupEnabled = groupEnabled; - firePropertyChange(PROPERTY_GROUP_ENABLED, oldValue, groupEnabled); - } - - public boolean isPrintEnabled() { - return printEnabled; - } - - public void setPrintEnabled(boolean printEnabled) { - Object oldValue = isPrintEnabled(); - this.printEnabled = printEnabled; - firePropertyChange(PROPERTY_PRINT_ENABLED, oldValue, printEnabled); - } - - public boolean isReplyEnabled() { - return replyEnabled; - } - - public void setReplyEnabled(boolean replyEnabled) { - Object oldValue = isReplyEnabled(); - this.replyEnabled = replyEnabled; - firePropertyChange(PROPERTY_REPLY_ENABLED, oldValue, replyEnabled); - } - - protected List<DemandeUIModel> getDemands() { - return demands; - } - - public void addDemand(DemandeUIModel demand) { - boolean added = !demands.contains(demand); - if (added) { - demands.add(demand); - } - int index = demands.indexOf(demand); - fireDemandAdded(demand, index, added); - } - - public void removeDemand(int i) { - DemandeUIModel demand = demands.get(i); - demands.remove(i); - fireDemandRemoved(demand, i); - } - - public boolean containsDemand(DemandeUIModel demand) { - return demands.contains(demand); - } - - public void addDemandsListener(DemandsListener listener) { - listeners.add(listener); - } - - public void removeDemandsListener(DemandsListener listener) { - listeners.remove(listener); - } - - protected void fireDemandAdded(DemandeUIModel demand, int index, boolean added) { - for (DemandsListener listener : listeners) { - listener.onDemandAdded(demand, index, added); - } - } - - protected void fireDemandRemoved(DemandeUIModel demand, int index) { - for (DemandsListener listener : listeners) { - listener.onDemandRemoved(demand, index); - } - } - - public static interface DemandsListener { - - void onDemandAdded(DemandeUIModel demand, int index, boolean added); - - void onDemandRemoved(DemandeUIModel demand, int index); - - } - - public DemandeUIModel getCurrentDemand() { - int currentIndex = getCurrentIndex(); - if (currentIndex < 0 || currentIndex >= demands.size()) { - return null; - } - return demands.get(currentIndex); - } - - public int getCurrentIndex() { - return currentIndex; - } - - public void setCurrentIndex(int currentIndex) { - Object oldValue = getCurrentDemand(); - this.currentIndex = currentIndex; - Object newValue = getCurrentDemand(); - firePropertyChange(PROPERTY_CURRENT_DEMAND, oldValue, newValue); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUI.css deleted file mode 100644 index 6135a67..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUI.css +++ /dev/null @@ -1,30 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#rangeTable { - editable: false; -} - -#okButton { - text: "faxtomail.quantitiesByRange.button.text"; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUI.jaxx deleted file mode 100644 index 40980ac..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUI.jaxx +++ /dev/null @@ -1,53 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='quantitiesByRangeUI' layout='{new BorderLayout()}' - implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<QuantitiesByRangeUIModel, QuantitiesByRangeUIHandler>'> - - <import> - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - - org.jdesktop.swingx.JXTable - </import> - - <script><![CDATA[ - - public QuantitiesByRangeUI(FaxToMailUI parentUI) { - FaxToMailUIUtil.setParentUI(this, parentUI); - } - - ]]></script> - - <QuantitiesByRangeUIModel id='model' - initializer='getContextValue(QuantitiesByRangeUIModel.class)'/> - - <JScrollPane constraints='BorderLayout.CENTER'> - <JXTable id='rangeTable'/> - </JScrollPane> - - <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'> - <JButton id='okButton' onActionPerformed='handler.cancel()'/> - </JPanel> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUIHandler.java deleted file mode 100644 index 87d0c1b..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUIHandler.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; -import jaxx.runtime.validator.swing.SwingValidator; -import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.table.DefaultTableColumnModelExt; -import org.jdesktop.swingx.table.TableColumnModelExt; -import org.nuiton.jaxx.application.swing.util.Cancelable; - -import javax.swing.*; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.List; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class QuantitiesByRangeUIHandler extends AbstractFaxToMailUIHandler<QuantitiesByRangeUIModel, QuantitiesByRangeUI> implements Cancelable { - - protected RangeTableModel rangeTableModel; - - @Override - public void beforeInit(QuantitiesByRangeUI ui) { - super.beforeInit(ui); - - QuantitiesByRangeUIModel dialogModel = new QuantitiesByRangeUIModel(); - dialogModel.setRootFolder(getContext().getCurrentMailFolder()); - this.ui.setContextValue(dialogModel); - } - - @Override - public void afterInit(QuantitiesByRangeUI quantitiesByRangeUI) { - initUI(quantitiesByRangeUI); - - final JXTable table = ui.getRangeTable(); - - TableColumnModelExt columnModel = new DefaultTableColumnModelExt(); - addColumnToModel(columnModel, - null, - newTableCellRender(Range.class), - RangeTableModel.RANGE_COLUMN); - addIntegerColumnToModel(columnModel, - RangeTableModel.QUOTATION_QUANTITY_COLUMN, - null, - table); - addIntegerColumnToModel(columnModel, - RangeTableModel.PRODUCT_QUANTITY_COLUMN, - null, - table); - addIntegerColumnToModel(columnModel, - RangeTableModel.SAV_QUANTITY_COLUMN, - null, - table); - - rangeTableModel = new RangeTableModel(columnModel); - rangeTableModel.setRows(getModel().getRangeRows()); - table.setModel(rangeTableModel); - table.setColumnModel(columnModel); - table.getTableHeader().setReorderingAllowed(false); - - getModel().addPropertyChangeListener(QuantitiesByRangeUIModel.PROPERTY_RANGE_ROWS, - new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - setRangeRows((List<RangeRowModel>) evt.getNewValue()); - } - }); - } - - @Override - public SwingValidator<QuantitiesByRangeUIModel> getValidator() { - return null; - } - - @Override - protected JComponent getComponentToFocus() { - return null; - } - - @Override - public void onCloseUI() { - - } - - @Override - public void cancel() { - closeDialog(); - } - - public void setRangeRows(List<RangeRowModel> rows) { - rangeTableModel.setRows(rows); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUIModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUIModel.java deleted file mode 100644 index 2472707..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUIModel.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.jdesktop.beans.AbstractBean; - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class QuantitiesByRangeUIModel extends AbstractBean { - - public static final String PROPERTY_ROOT_FOLDER = "rootFolder"; - public static final String PROPERTY_RANGE_ROWS = "rangeRows"; - - protected MailFolder rootFolder; - - protected List<RangeRowModel> rangeRows = new ArrayList<RangeRowModel>(); - - public MailFolder getRootFolder() { - return rootFolder; - } - - public void setRootFolder(MailFolder rootFolder) { - Object oldValue = getRootFolder(); - this.rootFolder = rootFolder; - firePropertyChange(PROPERTY_ROOT_FOLDER, oldValue, rootFolder); - } - - public List<RangeRowModel> getRangeRows() { - return rangeRows; - } - - public void setRangeRows(Collection<RangeRowModel> rangeRows) { - this.rangeRows = new ArrayList<RangeRowModel>(rangeRows); - firePropertyChange(PROPERTY_RANGE_ROWS, null, this.rangeRows); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/RangeRowModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/RangeRowModel.java deleted file mode 100644 index d8bfc0d..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/RangeRowModel.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import com.franciaflex.faxtomail.persistence.entities.RangeRowImpl; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class RangeRowModel extends AbstractFaxToMailBeanUIModel<RangeRow, RangeRowModel> { - - protected final RangeRow editObject = new RangeRowImpl(); - - protected static Binder<RangeRowModel, RangeRow> toBeanBinder = - BinderFactory.newBinder(RangeRowModel.class, - RangeRow.class); - - protected static Binder<RangeRow, RangeRowModel> fromBeanBinder = - BinderFactory.newBinder(RangeRow.class, RangeRowModel.class); - - - public RangeRowModel() { - super(fromBeanBinder, toBeanBinder); - } - - public void setCommandNumber(String commandNumber) { - Object oldValue = getCommandNumber(); - editObject.setCommandNumber(commandNumber); - firePropertyChange(RangeRow.PROPERTY_COMMAND_NUMBER, oldValue, commandNumber); - } - - public String getCommandNumber() { - return editObject.getCommandNumber(); - } - - public void setQuotationQuantity(Integer quotationQuantity) { - if (quotationQuantity == null) { - quotationQuantity = 0; - } - Object oldValue = getQuotationQuantity(); - editObject.setQuotationQuantity(quotationQuantity); - firePropertyChange(RangeRow.PROPERTY_QUOTATION_QUANTITY, oldValue, quotationQuantity); - } - - public Integer getQuotationQuantity() { - return editObject.getQuotationQuantity(); - } - - public void setProductQuantity(Integer productQuantity) { - if (productQuantity == null) { - productQuantity = 0; - } - Object oldValue = getProductQuantity(); - editObject.setProductQuantity(productQuantity); - firePropertyChange(RangeRow.PROPERTY_PRODUCT_QUANTITY, oldValue, productQuantity); - } - - public Integer getProductQuantity() { - return editObject.getProductQuantity(); - } - - public void setSavQuantity(Integer savQuantity) { - if (savQuantity == null) { - savQuantity = 0; - } - Object oldValue = getSavQuantity(); - editObject.setSavQuantity(savQuantity); - firePropertyChange(RangeRow.PROPERTY_SAV_QUANTITY, oldValue, savQuantity); - } - - public Integer getSavQuantity() { - return editObject.getSavQuantity(); - } - - public void setRange(Range range) { - Object oldValue = getRange(); - editObject.setRange(range); - firePropertyChange(RangeRow.PROPERTY_RANGE, oldValue, range); - setValid(range != null); - } - - public Range getRange() { - return editObject.getRange(); - } - - public String getTopiaId() { - return editObject.getTopiaId(); - } - - public void setTopiaId(String id) { - editObject.setTopiaId(id); - } - - @Override - protected RangeRow newEntity() { - return new RangeRowImpl(); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/RangeTableModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/RangeTableModel.java deleted file mode 100644 index f2d11a9..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/RangeTableModel.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import org.jdesktop.swingx.table.TableColumnModelExt; -import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; -import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; -import static org.nuiton.i18n.I18n.n; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class RangeTableModel extends AbstractApplicationTableModel<RangeRowModel> { - - public static final ColumnIdentifier<RangeRow> RANGE_COLUMN = ColumnIdentifier.newId( - RangeRow.PROPERTY_RANGE, - n("faxtomail.rangeRows.table.header.range"), - n("faxtomail.rangeRows.table.header.range.tip")); - - public static final ColumnIdentifier<RangeRow> COMMAND_NUMBER_COLUMN = ColumnIdentifier.newId( - RangeRow.PROPERTY_COMMAND_NUMBER, - n("faxtomail.rangeRows.table.header.commandNumber"), - n("faxtomail.rangeRows.table.header.commandNumber.tip")); - - public static final ColumnIdentifier<RangeRow> QUOTATION_QUANTITY_COLUMN = ColumnIdentifier.newId( - RangeRow.PROPERTY_QUOTATION_QUANTITY, - n("faxtomail.rangeRows.table.header.quotationColumn"), - n("faxtomail.rangeRows.table.header.quotationColumn.tip")); - - public static final ColumnIdentifier<RangeRow> PRODUCT_QUANTITY_COLUMN = ColumnIdentifier.newId( - RangeRow.PROPERTY_PRODUCT_QUANTITY, - n("faxtomail.rangeRows.table.header.productColumn"), - n("faxtomail.rangeRows.table.header.productColumn.tip")); - - public static final ColumnIdentifier<RangeRow> SAV_QUANTITY_COLUMN = ColumnIdentifier.newId( - RangeRow.PROPERTY_SAV_QUANTITY, - n("faxtomail.rangeRows.table.header.savQuantity"), - n("faxtomail.rangeRows.table.header.savQuantity.tip")); - - public RangeTableModel(TableColumnModelExt columnModel) { - super(columnModel, true, true); - setNoneEditableCols(); - } - - @Override - public RangeRowModel createNewRow() { - RangeRowModel row = new RangeRowModel(); - row.setProductQuantity(0); - row.setSavQuantity(0); - row.setQuotationQuantity(0); - row.setValid(false); - return row; - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/ButtonEmailGroup.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/ButtonEmailGroup.java deleted file mode 100644 index 8c2e6cd..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/ButtonEmailGroup.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.Collection; - -import static org.nuiton.i18n.I18n.t; - -/** - * Button to edit attachments. - * - * @author kmorin - morin@codelutin.com - */ -public class ButtonEmailGroup extends AbstractToolbarPopupButton<DemandGroupUI> { - - public ButtonEmailGroup() { - setToolTipText(t("faxtomail.demandGroup.action.tip")); - int demandNb = popup.getModel().sizeGroupedDemandes(); - setText(t("faxtomail.demandGroup.text", demandNb)); - - popup.getModel().addPropertyChangeListener(DemandeUIModel.PROPERTY_GROUPED_DEMANDES, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - Collection<DemandeUIModel> demands = (Collection<DemandeUIModel>) evt.getNewValue(); - if (demands != null) { - int size = demands.size(); - setText(t("faxtomail.demandGroup.text", size)); - } - } - }); - } - - @Override - protected String getActionIcon() { - return "group"; - } - - @Override - protected DemandGroupUI createNewPopup() { - return new DemandGroupUI(FaxToMailUIContext.getApplicationContext()); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupCellRenderer.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupCellRenderer.java deleted file mode 100644 index 898db84..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupCellRenderer.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import jaxx.runtime.SwingUtil; -import org.apache.commons.collections4.CollectionUtils; -import org.nuiton.decorator.Decorator; - -import javax.swing.*; -import javax.swing.table.DefaultTableCellRenderer; -import java.util.List; - -import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; - -/** - * Renderer of a attachement editor in a table cell. - * - * @author kmorin - morin@codelutin.com - */ -public class DemandGroupCellRenderer extends DefaultTableCellRenderer { - - public static final String TEXT_PATTERN = "<html><body>%s</body></html>"; - - private static final long serialVersionUID = 1L; - - private final String noneText; - - public static DemandGroupCellRenderer newRender() { - return new DemandGroupCellRenderer(); - } - - protected DemandGroupCellRenderer() { - setHorizontalAlignment(CENTER); - setIcon(SwingUtil.createActionIcon("group")); - this.noneText = n("faxtomail.demandGroup.empty"); - } - - @Override - protected void setValue(Object value) { - // do nothing - } - - @Override - public JComponent getTableCellRendererComponent(JTable table, - Object value, - boolean isSelected, - boolean hasFocus, - int row, - int column) { - - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - - List<DemandeUIModel> demands = (List<DemandeUIModel>) value; - - String toolTipTextValue; - - if (CollectionUtils.isEmpty(demands)) { - - // use HTML to show the tooltip in italic - toolTipTextValue = "<i>" + t(noneText) + "</i>"; - - - } else { - - StringBuilder sb = new StringBuilder(); - for (DemandeUIModel demand : demands) { - sb.append("<br/>").append(demand.getTitle()); - } - // use html to display the tooltip on several lines - toolTipTextValue = sb.substring(5); - } - String textValue = t("faxtomail.demandGroupCellRenderer.text", demands != null ? demands.size() : 0); - boolean editable = table.isCellEditable(row, column); - toolTipTextValue = String.format(TEXT_PATTERN, toolTipTextValue); -// setEnabled(editable); - setText(textValue); - setToolTipText(toolTipTextValue); - - return this; - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.css deleted file mode 100644 index 6dcbe71..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.css +++ /dev/null @@ -1,40 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#demandPanel { - border: { BorderFactory.createEmptyBorder(2, 3, 2, 3) }; -} - -#demandeSubjectLabel { - text: { getDemande().getTitle() }; -} - -#toolbar { - borderPainted: false; - floatable: false; -} - -#openDemandeButton { - actionIcon: "open"; - toolTipText: "faxtomail.attachmentEditor.action.open.tip"; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.jaxx deleted file mode 100644 index 686daf5..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupItem.jaxx +++ /dev/null @@ -1,50 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='demandPanel' layout='{new BorderLayout()}'> - - <import> - com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel - static org.nuiton.i18n.I18n.t - static jaxx.runtime.JAXXUtil.getStringValue - </import> - - <DemandeUIModel id='demande' javaBean='null'/> - - <DemandGroupUIHandler id='handler' - initializer='getContextValue(DemandGroupUIHandler.class)'/> - - <script><![CDATA[ -public DemandGroupItem(DemandGroupUIHandler handler) { - setContextValue(handler); -} - ]]></script> - - <JLabel id='demandeSubjectLabel' constraints='BorderLayout.CENTER'/> - - <JToolBar id='toolbar' constraints='BorderLayout.EAST'> - <JButton id='openDemandeButton' - onActionPerformed='handler.openDemande(demande)'/> - </JToolBar> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.css deleted file mode 100644 index 2b23275..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.css +++ /dev/null @@ -1,34 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#groupedDemandDialog { - minimumSize: { new java.awt.Dimension(500, 0) }; -} - -#body { - title: "faxtomail.demandGroup.title"; -} - -#demandGroup { - editable: true; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.jaxx deleted file mode 100644 index f2d9496..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUI.jaxx +++ /dev/null @@ -1,46 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI - superGenericType="com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel, DemandGroupUIHandler" - id='groupedDemandDialog'> - - <import> - com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel - - org.jdesktop.swingx.JXTable - org.jdesktop.swingx.JXTitledPanel - </import> - - <DemandeUIModel id='model' - initializer='getContextValue(DemandeUIModel.class)'/> - - <JXTitledPanel id='body'> - <JScrollPane id='demandGroupBodyScrollPane'> - <JPanel id='mainPanel' layout="{new BorderLayout()}"> - <JXTable id='demandGroup' constraints="BorderLayout.CENTER"/> - </JPanel> - </JScrollPane> - </JXTitledPanel> - -</com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java deleted file mode 100644 index b68656a..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/demandgroup/DemandGroupUIHandler.java +++ /dev/null @@ -1,181 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.actions.OpenGroupedDemandAction; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler; -import com.google.common.collect.Iterables; - -import jaxx.runtime.validator.swing.SwingValidator; - -import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.decorator.HighlighterFactory; - -import javax.swing.*; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import javax.swing.table.TableModel; - -import java.awt.*; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class DemandGroupUIHandler extends AbstractToolbarPopupHandler<DemandeUIModel, DemandGroupUI> { - - @Override - public void beforeInit(DemandGroupUI ui) { - super.beforeInit(ui); - - DemandeUIModel currentEmail = getContext().getCurrentEmail(); - this.ui.setContextValue(currentEmail); - } - - @Override - public void afterInit(DemandGroupUI ui) { - super.afterInit(ui); - - initTable(ui.getDemandGroup()); - - getModel().addPropertyChangeListener(DemandeUIModel.PROPERTY_GROUPED_DEMANDES, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - AbstractTableModel tableModel = (AbstractTableModel) getUI().getDemandGroup().getModel(); - tableModel.fireTableDataChanged(); - } - }); - } - - protected void initTable(JXTable table) { - - TableModel demandGroupTableModel = new AbstractTableModel() { - @Override - public int getRowCount() { - return getModel().sizeGroupedDemandes(); - } - - @Override - public int getColumnCount() { - return 1; - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - return Iterables.get(getModel().getGroupedDemandes(), rowIndex); - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return true; - } - }; - - demandGroupTableModel.addTableModelListener(new TableModelListener() { - @Override - public void tableChanged(TableModelEvent e) { - getUI().pack(); - } - }); - - TableColumnModel columnModel = new DefaultTableColumnModel(); - TableColumn column = new TableColumn(); - column.setCellRenderer(new DemandGroupItemRenderer()); - column.setCellEditor(new DemandGroupItemEditor()); - columnModel.addColumn(column); - - table.setModel(demandGroupTableModel); - table.setColumnModel(columnModel); - table.addHighlighter(HighlighterFactory.createAlternateStriping()); - } - - @Override - public void onCloseUI() { - } - - @Override - public SwingValidator<DemandeUIModel> getValidator() { - return null; - } - - @Override - protected JComponent getComponentToFocus() { - return null; - } - - public void openDemande(DemandeUIModel demande) { - closeEditor(); - - OpenGroupedDemandAction openAction = new OpenGroupedDemandAction(this, demande); - getContext().getActionEngine().runAction(openAction); - } - - protected class DemandGroupItemRenderer extends DemandGroupItem - implements TableCellRenderer { - - public DemandGroupItemRenderer() { - super(DemandGroupUIHandler.this); - } - - @Override - public Component getTableCellRendererComponent(JTable table, Object value, - boolean isSelected, boolean hasFocus, int row, int column) { - DemandeUIModel demand = (DemandeUIModel) value; - setDemande(demand); - return this; - } - } - - protected class DemandGroupItemEditor extends AbstractCellEditor implements TableCellEditor { - - protected DemandGroupItem demandGroupItem; - - public DemandGroupItemEditor() { - demandGroupItem = new DemandGroupItem(DemandGroupUIHandler.this); - } - - public Component getTableCellEditorComponent(JTable table, Object value, - boolean isSelected, int row, int column) { - DemandeUIModel demand = (DemandeUIModel) value; - demandGroupItem.setDemande(demand); - - return demandGroupItem; - } - - @Override - public Object getCellEditorValue() { - return demandGroupItem.getDemande(); - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/ButtonHistory.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/ButtonHistory.java deleted file mode 100644 index 9415fe7..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/ButtonHistory.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande.history; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.History; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton; -import org.apache.commons.collections4.CollectionUtils; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.Collection; - -import static org.nuiton.i18n.I18n.t; - -/** - * Button to edit attachments. - * - * @author kmorin - morin@codelutin.com - */ -public class ButtonHistory extends AbstractToolbarPopupButton<HistoryListUI> { - - private PropertyChangeListener listener = new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - Collection<History> histories = (Collection<History>) evt.getNewValue(); - setText(getButtonText(histories)); - } - }; - - public ButtonHistory(DemandeUIModel model) { - setToolTipText(t("faxtomail.historyList.action.tip")); - init(model); - } - - public String getButtonText(Collection<History> histories) { - int replyNb = CollectionUtils.size(histories); - return t("faxtomail.historyList.text", replyNb); - } - - public void init(DemandeUIModel model) { - if (popup.getModel() != null) { - popup.getModel().removePropertyChangeListener(Email.PROPERTY_HISTORY, listener); - } - popup.setModel(model); - if (model != null) { - popup.getModel().addPropertyChangeListener(Email.PROPERTY_HISTORY, listener); - setText(getButtonText(model.getHistory())); - } - } - - @Override - protected String getActionIcon() { - return "view-history"; - } - - @Override - protected HistoryListUI createNewPopup() { - return new HistoryListUI(FaxToMailUIContext.getApplicationContext()); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItem.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItem.css deleted file mode 100644 index d347d9d..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItem.css +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#historyItemPanel { - border: { BorderFactory.createEmptyBorder(2, 3, 2, 3) }; -} - -#data { - opaque: false; -} - -#dateLabel { - text : "faxtomail.common.on.label"; - font-style: "italic"; -} - -#date { - text : { handler.decorate(model.getModificationDate()) }; - font-weight: "bold"; -} - -#typeLabel { - text : ":"; - font-style: "italic"; -} - -#type { - text : { JAXXUtil.getStringValue(model.getType().getLabel()) }; - font-weight: "bold"; -} - -#userLabel { - text : "faxtomail.common.by.label"; - font-style: "italic"; -} - -#user { - text : { handler.decorateUser(model.getFaxToMailUser(), true) }; -} - -#fields { - text : { handler.decorateFields(model.getFields()) }; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItem.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItem.jaxx deleted file mode 100644 index 9c3dd50..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItem.jaxx +++ /dev/null @@ -1,60 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='historyItemPanel' layout="{new GridLayout(0,1)}"> - - <import> - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - - com.franciaflex.faxtomail.persistence.entities.History - - java.awt.FlowLayout - - static org.nuiton.i18n.I18n.t - static jaxx.runtime.JAXXUtil.getStringValue - </import> - - <HistoryItemModel id='model' initializer="new HistoryItemModel()" /> - - <HistoryListUIHandler id="handler" initializer="getContextValue(HistoryListUIHandler.class)" /> - - <script><![CDATA[ -public HistoryItem(HistoryListUIHandler handler) { - setContextValue(handler); -} - ]]></script> - - <JPanel id="data" - layout="{new FlowLayout(FlowLayout.LEADING)}"> - - <JLabel id='dateLabel'/> - <JLabel id='date'/> - <JLabel id='typeLabel'/> - <JLabel id='type'/> - <JLabel id='userLabel'/> - <JLabel id='user'/> - </JPanel> - - <JLabel id='fields'/> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItemModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItemModel.java deleted file mode 100644 index 631801a..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryItemModel.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande.history; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.History; -import com.franciaflex.faxtomail.persistence.entities.HistoryImpl; -import com.franciaflex.faxtomail.persistence.entities.HistoryType; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; -import com.google.common.collect.Sets; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; - -import java.util.Date; -import java.util.Set; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class HistoryItemModel extends AbstractFaxToMailBeanUIModel<History, HistoryItemModel> { - - public static final String PROPERTY_FIELDS = "fields"; - - protected static Binder<HistoryItemModel, History> toBeanBinder = - BinderFactory.newBinder(HistoryItemModel.class, - History.class); - - protected static Binder<History, HistoryItemModel> fromBeanBinder = - BinderFactory.newBinder(History.class, HistoryItemModel.class); - - protected final History editObject = new HistoryImpl(); - - public HistoryItemModel() { - super(fromBeanBinder, toBeanBinder); - } - - public HistoryType getType() { - return editObject.getType(); - } - - public void setType(HistoryType type) { - Object oldValue = editObject.getType(); - editObject.setType(type); - firePropertyChanged(History.PROPERTY_TYPE, oldValue, type); - } - - public void setFields(Set<String> fields) { - editObject.setFields(fields != null ? Sets.newLinkedHashSet(fields) : null); - firePropertyChanged(PROPERTY_FIELDS, null, fields); - } - - public Set<String> getFields() { - return editObject.getFields(); - } - - public Date getModificationDate() { - return editObject.getModificationDate(); - } - - public void setModificationDate(Date modificationDate) { - Object oldValue = editObject.getModificationDate(); - editObject.setModificationDate(modificationDate); - firePropertyChanged(History.PROPERTY_MODIFICATION_DATE, oldValue, modificationDate); - } - - public FaxToMailUser getFaxToMailUser() { - return editObject.getFaxToMailUser(); - } - - public void setFaxToMailUser(FaxToMailUser faxToMailUser) { - Object oldValue = editObject.getFaxToMailUser(); - editObject.setFaxToMailUser(faxToMailUser); - firePropertyChanged(History.PROPERTY_FAX_TO_MAIL_USER, oldValue, faxToMailUser); - } - - @Override - protected History newEntity() { - return new HistoryImpl(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUI.css deleted file mode 100644 index 27399b7..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUI.css +++ /dev/null @@ -1,30 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#body { - title: "faxtomail.historyList.title"; -} - -#histories { - enabled: false; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUI.jaxx deleted file mode 100644 index e1f68f0..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUI.jaxx +++ /dev/null @@ -1,44 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI - superGenericType="com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel, HistoryListUIHandler" - id='historyListDialog'> - - <import> - com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel - - org.jdesktop.swingx.JXList - org.jdesktop.swingx.JXTitledPanel - </import> - - <DemandeUIModel id='model' - javaBean="null"/> - - <JXTitledPanel id='body'> - <JScrollPane id='attachmentBodyScrollPane'> - <JXList id='histories' /> - </JScrollPane> - </JXTitledPanel> - -</com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java deleted file mode 100644 index 6d3e5f7..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java +++ /dev/null @@ -1,233 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande.history; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.History; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; -import com.google.common.base.Function; -import com.google.common.collect.Ordering; -import jaxx.runtime.JAXXUtil; -import jaxx.runtime.SwingUtil; -import jaxx.runtime.swing.model.JaxxDefaultListModel; -import jaxx.runtime.validator.swing.SwingValidator; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.jdesktop.swingx.JXList; -import org.jdesktop.swingx.decorator.HighlighterFactory; -import org.nuiton.i18n.I18n; - -import javax.swing.*; -import java.awt.*; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; -import java.awt.event.ActionEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.*; -import java.util.List; - -import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class HistoryListUIHandler extends AbstractToolbarPopupHandler<DemandeUIModel, HistoryListUI> { - - static { - n("faxtomail.demande.receptionDate.label"); - n("faxtomail.demande.ediError.label"); - n("faxtomail.demande.projectReference.label"); - n("faxtomail.demande.sender.label"); - n("faxtomail.demande.fax.label"); - n("faxtomail.demande.recipient.label"); - n("faxtomail.demande.subject.label"); - n("faxtomail.demande.clientCode.label"); - n("faxtomail.demande.mailFolder.label"); - n("faxtomail.demande.attachment.label"); - n("faxtomail.demande.demandStatus.label"); - n("faxtomail.demande.demandType.label"); - n("faxtomail.demande.priority.label"); - n("faxtomail.demande.waitingState.label"); - n("faxtomail.demande.takenBy.label"); - n("faxtomail.demande.rangeRow.label"); - } - - protected Action sendAction; - - @Override - public void afterInit(HistoryListUI ui) { - super.afterInit(ui); - - final JXList list = ui.getHistories(); - list.setCellRenderer(new HistoryListCellRenderer()); - JaxxDefaultListModel<History> listModel = new JaxxDefaultListModel<History>(); - List<History> histories = new ArrayList<History>(); - listModel.setAllElements(histories); - list.setModel(listModel); - list.addHighlighter(HighlighterFactory.createAlternateStriping()); - - - final PropertyChangeListener listener = new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - Collection<History> newValue = (Collection<History>) evt.getNewValue(); - List<History> histories = new ArrayList<History>(); - if (newValue != null) { - histories.addAll(newValue); - } - //sort histories by modification date - Collections.sort(histories, Ordering.natural().onResultOf(new Function<History, Comparable>() { - @Override - public Comparable apply(History history) { - return history.getModificationDate(); - } - })); - ((JaxxDefaultListModel) getUI().getHistories().getModel()).setAllElements(histories); - } - }; - getUI().addPropertyChangeListener(HistoryListUI.PROPERTY_MODEL, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - DemandeUIModel oldModel = (DemandeUIModel) evt.getOldValue(); - if (oldModel != null) { - oldModel.removePropertyChangeListener(Email.PROPERTY_HISTORY, listener); - } - DemandeUIModel newModel = (DemandeUIModel) evt.getNewValue(); - if (newModel != null) { - newModel.addPropertyChangeListener(Email.PROPERTY_HISTORY, listener); - listener.propertyChange(new PropertyChangeEvent(newModel, Email.PROPERTY_HISTORY, null, newModel.getHistory())); - } - } - }); - - sendAction = new AbstractAction() { - private static final long serialVersionUID = 1L; - - @Override - public void actionPerformed(ActionEvent e) { -// AbstractToolbarPopupHandler.this.ui.dispose(); -// AbstractToolbarPopupHandler.this.ui.setVisible(false); - StringBuilder historyAsString = new StringBuilder(); - for (History history : getModel().getHistory()) { - historyAsString.append(t("faxtomail.common.on.label") + " " + decorate(history.getModificationDate())) - .append(" : " + JAXXUtil.getStringValue(history.getType().getLabel())); - String decoratedFields = decorateFields(history.getFields()); - if (!decoratedFields.isEmpty()) { - historyAsString.append(" (" + decoratedFields + ")"); - } - historyAsString.append(" : ").append(t("faxtomail.common.by.label")); - historyAsString.append(" ").append(decorateUser(history.getFaxToMailUser(), true)); - historyAsString.append("\n"); - } - - StringSelection stringSelection = new StringSelection(historyAsString.toString()); - Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard(); - clpbrd.setContents (stringSelection, null); - - FaxToMailUIUtil.email(t("faxtomail.demande.history.send.subject", getModel().getTitle()), - t("faxtomail.demande.history.send.body")); - - closeEditor(); - } - }; - - ImageIcon actionIcon = SwingUtil.createActionIcon("reply"); - sendAction.putValue(Action.SMALL_ICON, actionIcon); - sendAction.putValue(Action.LARGE_ICON_KEY, actionIcon); - sendAction.putValue(Action.NAME, "send"); - sendAction.putValue(Action.SHORT_DESCRIPTION, t("faxtomail.demande.history.action.send.tip")); - - JButton sendButton = new JButton(sendAction); - sendButton.setText(null); - sendButton.setFocusPainted(false); - sendButton.setRequestFocusEnabled(false); - sendButton.setFocusable(false); - - ui.getBody().getRightDecoration().add(sendButton, 0); - } - - @Override - public void onCloseUI() { - } - - @Override - public SwingValidator<DemandeUIModel> getValidator() { - return null; - } - - @Override - protected JComponent getComponentToFocus() { - return null; - } - - public String decorateFields(Set<String> fields) { - List<String> fieldLabels = new ArrayList<String>(); - if (fields != null) { - for (String field : fields) { - String label; - if (I18n.hasKey("faxtomail.demande." + field + ".label")) { - label = t("faxtomail.demande." + field + ".label"); - } else { - label = field; - } - fieldLabels.add(label); - } - } - return StringUtils.join(fieldLabels, ", "); - } - - protected class HistoryListCellRenderer extends HistoryItem - implements ListCellRenderer<History> { - - public HistoryListCellRenderer() { - super(HistoryListUIHandler.this); - - getModel().addPropertyChangeListener(HistoryItemModel.PROPERTY_FIELDS, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getNewValue() != null) { - add(getFields(), 1); - } else { - remove(getFields()); - } - } - }); - } - - @Override - public Component getListCellRendererComponent(JList<? extends History> list, History history, int index, boolean isSelected, boolean cellHasFocus) { - getModel().fromEntity(history); - if (CollectionUtils.isEmpty(getModel().getFields())) { - remove(getFields()); - } - return this; - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/ButtonDemandReplies.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/ButtonDemandReplies.java deleted file mode 100644 index f9ea1c5..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/ButtonDemandReplies.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande.replies; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.Reply; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton; -import org.apache.commons.collections4.CollectionUtils; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.Collection; - -import static org.nuiton.i18n.I18n.t; -import static org.nuiton.i18n.I18n.n; - -/** - * Button to edit replies. - * - * @author kmorin - morin@codelutin.com - */ -public class ButtonDemandReplies extends AbstractToolbarPopupButton<DemandRepliesUI> { - - protected String textKey; - - private PropertyChangeListener listener = new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - Collection<Reply> replies = (Collection<Reply>) evt.getNewValue(); - setText(getButtonText(replies)); - } - }; - - public ButtonDemandReplies(DemandeUIModel model) { - this(n("faxtomail.demandReplies.text"), model); - } - - public ButtonDemandReplies(String textKey, DemandeUIModel model) { - this.textKey = textKey; - setToolTipText(t("faxtomail.demandReplies.action.tip")); - init(model); - } - - public String getButtonText(Collection<Reply> replies) { - int replyNb = CollectionUtils.size(replies); - return t(textKey, replyNb); - } - - public void init(DemandeUIModel model) { - if (popup.getModel() != null) { - popup.getModel().removePropertyChangeListener(Email.PROPERTY_REPLIES, listener); - } - popup.setModel(model); - if (model != null) { - popup.getModel().addPropertyChangeListener(Email.PROPERTY_REPLIES, listener); - setText(getButtonText(model.getReplies())); - } - } - - @Override - protected String getActionIcon() { - return "reply"; - } - - @Override - protected DemandRepliesUI createNewPopup() { - DemandRepliesUI ui = new DemandRepliesUI(FaxToMailUIContext.getApplicationContext()); - return ui; - } - - public DemandeUIModel getBean() { - return popup.getModel(); - } - - public void setEditable(boolean editable) { - popup.setEditable(editable); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.css deleted file mode 100644 index f0cab0f..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.css +++ /dev/null @@ -1,42 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#repliesDialog { - minimumSize: { new java.awt.Dimension(500, 0) }; -} - -#body { - title: "faxtomail.demandReplies.title"; -} - -#noReplyLabel { - text: "faxtomail.demandReplies.empty"; - visible: { getModel().getReplies().isEmpty() }; - border: { javax.swing.BorderFactory.createEmptyBorder(3, 3, 3, 3) }; - font-style: italic; -} - -#replies { - editable: true; - visible: { !getModel().getReplies().isEmpty() }; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.jaxx deleted file mode 100644 index 535d726..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUI.jaxx +++ /dev/null @@ -1,49 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI - superGenericType="com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel, DemandRepliesUIHandler" - id='repliesDialog'> - - <import> - com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel - - org.jdesktop.swingx.JXTable - org.jdesktop.swingx.JXTitledPanel - </import> - - <Boolean id='editable' javaBean='null' /> - - <DemandeUIModel id='model' - javaBean='null'/> - - <JXTitledPanel id='body'> - <JScrollPane id='demandRepliesBodyScrollPane'> - <JPanel id='mainPanel' layout="{new BorderLayout()}"> - <JLabel id='noReplyLabel' constraints="BorderLayout.NORTH"/> - <JXTable id='replies' constraints="BorderLayout.CENTER"/> - </JPanel> - </JScrollPane> - </JXTitledPanel> - -</com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupUI> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java deleted file mode 100644 index c6c3c26..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandRepliesUIHandler.java +++ /dev/null @@ -1,373 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande.replies; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.awt.Component; -import java.awt.Dimension; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; - -import javax.activation.DataHandler; -import javax.activation.DataSource; -import javax.mail.BodyPart; -import javax.mail.Message; -import javax.mail.Part; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMessage.RecipientType; -import javax.mail.internet.MimeMultipart; -import javax.swing.AbstractCellEditor; -import javax.swing.JComponent; -import javax.swing.JTable; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableColumnModel; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumn; -import javax.swing.table.TableColumnModel; -import javax.swing.table.TableModel; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyAttachmentModel; - -import jaxx.runtime.JAXXUtil; -import jaxx.runtime.validator.swing.SwingValidator; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.decorator.HighlighterFactory; - -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFileImpl; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.Reply; -import com.franciaflex.faxtomail.persistence.entities.ReplyContent; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI; -import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; -import com.google.common.collect.Iterables; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class DemandRepliesUIHandler extends AbstractToolbarPopupHandler<DemandeUIModel, DemandRepliesUI> { - - private final static Log log = LogFactory.getLog(DemandRepliesUIHandler.class); - - @Override - public void afterInit(DemandRepliesUI ui) { - super.afterInit(ui); - - initTable(ui.getReplies()); - - final PropertyChangeListener listener = new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - updateTable(); - JAXXUtil.processDataBinding(getUI(), - DemandRepliesUI.BINDING_NO_REPLY_LABEL_VISIBLE, - DemandRepliesUI.BINDING_REPLIES_VISIBLE); - } - }; - getUI().addPropertyChangeListener(DemandRepliesUI.PROPERTY_MODEL, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - DemandeUIModel oldModel = (DemandeUIModel) evt.getOldValue(); - if (oldModel != null) { - oldModel.removePropertyChangeListener(Email.PROPERTY_REPLIES, listener); - } - DemandeUIModel newModel = (DemandeUIModel) evt.getNewValue(); - if (newModel != null) { - newModel.addPropertyChangeListener(Email.PROPERTY_REPLIES, listener); - } - updateTable(); - } - }); - } - - protected void updateTable() { - AbstractTableModel tableModel = (AbstractTableModel) getUI().getReplies().getModel(); - tableModel.fireTableDataChanged(); - } - - protected void initTable(JXTable table) { - - TableModel demandRepliesTableModel = new AbstractTableModel() { - @Override - public int getRowCount() { - DemandeUIModel model = getModel(); - int count = model == null ? 0 : model.sizeReplies(); - return count; - } - - @Override - public int getColumnCount() { - return 1; - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - DemandeUIModel model = getModel(); - return model == null ? null : Iterables.get(model.getReplies(), rowIndex); - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return true; - } - }; - - demandRepliesTableModel.addTableModelListener(new TableModelListener() { - @Override - public void tableChanged(TableModelEvent e) { - getUI().pack(); - } - }); - - TableColumnModel columnModel = new DefaultTableColumnModel(); - TableColumn column = new TableColumn(); - DemandReplyItemRenderer renderer = new DemandReplyItemRenderer(); - DemandReplyItemEditor editor = new DemandReplyItemEditor(); - column.setCellRenderer(renderer); - column.setCellEditor(editor); - columnModel.addColumn(column); - - table.setModel(demandRepliesTableModel); - table.setColumnModel(columnModel); - table.addHighlighter(HighlighterFactory.createAlternateStriping()); - } - - @Override - public void onCloseUI() { - } - - @Override - public SwingValidator<DemandeUIModel> getValidator() { - return null; - } - - @Override - protected JComponent getComponentToFocus() { - return null; - } - - public void openReply(DemandReplyItem item) { - closeEditor(); - - Reply reply = item.getReply(); - FaxToMailUIUtil.forceReplyContentLoading(getContext(), reply); - boolean editable = item.isEditable(); - - try { - ReplyFormUI dialogContent = new ReplyFormUI(ui); - // TODO echatellier 20140804 : c'est très technique et très bas niveau, ca devrait se trouver dans les services - ReplyContent replyContent = reply.getReplyContent(); - Message message = new MimeMessage(null, new ByteArrayInputStream(replyContent.getSource())); - ReplyFormUIModel replyModel = dialogContent.getModel(); - replyModel.setEditable(editable); - replyModel.setReadonly(true); - replyModel.setOriginalDemand(ui.getModel()); - replyModel.setReadSentDate(reply.getSentDate()); - replyModel.setSubject(message.getSubject()); - replyModel.setTo(message.getRecipients(RecipientType.TO)[0].toString()); - replyModel.setFrom(message.getFrom()[0].toString()); - if (ArrayUtils.isNotEmpty(message.getRecipients(RecipientType.CC))) { - replyModel.setCc(message.getRecipients(RecipientType.CC)[0].toString()); - } - if (ArrayUtils.isNotEmpty(message.getRecipients(RecipientType.BCC))) { - replyModel.setCci(message.getRecipients(RecipientType.BCC)[0].toString()); - } - - if (message.isMimeType("multipart/*")) { - decomposeMultipartEmail(message, replyModel, reply.getTopiaId()); - - } else { - String content = IOUtils.toString(message.getInputStream()); - replyModel.setMessage(content); - } - - openFrame(dialogContent, t("faxtomail.reply.title", getModel().getSubject()), new Dimension(800, 600)); - - } catch (Exception e) { - getContext().getErrorHelper().showErrorDialog(t("faxtomail.demandReplies.error"), e); - } - - } - - public void openForward(DemandReplyItem item) { - closeEditor(); - - Reply reply = item.getReply(); - FaxToMailUIUtil.forceReplyContentLoading(getContext(), reply); - boolean editable = item.isEditable(); - - try { - ReplyFormUI dialogContent = new ReplyFormUI(ui); - // TODO echatellier 20140804 : c'est très technique et très bas niveau, ca devrait se trouver dans les services - ReplyContent replyContent = reply.getReplyContent(); - Message message = new MimeMessage(null, new ByteArrayInputStream(replyContent.getSource())); - ReplyFormUIModel replyModel = dialogContent.getModel(); - replyModel.setEditable(editable); - replyModel.setOriginalDemand(ui.getModel()); - replyModel.setReadSentDate(reply.getSentDate()); - replyModel.setSubject(t("faxtomail.reply.forwardsubject", message.getSubject())); - - if (message.isMimeType("multipart/*")) { - decomposeMultipartEmail(message, replyModel, reply.getTopiaId()); - - } else { - String content = IOUtils.toString(message.getInputStream()); - replyModel.setMessage(content); - } - - // XXX: à verifier pour le format, et si on quote ou pas encore le forward - String quotedReply = t("faxtomail.reply.message", - decorate(reply.getSentDate()), - message.getRecipients(RecipientType.TO)[0].toString(), - replyModel.getMessage().replaceAll("\n", "\n> ")); - replyModel.setMessage(quotedReply); - - openFrame(dialogContent, t("faxtomail.reply.forward", message.getSubject()), new Dimension(800, 600)); - - } catch (Exception e) { - getContext().getErrorHelper().showErrorDialog(t("faxtomail.demandReplies.error"), e); - } - - } - - /** - * Decompose a multipart part. - * - sets the email content if the part contains a text bodypart - * - adds attachments to the email - * - * @param part the part to decompose - * @throws Exception - */ - protected void decomposeMultipartEmail(Part part, ReplyFormUIModel reply, String topiaId) throws Exception { - DataSource dataSource = part.getDataHandler().getDataSource(); - MimeMultipart mimeMultipart = new MimeMultipart(dataSource); - int multiPartCount = mimeMultipart.getCount(); - - for (int j = 0; j < multiPartCount; j++) { - BodyPart bp = mimeMultipart.getBodyPart(j); - - // if it is a text part, the,n this is the email content - String disposition = bp.getDisposition(); - if (bp.isMimeType("text/*") && !Part.ATTACHMENT.equals(disposition)) { - String content = IOUtils.toString(bp.getInputStream()); - reply.setMessage(content); - - // if it is multipart part, decompose it - } else if (bp.isMimeType("multipart/*")) { - decomposeMultipartEmail(bp, reply, topiaId); - - // else, this is an attachment - } else { - String fileName = bp.getFileName(); - if (fileName == null) { - fileName = bp.getHeader("Content-ID")[0]; - // remove the guillemets between the id - fileName = fileName.replaceFirst("^<(.*)>$", "$1"); - } - log.debug("FileName : " + fileName); - - /*File dir = new File(FileUtils.getTempDirectory(), topiaId); - if (!dir.exists()) { - dir.mkdir(); - } - File file = new File(dir, fileName);*/ - - ByteArrayOutputStream fos = new ByteArrayOutputStream(); - - DataHandler dh = bp.getDataHandler(); - dh.writeTo(fos); - - // copy content into an empty attachment - AttachmentFile attachmentFile = new AttachmentFileImpl(); - attachmentFile.setContent(fos.toByteArray()); - attachmentFile.setFilename(fileName); - - Attachment attachment = new AttachmentImpl(); - attachment.setOriginalFile(attachmentFile); - - ReplyAttachmentModel replyAttachmentModel = new ReplyAttachmentModel(attachment, true, fileName); - - reply.addAttachment(replyAttachmentModel); - } - } - } - - protected class DemandReplyItemRenderer extends DemandReplyItem - implements TableCellRenderer { - - public DemandReplyItemRenderer() { - super(DemandRepliesUIHandler.this); - } - - @Override - public Component getTableCellRendererComponent(JTable table, Object value, - boolean isSelected, boolean hasFocus, int row, int column) { - Reply reply = (Reply) value; - setReply(reply); - - setEditable(DemandRepliesUIHandler.this.getUI().isEditable()); - return this; - } - } - - protected class DemandReplyItemEditor extends AbstractCellEditor implements TableCellEditor { - - protected DemandReplyItem demandReplyItem; - - public DemandReplyItemEditor() { - demandReplyItem = new DemandReplyItem(DemandRepliesUIHandler.this); - } - - public Component getTableCellEditorComponent(JTable table, Object value, - boolean isSelected, int row, int column) { - Reply reply = (Reply) value; - demandReplyItem.setReply(reply); - demandReplyItem.setEditable(getUI().isEditable()); - return demandReplyItem; - } - - @Override - public Object getCellEditorValue() { - return demandReplyItem.getReply(); - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css deleted file mode 100644 index f12aa60..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.css +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#replyPanel { - border: { BorderFactory.createEmptyBorder(2, 3, 2, 3) }; -} - -#replyDateLabel { - text: { getHandler().decorate(getReply().getSentDate()) + " - " }; - font-style: italic; -} - -#replySubjectLabel { - text: { getReply().getSubject() }; -} - -#toolbar { - borderPainted: false; - floatable: false; -} - -#openForwardButton { - actionIcon: "transmit"; - toolTipText: "faxtomail.demandReplies.action.forward.tip"; - visible: { isEditable() }; -} - -#openReplyButton { - actionIcon: "open"; - toolTipText: "faxtomail.demandReplies.action.open.tip"; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.jaxx deleted file mode 100644 index 16b901f..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/DemandReplyItem.jaxx +++ /dev/null @@ -1,58 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='replyPanel' layout='{new BorderLayout()}'> - - <import> - com.franciaflex.faxtomail.persistence.entities.Reply - com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel - static org.nuiton.i18n.I18n.t - static jaxx.runtime.JAXXUtil.getStringValue - </import> - - <!-- if true, display the form to forward reply button --> - <Boolean id='editable' javaBean='true' /> - - <Reply id='reply' javaBean='null'/> - - <DemandRepliesUIHandler id='handler' - initializer='getContextValue(DemandRepliesUIHandler.class)'/> - - <script><![CDATA[ -public DemandReplyItem(DemandRepliesUIHandler handler) { - setContextValue(handler); -} - ]]></script> - - <JLabel id='replyDateLabel' constraints='BorderLayout.WEST'/> - - <JLabel id='replySubjectLabel' constraints='BorderLayout.CENTER'/> - - <JToolBar id='toolbar' constraints='BorderLayout.EAST'> - <JButton id='openForwardButton' - onActionPerformed='handler.openForward(this)'/> - <JButton id='openReplyButton' - onActionPerformed='handler.openReply(this)'/> - </JToolBar> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/RepliesCellEditor.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/RepliesCellEditor.java deleted file mode 100644 index 961c76c..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/RepliesCellEditor.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande.replies; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; -import com.google.common.base.Preconditions; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; - -import javax.swing.*; -import javax.swing.border.LineBorder; -import javax.swing.event.CellEditorListener; -import javax.swing.event.ChangeEvent; -import javax.swing.table.TableCellEditor; -import java.awt.*; -import java.util.EventObject; - -/** - * To edit replies from a table cell. - * - * @author kmorin - morin@codelutin.com - */ -public class RepliesCellEditor extends AbstractCellEditor implements TableCellEditor { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = LogFactory.getLog(RepliesCellEditor.class); - - public static TableCellEditor newEditor(FaxToMailUI ui) { - return new RepliesCellEditor(FaxToMailUIContext.getApplicationContext()); - } - - protected final ButtonDemandReplies editorButton; - - protected FaxToMailUIContext context; - - public RepliesCellEditor(FaxToMailUIContext context) { - this.context = context; - - this.editorButton = new ButtonDemandReplies("faxtomail.demandRepliesCellRenderer.text", null); - this.editorButton.setBorder(new LineBorder(Color.BLACK)); - this.editorButton.setEditable(false); - addCellEditorListener(new CellEditorListener() { - @Override - public void editingStopped(ChangeEvent e) { - editorButton.setSelected(false); - } - - @Override - public void editingCanceled(ChangeEvent e) { - editorButton.setSelected(false); - } - }); - } - - @Override - public Component getTableCellEditorComponent(JTable table, - Object value, - boolean isSelected, - int row, - int column) { - AbstractApplicationTableModel<AbstractFaxToMailBeanUIModel> tableModel = - (AbstractApplicationTableModel<AbstractFaxToMailBeanUIModel>) table.getModel(); - - int modelRow = table.convertRowIndexToModel(row); - final DemandeUIModel model = (DemandeUIModel) tableModel.getEntry(modelRow); - editorButton.init(model); - - return editorButton; - } - - @Override - public boolean shouldSelectCell(EventObject anEvent) { - return true; - } - - @Override - public Object getCellEditorValue() { - - DemandeUIModel model = editorButton.getBean(); - Preconditions.checkNotNull(model, "No model found in editor."); - - Object result = model.getReplies(); - if (log.isDebugEnabled()) { - log.debug("editor value: " + result); - } - - return result; - } - - @Override - public boolean stopCellEditing() { - boolean b = super.stopCellEditing(); - if (b) { - editorButton.init(null); - } - return b; - } - - @Override - public void cancelCellEditing() { - editorButton.init(null); - super.cancelCellEditing(); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/RepliesCellRenderer.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/RepliesCellRenderer.java deleted file mode 100644 index ea0f666..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/replies/RepliesCellRenderer.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.demande.replies; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Reply; -import jaxx.runtime.SwingUtil; -import org.apache.commons.collections4.CollectionUtils; -import org.nuiton.decorator.Decorator; - -import javax.swing.*; -import javax.swing.table.DefaultTableCellRenderer; -import java.util.List; - -import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; - -/** - * Renderer of a attachement editor in a table cell. - * - * @author kmorin - morin@codelutin.com - */ -public class RepliesCellRenderer extends DefaultTableCellRenderer { - - public static final String TEXT_PATTERN = "<html><body>%s</body></html>"; - - private static final long serialVersionUID = 1L; - - private final String noneText; - - private final Decorator<Reply> decorator; - - public static RepliesCellRenderer newRender(Decorator<Reply> decorator) { - return new RepliesCellRenderer(decorator); - } - - protected RepliesCellRenderer(Decorator<Reply> decorator) { - setHorizontalAlignment(CENTER); - setIcon(SwingUtil.createActionIcon("reply")); - this.noneText = n("faxtomail.demandReplies.empty"); - this.decorator = decorator; - } - - @Override - protected void setValue(Object value) { - // do nothing - } - - @Override - public JComponent getTableCellRendererComponent(JTable table, - Object value, - boolean isSelected, - boolean hasFocus, - int row, - int column) { - - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - - List<Reply> replies = (List<Reply>) value; - - String toolTipTextValue; - - if (CollectionUtils.isEmpty(replies)) { - - // use HTML to show the tooltip in italic - toolTipTextValue = "<i>" + t(noneText) + "</i>"; - - - } else { - - StringBuilder sb = new StringBuilder(); - for (Reply reply : replies) { - sb.append("<br/>").append(decorator.toString(reply)); - } - // use html to display the tooltip on several lines - toolTipTextValue = sb.substring(5); - } - String textValue = t("faxtomail.demandRepliesCellRenderer.text", replies != null ? replies.size() : 0); - boolean editable = table.isCellEditable(row, column); - toolTipTextValue = String.format(TEXT_PATTERN, toolTipTextValue); - setEnabled(editable); - setText(textValue); - setToolTipText(toolTipTextValue); - - return this; - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css deleted file mode 100644 index a3ebcfe..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.css +++ /dev/null @@ -1,39 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#crossPanel { - //scaleImageToFitPanel: { true }; - border: { BorderFactory.createDashedBorder(null) }; - opaque: false; - background: { null }; - size: { new Dimension(500, 200) }; -} - -#removeButton { - text: " X "; - border : { BorderFactory.createLineBorder(Color.BLACK, 1, false) }; - opaque: false; - background: { null }; - contentAreaFilled: false; - focusPainted: false; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx deleted file mode 100644 index 63bb6b3..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorCrossUI.jaxx +++ /dev/null @@ -1,63 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='crossPanel' layout='{new FlowLayout(FlowLayout.TRAILING)}'> - - <import> - java.awt.BasicStroke - java.awt.Color - java.awt.Dimension - java.awt.FlowLayout - java.awt.Font - java.awt.Graphics - java.awt.Graphics2D - javax.swing.BorderFactory - javax.swing.JPanel - </import> - - <script><![CDATA[ - - protected void removeCross() { - JPanel container = getParentContainer(JPanel.class); - container.remove(this); - container.updateUI(); - } - - @Override - protected void paintComponent(Graphics g) { - super.paintComponent(g); - - Graphics2D g2 = (Graphics2D) g.create(); - g2.setStroke(new BasicStroke(3)); - g2.setColor(Color.BLUE); - g2.drawLine(0, 0, getWidth(), getHeight()); - g2.drawLine(getWidth(), 0, 0, getHeight()); - g2.dispose(); - } - - ]]></script> - - <JButton id="removeButton" - onActionPerformed="removeCross()"/> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.css deleted file mode 100644 index ccfd732..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.css +++ /dev/null @@ -1,38 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#highlighterPanel { - //scaleImageToFitPanel: { true }; - border: { BorderFactory.createDashedBorder(null) }; - background: { new Color(255, 255, 0, 80) }; - size: { new Dimension(500, 200) }; -} - -#removeButton { - text: " X "; - border : { BorderFactory.createLineBorder(Color.BLACK, 1, false) }; - opaque: false; - background: { null }; - contentAreaFilled: false; - focusPainted: false; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.jaxx deleted file mode 100644 index 165c621..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorHighlighterUI.jaxx +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='highlighterPanel' layout='{new FlowLayout(FlowLayout.TRAILING)}'> - - <import> - java.awt.BasicStroke - java.awt.Color - java.awt.Dimension - java.awt.FlowLayout - java.awt.Font - java.awt.Graphics - java.awt.Graphics2D - javax.swing.BorderFactory - javax.swing.JPanel - </import> - - <script><![CDATA[ - - protected void removeCross() { - JPanel container = getParentContainer(JPanel.class); - container.remove(this); - container.updateUI(); - } - - ]]></script> - - <JButton id="removeButton" - onActionPerformed="removeCross()"/> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.css deleted file mode 100644 index a7078e7..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.css +++ /dev/null @@ -1,38 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#linePanel { - border: { BorderFactory.createDashedBorder(null) }; - opaque: false; - background: { null }; - size: { new Dimension(500, 100) }; -} - -#removeButton { - text: " X "; - border : { BorderFactory.createLineBorder(Color.BLACK, 1, false) }; - opaque: false; - background: { null }; - contentAreaFilled: false; - focusPainted: false; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.jaxx deleted file mode 100644 index 1e61828..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorLineUI.jaxx +++ /dev/null @@ -1,69 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='linePanel' layout='{new FlowLayout(FlowLayout.TRAILING)}'> - - <import> - java.awt.BasicStroke - java.awt.Color - java.awt.Dimension - java.awt.FlowLayout - java.awt.Font - java.awt.Graphics - java.awt.Graphics2D - javax.swing.BorderFactory - javax.swing.JPanel - </import> - - <script><![CDATA[ - - protected void removeLine() { - JPanel container = getParentContainer(JPanel.class); - container.remove(this); - container.updateUI(); - } - - @Override - protected void paintComponent(Graphics g) { - super.paintComponent(g); - - Graphics2D g2 = (Graphics2D) g.create(); - g2.setStroke(new BasicStroke(3)); - g2.setColor(Color.BLUE); - if (Boolean.TRUE.equals(horizontal)) { - g2.drawLine(0, getHeight() / 2, getWidth(), getHeight() / 2); - - } else { - g2.drawLine(getWidth() / 2, 0, getWidth() / 2, getHeight()); - } - g2.dispose(); - } - - ]]></script> - - <Boolean id="horizontal" javaBean="true"/> - - <JButton id="removeButton" - onActionPerformed="removeLine()"/> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.css deleted file mode 100644 index 4bed638..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.css +++ /dev/null @@ -1,56 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#notePanel { - background: { Color.YELLOW }; - border : { BorderFactory.createEmptyBorder(2, 2, 2, 2) }; -} - -#noteHeader { - background: { null }; -} - -#noteTitle { - font: { Font.decode(BaseFont.HELVETICA).deriveFont(Font.ITALIC) }; - font-size: { (float)(DEFAULT_FONT_SIZE * getZoom()) }; - text: { getTitle() }; -} - -#removeButton { - text: " X "; - border : { BorderFactory.createLineBorder(Color.BLACK, 1, false) }; - opaque: false; - background: { null }; - contentAreaFilled: false; - focusPainted: false; -} - -#noteText { - border: { null }; - opaque : { false }; - background: { null }; - font: { Font.decode(BaseFont.HELVETICA) }; - font-size: { (float)(DEFAULT_FONT_SIZE * getZoom()) }; - lineWrap: { false }; - wrapStyleWord: { false }; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx deleted file mode 100644 index 3c5980c..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorNoteUI.jaxx +++ /dev/null @@ -1,84 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='notePanel' layout='{new BorderLayout()}' onComponentResized="pack()"> - - <import> - java.awt.Color - java.awt.Dimension - java.awt.Font - java.awt.Insets - java.awt.Point - javax.swing.BorderFactory - javax.swing.JPanel - com.itextpdf.text.pdf.BaseFont - com.franciaflex.faxtomail.ui.swing.util.JImagePanel - </import> - - <script><![CDATA[ - - public static final int DEFAULT_FONT_SIZE = 12; - - protected void textTyped() { - setText(getNoteText().getText()); - pack(); - } - - protected void pack() { - JPanel container = getParentContainer(JPanel.class); - Point location = getLocation(); - Insets containerInsets = container.getInsets(); - Dimension size = getPreferredSize(); - setBounds(location.x + containerInsets.left, - location.y + containerInsets.top, - size.width + 10, // no real logical reason for 10, but otherwise, the text is sometimes cut in the end - size.height); - } - - protected void removeNote() { - JPanel container = getParentContainer(JPanel.class); - container.remove(this); - container.updateUI(); - } - - ]]></script> - - <String id="title" javaBean="null"/> - <String id="text" javaBean=""/> - <Float id="zoom" javaBean="1.0f"/> - - <JPanel id="noteHeader" - layout='{ new BorderLayout() }' - constraints="BorderLayout.NORTH"> - <JLabel id="noteTitle" - constraints="BorderLayout.CENTER"/> - <JButton id="removeButton" - constraints="BorderLayout.EAST" - onActionPerformed="removeNote()"/> - </JPanel> - - <JTextArea id="noteText" - constraints="BorderLayout.CENTER" - onKeyReleased="textTyped()"/> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css deleted file mode 100644 index 86a6441..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.css +++ /dev/null @@ -1,128 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -JSeparator { - border: { BorderFactory.createEmptyBorder(0, 5, 0, 5) }; -} - -#toolbar { - floatable: false; - margin: {new java.awt.Insets(5, 0, 0, 5)}; - borderPainted: false; -} - -#noteButton { - actionIcon: note; - toolTipText: "faxtomail.pdfEditor.button.addNote.tip"; - selected: true; -} - -#crossButton { - actionIcon: cross; - toolTipText: "faxtomail.pdfEditor.button.addCross.tip"; -} - -#hLineButton { - actionIcon: hline; - toolTipText: "faxtomail.pdfEditor.button.addHLine.tip"; -} - -#vLineButton { - actionIcon: vline; - toolTipText: "faxtomail.pdfEditor.button.addVLine.tip"; -} - -#highlighterButton { - actionIcon: highlighter; - toolTipText: "faxtomail.pdfEditor.button.addHighlighter.tip"; -} - -#prevPageButton { - actionIcon: left; - enabled: { getModel().getCurrentPageIndex() > 0 }; - toolTipText: "faxtomail.pdfEditor.button.previousPage"; -} - -#pageNumber { - bean: { model }; - property: "currentPageIndex"; - modelText: { String.valueOf(model.getCurrentPageIndex() + 1) }; - useFloat: false; - useSign: false; - autoPopup: false; - showPopupButton: false; - showReset: false; - width: 50; -} - -#pageTotal { - text: { " / " + String.valueOf(model.getPages().length) }; -} - -#nextPageButton { - actionIcon: right; - enabled: { getModel().getCurrentPageIndex() < getModel().getPages().length - 1 }; - toolTipText: "faxtomail.pdfEditor.button.nextPage"; -} - -#zoomOutButton { - actionIcon: zoom-out; - toolTipText: "faxtomail.pdfEditor.button.zoomOut"; -} - -#zoomLabel { - text: { String.format("%.0f", model.getZoom() * 100) + "%"}; -} - -#zoomInButton { - actionIcon: zoom-in; - toolTipText: "faxtomail.pdfEditor.button.zoomIn"; -} - -#rotateClockwiseButton { - actionIcon: rotate-clockwise; - toolTipText: "faxtomail.pdfEditor.button.rotateClockwise"; -} - -#rotateAntiClockwiseButton { - actionIcon: rotate-anticlockwise; - toolTipText: "faxtomail.pdfEditor.button.rotateAntiClockwise"; -} - -#printButton { - actionIcon: print; - toolTipText: "faxtomail.pdfEditor.button.print"; -} - -#cancelButton { - actionIcon: cancel; - text: "faxtomail.pdfEditor.action.cancel"; - toolTipText: "faxtomail.pdfEditor.action.cancel.tip"; -} - -#validateButton { - actionIcon: validate; - text: "faxtomail.pdfEditor.action.validate"; - toolTipText: "faxtomail.pdfEditor.action.validate.tip"; - _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.GenerateAnnotatedAttachmentAction.class}; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx deleted file mode 100644 index d6c71f0..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUI.jaxx +++ /dev/null @@ -1,104 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id="pdfEditorUIPanel" - layout='{new BorderLayout()}' - implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<PDFEditorUIModel, PDFEditorUIHandler>'> - - <import> - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - - com.franciaflex.faxtomail.ui.swing.util.JImagePanel - - javax.swing.SwingConstants - - jaxx.runtime.swing.editor.NumberEditor - - </import> - - <script><![CDATA[ - - public PDFEditorUI(FaxToMailUI parentUI) { - FaxToMailUIUtil.setParentUI(this, parentUI); - } - - ]]></script> - - <PDFEditorUIModel id='model' initializer='new PDFEditorUIModel()'/> - - <JToolBar id="toolbar" - constraints='BorderLayout.NORTH'> - - <JToggleButton id='noteButton' buttonGroup="actionGroup" value="NOTE"/> - <!--onActionPerformed="handler.addNote()"/>--> - <JToggleButton id='crossButton' buttonGroup="actionGroup" value="CROSS"/> - <!--onActionPerformed="handler.addCross()"/>--> - <JToggleButton id='hLineButton' buttonGroup="actionGroup" value="HLINE"/> - <JToggleButton id='vLineButton' buttonGroup="actionGroup" value="VLINE"/> - <!--onActionPerformed="handler.addLine()"/>--> - <JToggleButton id='highlighterButton' buttonGroup="actionGroup" value="HIGHLIGHTER"/> - <!--onActionPerformed="handler.addHighlighter()"/>--> - - <JSeparator constructorParams="SwingConstants.VERTICAL"/> - - <JButton id="prevPageButton" - onActionPerformed="getModel().decPageIndex()"/> - <NumberEditor id='pageNumber' - constructorParams='this' /> - <JLabel id="pageTotal"/> - <JButton id="nextPageButton" - onActionPerformed="getModel().incPageIndex()"/> - - <JButton id="zoomOutButton" - onActionPerformed="handler.zoomOut()"/> - <JLabel id="zoomLabel"/> - <JButton id="zoomInButton" - onActionPerformed="handler.zoomIn()"/> - - <JButton id="rotateClockwiseButton" - onActionPerformed="handler.rotateClockwise()"/> - <JButton id="rotateAntiClockwiseButton" - onActionPerformed="handler.rotateAntiClockwise()"/> - - <JSeparator constructorParams="SwingConstants.VERTICAL"/> - - <JButton id="printButton" - onActionPerformed="handler.print()"/> - - </JToolBar> - - <JScrollPane constraints='BorderLayout.CENTER'> - <JPanel> - <JPanel id="container" layout="{null}"> - <JImagePanel id="documentPanel" onMouseClicked="handler.addEditionComponent(event)"> - </JImagePanel> - </JPanel> - </JPanel> - </JScrollPane> - - <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'> - <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> - <JButton id='validateButton'/> - </JPanel> -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java deleted file mode 100644 index b96d61e..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java +++ /dev/null @@ -1,584 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.pdfeditor; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.awt.*; -import java.awt.event.ContainerEvent; -import java.awt.event.ContainerListener; -import java.awt.event.MouseEvent; -import java.awt.geom.Rectangle2D; -import java.awt.image.BufferedImage; -import java.awt.image.RenderedImage; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.RandomAccessFile; -import java.net.URL; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; -import java.nio.charset.StandardCharsets; -import java.util.Date; -import java.util.List; - -import javax.media.jai.PlanarImage; -import javax.swing.JComponent; -import javax.swing.JPanel; - -import jaxx.runtime.swing.ComponentMover; -import jaxx.runtime.swing.ComponentResizer; -import jaxx.runtime.swing.JAXXButtonGroup; -import jaxx.runtime.validator.swing.SwingValidator; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.io.RandomAccess; -import org.apache.pdfbox.pdmodel.PDDocument; -import org.apache.pdfbox.pdmodel.PDPage; -import org.apache.pdfbox.pdmodel.common.PDRectangle; -import org.nuiton.jaxx.application.swing.util.Cancelable; -import org.nuiton.jaxx.application.swing.util.CloseableUI; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.HistoryType; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.ui.swing.actions.GenerateAnnotatedAttachmentAction; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; -import com.franciaflex.faxtomail.ui.swing.util.JImagePanel; -import com.itextpdf.text.DocumentException; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class PDFEditorUIHandler extends AbstractFaxToMailUIHandler<PDFEditorUIModel, PDFEditorUI> implements CloseableUI, Cancelable { - - private static final Log log = LogFactory.getLog(PDFEditorUIHandler.class); - - protected ComponentMover cm = new ComponentMover(); - protected ComponentResizer cr = new ComponentResizer(); - - protected PDDocument pdf; - - @Override - public void afterInit(PDFEditorUI pdfEditorUI) { - initUI(pdfEditorUI); - - cm.setDragInsets(cr.getDragInsets()); - cm.setEdgeInsets(new Insets(0, 0, 0, 0)); - - final PDFEditorUIModel model = getModel(); - - JAXXButtonGroup actionGroup = ui.getActionGroup(); - actionGroup.addPropertyChangeListener(JAXXButtonGroup.SELECTED_VALUE_PROPERTY, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - String value = (String) evt.getNewValue(); - model.setSelectedComponent(PDFEditorUIModel.EditionComponent.valueOf(value)); - } - }); - - String value = (String) actionGroup.getSelectedValue(); - model.setSelectedComponent(PDFEditorUIModel.EditionComponent.valueOf(value)); - - ui.getContainer().addContainerListener(new ContainerListener() { - @Override - public void componentAdded(ContainerEvent e) { - Component child = e.getChild(); - PDFEditorUIModel.Page currentPage = model.getCurrentPage(); - if (child.getClass().isAssignableFrom(PDFEditorNoteUI.class)) { - currentPage.addNote((PDFEditorNoteUI) child); - - } else if (child.getClass().isAssignableFrom(PDFEditorCrossUI.class)) { - currentPage.addCross((PDFEditorCrossUI) child); - - } else if (child.getClass().isAssignableFrom(PDFEditorLineUI.class)) { - currentPage.addLine((PDFEditorLineUI) child); - - } else if (child.getClass().isAssignableFrom(PDFEditorHighlighterUI.class)) { - currentPage.addHighlighter((PDFEditorHighlighterUI) child); - } - } - - @Override - public void componentRemoved(ContainerEvent e) { - Component child = e.getChild(); - PDFEditorUIModel.Page currentPage = model.getCurrentPage(); - if (child.getClass().isAssignableFrom(PDFEditorNoteUI.class)) { - currentPage.removeNote((PDFEditorNoteUI) child); - - } else if (child.getClass().isAssignableFrom(PDFEditorCrossUI.class)) { - currentPage.removeCross((PDFEditorCrossUI) child); - - } else if (child.getClass().isAssignableFrom(PDFEditorLineUI.class)) { - currentPage.removeLine((PDFEditorLineUI) child); - - } else if (child.getClass().isAssignableFrom(PDFEditorHighlighterUI.class)) { - currentPage.removeHighlighter((PDFEditorHighlighterUI) child); - } - } - }); - - model.addPropertyChangeListener(PDFEditorUIModel.PROPERTY_CURRENT_PAGE_INDEX, - new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - Integer pageNb = (Integer) evt.getNewValue(); - Integer prevPageNb = (Integer) evt.getOldValue(); - updatePageNumber(pageNb, prevPageNb); - } - } - ); - - model.addPropertyChangeListener(new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (Attachment.PROPERTY_ORIGINAL_FILE.equals(evt.getPropertyName()) - || Attachment.PROPERTY_EDITED_FILE.equals(evt.getPropertyName())) { - - PDFEditorUIModel model = (PDFEditorUIModel) evt.getSource(); - AttachmentFile attachmentFile = model.getNotNullFile(); - - if (attachmentFile != null) { - File file = attachmentFile.getFile(); - if (!FaxToMailUIUtil.isFileAPDF(attachmentFile)) { - try { - file = convertFileToPdf(attachmentFile); - - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("", e); - } - getContext().getErrorHelper().showErrorDialog(t("faxtomail.pdfEditor.convertToPdf.error")); - - } catch (DocumentException e) { - if (log.isErrorEnabled()) { - log.error("", e); - } - getContext().getErrorHelper().showErrorDialog(t("faxtomail.pdfEditor.convertToPdf.error")); - } - } - if (FaxToMailUIUtil.isFileAPDF(attachmentFile)) { - try { - pdf = PDDocument.load(file); - - model.setPageNumber(pdf.getNumberOfPages()); - model.setCurrentPageIndex(0); - - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("", e); - } - getContext().getErrorHelper().showErrorDialog(t("faxtomail.pdfEditor.readPdf.error")); - } - } - getUI().setCursor(Cursor.getDefaultCursor()); - model.firePropertyChanged(PDFEditorUIModel.PROPERTY_CURRENT_PAGE_INDEX, null, 0); - } - } - } - }); - - model.addPropertyChangeListener(PDFEditorUIModel.PROPERTY_ZOOM, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - displayPage(model.getCurrentPageIndex(), - (Float) evt.getOldValue(), - model.getRotation()); - } - }); - - model.addPropertyChangeListener(PDFEditorUIModel.PROPERTY_ROTATION, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - displayPage(model.getCurrentPageIndex(), - model.getZoom(), - (Integer) evt.getOldValue()); - } - }); - } - - @Override - protected JComponent getComponentToFocus() { - return null; - } - - @Override - public SwingValidator<PDFEditorUIModel> getValidator() { - return null; - } - - @Override - public boolean quitUI() { - boolean result = quitScreen2( - true, - getModel().isModify(), - null, - t("faxtomail.pdfEditor.askSaveBeforeLeaving.save"), - getContext().getActionFactory().createLogicAction(this, GenerateAnnotatedAttachmentAction.class) - ); - return result; - } - - @Override - public Component getTopestUI() { - return getUI(); - } - - @Override - public void onCloseUI() { - - } - - public void addEditionComponent(MouseEvent event) { - PDFEditorUIModel.EditionComponent editionComponent = getModel().getSelectedComponent(); - switch (editionComponent) { - case NOTE: - addNote(event.getX(), event.getY()); - break; - case CROSS: - addCross(event.getX(), event.getY()); - break; - case HLINE: - addHLine(event.getX(), event.getY()); - break; - case VLINE: - addVLine(event.getX(), event.getY()); - break; - case HIGHLIGHTER: - addHighlighter(event.getX(), event.getY()); - break; - } - } - - public void addNote(int x, int y) { - PDFEditorNoteUI note = new PDFEditorNoteUI(); - note.setZoom(getModel().getZoom()); - String title = decorate(new Date()) + " - " + getContext().getCurrentUser().getTrigraph(); - note.setTitle(title); - addPanel(note, x, y); - } - - public void addCross(int x, int y) { - PDFEditorCrossUI cross = new PDFEditorCrossUI(); - addPanel(cross, x, y); - cr.registerComponent(cross); - } - - public void addHLine(int x, int y) { - PDFEditorLineUI line = new PDFEditorLineUI(); - line.setHorizontal(true); - addPanel(line, x, y); - cr.registerComponent(ComponentResizer.DIRECTION_HORIZONTAL, line); - } - - public void addVLine(int x, int y) { - PDFEditorLineUI line = new PDFEditorLineUI(); - line.setHorizontal(false); - addPanel(line, x, y); - cr.registerComponent(ComponentResizer.DIRECTION_VERTICAL, line); - } - - public void addHighlighter(int x, int y) { - PDFEditorHighlighterUI highlighter = new PDFEditorHighlighterUI(); - addPanel(highlighter, x, y); - cr.registerComponent(highlighter); - } - - protected void addPanel(JPanel panel, int x, int y) { - JPanel container = ui.getContainer(); - container.add(panel, 0); - - Insets insets = container.getInsets(); - Dimension size = panel.getPreferredSize(); - panel.setBounds(x + insets.left, y + insets.top, - size.width, size.height); - - container.updateUI(); - - cm.registerComponent(panel); - } - - protected void updatePageNumber(Integer pageNb, Integer prevPageNb) { - if (pdf != null) { - if (pageNb != null) { - if (prevPageNb != null) { - PDFEditorUIModel.Page p = getModel().getPage(prevPageNb); - for (JPanel panel : p.getNotes()) { - panel.setVisible(false); - } - for (JPanel panel : p.getCrosses()) { - panel.setVisible(false); - } - } - - displayPage(pageNb, getModel().getZoom(), getModel().getRotation()); - } - } - } - - protected void displayPage(int pageNb, float previousZoom, int previousRotation) { - List<PDPage> pages = pdf.getDocumentCatalog().getAllPages(); - PDPage page = pages.get(pageNb); - // create the image - PDRectangle bBox = page.findCropBox(); - Rectangle rect = new Rectangle(0, 0, (int) bBox.getWidth(), - (int) bBox.getHeight()); - - float zoom = getModel().getZoom(); - int rotation = getModel().getRotation(); - - int width = (int) (zoom * rect.width); - int height = (int) (zoom * rect.height); - try { - Image image = page.convertToImage(BufferedImage.TYPE_INT_RGB, 72); - // page.getImage(width, height, // width & height - // rect, // clip rect - // null, // null for the ImageObserver - // true, // fill background with white - // true // block until drawing is done - // ); - - JPanel container = getUI().getContainer(); - Dimension containerSize = new Dimension(rotation % 180 == 0 ? width : height, - rotation % 180 == 0 ? height : width); - container.setPreferredSize(containerSize); - container.setMinimumSize(containerSize); - container.setMaximumSize(containerSize); - container.setSize(containerSize); - - JImagePanel documentPanel = ui.getDocumentPanel(); - documentPanel.setRotation(rotation); - documentPanel.setImage(image); - - Insets insets = container.getInsets(); - rect = container.getBounds(); - - float zoomRatio = zoom / previousZoom; - int rotationDiff = rotation - previousRotation; - - PDFEditorUIModel.Page p = getModel().getPage(pageNb); - - for (PDFEditorNoteUI panel : p.getNotes()) { - panel.setVisible(true); - - panel.setZoom(zoom); - Rectangle bounds = panel.getBounds(); - int x, y; - - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; - - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - bounds.height / 2 - bounds.width / 2 - bounds.y; - y = bounds.x + bounds.width / 2 - bounds.height / 2; - - } else { - x = bounds.y + bounds.height / 2 - bounds.width / 2; - y = rect.height - bounds.height / 2 - bounds.width / 2 - bounds.x; - } - - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * bounds.width), (int) (zoomRatio * bounds.height)); - - } - - boolean orientation180 = Math.abs(rotationDiff) % 180 == 0; - - for (PDFEditorCrossUI panel : p.getCrosses()) { - panel.setVisible(true); - - Rectangle bounds = panel.getBounds(); - - int newWidth = orientation180 ? bounds.width : bounds.height; - int newHeight = orientation180 ? bounds.height : bounds.width; - - int x, y; - - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; - - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - newWidth - bounds.y; - y = bounds.x; - - } else { - x = bounds.y; - y = rect.height - newHeight - bounds.x; - } - - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); - - } - - List<PDFEditorLineUI> lines = p.getLines(); - cr.deregisterComponent(lines.toArray(new PDFEditorLineUI[lines.size()])); - - for (PDFEditorLineUI panel : lines) { - panel.setVisible(true); - - Rectangle bounds = panel.getBounds(); - - boolean horizontal = panel.isHorizontal(); - panel.setHorizontal(orientation180 ? horizontal : !horizontal); - - int newWidth = orientation180 ? bounds.width : bounds.height; - int newHeight = orientation180 ? bounds.height : bounds.width; - - int x, y; - - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; - - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - newWidth - bounds.y; - y = bounds.x; - - } else { - x = bounds.y; - y = rect.height - newHeight - bounds.x; - } - - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); - - cr.registerComponent(panel.isHorizontal() ? ComponentResizer.DIRECTION_HORIZONTAL : ComponentResizer.DIRECTION_VERTICAL, - panel); - } - - for (PDFEditorHighlighterUI panel : p.getHighlighters()) { - panel.setVisible(true); - - Rectangle bounds = panel.getBounds(); - - int newWidth = orientation180 ? bounds.width : bounds.height; - int newHeight = orientation180 ? bounds.height : bounds.width; - - int x, y; - - if (rotationDiff == 0) { - x = bounds.x; - y = bounds.y; - - } else if (rotationDiff == 90 || rotationDiff == -270) { - x = rect.width - newWidth - bounds.y; - y = bounds.x; - - } else { - x = bounds.y; - y = rect.height - newHeight - bounds.x; - } - - panel.setBounds((int) (zoomRatio * x) + insets.left, - (int) (zoomRatio * y) + insets.top, - (int) (zoomRatio * newWidth), (int) (zoomRatio * newHeight)); - - } - - container.updateUI(); - - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("Cannot convert page into image", e); - } - } - } - - public File convertFileToPdf(AttachmentFile attachmentFile) throws IOException, DocumentException { - File target = FaxToMailUIUtil.convertFileToPdf(attachmentFile); - // convert content to blob - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - AttachmentFile attachmentFileNew = serviceContext.getEmailService().getAttachmentFileFromStream(new FileInputStream(target)); - attachmentFileNew.setFilename(attachmentFile.getFilename() + ".pdf"); - attachmentFileNew.setRotation(0); - getModel().setEditedFile(attachmentFileNew); - - return target; - } - - public void zoomOut() { - PDFEditorUIModel model = getModel(); - float zoom = model.getZoom(); - model.setZoom(zoom - 0.5f); - } - - public void zoomIn() { - PDFEditorUIModel model = getModel(); - float zoom = model.getZoom(); - model.setZoom(zoom + 0.5f); - } - - public void rotateClockwise() { - int rotation = getModel().getRotation(); - getModel().setRotation((360 + rotation + 90) % 360); - } - - public void rotateAntiClockwise() { - int rotation = getModel().getRotation(); - getModel().setRotation((360 + rotation - 90) % 360); - } - - public void print() { - PDFEditorUIModel model = getModel(); - AttachmentFile attachmentFile = model.getNotNullFile(); - boolean print = FaxToMailUIUtil.print(attachmentFile, false); - - // TODO kmorin 20140702 à mettre dans une action ou avec un loading ou qqchose - // j'ai essayé une action vite fait mais ca ferme l'éditeur à la fin de l'action - if (print) { - DemandeUIModel demand = model.getDemand(); - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - Email email = serviceContext.getEmailService().addToHistory(demand.getTopiaId(), - HistoryType.PRINTING, - getContext().getCurrentUser(), - new Date(), - attachmentFile.getFilename()); - demand.setHistory(email.getHistory()); - } - } - - @Override - public void cancel() { - closeFrame(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java deleted file mode 100644 index dff67d7..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java +++ /dev/null @@ -1,273 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.pdfeditor; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.ArrayList; -import java.util.List; - -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; - -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class PDFEditorUIModel extends AbstractFaxToMailBeanUIModel<Attachment, PDFEditorUIModel> { - - public static final String PROPERTY_PAGES = "pages"; - public static final String PROPERTY_CURRENT_PAGE_INDEX = "currentPageIndex"; - public static final String PROPERTY_ZOOM = "zoom"; - public static final String PROPERTY_ROTATION = "rotation"; - - protected final Attachment editObject = new AttachmentImpl(); - - protected DemandeUIModel demand; - - protected EditionComponent selectedComponent; - - public static enum EditionComponent { - NOTE, CROSS, HLINE, VLINE, HIGHLIGHTER - } - - public class Page { - - protected List<PDFEditorNoteUI> notes = new ArrayList<PDFEditorNoteUI>(); - protected List<PDFEditorCrossUI> crosses = new ArrayList<PDFEditorCrossUI>(); - protected List<PDFEditorLineUI> lines = new ArrayList<PDFEditorLineUI>(); - protected List<PDFEditorHighlighterUI> highlighters = new ArrayList<PDFEditorHighlighterUI>(); - - public List<PDFEditorNoteUI> getNotes() { - return notes; - } - - public void addNote(PDFEditorNoteUI note) { - notes.add(note); - setModify(true); - } - - public void removeNote(PDFEditorNoteUI note) { - notes.remove(note); - setModify(true); - } - - public List<PDFEditorCrossUI> getCrosses() { - return crosses; - } - - public void addCross(PDFEditorCrossUI cross) { - crosses.add(cross); - setModify(true); - } - - public void removeCross(PDFEditorCrossUI cross) { - crosses.remove(cross); - setModify(true); - } - - public List<PDFEditorLineUI> getLines() { - return lines; - } - - public void addLine(PDFEditorLineUI line) { - lines.add(line); - setModify(true); - } - - public void removeLine(PDFEditorLineUI line) { - lines.remove(line); - setModify(true); - } - - public List<PDFEditorHighlighterUI> getHighlighters() { - return highlighters; - } - - public void addHighlighter(PDFEditorHighlighterUI highlighter) { - highlighters.add(highlighter); - setModify(true); - } - - public void removeHighlighter(PDFEditorHighlighterUI highlighter) { - highlighters.remove(highlighter); - setModify(true); - } - } - - protected Page[] pages; - - protected int currentPageIndex = -1; - - protected float zoom = 1.0f; - - protected int rotation = 0; - - protected static Binder<PDFEditorUIModel, Attachment> toBeanBinder = - BinderFactory.newBinder(PDFEditorUIModel.class, - Attachment.class); - - protected static Binder<Attachment, PDFEditorUIModel> fromBeanBinder = - BinderFactory.newBinder(Attachment.class, PDFEditorUIModel.class); - - public PDFEditorUIModel() { - super(fromBeanBinder, toBeanBinder); - } - - public void setOriginalFile(AttachmentFile file) { - Object oldValue = getOriginalFile(); - editObject.setOriginalFile(file); - firePropertyChange(Attachment.PROPERTY_ORIGINAL_FILE, oldValue, file); - } - - public AttachmentFile getOriginalFile() { - return editObject.getOriginalFile(); - } - - public void setEditedFile(AttachmentFile file) { - Object oldValue = getEditedFile(); - editObject.setEditedFile(file); - firePropertyChange(Attachment.PROPERTY_EDITED_FILE, oldValue, file); - setRotation(file != null ? file.getRotation() : 0); - } - - public AttachmentFile getEditedFile() { - return editObject.getEditedFile(); - } - - public AttachmentFile getNotNullFile() { - AttachmentFile file = getEditedFile(); - if (file == null) { - file = getOriginalFile(); - } - return file; - } - - public String getTopiaId() { - return editObject.getTopiaId(); - } - - public void setTopiaId(String id) { - Object oldValue = getTopiaId(); - editObject.setTopiaId(id); - firePropertyChange(Attachment.PROPERTY_TOPIA_ID, oldValue, id); - } - - public Page[] getPages() { - return pages; - } - - public void setPageNumber(int nb) { - pages = new Page[nb]; - for (int i = 0 ; i < nb ; i++) { - pages[i] = new Page(); - } - firePropertyChanged(PROPERTY_PAGES, null, pages); - } - - public Page getCurrentPage() { - if (pages == null || currentPageIndex < 0 || currentPageIndex >= pages.length) { - return null; - } - return pages[currentPageIndex]; - } - - public Page getPage(int i) { - if (pages == null || i < 0 || i >= pages.length) { - return null; - } - return pages[i]; - } - - public int getCurrentPageIndex() { - return currentPageIndex; - } - - public void setCurrentPageIndex(int currentPageIndex) { - Object oldValue = getCurrentPageIndex(); - currentPageIndex = Math.max(0, currentPageIndex); - if (pages != null) { - currentPageIndex = Math.min(pages.length - 1, currentPageIndex); - } - this.currentPageIndex = currentPageIndex; - firePropertyChange(PROPERTY_CURRENT_PAGE_INDEX, oldValue, currentPageIndex); - } - - public void decPageIndex() { - setCurrentPageIndex(currentPageIndex - 1); - } - - public void incPageIndex() { - setCurrentPageIndex(currentPageIndex + 1); - } - - public float getZoom() { - return zoom; - } - - public void setZoom(float zoom) { - if (zoom >= 1f && zoom <= 15f) { - Object oldValue = getZoom(); - this.zoom = zoom; - firePropertyChanged(PROPERTY_ZOOM, oldValue, zoom); - } - } - - public int getRotation() { - return rotation; - } - - public void setRotation(int rotation) { - Object oldValue = getRotation(); - this.rotation = rotation; - firePropertyChanged(PROPERTY_ROTATION, oldValue, rotation); - } - - public DemandeUIModel getDemand() { - return demand; - } - - public void setDemand(DemandeUIModel demand) { - this.demand = demand; - } - - public EditionComponent getSelectedComponent() { - return selectedComponent; - } - - public void setSelectedComponent(EditionComponent selectedComponent) { - this.selectedComponent = selectedComponent; - } - - @Override - protected Attachment newEntity() { - return new AttachmentImpl(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.css deleted file mode 100644 index 67a9b05..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.css +++ /dev/null @@ -1,40 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#message { - text: "faxtomail.chooseAttachmentToPrint.message"; - border: { javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5) }; -} - -#cancelButton { - actionIcon: cancel; - text: "faxtomail.chooseAttachmentToPrint.action.cancel"; - toolTipText: "faxtomail.chooseAttachmentToPrint.action.cancel.tip"; -} - -#validateButton { - actionIcon: validate; - text: "faxtomail.chooseAttachmentToPrint.action.validate"; - toolTipText: "faxtomail.chooseAttachmentToPrint.action.validate.tip"; - enabled: { !model.getAttachmentsToPrint().isEmpty() }; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.jaxx deleted file mode 100644 index 3cc3f29..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUI.jaxx +++ /dev/null @@ -1,62 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='attachmentToPrintChooser' layout='{new BorderLayout()}' - implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<AttachmentToPrintChooserUIModel, AttachmentToPrintChooserUIHandler>'> - - <import> - com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel - - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - - javax.swing.BoxLayout - - </import> - - <script><![CDATA[ - - public AttachmentToPrintChooserUI(FaxToMailUI parentUI, DemandeUIModel demande) { - FaxToMailUIUtil.setParentUI(this, parentUI); - AttachmentToPrintChooserUIModel model = new AttachmentToPrintChooserUIModel(); - model.setDemand(demande); - setContextValue(model); - } - - ]]></script> - - <AttachmentToPrintChooserUIModel id='model' javaBean='getContextValue(AttachmentToPrintChooserUIModel.class)'/> - - <JLabel id="message" constraints='BorderLayout.NORTH'/> - - <JScrollPane constraints='BorderLayout.CENTER'> - <JPanel id="attachmentPanel" - layout="{ new BoxLayout(attachmentPanel, BoxLayout.Y_AXIS) }"/> - </JScrollPane> - - <JPanel layout='{ new GridLayout(1, 0) }' constraints='BorderLayout.SOUTH'> - <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> - <JButton id='validateButton' onActionPerformed="handler.print()"/> - </JPanel> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java deleted file mode 100644 index 6b5076d..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.print; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.awt.*; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - -import javax.swing.JCheckBox; -import javax.swing.JComponent; - -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.ui.swing.actions.PrintOnDefaultPrinterAction; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import jaxx.runtime.validator.swing.SwingValidator; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; -import org.nuiton.jaxx.application.swing.util.Cancelable; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class AttachmentToPrintChooserUIHandler extends AbstractFaxToMailUIHandler<AttachmentToPrintChooserUIModel, AttachmentToPrintChooserUI> - implements Cancelable { - - private static final Log log = LogFactory.getLog(AttachmentToPrintChooserUIHandler.class); - - @Override - public void afterInit(AttachmentToPrintChooserUI attachmentToPrintChooserUI) { - initUI(attachmentToPrintChooserUI); - - AttachmentToPrintChooserUIModel model = getModel(); - DemandeUIModel demand = model.getDemand(); - - // add demand details - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - EmailService emailService = serviceContext.getEmailService(); - Email email = getModel().getDemand().toEntity(); - final AttachmentFile demandDetailAttachment = emailService.getEmailDetailAsAttachment(email); - - JCheckBox checkBox = new JCheckBox(demandDetailAttachment.getFilename(), true); - ui.getAttachmentPanel().add(checkBox); - - // add attached files - getModel().addAttachmentToPrint(demandDetailAttachment); - checkBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - log.info("state changed " + e.getStateChange()); - if (e.getStateChange() == ItemEvent.SELECTED) { - getModel().addAttachmentToPrint(demandDetailAttachment); - } else { - getModel().removeAttachmentToPrint(demandDetailAttachment); - } - } - }); - - for (Attachment attachment : demand.getAttachment()) { - - if (attachment.getOriginalFile() == null) { - FaxToMailUIUtil.forceAttachmentFileLoading(getContext(), attachment); - } - createCheckBox(attachment.getOriginalFile()); - - final AttachmentFile file = attachment.getEditedFile(); - if (file != null) { - createCheckBox(file); - } - } - } - - protected void createCheckBox(final AttachmentFile attachmentFile) { - if (attachmentFile == null) { - return; - } - String attachmentName = attachmentFile.getFilename(); - boolean printable = FaxToMailUIUtil.isFileTypeEditable(attachmentName); - - JCheckBox checkBox = new JCheckBox(attachmentName, printable); - checkBox.setEnabled(printable); - ui.getAttachmentPanel().add(checkBox); - - if (printable) { - getModel().addAttachmentToPrint(attachmentFile); - - checkBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - log.info("state changed " + e.getStateChange()); - if (e.getStateChange() == ItemEvent.SELECTED) { - getModel().addAttachmentToPrint(attachmentFile); - } else { - getModel().removeAttachmentToPrint(attachmentFile); - } - } - }); - } - } - - @Override - public void onCloseUI() { - } - - @Override - public SwingValidator<AttachmentToPrintChooserUIModel> getValidator() { - return null; - } - - @Override - public void cancel() { - closeFrame(); - } - - @Override - protected JComponent getComponentToFocus() { - return ui.getAttachmentPanel(); - } - - @Override - public Component getTopestUI() { - return getUI(); - } - - public void print() { - Multimap<DemandeUIModel, AttachmentFile> attachmentToPrints = HashMultimap.create(); - attachmentToPrints.putAll(getModel().getDemand(), getModel().getAttachmentsToPrint()); - - PrintOnDefaultPrinterAction action = new PrintOnDefaultPrinterAction(this, - attachmentToPrints, - false, - false) { - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - closeFrame(); - } - }; - getContext().getActionEngine().runAction(action); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIModel.java deleted file mode 100644 index 6d8ac6c..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIModel.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.print; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import org.jdesktop.beans.AbstractBean; - -import java.util.Collection; -import java.util.HashSet; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class AttachmentToPrintChooserUIModel extends AbstractBean { - - public static final String PROPERTY_ATTACHEMENTS_TO_PRINT = "attachmentsToPrint"; - - protected DemandeUIModel demand; - - protected Collection<AttachmentFile> attachmentsToPrint = new HashSet<AttachmentFile>(); - - public DemandeUIModel getDemand() { - return demand; - } - - public void setDemand(DemandeUIModel demand) { - this.demand = demand; - } - - public Collection<AttachmentFile> getAttachmentsToPrint() { - return attachmentsToPrint; - } - - public void setAttachmentsToPrint(Collection<AttachmentFile> attachmentsToPrint) { - Object oldValue = new HashSet<AttachmentFile>(this.attachmentsToPrint); - this.attachmentsToPrint.clear(); - this.attachmentsToPrint.addAll(attachmentsToPrint); - firePropertyChange(PROPERTY_ATTACHEMENTS_TO_PRINT, oldValue, this.attachmentsToPrint); - } - - public void addAttachmentToPrint(AttachmentFile attachmentFile) { - Object oldValue = new HashSet<AttachmentFile>(this.attachmentsToPrint); - this.attachmentsToPrint.add(attachmentFile); - firePropertyChange(PROPERTY_ATTACHEMENTS_TO_PRINT, oldValue, this.attachmentsToPrint); - } - - public void removeAttachmentToPrint(AttachmentFile attachmentFile) { - Object oldValue = new HashSet<AttachmentFile>(this.attachmentsToPrint); - this.attachmentsToPrint.remove(attachmentFile); - firePropertyChange(PROPERTY_ATTACHEMENTS_TO_PRINT, oldValue, this.attachmentsToPrint); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css deleted file mode 100644 index 3e48ebe..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.css +++ /dev/null @@ -1,49 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#attachmentPanel { - border: { BorderFactory.createLineBorder(Color.LIGHT_GRAY) }; -} - -#attachmentNameLabel { - actionIcon: "attachment"; - text: { t("faxtomail.reply.attachment.label", getReplyAttachmentModel().getLabel(), getReplyAttachmentModel().getLength() / 1024) }; - border: { BorderFactory.createEmptyBorder(3, 3, 3, 3) }; -} - -#toolbar { - borderPainted: false; - floatable: false; -} - -#openAttachmentButton { - actionIcon: "open-file"; - toolTipText: "faxtomail.attachmentEditor.action.open.tip"; -} - -#removeAttachmentButton { - actionIcon: "delete"; - toolTipText: "faxtomail.attachmentEditor.action.remove.tip"; - visible: { !getHandler().getModel().isReadonly() }; -} - diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx deleted file mode 100644 index 841dbec..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/AttachmentItem.jaxx +++ /dev/null @@ -1,50 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='attachmentPanel' layout='{new BorderLayout()}'> - - <import> - - java.awt.Color - java.io.File - javax.swing.BorderFactory - - static org.nuiton.i18n.I18n.t - static jaxx.runtime.JAXXUtil.getStringValue - - </import> - - <ReplyAttachmentModel id='replyAttachmentModel' javaBean='null'/> - - <ReplyFormUIHandler id='handler' javaBean='null'/> - - <JLabel id='attachmentNameLabel' constraints='BorderLayout.CENTER'/> - - <JToolBar id='toolbar' constraints='BorderLayout.EAST'> - <JButton id='openAttachmentButton' - onActionPerformed='handler.openAttachment(replyAttachmentModel)'/> - <JButton id='removeAttachmentButton' - onActionPerformed='handler.removeAttachment(replyAttachmentModel)'/> - </JToolBar> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyAttachmentModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyAttachmentModel.java deleted file mode 100644 index 9904351..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyAttachmentModel.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.reply; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; - -/** -* @author Kevin Morin (Code Lutin) -* -*/ -public class ReplyAttachmentModel { - - protected Attachment attachment; - protected boolean original; - protected String label; - - public ReplyAttachmentModel(Attachment attachment, boolean original, String label) { - this.attachment = attachment; - this.original = original; - this.label = label; - } - - public Attachment getAttachment() { - return attachment; - } - - public void setAttachment(Attachment attachment) { - this.attachment = attachment; - } - - public boolean isOriginal() { - return original; - } - - public void setOriginal(boolean original) { - this.original = original; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public AttachmentFile getAttachmentFile() { - return original ? attachment.getOriginalFile() : attachment.getEditedFile(); - } - - public long getLength() { - return getAttachmentFile() != null ? getAttachmentFile().getLength() : 0; - } - - @Override - public String toString() { - return label; - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css deleted file mode 100644 index 3968777..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.css +++ /dev/null @@ -1,150 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#fromLabel { - text: "faxtomail.reply.label.from"; -} - -#fromPanelLayout { - selected: { String.valueOf(model.isReadonly()) }; -} - -#fromField { - text: { model.getFrom() }; - editable: false; -} - -#fromComboBox { - editable: true; - selectedItem: { model.getFrom() }; -} - -#toLabel { - text: "faxtomail.reply.label.to"; -} - -#toField { - text: { model.getTo() }; - editable: { !model.isReadonly() }; -} - -#ccLabel { - text: "faxtomail.reply.label.cc"; -} - -#ccField { - text: { model.getCc() }; - editable: { !model.isReadonly() }; -} - -#cciLabel { - text: "faxtomail.reply.label.cci"; -} - -#cciField { - text: { model.getCci() }; - editable: { !model.isReadonly() }; -} - -#subjectLabel { - text: "faxtomail.reply.label.subject"; -} - -#subjectField { - text: { model.getSubject() }; - editable: { !model.isReadonly() }; -} - -#splitPane { - dividerLocation: 270; -} - -#message { - text: { model.getMessage() }; - editable: { !model.isReadonly() }; -} - -#attachmentsPanel { - background: { Color.WHITE }; -} - -#attachmentsLabel { - text: { t("faxtomail.reply.attachments.title", - getModel().getTotalAttachmentLength(), - getModel().getMaxAttachmentLength()) }; - foreground: { getModel().isAttachmentSizeValid(getModel().getTotalAttachmentLength()) ? Color.BLACK : Color.RED } -} - -#addAttachmentForm { - visible: { !model.isReadonly() }; -} - -#addAttachmentLabel { - text: "faxtomail.reply.attachments.add.label"; -} - -#addAttachmentFile { - editable: true; -} - -#chooseFileButton { - actionIcon: "open"; -} - -#addAttachmentButton { - actionIcon: "add"; - enabled: { addAttachmentFile.getSelectedItem() != null }; -} - -#buttonPanelLayout { - selected: { String.valueOf(model.isReadonly()) }; -} - -#forwardButton { - actionIcon: transmit; - text: "faxtomail.reply.action.forward"; - toolTipText: "faxtomail.reply.action.forward.tip"; - visible: { getModel().isEditable() }; -} - -#closeButton { - actionIcon: cancel; - text: "faxtomail.reply.action.close"; - toolTipText: "faxtomail.reply.action.close.tip"; -} - -#cancelButton { - actionIcon: cancel; - text: "faxtomail.reply.action.cancel"; - toolTipText: "faxtomail.reply.action.cancel.tip"; -} - -#validateButton { - actionIcon: reply; - text: "faxtomail.reply.action.validate"; - toolTipText: "faxtomail.reply.action.validate.tip"; - _applicationAction: { com.franciaflex.faxtomail.ui.swing.actions.ReplyAction.class }; - - /* FIXME echatellier 20140715 : ca doit pas se faire comme ca, mais pas trop d'idée */ - enabled: { getModel().isValid() && getModel().isAttachmentSizeValid(getModel().getTotalAttachmentLength()) }; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx deleted file mode 100644 index 4c83d18..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx +++ /dev/null @@ -1,171 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='replyPanel' layout='{new BorderLayout()}' - implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<ReplyFormUIModel, ReplyFormUIHandler>'> - - <import> - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - - java.awt.CardLayout - java.awt.Color - java.awt.FlowLayout - - jaxx.runtime.swing.CardLayout2Ext - - static org.nuiton.i18n.I18n.t - </import> - - <script><![CDATA[ - - public ReplyFormUI(FaxToMailUI parentUI) { - FaxToMailUIUtil.setParentUI(this, parentUI); - } - - ]]></script> - - <ReplyFormUIModel id='model' - initializer='getContextValue(ReplyFormUIModel.class)'/> - - <BeanValidator id='validator' bean='model' - uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'> - <field name='from' component='fromComboBox'/> - <field name='to' component='toField'/> - <field name='subject' component='subjectField'/> - <field name='totalAttachmentLength' component="attachmentsPanel"/> - </BeanValidator> - - <CardLayout2Ext id='fromPanelLayout' - constructorParams='this, "fromPanel"'/> - - <CardLayout2Ext id='buttonPanelLayout' - constructorParams='this, "buttonPanel"'/> - - <Table constraints='BorderLayout.NORTH' - fill='both'> - <row> - <cell> - <JLabel id="fromLabel"/> - </cell> - <cell weightx='1'> - <JPanel id="fromPanel" - layout="{ fromPanelLayout }"> - <JTextField id="fromField" - constraints='"true"'/> - <JComboBox id="fromComboBox" - onItemStateChanged='handler.setText(event, "from")' - constraints='"false"'/> - </JPanel> - </cell> - </row> - <row> - <cell> - <JLabel id="toLabel"/> - </cell> - <cell weightx='1'> - <JTextField id="toField" - onKeyReleased='handler.setText(event, "to")'/> - </cell> - </row> - <row> - <cell> - <JLabel id="ccLabel"/> - </cell> - <cell weightx='1'> - <JTextField id="ccField" - onKeyReleased='handler.setText(event, "cc")'/> - </cell> - </row> - <row> - <cell> - <JLabel id="cciLabel"/> - </cell> - <cell weightx='1'> - <JTextField id="cciField" - onKeyReleased='handler.setText(event, "cci")'/> - </cell> - </row> - <row> - <cell> - <JLabel id="subjectLabel"/> - </cell> - <cell weightx='1'> - <JTextField id="subjectField" - onKeyReleased='handler.setText(event, "subject")'/> - </cell> - </row> - </Table> - - <JSplitPane id="splitPane" - orientation="{JSplitPane.VERTICAL_SPLIT}" - constraints='BorderLayout.CENTER'> - <JScrollPane> - <JEditorPane id="message" - onKeyReleased='handler.setText(event, "message")'/> - </JScrollPane> - - <JPanel layout='{new BorderLayout()}'> - <JLabel id="attachmentsLabel" constraints='BorderLayout.NORTH'/> - <JScrollPane id="attachmentsContainer" - constraints='BorderLayout.CENTER'> - <JPanel id="attachmentsPanel" layout="{new FlowLayout(FlowLayout.LEADING)}"/> - </JScrollPane> - <Table fill="both" - id="addAttachmentForm" - constraints='BorderLayout.SOUTH'> - <row> - <cell> - <JLabel id='addAttachmentLabel'/> - </cell> - <cell weightx="1"> - <JComboBox id="addAttachmentFile"/> - </cell> - <cell> - <JButton id='chooseFileButton' - onActionPerformed='handler.openLocation()'/> - </cell> - <cell> - <JButton id='addAttachmentButton' - onActionPerformed='handler.addAttachment()'/> - </cell> - </row> - </Table> - - </JPanel> - </JSplitPane> - - <JPanel id="buttonPanel" - layout="{ buttonPanelLayout }" - constraints='BorderLayout.SOUTH'> - <JPanel constraints='"true"' - layout='{new GridLayout(1, 0)}'> - <JButton id='forwardButton' onActionPerformed='handler.forward()'/> - <JButton id='closeButton' onActionPerformed='handler.cancel()'/> - </JPanel> - <JPanel constraints='"false"' - layout='{new GridLayout(1, 0)}'> - <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> - <JButton id='validateButton'/> - </JPanel> - </JPanel> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java deleted file mode 100644 index 72f613a..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java +++ /dev/null @@ -1,440 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.reply; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.awt.Component; -import java.awt.Dimension; -import java.awt.event.ActionListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.swing.ComboBoxEditor; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JEditorPane; -import javax.swing.JFileChooser; -import javax.swing.JPanel; -import javax.swing.JTextField; - -import jaxx.runtime.JAXXUtil; -import jaxx.runtime.SwingUtil; -import jaxx.runtime.validator.swing.SwingValidator; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.jaxx.application.swing.util.Cancelable; -import org.nuiton.validator.bean.simple.SimpleBeanValidator; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFileImpl; -import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.ui.swing.actions.AddAttachmentToReplyAction; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; -import com.google.common.base.Strings; -import com.google.common.collect.Lists; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIModel, ReplyFormUI> implements Cancelable { - - private static final Log log = LogFactory.getLog(ReplyFormUIHandler.class); - - protected AddAttachmentToReplyAction addAttachmentToReplyAction; - - @Override - public void beforeInit(ReplyFormUI ui) { - super.beforeInit(ui); - - addAttachmentToReplyAction = - getContext().getActionFactory().createLogicAction(this, AddAttachmentToReplyAction.class); - - ReplyFormUIModel model = new ReplyFormUIModel(); - //TODO kmorin 20140813 action ? - long maxSize = getContext().newServiceContext().getConfigurationService().getEmailMaxSize(); - model.setMaxAttachmentLength(maxSize); - - this.ui.setContextValue(model); - } - - @Override - public void afterInit(ReplyFormUI replyFormUI) { - initUI(ui); - - JEditorPane editor = ui.getMessage(); - editor.setCaretPosition(0); - - ReplyFormUIModel model = getModel(); - model.addPropertyChangeListener(ReplyFormUIModel.PROPERTY_ORIGINAL_DEMAND, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - DemandeUIModel demand = (DemandeUIModel) evt.getNewValue(); - ReplyFormUIModel model = (ReplyFormUIModel) evt.getSource(); - - List<DemandeUIModel> models = new ArrayList<DemandeUIModel>(); - models.addAll(demand.getGroupedDemandes()); - - for (DemandeUIModel demandeUIModel : models) { - String prefix = demandeUIModel.getTitle(); - for (Attachment attachment : demandeUIModel.getAttachment()) { - - ReplyAttachmentModel replyOriginalAttachmentModel = - new ReplyAttachmentModel(attachment, true, prefix + attachment.getOriginalFileName()); - model.addAvailableAttachment(replyOriginalAttachmentModel); - - if (!Strings.isNullOrEmpty(attachment.getEditedFileName())) { - ReplyAttachmentModel replyEditedAttachmentModel = - new ReplyAttachmentModel(attachment, false, prefix + attachment.getEditedFileName()); - model.addAvailableAttachment(replyEditedAttachmentModel); - } - } - } - - model.setFrom(demand.getRecipient()); - - model.setSubject(t("faxtomail.reply.subject", demand.getSubject())); - - String plainContent = JAXXUtil.getStringValue(demand.getPlainContent()); - String quotedReply = t("faxtomail.reply.message", - decorate(demand.getReceptionDate()), - demand.getSender(), - plainContent.replaceAll("\n", "\n> ")); - model.setMessage(quotedReply); - - // this have to be disable for read only mode (useless) - if (!model.isReadonly()) { - - // attachment combo - JComboBox<AttachmentFile> addAttachmentFile = ui.getAddAttachmentFile(); - addAttachmentFile.setModel(SwingUtil.newComboModel(model.getAvailableAttachments().toArray())); - addAttachmentFile.setSelectedItem(null); - - // sender combo - MailFolder folder = demand.getMailFolder(); - List<String> folderReplyAdresses = new ArrayList<String>(); - List<String> folderReplyDomains = new ArrayList<String>(); - while (folder != null) { - folderReplyAdresses.addAll(folder.getReplyAddresses()); - folderReplyDomains.addAll(folder.getReplyDomains()); - folder = folder.getParent(); - } - model.setSenderAllowedDomains(folderReplyDomains); - - List<String> replyToAddresses = Lists.newArrayList(demand.getRecipient()); - if (folderReplyAdresses != null) { - replyToAddresses.addAll(folderReplyAdresses); - } - - ui.getFromComboBox().setModel(SwingUtil.newComboModel(replyToAddresses.toArray())); - model.setSenderAllowedAddresses(replyToAddresses); - } - } - }); - - model.addPropertyChangeListener(ReplyFormUIModel.PROPERTY_ATTACHMENT, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - updateAttachmentPanel((Collection<ReplyAttachmentModel>) evt.getNewValue()); - } - }); - - model.addPropertyChangeListener(ReplyFormUIModel.PROPERTY_READONLY, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - updateAttachmentPanel(getModel().getAttachments()); - } - }); - - JComboBox addAttachmentFile = ui.getAddAttachmentFile(); - addAttachmentFile.setEditor(new FileComboBoxEditor()); - - getValidator().addPropertyChangeListener(SimpleBeanValidator.VALID_PROPERTY, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - - ReplyFormUIModel model = getModel(); - if (log.isDebugEnabled()) { - log.debug("Model [" + model + - "] pass to valid state [" + - evt.getNewValue() + "]"); - } - model.setValid((Boolean) evt.getNewValue()); - } - }); - } - - @Override - public void cancel() { - closeFrame(); - } - - @Override - public void onCloseUI() { - } - - @Override - public SwingValidator<ReplyFormUIModel> getValidator() { - return getUI().getValidator(); - } - - @Override - protected JComponent getComponentToFocus() { - return getUI().getMessage(); - } - - @Override - public Component getTopestUI() { - return getUI(); - } - - public void removeAttachment(ReplyAttachmentModel attachment) { - ReplyFormUIModel model = getModel(); - - model.removeAttachment(attachment); - - model.addAvailableAttachment(attachment); - ui.getAddAttachmentFile().addItem(attachment); - } - - public void addAttachment() { - ReplyFormUIModel model = getModel(); - - JComboBox addAttachmentFile = ui.getAddAttachmentFile(); - ReplyAttachmentModel replyAttachmentModel = null; - Object selectedItem = addAttachmentFile.getSelectedItem(); - - if (ReplyAttachmentModel.class.isAssignableFrom(selectedItem.getClass())) { - replyAttachmentModel = (ReplyAttachmentModel) selectedItem; - addAttachmentToReplyAction.setReplyAttachmentModel(replyAttachmentModel); - getContext().getActionEngine().runActionAndWait(addAttachmentToReplyAction); - - } else if (File.class.isAssignableFrom(selectedItem.getClass())) { - File file = (File) selectedItem; - - AttachmentFile attachmentFile = new AttachmentFileImpl(); - String fileName = file.getName(); - attachmentFile.setFilename(fileName); - - try { - attachmentFile.setContent(FileUtils.readFileToByteArray(file)); - - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("Error while converting the file " + fileName + " into a byte[]", e); - } - } - - Attachment attachment = new AttachmentImpl(); - attachment.setOriginalFile(attachmentFile); - replyAttachmentModel = new ReplyAttachmentModel(attachment, true, fileName); - - } - if (replyAttachmentModel != null) { - model.addAttachment(replyAttachmentModel); - - model.removeAvailableAttachment(replyAttachmentModel); - ui.getAddAttachmentFile().removeItem(replyAttachmentModel); - - addAttachmentFile.setSelectedItem(null); - } - } - - protected void updateAttachmentPanel(Collection<ReplyAttachmentModel> attachments) { - JPanel attachmentsPanel = ui.getAttachmentsPanel(); - attachmentsPanel.removeAll(); - for (ReplyAttachmentModel attachment : attachments) { - AttachmentItem item = new AttachmentItem(); - item.setHandler(this); - item.setReplyAttachmentModel(attachment); - attachmentsPanel.add(item); - } - attachmentsPanel.updateUI(); - } - - public void openLocation() { - // use last selected file - ReplyFormUIModel model = getModel(); - - File startFile = model.getLastVisitedDirectory(); - JFileChooser fc = new JFileChooser(startFile); - -// fc.setDialogTitle(view.getTitle()); - - // used to enable file selection - fc.setFileSelectionMode(JFileChooser.FILES_ONLY); - - int returnVal = fc.showOpenDialog(ui); - model.setLastVisitedDirectory(fc.getCurrentDirectory()); - - if (returnVal == JFileChooser.APPROVE_OPTION) { - - // get selected to display in ui - File file = fc.getSelectedFile(); - - ui.getAddAttachmentFile().setSelectedItem(file); - } - } - - public void openAttachment(ReplyAttachmentModel attachment) { -//TODO kmorin 20140813 action ? - FaxToMailUIUtil.openFile(getContext(), attachment.getAttachmentFile()); - - } - - protected class FileComboBoxEditor implements ComboBoxEditor { - - protected ReplyAttachmentModel oldValue; - - protected JTextField editorComponent = new JTextField(); - - @Override - public Component getEditorComponent() { - return editorComponent; - } - - @Override - public void setItem(Object anObject) { - String text; - ReplyAttachmentModel replyAttachmentModel = null; - if (anObject != null) { - if (ReplyAttachmentModel.class.isAssignableFrom(anObject.getClass())) { - replyAttachmentModel = (ReplyAttachmentModel) anObject; - - } else if (File.class.isAssignableFrom(anObject.getClass())) { - File file = (File) anObject; - - AttachmentFile attachmentFile = new AttachmentFileImpl(); - String fileName = file.getName(); - attachmentFile.setFilename(fileName); - - replyAttachmentModel = new ReplyAttachmentModel(new AttachmentImpl(), true, fileName); - } - } - - if (replyAttachmentModel != null) { - text = replyAttachmentModel.getLabel(); - oldValue = replyAttachmentModel; - - } else { - text = ""; - } - if (! text.equals(editorComponent.getText())) { - editorComponent.setText(text); - } - } - - @Override - public Object getItem() { - Object newValue = editorComponent.getText(); - - if (oldValue != null) { - // The original value is not a string. Should return the value in it's - // original type. - if (newValue.equals(oldValue.getLabel())) { - return oldValue; - - } else { - // Must take the value from the editor and get the value and cast it to the new type. - Class<?> cls = oldValue.getClass(); - try { - Method method = cls.getMethod("valueOf", new Class[]{String.class}); - newValue = method.invoke(oldValue, new Object[] { editorComponent.getText()}); - } catch (Exception ex) { - // Fail silently and return the newValue (a String object) - } - } - } - return newValue; - } - - @Override - public void selectAll() { - editorComponent.selectAll(); - editorComponent.requestFocus(); - } - - @Override - public void addActionListener(ActionListener l) { - editorComponent.addActionListener(l); - } - - @Override - public void removeActionListener(ActionListener l) { - editorComponent.removeActionListener(l); - } - } - - /** - * Close current dialog ui, and reopen a new one for transfering repons to new recipient. - */ - public void forward() { - closeFrame(); - - try { - // display a new ui with a copy of original ui model - ReplyFormUI dialogContent = new ReplyFormUI(ui); - ReplyFormUIModel replyModel = dialogContent.getModel(); - replyModel.fromModel(ui.getModel()); - - // XXX: à verifier pour le format, et si on quote ou pas encore le forward - String quotedReply = t("faxtomail.reply.message", - decorate(replyModel.getReadSentDate()), - replyModel.getFrom(), - replyModel.getMessage().replaceAll("\n", "\n> ")); - replyModel.setMessage(quotedReply); - replyModel.setSubject(t("faxtomail.reply.forwardsubject", replyModel.getSubject())); - - // clear fields that need to be filled by hand - replyModel.setReadonly(false); - replyModel.setReadSentDate(null); - replyModel.setTo(null); - replyModel.setCc(null); - replyModel.setCci(null); - - openFrame(dialogContent, t("faxtomail.reply.forward", getModel().getSubject()), new Dimension(800, 600)); - - } catch (Exception ex) { - if (log.isErrorEnabled()) { - log.error("Can't display forward frame", ex); - } - getContext().getErrorHelper().showErrorDialog(t("faxtomail.demandReplies.error"), ex); - } - - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java deleted file mode 100644 index 4e68e8d..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel.java +++ /dev/null @@ -1,357 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.reply; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.File; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.io.FileUtils; -import org.jdesktop.beans.AbstractSerializableBean; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; - -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.google.common.base.Preconditions; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class ReplyFormUIModel extends AbstractSerializableBean { - - public static final String PROPERTY_TO = "to"; - public static final String PROPERTY_CC = "cc"; - public static final String PROPERTY_CCI = "cci"; - public static final String PROPERTY_FROM = "from"; - public static final String PROPERTY_SUBJECT = "subject"; - public static final String PROPERTY_MESSAGE = "message"; - public static final String PROPERTY_ORIGINAL_DEMAND = "originalDemand"; - public static final String PROPERTY_ATTACHMENT = "attachment"; - public static final String PROPERTY_MAX_ATTACHMENT_LENGTH = "maxAttachmentLength"; - public static final String PROPERTY_TOTAL_ATTACHMENT_LENGTH = "totalAttachmentLength"; - public static final String PROPERTY_VALID = "valid"; - public static final String PROPERTY_SENDER_ALLOWED_DOMAINS = "senderAllowedDomains"; - public static final String PROPERTY_SENDER_ALLOWED_ADDRESSES = "senderAllowedAddresses"; - public static final String PROPERTY_READONLY = "readonly"; - public static final String PROPERTY_EDITABLE = "editable"; - public static final String PROPERTY_READ_SENT_DATE = "readSentDate"; - - protected String to; - protected String cc; - protected String cci; - protected String from; - protected String subject; - protected String message; - protected DemandeUIModel originalDemand; - protected long maxAttachmentLength = 0; - protected long totalAttachmentLength = 0; - protected boolean valid = true; - - /** Flag pour marquer les champs non editables dans le cas d'une lecture d'une réponse déjà envoyée. */ - protected boolean readonly = false; - - /** Flag pour activer ou non la possibilité de transferer la demande. */ - protected boolean editable = false; - - /** Date d'envoi d'une réponse ouverte en lecture seule (peut être {@code null}). */ - protected Date readSentDate; - - protected List<String> senderAllowedDomains; - protected List<String> senderAllowedAddresses; - - protected Set<ReplyAttachmentModel> attachments = new HashSet<ReplyAttachmentModel>(); - protected Set<ReplyAttachmentModel> availableAttachments = new HashSet<ReplyAttachmentModel>(); - - protected File lastVisitedDirectory = FileUtils.getUserDirectory(); - - protected Binder<ReplyFormUIModel, ReplyFormUIModel> copyBinder = BinderFactory.newBinder(ReplyFormUIModel.class); - - public void fromModel(ReplyFormUIModel other) { - copyBinder.copyExcluding(other, this); - } - - public String getTo() { - return to; - } - - public void setTo(String to) { - Object oldValue = getTo(); - this.to = to; - firePropertyChange(PROPERTY_TO, oldValue, to); - } - - public String getCc() { - return cc; - } - public void setCc(String cc) { - Object oldValue = this.cc; - this.cc = cc; - firePropertyChange(PROPERTY_CC, oldValue, cc); - } - - public String getCci() { - return cci; - } - - public void setCci(String cci) { - Object oldValue = this.cci; - this.cci = cci; - firePropertyChange(PROPERTY_CCI, oldValue, cci); - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - Object oldValue = getFrom(); - this.from = from; - firePropertyChange(PROPERTY_FROM, oldValue, from); - } - - public String getSubject() { - return subject; - } - - public void setSubject(String subject) { - Object oldValue = getSubject(); - this.subject = subject; - firePropertyChange(PROPERTY_SUBJECT, oldValue, subject); - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - Object oldValue = getMessage(); - this.message = message; - firePropertyChange(PROPERTY_MESSAGE, oldValue, message); - } - - public DemandeUIModel getOriginalDemand() { - return originalDemand; - } - - public void setOriginalDemand(DemandeUIModel originalDemand) { - Object oldValue = getOriginalDemand(); - this.originalDemand = originalDemand; - firePropertyChange(PROPERTY_ORIGINAL_DEMAND, oldValue, originalDemand); - } - - public Set<ReplyAttachmentModel> getAttachments() { - return attachments; - } - - public void addAttachment(ReplyAttachmentModel attachment) { - attachments.add(attachment); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachments()); - setTotalAttachmentLength(totalAttachmentLength + attachment.getLength()); - } - - public void removeAttachment(ReplyAttachmentModel attachment) { - attachments.remove(attachment); - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachments()); - - setTotalAttachmentLength(totalAttachmentLength - attachment.getLength()); - } - - public void setAttachments(Set<ReplyAttachmentModel> attachments) { - this.attachments = attachments; - if (availableAttachments != null) { - availableAttachments.removeAll(attachments); - } - firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachments()); - } - - public Set<ReplyAttachmentModel> getAvailableAttachments() { - return availableAttachments; - } - - public void addAvailableAttachment(ReplyAttachmentModel attachment) { - availableAttachments.add(attachment); - } - - public void removeAvailableAttachment(ReplyAttachmentModel attachment) { - availableAttachments.remove(attachment); - } - - public File getLastVisitedDirectory() { - return lastVisitedDirectory; - } - - public void setLastVisitedDirectory(File lastVisitedDirectory) { - this.lastVisitedDirectory = lastVisitedDirectory; - } - - public boolean isReadonly() { - return readonly; - } - - public void setReadonly(boolean readonly) { - Object oldValue = isReadonly(); - this.readonly = readonly; - firePropertyChange(PROPERTY_READONLY, oldValue, readonly); - } - - public boolean isEditable() { - return editable; - } - - public void setEditable(boolean editable) { - Object oldValue = isEditable(); - this.editable = editable; - firePropertyChange(PROPERTY_EDITABLE, oldValue, editable); - } - - public void setReadSentDate(Date readSentDate) { - Object oldValue = this.readSentDate; - this.readSentDate = readSentDate; - firePropertyChange(PROPERTY_READ_SENT_DATE, oldValue, readSentDate); - } - - public Date getReadSentDate() { - return readSentDate; - } - - public long getMaxAttachmentLength() { - return maxAttachmentLength / 1024; - } - - public void setMaxAttachmentLength(long maxAttachmentLength) { - Object oldValue = getMaxAttachmentLength(); - this.maxAttachmentLength = maxAttachmentLength; - firePropertyChange(PROPERTY_MAX_ATTACHMENT_LENGTH, oldValue, maxAttachmentLength); - } - - public long getTotalAttachmentLength() { - return totalAttachmentLength / 1024; - } - - public void setTotalAttachmentLength(long totalAttachmentLength) { - Object oldValue = getTotalAttachmentLength(); - this.totalAttachmentLength = totalAttachmentLength; - firePropertyChange(PROPERTY_TOTAL_ATTACHMENT_LENGTH, oldValue, getTotalAttachmentLength()); - } - - public boolean isValid() { - return valid; - } - - public void setValid(boolean valid) { - Object oldValue = isValid(); - this.valid = valid; - firePropertyChange(PROPERTY_VALID, oldValue, valid); - } - - /** - * Appelée par la validation. - * - * Voir le fichier src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml - * - * @param field field to validate - * @return validity - */ - public boolean isValid(String field) { - boolean result = true; - if (PROPERTY_FROM.equals(field)) { - // valid if the email address is in the list of the authorized addresses - // or if the domain is in the authorized domains, or if the domain list is empty - result = isEmailAllowed(getFrom()) || isDomainAllowed(getFrom()); - } - return result; - } - - /** - * Test si un email est present dans une liste (sans tenir compte de la casse). - * - * @param mail email to test - * @return true/false - */ - protected boolean isEmailAllowed(String mail) { - Preconditions.checkNotNull(mail); - List<String> senderAllowedAddresses = getSenderAllowedAddresses(); - if (senderAllowedAddresses != null) { - for (String address : senderAllowedAddresses) { - if (mail.equalsIgnoreCase(address)) { - return true; - } - } - } - return false; - } - - /** - * Test si un email se termine par un des domaines autorisés. - * - * @param mail email to test - * @return true/false - */ - protected boolean isDomainAllowed(String mail) { - Preconditions.checkNotNull(mail); - List<String> senderAllowedDomains = getSenderAllowedDomains(); - - if (CollectionUtils.isEmpty(senderAllowedDomains)) { - return true; - } - for (String domain : senderAllowedDomains) { - if (mail.endsWith(domain)) { - return true; - } - } - return false; - } - - // Do not remove the unused parameter, it is just for the validation - // to bind the totalAttachmentLength property - public boolean isAttachmentSizeValid(long totalAttachmentLength) { - boolean valid = maxAttachmentLength == 0 || this.totalAttachmentLength < maxAttachmentLength; - return valid; - } - - public List<String> getSenderAllowedDomains() { - return senderAllowedDomains; - } - - public void setSenderAllowedDomains(List<String> senderAllowedDomains) { - Object oldValue = getSenderAllowedDomains(); - this.senderAllowedDomains = senderAllowedDomains; - firePropertyChange(PROPERTY_SENDER_ALLOWED_DOMAINS, oldValue, senderAllowedDomains); - } - - public void setSenderAllowedAddresses(List<String> senderAllowedAddresses) { - Object oldValue = getSenderAllowedAddresses(); - this.senderAllowedAddresses = senderAllowedAddresses; - firePropertyChange(PROPERTY_SENDER_ALLOWED_ADDRESSES, oldValue, senderAllowedAddresses); - } - - public List<String> getSenderAllowedAddresses() { - return senderAllowedAddresses; - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css deleted file mode 100644 index ca145cc..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.css +++ /dev/null @@ -1,333 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -.horizontal-separator { - text: " | "; -} -.page-separator { - text: "/"; -} - -JSplitPane { - oneTouchExpandable:true; -} - -BeanFilterableComboBox { - showReset: true; - showDecorator: false; - bean: {model}; -} - -JXDatePicker { - _selectOnFocus: {true}; -} - -.between2ndPartLabel, .between2ndPartLabel_advancedSearch { - text: "faxtomail.search.between2ndPart.label"; -} - -.advancedSearch, .between2ndPartLabel_advancedSearch { - visible: { showAdvancedSearchButton.isSelected() }; -} - -#goToFolderMenu { - actionIcon: list; - text: "faxtomail.search.action.gotoFolder"; - toolTipText: "faxtomail.search.action.gotoFolder.tip"; - enabled: { model.isMenuEnabled() }; -} - -#modifiedByLabel { - text: "faxtomail.search.modifiedBy.label"; -} - -#takenByLabel { - text: "faxtomail.demande.takenBy.label"; -} - -#takenByComboBox { - property: takenBy; - selectedItem: { model.getTakenBy() }; -} - -#modifiedBetweenLabel { - text: "faxtomail.search.modifiedBetween.label"; -} - -#modifiedBetweenStartDatePicker { - date: { model.getMinModificationDate() }; -} - -#modifiedBetweenEndDatePicker { - date: { model.getMaxModificationDate() }; -} - -#transferBetweenLabel { - text: "faxtomail.search.transferBetween.label"; -} - -#transferBetweenStartDatePicker { - date: { model.getMinTransferDate() }; -} - -#transferBetweenEndDatePicker { - date: { model.getMaxTransferDate() }; -} - -#transferByLabel { - text: "faxtomail.demande.transferBy.label"; -} - -#transferByComboBox { - property: transferBy; - selectedItem: { model.getTransferBy() }; -} - -#receivedBetweenLabel { - text: "faxtomail.search.receivedBetween.label"; -} - -#receivedBetweenStartDatePicker { - date: { model.getMinReceptionDate() }; -} - -#receivedBetweenEndDatePicker { - date: { model.getMaxReceptionDate() }; -} - -#archivedBetweenLabel { - text: "faxtomail.search.archivedBetween.label"; -} - -#archivedBetweenStartDatePicker { - date: { model.getMinArchivedDate() }; -} - -#archivedBetweenEndDatePicker { - date: { model.getMaxArchivedDate() }; -} - -#archivedByLabel { - text: "faxtomail.demande.archivedBy.label"; -} - -#archivedByComboBox { - property: archivedBy; - selectedItem: { model.getArchivedBy() }; -} - -#printedBetweenLabel { - text: "faxtomail.search.printedBetween.label"; -} - -#printedBetweenStartDatePicker { - date: { model.getMinPrintingDate() }; -} - -#printedBetweenEndDatePicker { - date: { model.getMaxPrintingDate() }; -} - -#printedByLabel { - text: "faxtomail.demande.printedBy.label"; -} - -#printedByComboBox { - property: printingBy; - selectedItem: { model.getPrintingBy() }; -} - -#repliedBetweenLabel { - text: "faxtomail.search.repliedBetween.label"; -} - -#repliedBetweenStartDatePicker { - date: { model.getMinReplyDate() }; -} - -#repliedBetweenEndDatePicker { - date: { model.getMaxReplyDate() }; -} - -#repliedByLabel { - text: "faxtomail.demande.repliedBy.label"; -} - -#repliedByComboBox { - property: replyBy; - selectedItem: { model.getReplyBy() }; -} - -#objectLabel { - text: "faxtomail.demande.object.label"; -} - -#objectField { - text: {model.getDemandObject()}; -} - -#senderLabel { - text: "faxtomail.demande.sender.label"; -} - -#senderField { - text: {model.getSender()}; -} - -#clientLabel { - text: "faxtomail.demande.client.label"; -} - -/*#clientField { - text: {model.getClientCode()}; -}*/ - -#docTypeLabel { - text: "faxtomail.demande.docType.label"; -} - -#ediCodeNumberLabel { - text: "faxtomail.demande.ediError.label"; -} - -#ediCodeNumberField { - text: { model.getEdiCodeNumber() }; -} - -#priorityLabel { - text: "faxtomail.demande.priority.label"; -} - -#statusLabel { - text: "faxtomail.demande.status.label"; -} - -#waitingStateLabel { - text: "faxtomail.demande.waitingState.label"; -} - -#projectReferenceLabel { - text: "faxtomail.demande.projectReference.label"; -} - -#projectReferenceField { - text: { model.getProjectReference() }; -} - -#commandNbLabel { - text: "faxtomail.demande.commandNb.label"; -} - -#commandNbField { - text: { model.getCommandNb() }; -} - -#localReferenceLabel { - text: "faxtomail.demande.localReference.label"; -} - -#localReferenceField { - text: { model.getLocalReference() }; -} - -#messageLabel { - text: "faxtomail.demande.comment.label"; -} - -#messageField { - text: { model.getMessage() }; -} - -#bodyLabel { - text: "faxtomail.demande.body.label"; -} - -#bodyField { - text: { model.getBody() }; -} - -#gammeLabel { - text: "faxtomail.demande.gamme.label"; -} - -#showAdvancedSearchButton { - text: { showAdvancedSearchButton.isSelected() ? "faxtomail.search.hideAdvancedSearch.label" : "faxtomail.search.showAdvancedSearch.label" }; - actionIcon: "expand"; - selectedIcon: { JAXXWidgetUtil.createActionIcon("collapse") }; -} - -#searchButton { - text: "faxtomail.search.button.label"; - i18nMnemonic: "faxtomail.search.button.mnemonic"; -} - -#dataTable { - editable: true; - autoCreateRowSorter: true; -} - -#groupButton { - actionIcon: group; - text: "faxtomail.searchToGroup.action.group"; - toolTipText: "faxtomail.searchToGroup.action.group.tip"; - enabled: { model.isGroupEnabled() }; -} - -#cancelButton { - actionIcon: cancel; - text: "faxtomail.searchToGroup.action.cancel"; - toolTipText: "faxtomail.searchToGroup.action.cancel.tip"; -} - - -#totalDemandCountLabel { - text: "faxtomail.demandeList.totalCount"; -} - -#totalDemandCountValue { - text: { String.valueOf(model.getPaginationResult().getCount()) }; -} - -#resultsPerPageLabel { - text: "faxtomail.demandeList.resultPerPage"; -} - -#pageNumberLabel { - text: "faxtomail.demandeList.pages"; -} - -#previousPageButton { - text: "faxtomail.demandeList.goToPreviousPage"; - enabled: { model.getPaginationResult().hasPreviousPage() }; -} - -#currentPageLabel { - text: { String.valueOf(getModel().getPaginationParameter().getPageNumber() + 1) }; -} - -#totalPageNumberLabel { - text: { String.valueOf(getModel().getPaginationResult().getLastPage().getPageNumber() + 1) }; -} - -#nextPageButton { - text: "faxtomail.demandeList.goToNextPage"; - enabled: { model.getPaginationResult().hasNextPage() }; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx deleted file mode 100644 index d30b5f4..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUI.jaxx +++ /dev/null @@ -1,399 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='searchToGroupPanel' layout='{new BorderLayout()}' - implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<SearchUIModel, SearchToGroupUIHandler>'> - - <import> - com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - - com.franciaflex.faxtomail.persistence.entities.HasLabel - com.franciaflex.faxtomail.persistence.entities.Email - com.franciaflex.faxtomail.persistence.entities.DemandType - com.franciaflex.faxtomail.persistence.entities.DemandStatus - com.franciaflex.faxtomail.persistence.entities.Range - com.franciaflex.faxtomail.persistence.entities.Priority - com.franciaflex.faxtomail.persistence.entities.WaitingState - com.franciaflex.faxtomail.persistence.entities.FaxToMailUser - - jaxx.runtime.swing.editor.bean.BeanFilterableComboBox - jaxx.runtime.swing.JAXXWidgetUtil - - org.jdesktop.swingx.JXDatePicker - org.jdesktop.swingx.JXTable - - java.awt.FlowLayout - </import> - - <script><![CDATA[ - - public SearchToGroupUI(FaxToMailUI parentUI) { - FaxToMailUIUtil.setParentUI(this, parentUI); - } - - ]]></script> - - <SearchUIModel id='model' - initializer='getContextValue(SearchUIModel.class)'/> - - <JSplitPane orientation="{JSplitPane.VERTICAL_SPLIT}" - constraints='BorderLayout.CENTER'> - - <JPanel layout='{new BorderLayout()}'> - <JScrollPane id='searchScrollPane' constraints='BorderLayout.CENTER'> - - <Table fill='horizontal'> - - <row> - <cell anchor='west'> - <JLabel id='receivedBetweenLabel'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='receivedBetweenStartDatePicker' - onActionPerformed="model.setMinReceptionDate(receivedBetweenStartDatePicker.getDate())"/> - </cell> - - <cell> - <JLabel styleClass='between2ndPartLabel'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='receivedBetweenEndDatePicker' - onActionPerformed="model.setMaxReceptionDate(receivedBetweenEndDatePicker.getDate())"/> - </cell> - - <cell> - <JLabel id='priorityLabel'/> - </cell> - <cell weightx='2'> - <JComboBox id='priorityComboBox' genericType="Priority"/> - </cell> - </row> - - <row> - <cell> - <JLabel id='commandNbLabel'/> - </cell> - <cell columns='3' weightx='1'> - <JTextField id='commandNbField' - onKeyReleased='handler.setText(event, "commandNb")'/> - </cell> - - <cell> - <JLabel id='waitingStateLabel'/> - </cell> - <cell columns='1' weightx='1'> - <JComboBox id='waitingStateComboBox' genericType="WaitingState"/> - </cell> - </row> - - <row> - <cell> - <JLabel id='projectReferenceLabel'/> - </cell> - <cell columns='3' weightx='1'> - <JTextField id='projectReferenceField' - onKeyReleased='handler.setText(event, "projectReference")'/> - </cell> - - <cell> - <JLabel id='localReferenceLabel'/> - </cell> - <cell columns='1' weightx='1'> - <JTextField id='localReferenceField' - onKeyReleased='handler.setText(event, "localReference")'/> - </cell> - - </row> - - <row> - <cell> - <JLabel id='gammeLabel'/> - </cell> - <cell columns='3' weightx='1'> - <JComboBox id='gammeComboBox' genericType="Range"/> - </cell> - - <cell> - <JLabel id='objectLabel'/> - </cell> - <cell columns='1' weightx='1'> - <JTextField id='objectField' - onKeyReleased='handler.setText(event, "demandObject")'/> - </cell> - </row> - - <row> - <cell> - <JLabel id='docTypeLabel'/> - </cell> - <cell columns='3' weightx='1'> - <JComboBox id='docTypeComboBox' genericType="DemandType" /> - </cell> - - <cell> - <JLabel id='bodyLabel'/> - </cell> - <cell columns='1' weightx='1'> - <JTextField id='bodyField' - onKeyReleased='handler.setText(event, "body")'/> - </cell> - </row> - - <row> - <cell> - <JLabel id='clientLabel'/> - </cell> - <cell columns='3' weightx='1'> - <JTextField id='clientField' - onKeyReleased='handler.setText(event, "clientCode")'/> - </cell> - - <cell> - <JLabel id='messageLabel'/> - </cell> - <cell columns='1' weightx='1'> - <JTextField id='messageField' - onKeyReleased='handler.setText(event, "message")'/> - </cell> - </row> - - <row> - <cell> - <JLabel id='senderLabel'/> - </cell> - <cell columns='3' weightx="1"> - <JTextField id='senderField' - onKeyReleased='handler.setText(event, "sender")'/> - </cell> - - <cell> - <JLabel id='statusLabel'/> - </cell> - <cell weightx='1'> - <JComboBox id='statusComboBox' genericType="DemandStatus"/> - </cell> - </row> - - <row> - <cell fill="none" columns="6" anchor="east"> - <JToggleButton id="showAdvancedSearchButton"/> - </cell> - </row> - - <row> - <cell> - <JLabel id='takenByLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='2'> - <BeanFilterableComboBox id='takenByComboBox' - styleClass="advancedSearch" - constructorParams='this' - genericType="FaxToMailUser"/> - </cell> - - <cell> - <JLabel id='ediCodeNumberLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='1'> - <JTextField id='ediCodeNumberField' styleClass="advancedSearch" - onKeyReleased='handler.setText(event, "ediCodeNumber")'/> - </cell> - </row> - - <row> - <cell anchor='west'> - <JLabel id='modifiedBetweenLabel' styleClass="advancedSearch"/> - </cell> - <cell weightx='1'> - <JXDatePicker id='modifiedBetweenStartDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMinModificationDate(modifiedBetweenStartDatePicker.getDate())"/> - </cell> - <cell> - <JLabel styleClass='between2ndPartLabel_advancedSearch'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='modifiedBetweenEndDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMaxModificationDate(modifiedBetweenEndDatePicker.getDate())"/> - </cell> - - <cell anchor='west'> - <JLabel id='modifiedByLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='2'> - <BeanFilterableComboBox id='modifiedByComboBox' - styleClass="advancedSearch" - constructorParams='this' - genericType="FaxToMailUser"/> - </cell> - </row> - - <row> - <cell anchor='west'> - <JLabel id='transferBetweenLabel' styleClass="advancedSearch"/> - </cell> - <cell weightx='1'> - <JXDatePicker id='transferBetweenStartDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMinTransferDate(transferBetweenStartDatePicker.getDate())"/> - </cell> - <cell> - <JLabel styleClass='between2ndPartLabel_advancedSearch'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='transferBetweenEndDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMaxTransferDate(transferBetweenEndDatePicker.getDate())"/> - </cell> - - <cell anchor='west'> - <JLabel id='transferByLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='2'> - <BeanFilterableComboBox id='transferByComboBox' - styleClass="advancedSearch" - constructorParams='this' - genericType="FaxToMailUser"/> - </cell> - </row> - - <row> - <cell anchor='west'> - <JLabel id='archivedBetweenLabel' styleClass="advancedSearch"/> - </cell> - <cell weightx='1'> - <JXDatePicker id='archivedBetweenStartDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMinArchivedDate(archivedBetweenStartDatePicker.getDate())"/> - </cell> - <cell> - <JLabel styleClass='between2ndPartLabel_advancedSearch'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='archivedBetweenEndDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMaxArchivedDate(archivedBetweenEndDatePicker.getDate())"/> - </cell> - - <cell anchor='west'> - <JLabel id='archivedByLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='2'> - <BeanFilterableComboBox id='archivedByComboBox' - styleClass="advancedSearch" - constructorParams='this' - genericType="FaxToMailUser"/> - </cell> - </row> - - <row> - <cell anchor='west'> - <JLabel id='printedBetweenLabel' styleClass="advancedSearch"/> - </cell> - <cell weightx='1'> - <JXDatePicker id='printedBetweenStartDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMinPrintingDate(printedBetweenStartDatePicker.getDate())"/> - </cell> - <cell> - <JLabel styleClass='between2ndPartLabel_advancedSearch'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='printedBetweenEndDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMaxPrintingDate(printedBetweenEndDatePicker.getDate())"/> - </cell> - - <cell anchor='west'> - <JLabel id='printedByLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='2'> - <BeanFilterableComboBox id='printedByComboBox' - styleClass="advancedSearch" - constructorParams='this' - genericType="FaxToMailUser"/> - </cell> - </row> - - <row> - <cell anchor='west'> - <JLabel id='repliedBetweenLabel' styleClass="advancedSearch"/> - </cell> - <cell weightx='1'> - <JXDatePicker id='repliedBetweenStartDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMinReplyDate(repliedBetweenStartDatePicker.getDate())"/> - </cell> - <cell> - <JLabel styleClass='between2ndPartLabel_advancedSearch'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='repliedBetweenEndDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMaxReplyDate(repliedBetweenEndDatePicker.getDate())"/> - </cell> - - <cell anchor='west'> - <JLabel id='repliedByLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='2'> - <BeanFilterableComboBox id='repliedByComboBox' - styleClass="advancedSearch" - constructorParams='this' - genericType="FaxToMailUser"/> - - </cell> - </row> - - </Table> - </JScrollPane> - - <JPanel constraints='BorderLayout.SOUTH'> - <JButton id="searchButton" onActionPerformed="handler.searchDemandes()" /> - </JPanel> - </JPanel> - - <JPanel layout='{new BorderLayout()}'> - <JScrollPane constraints='BorderLayout.CENTER'> - <JXTable id='dataTable'/> - </JScrollPane> - <JPanel layout="{new FlowLayout(FlowLayout.LEADING)}" constraints='BorderLayout.SOUTH'> - <JLabel id="totalDemandCountLabel" /> - <JLabel id="totalDemandCountValue" /> - - <JLabel styleClass="horizontal-separator" /> - <JLabel id="resultsPerPageLabel" /> - <JComboBox id="resultPerPageCombo" genericType="Integer" /> - - <JLabel styleClass="horizontal-separator"/> - - <JLabel id="pageNumberLabel" /> - <JButton id="previousPageButton" - onActionPerformed="handler.goToPreviousPage()"/> - <JLabel id="currentPageLabel" /> - <JLabel styleClass="page-separator"/> - <JLabel id="totalPageNumberLabel" /> - <JButton id="nextPageButton" - onActionPerformed="handler.goToNextPage()" /> - </JPanel> - </JPanel> - - </JSplitPane> - - <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'> - <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> - <JButton id='groupButton' onActionPerformed='handler.group()'/> - </JPanel> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java deleted file mode 100644 index 6979230..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java +++ /dev/null @@ -1,383 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.search; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.awt.Color; -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import javax.swing.*; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - -import com.franciaflex.faxtomail.persistence.entities.HasLabel; -import com.franciaflex.faxtomail.persistence.entities.SearchFilter; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox; -import jaxx.runtime.validator.swing.SwingValidator; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.JXDatePicker; -import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.decorator.ColorHighlighter; -import org.jdesktop.swingx.decorator.ComponentAdapter; -import org.jdesktop.swingx.decorator.HighlightPredicate; -import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; -import org.nuiton.jaxx.application.swing.util.Cancelable; - -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.ui.swing.actions.GroupAction; -import com.franciaflex.faxtomail.ui.swing.actions.SearchToGroupAction; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailDemandListHandler; -import com.franciaflex.faxtomail.ui.swing.util.PaginationComboModel; -import org.nuiton.util.pagination.PaginationParameter; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class SearchToGroupUIHandler extends AbstractFaxToMailDemandListHandler<SearchUIModel, SearchToGroupUI> - implements Cancelable { - - /** Logger. */ - private static final Log log = LogFactory.getLog(SearchToGroupUIHandler.class); - - protected List<MailField> tableColumns; - - @Override - public void beforeInit(SearchToGroupUI ui) { - super.beforeInit(ui); - - SearchUIModel searchUIModel = getContext().getSearch(); - if (searchUIModel == null) { - searchUIModel = new SearchUIModel(); -// searchUIModel.setTakenBy(getContext().getCurrentUser()); -// searchUIModel.setModifiedBy(getContext().getCurrentUser()); - - Date now = new Date(); - Calendar cal = Calendar.getInstance(); - cal.add(Calendar.MONTH, -2); - Date twoMonthsAgo = cal.getTime(); - -// searchUIModel.setMaxModificationDate(now); -// searchUIModel.setMinModificationDate(twoMonthsAgo); - searchUIModel.setMaxReceptionDate(now); - searchUIModel.setMinReceptionDate(twoMonthsAgo); - //searchUIModel.setMaxPrintingDate(now); - //searchUIModel.setMinPrintingDate(twoMonthsAgo); - } - - getUI().setContextValue(searchUIModel); - } - - @Override - protected JComponent getComponentToFocus() { - return null; - } - - @Override - public void afterInit(SearchToGroupUI ui) { - initUI(ui); - - List<FaxToMailUser> users = getContext().getFaxtomailUserCache(); - SearchUIModel model = getModel(); - initBeanFilterableComboBox(ui.getTakenByComboBox(), - users, - model.getTakenBy()); - initBeanFilterableComboBox(ui.getModifiedByComboBox(), - users, - model.getModifiedBy()); - initBeanFilterableComboBox(ui.getArchivedByComboBox(), - users, - model.getArchivedBy()); - initBeanFilterableComboBox(ui.getTransferByComboBox(), - users, - model.getTransferBy()); - initBeanFilterableComboBox(ui.getPrintedByComboBox(), - users, - model.getPrintingBy()); - initBeanFilterableComboBox(ui.getRepliedByComboBox(), - users, - model.getReplyBy()); - - initCheckBoxComboBox(ui.getDocTypeComboBox(), - getContext().getDemandTypeCache(), - model.getDemandType(), - SearchFilter.PROPERTY_DEMAND_TYPE, - true); - initCheckBoxComboBox(ui.getPriorityComboBox(), - getContext().getPriorityCache(), - model.getPriority(), - SearchFilter.PROPERTY_PRIORITY, - true); - initCheckBoxComboBox(ui.getWaitingStateComboBox(), - getContext().getWaitingStateCache(), - model.getWaitingStates(), - SearchFilter.PROPERTY_WAITING_STATES, - true); - initCheckBoxComboBox(ui.getStatusComboBox(), - Arrays.asList(DemandStatus.values()), - model.getDemandStatus(), - SearchFilter.PROPERTY_DEMAND_STATUS, - false); - initCheckBoxComboBox(ui.getGammeComboBox(), - getContext().getRangeCache(), - model.getGamme(), - SearchFilter.PROPERTY_GAMME, - false); - - final JXTable dataTable = getUI().getDataTable(); - dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - initDemandeTable(dataTable, true); - - model.addPropertyChangeListener(SearchUIModel.PROPERTY_RESULTS, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - List<DemandeUIModel> emails = (List<DemandeUIModel>) evt.getNewValue(); - AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel(); - dataTableModel.setRows(emails); - - DemandeUIModel currentEmail = getContext().getCurrentEmail(); - if (currentEmail != null) { - int row = dataTableModel.getRowIndex(currentEmail); - if (row > 0) { - dataTable.setRowSelectionInterval(row, row); - } - } - } - }); - - dataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent e) { - if (!e.getValueIsAdjusting()) { - ListSelectionModel selectionModel = (ListSelectionModel) e.getSource(); - SearchUIModel model = getModel(); - int selectedIndex = selectionModel.getLeadSelectionIndex(); - AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel(); - DemandeUIModel selectedModel = selectedIndex < 0 ? null : dataTableModel.getEntry(selectedIndex); - model.setGroupEnabled(!selectionModel.isSelectionEmpty() && isDemandSelectable(selectedModel)); - } - } - }); - - HighlightPredicate rowAlreadyInGroupPredicate = new HighlightPredicate() { - @Override - public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { - int viewRow = adapter.row; - int modelRow = adapter.convertRowIndexToModel(viewRow); - AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel(); - DemandeUIModel row = dataTableModel.getEntry(modelRow); - return !isDemandSelectable(row); - } - }; - dataTable.addHighlighter(new ColorHighlighter(rowAlreadyInGroupPredicate, null, Color.GRAY, Color.GRAY, Color.WHITE)); - - // int combo box for result per page - ui.getResultPerPageCombo().setModel(new PaginationComboModel()); - int resultPerPage = getConfig().getResultPerPage(); - ui.getModel().setResultPerPage(resultPerPage); - ui.getResultPerPageCombo().setSelectedItem(resultPerPage); - ui.getResultPerPageCombo().addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - updateResultPerPage(e); - } - }); - - getContext().getSwingSession().add(ui, true); - } - - - @Override - protected void initTextField(JTextField jTextField) { - super.initTextField(jTextField); - jTextField.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - searchDemandes(); - } - }); - } - - @Override - protected <HL extends HasLabel> void initCheckBoxComboBox(JComboBox<HL> comboBox, List<HL> values, List<HL> selection, String property, boolean addNull) { - super.initCheckBoxComboBox(comboBox, values, selection, property, addNull); - comboBox.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_ENTER) { - searchDemandes(); - } - } - }); - } - - @Override - protected void initDatePicker(JXDatePicker picker) { - super.initDatePicker(picker); - picker.getEditor().addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_ENTER) { - searchDemandes(); - } - } - }); - } - - public void searchDemandes() { - getModel().resetPaginationParameter(); - runSearchAction(); - } - - public void goToNextPage() { - getModel().setPaginationParameter(getModel().getPaginationResult().getNextPage()); - runSearchAction(); - } - - public void goToPreviousPage() { - getModel().setPaginationParameter(getModel().getPaginationResult().getPreviousPage()); - runSearchAction(); - } - - public void updateResultPerPage(ItemEvent event) { - if (event.getStateChange() == ItemEvent.SELECTED) { - int resultPerPage = (Integer)event.getItem(); - getConfig().setResultPerPage(resultPerPage); - getConfig().save(); - getModel().setResultPerPage(resultPerPage); - getModel().resetPaginationParameter(); - runSearchAction(); - } - } - - protected void runSearchAction() { - FaxToMailUIContext context = getContext(); - PaginationParameter currentPaginationParameter = context.getCurrentPaginationParameter(); - if (currentPaginationParameter != null) { - getModel().setPaginationParameter(currentPaginationParameter); - context.setCurrentPaginationParameter(null); - } - - try { - SearchToGroupAction searchAction = new SearchToGroupAction(this); - if (context.isActionInProgress(null)) { - context.getActionEngine().runFullInternalAction(searchAction); - } else { - context.getActionEngine().runAction(searchAction); - } - - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("error while searching", e); - } - context.getErrorHelper().showErrorDialog(t("faxtomail.search.action.error")); - } - } - - @Override - public List<MailField> getColumns() { - if (tableColumns == null) { - tableColumns = getContext().newServiceContext().getConfigurationService().getSearchDisplayColumns(); - } - return tableColumns; - } - - protected boolean isDemandSelectable(DemandeUIModel demand) { - DemandeUIModel currentDemand = getContext().getCurrentEmail(); - return !currentDemand.equals(demand) && !currentDemand.getGroupedDemandes().contains(demand); - } - - @Override - protected MouseListener getDataTableMouseListener() { - return new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) { - group(); - } - } - }; - } - - @Override - protected MailField[] getEditableTableProperties() { - return new MailField[0]; - } - - @Override - public void onCloseUI() { - } - - @Override - public SwingValidator<SearchUIModel> getValidator() { - return null; - } - - @Override - public void cancel() { - getContext().getSwingSession().updateState(); - closeFrame(); - } - - @Override - public Component getTopestUI() { - return getUI(); - } - - public void group(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_ENTER) { - group(); - } - } - - public void group() { - if (getModel().isGroupEnabled()) { - getContext().getActionEngine().runAction(new GroupAction(this)); - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css deleted file mode 100644 index 8dbeb3b..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css +++ /dev/null @@ -1,332 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -.horizontal-separator { - text: " | "; -} -.page-separator { - text: "/"; -} - -JSplitPane { - oneTouchExpandable:true; -} - -BeanFilterableComboBox { - showReset: true; - showDecorator: false; - bean: {model}; -} - -JXDatePicker { - _selectOnFocus: {true}; -} - -.between2ndPartLabel, .between2ndPartLabel_advancedSearch { - text: "faxtomail.search.between2ndPart.label"; -} - -.advancedSearch, .between2ndPartLabel_advancedSearch { - visible: { showAdvancedSearchButton.isSelected() }; -} - -#goToFolderMenu { - actionIcon: list; - text: "faxtomail.search.action.gotoFolder"; - toolTipText: "faxtomail.search.action.gotoFolder.tip"; - enabled: { model.isMenuEnabled() }; -} - -#takenByLabel { - text: "faxtomail.demande.takenBy.label"; -} - -#takenByComboBox { - property: takenBy; - selectedItem: { model.getTakenBy() }; -} - -#modifiedBetweenLabel { - text: "faxtomail.search.modifiedBetween.label"; -} - -#modifiedBetweenStartDatePicker { - date: { model.getMinModificationDate() }; -} - -#modifiedBetweenEndDatePicker { - date: { model.getMaxModificationDate() }; -} - -#modifiedByLabel { - text: "faxtomail.search.modifiedBy.label"; -} - -#modifiedByComboBox { - property: modifiedBy; - selectedItem: { model.getModifiedBy() }; -} - -#transferBetweenLabel { - text: "faxtomail.search.transferBetween.label"; -} - -#transferBetweenStartDatePicker { - date: { model.getMinTransferDate() }; -} - -#transferBetweenEndDatePicker { - date: { model.getMaxTransferDate() }; -} - -#transferByLabel { - text: "faxtomail.demande.transferBy.label"; -} - -#transferByComboBox { - property: transferBy; - selectedItem: { model.getTransferBy() }; -} - -#receivedBetweenLabel { - text: "faxtomail.search.receivedBetween.label"; -} - -#receivedBetweenStartDatePicker { - date: { model.getMinReceptionDate() }; -} - -#receivedBetweenEndDatePicker { - date: { model.getMaxReceptionDate() }; -} - -#archivedBetweenLabel { - text: "faxtomail.search.archivedBetween.label"; -} - -#archivedBetweenStartDatePicker { - date: { model.getMinArchivedDate() }; -} - -#archivedBetweenEndDatePicker { - date: { model.getMaxArchivedDate() }; -} - -#archivedByLabel { - text: "faxtomail.demande.archivedBy.label"; -} - -#archivedByComboBox { - property: archivedBy; - selectedItem: { model.getArchivedBy() }; -} - -#printedBetweenLabel { - text: "faxtomail.search.printedBetween.label"; -} - -#printedBetweenStartDatePicker { - date: { model.getMinPrintingDate() }; -} - -#printedBetweenEndDatePicker { - date: { model.getMaxPrintingDate() }; -} - -#printedByLabel { - text: "faxtomail.demande.printedBy.label"; -} - -#printedByComboBox { - property: printingBy; - selectedItem: { model.getPrintingBy() }; -} - -#repliedBetweenLabel { - text: "faxtomail.search.repliedBetween.label"; -} - -#repliedBetweenStartDatePicker { - date: { model.getMinReplyDate() }; -} - -#repliedBetweenEndDatePicker { - date: { model.getMaxReplyDate() }; -} - -#repliedByLabel { - text: "faxtomail.demande.repliedBy.label"; -} - -#repliedByComboBox { - property: replyBy; - selectedItem: { model.getReplyBy() }; -} - -#objectLabel { - text: "faxtomail.demande.object.label"; -} - -#objectField { - text: {model.getDemandObject()}; -} - -#senderLabel { - text: "faxtomail.demande.sender.label"; -} - -#senderField { - text: {model.getSender()}; -} - -#clientLabel { - text: "faxtomail.demande.client.label"; -} - -#docTypeLabel { - text: "faxtomail.demande.docType.label"; -} - -#ediCodeNumberLabel { - text: "faxtomail.demande.ediError.label"; -} - -#ediCodeNumberField { - text: { model.getEdiCodeNumber() }; -} - -#priorityLabel { - text: "faxtomail.demande.priority.label"; -} - -#statusLabel { - text: "faxtomail.demande.status.label"; -} - -#waitingStateLabel { - text: "faxtomail.demande.waitingState.label"; -} - -#projectReferenceLabel { - text: "faxtomail.demande.projectReference.label"; -} - -#projectReferenceField { - text: { model.getProjectReference() }; -} - -#localReferenceLabel { - text: "faxtomail.demande.localReference.label"; -} - -#localReferenceField { - text: { model.getLocalReference() }; -} - -#commandNbLabel { - text: "faxtomail.demande.commandNb.label"; -} - -#commandNbField { - text: { model.getCommandNb() }; -} - -#messageLabel { - text: "faxtomail.demande.comment.label"; -} - -#messageField { - text: { model.getMessage() }; -} - -#bodyLabel { - text: "faxtomail.demande.body.label"; -} - -#bodyField { - text: { model.getBody() }; -} - -#commandNumberLabel { - text: "faxtomail.demande.commandNumber.label"; -} - -#commandNumberField { - text: { model.getCommandNumber() }; -} - -#gammeLabel { - text: "faxtomail.demande.gamme.label"; -} - -#addGroupedElementCheckbox { - text: "faxtomail.search.addGroupedElement.label"; - selected: { model.isAddGroupDemands() }; -} - -#showAdvancedSearchButton { - text: { showAdvancedSearchButton.isSelected() ? "faxtomail.search.hideAdvancedSearch.label" : "faxtomail.search.showAdvancedSearch.label" }; - icon: { JAXXWidgetUtil.createActionIcon(showAdvancedSearchButton.isSelected() ? "collapse" :"expand") }; -} - -#searchButton { - text: "faxtomail.search.button.label"; - i18nMnemonic: "faxtomail.search.button.mnemonic"; -} - -#dataTable { - editable: true; - autoCreateRowSorter: true; -} - -#totalDemandCountLabel { - text: "faxtomail.demandeList.totalCount"; -} - -#totalDemandCountValue { - text: { String.valueOf(model.getPaginationResult().getCount()) }; -} - -#resultsPerPageLabel { - text: "faxtomail.demandeList.resultPerPage"; -} - -#pageNumberLabel { - text: "faxtomail.demandeList.pages"; -} - -#previousPageButton { - text: "faxtomail.demandeList.goToPreviousPage"; - enabled: { model.getPaginationResult().hasPreviousPage() }; -} - -#currentPageLabel { - text: { String.valueOf(getModel().getPaginationParameter().getPageNumber() + 1) }; -} - -#totalPageNumberLabel { - text: { String.valueOf(getModel().getPaginationResult().getLastPage().getPageNumber() + 1) }; -} - -#nextPageButton { - text: "faxtomail.demandeList.goToNextPage"; - enabled: { model.getPaginationResult().hasNextPage() }; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx deleted file mode 100644 index 2bbff9d..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx +++ /dev/null @@ -1,413 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='searchPanel' layout='{new BorderLayout()}' - implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<SearchUIModel, SearchUIHandler>'> - - <import> - com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - - com.franciaflex.faxtomail.persistence.entities.HasLabel - com.franciaflex.faxtomail.persistence.entities.Email - com.franciaflex.faxtomail.persistence.entities.DemandType - com.franciaflex.faxtomail.persistence.entities.DemandStatus - com.franciaflex.faxtomail.persistence.entities.Range - com.franciaflex.faxtomail.persistence.entities.Priority - com.franciaflex.faxtomail.persistence.entities.WaitingState - com.franciaflex.faxtomail.persistence.entities.FaxToMailUser - - jaxx.runtime.swing.editor.bean.BeanFilterableComboBox - jaxx.runtime.swing.JAXXWidgetUtil - - org.jdesktop.swingx.JXDatePicker - org.jdesktop.swingx.JXTable - - java.awt.FlowLayout - </import> - - <script><![CDATA[ - - public SearchUI(FaxToMailUI parentUI) { - FaxToMailUIUtil.setParentUI(this, parentUI); - } - - ]]></script> - - <SearchUIModel id='model' - initializer='getContextValue(SearchUIModel.class)'/> - - <JPopupMenu id='tablePopup'> - <JMenuItem id='goToFolderMenu' - onActionPerformed='handler.goToMenu()'/> - <!--<JMenuItem id='printMenu'--> - <!--onActionPerformed='handler.print()'/>--> - <!--<JMenuItem id='replyMenu'--> - <!--onActionPerformed='handler.reply()'/>--> - <!--<JMenuItem id='addAttachmentMenu'--> - <!--onActionPerformed='handler.addAttachment()'/>--> - </JPopupMenu> - - <JSplitPane orientation="{JSplitPane.VERTICAL_SPLIT}" - constraints='BorderLayout.CENTER'> - - <JPanel layout='{new BorderLayout()}'> - <JScrollPane id='searchScrollPane' constraints='BorderLayout.CENTER'> - - <Table fill='horizontal'> - - <row> - <cell anchor='west'> - <JLabel id='receivedBetweenLabel'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='receivedBetweenStartDatePicker' - onActionPerformed="model.setMinReceptionDate(receivedBetweenStartDatePicker.getDate())"/> - </cell> - - <cell> - <JLabel styleClass='between2ndPartLabel'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='receivedBetweenEndDatePicker' - onActionPerformed="model.setMaxReceptionDate(receivedBetweenEndDatePicker.getDate())"/> - </cell> - - <cell> - <JLabel id='priorityLabel'/> - </cell> - <cell weightx='2'> - <JComboBox id='priorityComboBox' genericType="Priority"/> - </cell> - </row> - - <row> - <cell> - <JLabel id='commandNbLabel'/> - </cell> - <cell columns='3' weightx='1'> - <JTextField id='commandNbField' - onKeyReleased='handler.setText(event, "commandNb")'/> - </cell> - - <cell> - <JLabel id='waitingStateLabel'/> - </cell> - <cell columns='1' weightx='1'> - <JComboBox id='waitingStateComboBox' genericType="WaitingState"/> - </cell> - </row> - - <row> - <cell> - <JLabel id='projectReferenceLabel'/> - </cell> - <cell columns='3' weightx='1'> - <JTextField id='projectReferenceField' - onKeyReleased='handler.setText(event, "projectReference")'/> - </cell> - - <cell> - <JLabel id='localReferenceLabel'/> - </cell> - <cell columns='1' weightx='1'> - <JTextField id='localReferenceField' - onKeyReleased='handler.setText(event, "localReference")'/> - </cell> - - </row> - - <row> - <cell> - <JLabel id='gammeLabel'/> - </cell> - <cell columns='3' weightx='1'> - <JComboBox id='gammeComboBox' genericType="Range"/> - </cell> - - <cell> - <JLabel id='objectLabel'/> - </cell> - <cell columns='1' weightx='1'> - <JTextField id='objectField' - onKeyReleased='handler.setText(event, "demandObject")'/> - </cell> - </row> - - <row> - <cell> - <JLabel id='docTypeLabel'/> - </cell> - <cell columns='3' weightx='1'> - <JComboBox id='docTypeComboBox' genericType="DemandType" /> - </cell> - - <cell> - <JLabel id='bodyLabel'/> - </cell> - <cell columns='1' weightx='1'> - <JTextField id='bodyField' - onKeyReleased='handler.setText(event, "body")'/> - </cell> - </row> - - <row> - <cell> - <JLabel id='clientLabel'/> - </cell> - <cell columns='3' weightx='1'> - <JTextField id='clientField' - onKeyReleased='handler.setText(event, "clientCode")'/> - </cell> - - <cell> - <JLabel id='messageLabel'/> - </cell> - <cell columns='1' weightx='1'> - <JTextField id='messageField' - onKeyReleased='handler.setText(event, "message")'/> - </cell> - </row> - - <row> - <cell> - <JLabel id='senderLabel'/> - </cell> - <cell columns='3' weightx="1"> - <JTextField id='senderField' - onKeyReleased='handler.setText(event, "sender")'/> - </cell> - - <cell> - <JLabel id='statusLabel'/> - </cell> - <cell weightx='1'> - <JComboBox id='statusComboBox' genericType="DemandStatus"/> - </cell> - </row> - - <row> - <cell columns="5"> - <JCheckBox id="addGroupedElementCheckbox" - onItemStateChanged='handler.setBoolean(event, "addGroupDemands")'/> - </cell> - <cell fill="none" anchor="east"> - <JToggleButton id="showAdvancedSearchButton"/> - </cell> - </row> - - <row> - <cell> - <JLabel id='takenByLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='2'> - <BeanFilterableComboBox id='takenByComboBox' - styleClass="advancedSearch" - constructorParams='this' - genericType="FaxToMailUser"/> - </cell> - - <cell> - <JLabel id='ediCodeNumberLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='1'> - <JTextField id='ediCodeNumberField' styleClass="advancedSearch" - onKeyReleased='handler.setText(event, "ediCodeNumber")'/> - </cell> - </row> - - <row> - <cell anchor='west'> - <JLabel id='modifiedBetweenLabel' styleClass="advancedSearch"/> - </cell> - <cell weightx='1'> - <JXDatePicker id='modifiedBetweenStartDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMinModificationDate(modifiedBetweenStartDatePicker.getDate())"/> - </cell> - <cell> - <JLabel styleClass='between2ndPartLabel_advancedSearch'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='modifiedBetweenEndDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMaxModificationDate(modifiedBetweenEndDatePicker.getDate())"/> - </cell> - - <cell anchor='west'> - <JLabel id='modifiedByLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='2'> - <BeanFilterableComboBox id='modifiedByComboBox' - styleClass="advancedSearch" - constructorParams='this' - genericType="FaxToMailUser"/> - </cell> - </row> - - <row> - <cell anchor='west'> - <JLabel id='transferBetweenLabel' styleClass="advancedSearch"/> - </cell> - <cell weightx='1'> - <JXDatePicker id='transferBetweenStartDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMinTransferDate(transferBetweenStartDatePicker.getDate())"/> - </cell> - <cell> - <JLabel styleClass='between2ndPartLabel_advancedSearch'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='transferBetweenEndDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMaxTransferDate(transferBetweenEndDatePicker.getDate())"/> - </cell> - - <cell anchor='west'> - <JLabel id='transferByLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='2'> - <BeanFilterableComboBox id='transferByComboBox' - styleClass="advancedSearch" - constructorParams='this' - genericType="FaxToMailUser"/> - </cell> - </row> - - <row> - <cell anchor='west'> - <JLabel id='archivedBetweenLabel' styleClass="advancedSearch"/> - </cell> - <cell weightx='1'> - <JXDatePicker id='archivedBetweenStartDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMinArchivedDate(archivedBetweenStartDatePicker.getDate())"/> - </cell> - <cell> - <JLabel styleClass='between2ndPartLabel_advancedSearch'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='archivedBetweenEndDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMaxArchivedDate(archivedBetweenEndDatePicker.getDate())"/> - </cell> - - <cell anchor='west'> - <JLabel id='archivedByLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='2'> - <BeanFilterableComboBox id='archivedByComboBox' - styleClass="advancedSearch" - constructorParams='this' - genericType="FaxToMailUser"/> - </cell> - </row> - - <row> - <cell anchor='west'> - <JLabel id='printedBetweenLabel' styleClass="advancedSearch"/> - </cell> - <cell weightx='1'> - <JXDatePicker id='printedBetweenStartDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMinPrintingDate(printedBetweenStartDatePicker.getDate())"/> - </cell> - <cell> - <JLabel styleClass='between2ndPartLabel_advancedSearch'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='printedBetweenEndDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMaxPrintingDate(printedBetweenEndDatePicker.getDate())"/> - </cell> - - <cell anchor='west'> - <JLabel id='printedByLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='2'> - <BeanFilterableComboBox id='printedByComboBox' - styleClass="advancedSearch" - constructorParams='this' - genericType="FaxToMailUser"/> - </cell> - </row> - - <row> - <cell anchor='west'> - <JLabel id='repliedBetweenLabel' styleClass="advancedSearch"/> - </cell> - <cell weightx='1'> - <JXDatePicker id='repliedBetweenStartDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMinReplyDate(repliedBetweenStartDatePicker.getDate())"/> - </cell> - <cell> - <JLabel styleClass='between2ndPartLabel_advancedSearch'/> - </cell> - <cell weightx='1'> - <JXDatePicker id='repliedBetweenEndDatePicker' styleClass="advancedSearch" - onActionPerformed="model.setMaxReplyDate(repliedBetweenEndDatePicker.getDate())"/> - </cell> - - <cell anchor='west'> - <JLabel id='repliedByLabel' styleClass="advancedSearch"/> - </cell> - <cell columns='3' weightx='2'> - <BeanFilterableComboBox id='repliedByComboBox' - styleClass="advancedSearch" - constructorParams='this' - genericType="FaxToMailUser"/> - - </cell> - </row> - - </Table> - - </JScrollPane> - - <JPanel constraints='BorderLayout.SOUTH'> - <JButton id="searchButton" onActionPerformed="handler.searchDemandes()" /> - </JPanel> - </JPanel> - - <JPanel layout='{new BorderLayout()}'> - <JScrollPane constraints='BorderLayout.CENTER'> - <JXTable id='dataTable' - onMouseClicked='handler.autoSelectRowInTable(event, tablePopup)' - onKeyPressed='handler.openRowMenu(event, tablePopup)'/> - </JScrollPane> - <JPanel layout="{new FlowLayout(FlowLayout.LEADING)}" constraints='BorderLayout.SOUTH'> - <JLabel id="totalDemandCountLabel" /> - <JLabel id="totalDemandCountValue" /> - - <JLabel styleClass="horizontal-separator" /> - <JLabel id="resultsPerPageLabel" /> - <JComboBox id="resultPerPageCombo" genericType="Integer" /> - - <JLabel styleClass="horizontal-separator"/> - - <JLabel id="pageNumberLabel" /> - <JButton id="previousPageButton" - onActionPerformed="handler.goToPreviousPage()"/> - - <JLabel id="currentPageLabel" /> - <JLabel styleClass="page-separator"/> - <JLabel id="totalPageNumberLabel" /> - <JButton id="nextPageButton" - onActionPerformed="handler.goToNextPage()" /> - </JPanel> - </JPanel> - - </JSplitPane> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java deleted file mode 100644 index ac835b0..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java +++ /dev/null @@ -1,354 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.search; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import javax.swing.*; - -import com.franciaflex.faxtomail.persistence.entities.HasLabel; -import com.franciaflex.faxtomail.persistence.entities.SearchFilter; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox; -import jaxx.runtime.validator.swing.SwingValidator; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.JXDatePicker; -import org.jdesktop.swingx.JXTable; -import org.nuiton.jaxx.application.swing.action.ApplicationActionEngine; -import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; -import org.nuiton.jaxx.application.swing.util.CloseableUI; - -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.ui.swing.actions.SearchAction; -import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeListAction; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailDemandListHandler; -import com.franciaflex.faxtomail.ui.swing.util.DemandeTableModel; -import com.franciaflex.faxtomail.ui.swing.util.PaginationComboModel; -import org.nuiton.util.pagination.PaginationParameter; - -/** - * Handler of UI {@link SearchUIHandler}. - * - * @author kmorin - morin@codelutin.com - * - */ -public class SearchUIHandler extends AbstractFaxToMailDemandListHandler<SearchUIModel, SearchUI> implements CloseableUI { - - /** Logger. */ - private static final Log log = LogFactory.getLog(SearchUIHandler.class); - - protected List<MailField> tableColumns; - - @Override - public void beforeInit(SearchUI ui) { - super.beforeInit(ui); - - SearchUIModel searchUIModel = getContext().getSearch(); - if (searchUIModel == null) { - searchUIModel = new SearchUIModel(); -// searchUIModel.setTakenBy(getContext().getCurrentUser()); -// searchUIModel.setModifiedBy(getContext().getCurrentUser()); - - Date now = new Date(); - Calendar cal = Calendar.getInstance(); - cal.add(Calendar.MONTH, -2); - Date twoMonthsAgo = cal.getTime(); - -// searchUIModel.setMaxModificationDate(now); -// searchUIModel.setMinModificationDate(twoMonthsAgo); - searchUIModel.setMaxReceptionDate(now); - searchUIModel.setMinReceptionDate(twoMonthsAgo); - //searchUIModel.setMaxPrintingDate(now); - //searchUIModel.setMinPrintingDate(twoMonthsAgo); - } - - getUI().setContextValue(searchUIModel); - } - - @Override - public void afterInit(SearchUI ui) { - - initUI(ui); - - // this loading take 1,5 seconds - List<FaxToMailUser> users = getContext().getFaxtomailUserCache(); - SearchUIModel model = getModel(); - initBeanFilterableComboBox(ui.getTakenByComboBox(), - users, - model.getTakenBy()); - initBeanFilterableComboBox(ui.getModifiedByComboBox(), - users, - model.getModifiedBy()); - initBeanFilterableComboBox(ui.getArchivedByComboBox(), - users, - model.getArchivedBy()); - initBeanFilterableComboBox(ui.getTransferByComboBox(), - users, - model.getTransferBy()); - initBeanFilterableComboBox(ui.getPrintedByComboBox(), - users, - model.getPrintingBy()); - initBeanFilterableComboBox(ui.getRepliedByComboBox(), - users, - model.getReplyBy()); - - initCheckBoxComboBox(ui.getDocTypeComboBox(), - getContext().getDemandTypeCache(), - model.getDemandType(), - SearchFilter.PROPERTY_DEMAND_TYPE, - true); - initCheckBoxComboBox(ui.getPriorityComboBox(), - getContext().getPriorityCache(), - model.getPriority(), - SearchFilter.PROPERTY_PRIORITY, - true); - initCheckBoxComboBox(ui.getWaitingStateComboBox(), - getContext().getWaitingStateCache(), - model.getWaitingStates(), - SearchFilter.PROPERTY_WAITING_STATES, - true); - initCheckBoxComboBox(ui.getStatusComboBox(), - Arrays.asList(DemandStatus.values()), - model.getDemandStatus(), - SearchFilter.PROPERTY_DEMAND_STATUS, - false); - initCheckBoxComboBox(ui.getGammeComboBox(), - getContext().getRangeCache(), - model.getGamme(), - SearchFilter.PROPERTY_GAMME, - false); - - final JXTable dataTable = getUI().getDataTable(); - dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - initDemandeTable(dataTable, true); - - model.addPropertyChangeListener(SearchUIModel.PROPERTY_RESULTS, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - List<DemandeUIModel> emails = (List<DemandeUIModel>) evt.getNewValue(); - AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel(); - dataTableModel.setRows(emails); - - DemandeUIModel currentEmail = getContext().getCurrentEmail(); - if (currentEmail != null) { - int row = dataTableModel.getRowIndex(currentEmail); - if (row > 0) { - dataTable.setRowSelectionInterval(row, row); - dataTable.scrollRowToVisible(row); - } - } - } - }); - - if (getContext().getSearch() != null) { - runSearchAction(); - } - - // int combo box for result per page - ui.getResultPerPageCombo().setModel(new PaginationComboModel()); - int resultPerPage = getConfig().getResultPerPage(); - ui.getModel().setResultPerPage(resultPerPage); - ui.getResultPerPageCombo().setSelectedItem(resultPerPage); - ui.getResultPerPageCombo().addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - updateResultPerPage(e); - } - }); - } - - @Override - protected void initTextField(JTextField jTextField) { - super.initTextField(jTextField); - jTextField.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - searchDemandes(); - } - }); - } - - @Override - protected <HL extends HasLabel> void initCheckBoxComboBox(JComboBox<HL> comboBox, List<HL> values, List<HL> selection, String property, boolean addNull) { - super.initCheckBoxComboBox(comboBox, values, selection, property, addNull); - comboBox.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_ENTER) { - searchDemandes(); - } - } - }); - } - - @Override - protected void initDatePicker(JXDatePicker picker) { - super.initDatePicker(picker); - picker.getEditor().addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_ENTER) { - searchDemandes(); - } - } - }); - } - - protected void onDoubleClickOnDemande(DemandeUIModel selectedEmail) { - getContext().setCurrentPaginationParameter(getModel().getPaginationParameter()); - } - - public void searchDemandes() { - getModel().resetPaginationParameter(); - runSearchAction(); - } - - public void goToNextPage() { - getModel().setPaginationParameter(getModel().getPaginationResult().getNextPage()); - runSearchAction(); - } - - public void goToPreviousPage() { - getModel().setPaginationParameter(getModel().getPaginationResult().getPreviousPage()); - runSearchAction(); - } - - public void updateResultPerPage(ItemEvent event) { - if (event.getStateChange() == ItemEvent.SELECTED) { - int resultPerPage = (Integer)event.getItem(); - getConfig().setResultPerPage(resultPerPage); - getConfig().save(); - getModel().setResultPerPage(resultPerPage); - getModel().resetPaginationParameter(); - runSearchAction(); - } - } - - protected void runSearchAction() { - FaxToMailUIContext context = getContext(); - PaginationParameter currentPaginationParameter = context.getCurrentPaginationParameter(); - if (currentPaginationParameter != null) { - getModel().setPaginationParameter(currentPaginationParameter); - context.setCurrentPaginationParameter(null); - } - - try { - SearchAction searchAction = new SearchAction(this); - if (context.isActionInProgress(null)) { - context.getActionEngine().runFullInternalAction(searchAction); - } else { - context.getActionEngine().runAction(searchAction); - } - - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("error while searching", e); - } - context.getErrorHelper().showErrorDialog(t("faxtomail.search.action.error")); - } - } - - @Override - public List<MailField> getColumns() { - if (tableColumns == null) { - tableColumns = getContext().newServiceContext().getConfigurationService().getSearchDisplayColumns(); - } - return tableColumns; - } - - @Override - protected JComponent getComponentToFocus() { - return getUI().getModifiedByComboBox(); - } - - @Override - public void onCloseUI() { - if (log.isDebugEnabled()) { - log.debug("closing: " + ui); - } - clearValidators(); - } - - @Override - public boolean quitUI() { -// boolean result = quitScreen( -// getModel().isValid(), -// getModel().isModify(), -// _("tutti.editCruise.askCancelEditBeforeLeaving.cancelSaveCruise"), -// _("tutti.editCruise.askSaveBeforeLeaving.saveCruise"), -// ui.getSaveButton().getAction() -// ); -// return result; - return true; - } - - @Override - public SwingValidator<SearchUIModel> getValidator() { - return null; - } - - @Override - protected void beforeOpenPopup(int rowIndex, int columnIndex) { - super.beforeOpenPopup(rowIndex, columnIndex); - - int selectedRowCount = getUI().getDataTable().getSelectedRowCount(); - - SearchUIModel model = getModel(); - model.setMenuEnabled(selectedRowCount == 1); - } - - public void goToMenu() { - JXTable dataTable = ui.getDataTable(); - int rowIndex = dataTable.getSelectedRow(); - rowIndex = dataTable.convertRowIndexToModel(rowIndex); - DemandeUIModel selectedEmail = ((DemandeTableModel) dataTable.getModel()).getEntry(rowIndex); - getContext().setCurrentEmail(selectedEmail); - getContext().setCurrentMailFolder(selectedEmail.getMailFolder()); - getContext().getActionEngine().runAction(new ShowDemandeListAction(getContext().getMainUI().getHandler())); - } - - @Override - protected MailField[] getEditableTableProperties() { - return new MailField[] { MailField.ATTACHMENT, MailField.REPLIES }; - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java deleted file mode 100644 index 566e929..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java +++ /dev/null @@ -1,471 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.search; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.Date; -import java.util.List; - -import com.franciaflex.faxtomail.persistence.entities.SearchFilter; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; -import org.nuiton.util.pagination.PaginationParameter; -import org.nuiton.util.pagination.PaginationResult; - -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.Priority; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; - -/** - * @author kmorin - kmorin@codelutin.com - * - */ -public class SearchUIModel extends AbstractFaxToMailBeanUIModel<SearchFilter, SearchUIModel> { - - public static final String PROPERTY_RESULTS = "results"; - public static final String PROPERTY_MENU_ENABLED = "menuEnabled"; - public static final String PROPERTY_GROUP_ENABLED = "groupEnabled"; - public static final String PROPERTY_PAGINATION_PARAMETER = "paginationParameter"; - public static final String PROPERTY_PAGINATION_RESULT = "paginationResult"; - public static final String PROPERTY_RESULT_PER_PAGE = "resultPerPage"; - - protected final SearchFilter editObject = new SearchFilter(); - - protected int resultPerPage = 50; - protected PaginationParameter paginationParameter = PaginationParameter.of(0, resultPerPage, Email.PROPERTY_RECEPTION_DATE, false); - protected PaginationResult<Email> paginationResult = PaginationResult.of(null, 0, paginationParameter); - protected List<DemandeUIModel> results; - - protected boolean menuEnabled; - protected boolean groupEnabled; - - protected static Binder<SearchUIModel, SearchFilter> toBeanBinder = - BinderFactory.newBinder(SearchUIModel.class, - SearchFilter.class); - - protected static Binder<SearchFilter, SearchUIModel> fromBeanBinder = - BinderFactory.newBinder(SearchFilter.class, SearchUIModel.class); - - public SearchUIModel() { - super(fromBeanBinder, toBeanBinder); - setAddGroupDemands(true); - } - - public void setSender(String sender) { - Object oldValue = getSender(); - editObject.setSender(sender); - firePropertyChanged(SearchFilter.PROPERTY_SENDER, oldValue, sender); - } - - public String getSender() { - return editObject.getSender(); - } - - public void setDemandObject(String demandObject) { - Object oldValue = getDemandObject(); - editObject.setDemandObject(demandObject); - firePropertyChanged(SearchFilter.PROPERTY_DEMAND_OBJECT, oldValue, demandObject); - } - - public String getDemandObject() { - return editObject.getDemandObject(); - } - - public void setClientCode(String clientCode) { - Object oldValue = getClientCode(); - editObject.setClientCode(clientCode); - firePropertyChanged(SearchFilter.PROPERTY_CLIENT_CODE, oldValue, clientCode); - } - - public String getClientCode() { - return editObject.getClientCode(); - } - - public void setMessage(String message) { - Object oldValue = getMessage(); - editObject.setMessage(message); - firePropertyChanged(SearchFilter.PROPERTY_MESSAGE, oldValue, message); - } - - public String getMessage() { - return editObject.getMessage(); - } - - public void setBody(String body) { - Object oldValue = getBody(); - editObject.setBody(body); - firePropertyChanged(SearchFilter.PROPERTY_BODY, oldValue, body); - } - - public String getBody() { - return editObject.getBody(); - } - - public void setWaitingState(List<WaitingState> waitingStates) { - editObject.setWaitingStates(waitingStates); - firePropertyChanged(SearchFilter.PROPERTY_WAITING_STATES, null, waitingStates); - } - - public List<WaitingState> getWaitingStates() { - return editObject.getWaitingStates(); - } - - public void setTakenBy(FaxToMailUser faxToMailUser) { - Object oldValue = getTakenBy(); - editObject.setTakenBy(faxToMailUser); - firePropertyChanged(SearchFilter.PROPERTY_TAKEN_BY, oldValue, faxToMailUser); - } - - public FaxToMailUser getTakenBy() { - return editObject.getTakenBy(); - } - - public FaxToMailUser getPrintingBy() { - return editObject.getPrintingBy(); - } - - public void setPrintingBy(FaxToMailUser faxToMailUser) { - Object oldValue = getPrintingBy(); - editObject.setPrintingBy(faxToMailUser); - firePropertyChanged(SearchFilter.PROPERTY_PRINTING_BY, oldValue, faxToMailUser); - } - - public FaxToMailUser getArchivedBy() { - return editObject.getArchivedBy(); - } - - public void setArchivedBy(FaxToMailUser faxToMailUser) { - Object oldValue = getArchivedBy(); - editObject.setArchivedBy(faxToMailUser); - firePropertyChanged(SearchFilter.PROPERTY_ARCHIVED_BY, oldValue, faxToMailUser); - } - - public FaxToMailUser getReplyBy() { - return editObject.getReplyBy(); - } - - public void setReplyBy(FaxToMailUser faxToMailUser) { - Object oldValue = getReplyBy(); - editObject.setReplyBy(faxToMailUser); - firePropertyChanged(SearchFilter.PROPERTY_REPLY_BY, oldValue, faxToMailUser); - } - - public List<Priority> getPriority() { - return editObject.getPriority(); - } - - public void setPriority(List<Priority> priority) { - editObject.setPriority(priority); - firePropertyChanged(SearchFilter.PROPERTY_PRIORITY, null, priority); - } - - public List<DemandType> getDemandType() { - return editObject.getDemandType(); - } - - public void setDemandType(List<DemandType> demandType) { - editObject.setDemandType(demandType); - firePropertyChanged(SearchFilter.PROPERTY_DEMAND_TYPE, null, demandType); - } - - public List<DemandStatus> getDemandStatus() { - return editObject.getDemandStatus(); - } - - public void setDemandStatus(List<DemandStatus> demandStatus) { - editObject.setDemandStatus(demandStatus); - firePropertyChanged(SearchFilter.PROPERTY_DEMAND_STATUS, null, demandStatus); - } - - public void setEdiCodeNumber(String ediCodeNumber) { - Object oldValue = getEdiCodeNumber(); - editObject.setEdiCodeNumber(ediCodeNumber); - firePropertyChanged(SearchFilter.PROPERTY_EDI_CODE_NUMBER, oldValue, ediCodeNumber); - } - - public String getEdiCodeNumber() { - return editObject.getEdiCodeNumber(); - } - - public void setProjectReference(String projectReference) { - Object oldValue = getProjectReference(); - editObject.setProjectReference(projectReference); - firePropertyChanged(SearchFilter.PROPERTY_PROJECT_REFERENCE, oldValue, projectReference); - } - - public String getProjectReference() { - return editObject.getProjectReference(); - } - - public String getCommandNb() { - return editObject.getCommandNb(); - } - - public void setCommandNb(String commandNb) { - Object oldValue = getCommandNb(); - editObject.setCommandNb(commandNb); - firePropertyChanged(SearchFilter.PROPERTY_COMMAND_NB, oldValue, commandNb); - } - - public String getLocalReference() { - return editObject.getLocalReference(); - } - - public void setLocalReference(String localReference) { - Object oldValue = getLocalReference(); - editObject.setLocalReference(localReference); - firePropertyChanged(SearchFilter.PROPERTY_LOCAL_REFERENCE, oldValue, localReference); - } - - public FaxToMailUser getModifiedBy() { - return editObject.getModifiedBy(); - } - - public void setModifiedBy(FaxToMailUser modifiedBy) { - Object oldValue = getModifiedBy(); - editObject.setModifiedBy(modifiedBy); - firePropertyChanged(SearchFilter.PROPERTY_MODIFIED_BY, oldValue, modifiedBy); - } - - public FaxToMailUser getTransferBy() { - return editObject.getTransferBy(); - } - - public void setTransferBy(FaxToMailUser transferBy) { - Object oldValue = getTransferBy(); - editObject.setTransferBy(transferBy); - firePropertyChanged(SearchFilter.PROPERTY_TRANSFER_BY, oldValue, transferBy); - } - - public Date getMinModificationDate() { - return editObject.getMinModificationDate(); - } - - public void setMinModificationDate(Date minModificationDate) { - Object oldValue = getMinModificationDate(); - editObject.setMinModificationDate(minModificationDate); - firePropertyChanged(SearchFilter.PROPERTY_MIN_MODIFICATION_DATE, oldValue, minModificationDate); - } - - public Date getMaxModificationDate() { - return editObject.getMaxModificationDate(); - } - - public void setMaxModificationDate(Date maxModificationDate) { - Object oldValue = getMaxModificationDate(); - editObject.setMaxModificationDate(maxModificationDate); - firePropertyChanged(SearchFilter.PROPERTY_MAX_MODIFICATION_DATE, oldValue, maxModificationDate); - } - - public Date getMinReceptionDate() { - return editObject.getMinReceptionDate(); - } - - public void setMinReceptionDate(Date minReceptionDate) { - Object oldValue = getMinReceptionDate(); - editObject.setMinReceptionDate(minReceptionDate); - firePropertyChanged(SearchFilter.PROPERTY_MIN_RECEPTION_DATE, oldValue, minReceptionDate); - } - - public Date getMaxReceptionDate() { - return editObject.getMaxReceptionDate(); - } - - public void setMaxReceptionDate(Date maxReceptionDate) { - Object oldValue = getMaxReceptionDate(); - editObject.setMaxReceptionDate(maxReceptionDate); - firePropertyChanged(SearchFilter.PROPERTY_MAX_RECEPTION_DATE, oldValue, maxReceptionDate); - } - - public Date getMinPrintingDate() { - return editObject.getMinPrintingDate(); - } - - public void setMinPrintingDate(Date minPrintingDate) { - Object oldValue = getMinPrintingDate(); - editObject.setMinPrintingDate(minPrintingDate); - firePropertyChanged(SearchFilter.PROPERTY_MIN_PRINTING_DATE, oldValue, minPrintingDate); - } - - public Date getMaxPrintingDate() { - return editObject.getMaxPrintingDate(); - } - - public void setMaxPrintingDate(Date maxPrintingDate) { - Object oldValue = getMaxPrintingDate(); - editObject.setMaxPrintingDate(maxPrintingDate); - firePropertyChanged(SearchFilter.PROPERTY_MAX_PRINTING_DATE, oldValue, maxPrintingDate); - } - - public Date getMinArchivedDate() { - return editObject.getMinArchivedDate(); - } - - public void setMinArchivedDate(Date minArchivedDate) { - Object oldValue = getMinArchivedDate(); - editObject.setMinArchivedDate(minArchivedDate); - firePropertyChanged(SearchFilter.PROPERTY_MIN_ARCHIVED_DATE, oldValue, minArchivedDate); - } - - public Date getMaxArchivedDate() { - return editObject.getMaxArchivedDate(); - } - - public void setMaxArchivedDate(Date maxArchivedDate) { - Object oldValue = getMaxArchivedDate(); - editObject.setMaxArchivedDate(maxArchivedDate); - firePropertyChanged(SearchFilter.PROPERTY_MAX_ARCHIVED_DATE, oldValue, maxArchivedDate); - } - - public Date getMinReplyDate() { - return editObject.getMinReplyDate(); - } - - public void setMinReplyDate(Date minReplyDate) { - Object oldValue = getMinReplyDate(); - editObject.setMinReplyDate(minReplyDate); - firePropertyChanged(SearchFilter.PROPERTY_MIN_REPLY_DATE, oldValue, minReplyDate); - } - - public Date getMaxReplyDate() { - return editObject.getMaxReplyDate(); - } - - public void setMaxReplyDate(Date maxReplyDate) { - Object oldValue = getMaxReplyDate(); - editObject.setMaxReplyDate(maxReplyDate); - firePropertyChanged(SearchFilter.PROPERTY_MAX_REPLY_DATE, oldValue, maxReplyDate); - } - - public Date getMinTransferDate() { - return editObject.getMinTransferDate(); - } - - public void setMinTransferDate(Date minTransferDate) { - Object oldValue = getMinTransferDate(); - editObject.setMinTransferDate(minTransferDate); - firePropertyChanged(SearchFilter.PROPERTY_MIN_TRANSFER_DATE, oldValue, minTransferDate); - } - - public Date getMaxTransferDate() { - return editObject.getMaxTransferDate(); - } - - public void setMaxTransferDate(Date maxTransferDate) { - Object oldValue = getMaxTransferDate(); - editObject.setMaxTransferDate(maxTransferDate); - firePropertyChanged(SearchFilter.PROPERTY_MAX_TRANSFER_DATE, oldValue, maxTransferDate); - } - - public List<Range> getGamme() { - return editObject.getGamme(); - } - - public void setGamme(List<Range> gamme) { - editObject.setGamme(gamme); - firePropertyChanged(SearchFilter.PROPERTY_GAMME, null, gamme); - } - - public List<DemandeUIModel> getResults() { - return results; - } - - public void setResults(List<DemandeUIModel> results) { - this.results = results; - firePropertyChanged(PROPERTY_RESULTS, null, results); - } - - public void setResultPerPage(int resultPerPage) { - int oldValue = this.resultPerPage; - this.resultPerPage = resultPerPage; - firePropertyChanged(PROPERTY_RESULT_PER_PAGE, oldValue, resultPerPage); - } - - public int getResultPerPage() { - return resultPerPage; - } - - public void setPaginationParameter(PaginationParameter paginationParameter) { - Object oldValue = this.paginationParameter; - this.paginationParameter = paginationParameter; - firePropertyChanged(PROPERTY_PAGINATION_PARAMETER, oldValue, paginationParameter); - } - - public PaginationParameter getPaginationParameter() { - return paginationParameter; - } - - public void resetPaginationParameter() { - setPaginationParameter(PaginationParameter.of(0, resultPerPage, Email.PROPERTY_RECEPTION_DATE, false)); - } - - public void setPaginationResult(PaginationResult<Email> paginationResult) { - Object oldValue = this.paginationResult; - this.paginationResult = paginationResult; - firePropertyChanged(PROPERTY_PAGINATION_RESULT, oldValue, paginationResult); - } - - public PaginationResult<Email> getPaginationResult() { - return paginationResult; - } - - public boolean isMenuEnabled() { - return menuEnabled; - } - - public void setMenuEnabled(boolean menuEnabled) { - Object oldValue = isMenuEnabled(); - this.menuEnabled = menuEnabled; - firePropertyChanged(PROPERTY_MENU_ENABLED, oldValue, menuEnabled); - } - - public boolean isGroupEnabled() { - return groupEnabled; - } - - public void setGroupEnabled(boolean groupEnabled) { - Object oldValue = isGroupEnabled(); - this.groupEnabled = groupEnabled; - firePropertyChanged(PROPERTY_GROUP_ENABLED, oldValue, groupEnabled); - } - - public boolean isAddGroupDemands() { - return editObject.isAddGroupDemands(); - } - - public void setAddGroupDemands(boolean addGroupDemands) { - Object oldValue = isAddGroupDemands(); - editObject.setAddGroupDemands(addGroupDemands); - firePropertyChange(SearchFilter.PROPERTY_ADD_GROUP_DEMANDS, oldValue, addGroupDemands); - } - - @Override - protected SearchFilter newEntity() { - return new SearchFilter(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css deleted file mode 100644 index 9e16ca8..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.css +++ /dev/null @@ -1,47 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#message { - text: "faxtomail.chooseMailFolder.message"; - border: { javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5) }; -} - -#navigationTree { - font-size: "11"; - rootVisible: false; - showsRootHandles: true; -} - -#cancelButton { - actionIcon: cancel; - text: "faxtomail.chooseMailFolder.action.cancel"; - toolTipText: "faxtomail.chooseMailFolder.action.cancel.tip"; -} - -#validateButton { - actionIcon: validate; - text: "faxtomail.chooseMailFolder.action.validate"; - toolTipText: "faxtomail.chooseMailFolder.action.validate.tip"; - _applicationAction: {com.franciaflex.faxtomail.ui.swing.actions.TransmitAction.class}; - enabled: { model.getMailFolder() != null }; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx deleted file mode 100644 index e93bef4..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUI.jaxx +++ /dev/null @@ -1,54 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JPanel id='mailFolderChooser' layout='{new BorderLayout()}' - implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<MailFolderChooserUIModel, MailFolderChooserUIHandler>'> - - <import> - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - - javax.swing.tree.DefaultTreeModel - </import> - - <script><![CDATA[ - public MailFolderChooserUI(FaxToMailUI parentUI, MailFolderChooserUIModel model) { - FaxToMailUIUtil.setParentUI(this, parentUI); - setContextValue(model); - } - ]]></script> - - <MailFolderChooserUIModel id='model' initializer='getContextValue(MailFolderChooserUIModel.class)' /> - - <JLabel id="message" constraints='BorderLayout.NORTH'/> - - <JScrollPane constraints='BorderLayout.CENTER'> - <JTree id="navigationTree"/> - </JScrollPane> - - <JPanel layout='{new GridLayout(1, 0)}' constraints='BorderLayout.SOUTH'> - <JButton id='cancelButton' onActionPerformed='handler.cancel()'/> - <JButton id='validateButton'/> - </JPanel> - -</JPanel> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java deleted file mode 100644 index ce16cb7..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.transmit; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.awt.*; -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import javax.swing.JComponent; -import javax.swing.JTree; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.DefaultMutableTreeNode; - -import jaxx.runtime.validator.swing.SwingValidator; - -import org.nuiton.jaxx.application.swing.util.Cancelable; - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; -import com.franciaflex.faxtomail.ui.swing.util.FolderTreeNode; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class MailFolderChooserUIHandler extends AbstractFaxToMailUIHandler<MailFolderChooserUIModel, MailFolderChooserUI> implements Cancelable { - - @Override - public void afterInit(MailFolderChooserUI mailFolderChooserUI) { - initUI(mailFolderChooserUI); - - MailFolderChooserUIModel model = getModel(); - MailFolder currentMailFolder = model.getDemandeUIModels().get(0).getMailFolder(); - - // on recupere seulement les dossiers qui accepte l'ensemble des états d'attentes de l'ensemble des demandes - Set<WaitingState> allWaitingStates = new HashSet<WaitingState>(); - for (DemandeUIModel demande : model.getDemandeUIModels()) { - if (demande.getWaitingState() != null) { - allWaitingStates.add(demande.getWaitingState()); - } - } - - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - Collection<MailFolder> foldersWithWaitingState = null; - // foldersWithWaitingState reste à null dans le cas ou l'arbre ne doit pas être filtré - // sinon l'appel peut renvoyer une liste de vide dans le cas où aucun dossier n'est selectionnable - if (!allWaitingStates.isEmpty()) { - foldersWithWaitingState = serviceContext.getMailFolderService().getFoldersWithWaitingState(allWaitingStates); - } - - // init tree - Collection<MailFolder> folders = serviceContext.getMailFolderService(). - getRootMailFoldersWithMoveRights(getContext().getCurrentUser()); - JTree navigationTree = ui.getNavigationTree(); - - Map<MailFolder, FolderTreeNode> nodesByFolder = - FaxToMailUIUtil.initFolderTree(getContext(), navigationTree, folders, false); - - for (MailFolder folder : nodesByFolder.keySet()) { - DefaultMutableTreeNode node = nodesByFolder.get(folder); - - if (node.getClass().isAssignableFrom(FolderTreeNode.class)) { - FolderTreeNode folderTreeNode = (FolderTreeNode) node; - MailFolder folderWithAllowMoveDemandIntoFolder = folder; - - // le dossier n'est pas grisé si: - // - le n'est pas le dossier courrant - // - l'utilsateur à les droits sur le dossier - // - le dossier cible à les mêmes etatAttente/typeDemande que toutes les demandes à bouger - folderTreeNode.setCanSelect(!currentMailFolder.equals(folder) && - folderWithAllowMoveDemandIntoFolder.isFolderMoveable() && - (foldersWithWaitingState == null || foldersWithWaitingState.contains(folder))); - } - } - - navigationTree.addTreeSelectionListener(new TreeSelectionListener() { - @Override - public void valueChanged(TreeSelectionEvent e) { - FolderTreeNode folderNode = (FolderTreeNode) e.getPath().getLastPathComponent(); - MailFolder folder = folderNode.getMailFolder(); - if (!folderNode.isCanSelect()) { - folder = null; - } - getModel().setMailFolder(folder); - } - }); - - // fix jaxx binding, apparement, il faut lui refaire un set null - getModel().setMailFolder(null); - } - - @Override - public void onCloseUI() { - } - - @Override - public SwingValidator<MailFolderChooserUIModel> getValidator() { - return null; - } - - @Override - public void cancel() { - closeFrame(); - } - - @Override - protected JComponent getComponentToFocus() { - return ui.getNavigationTree(); - } - - @Override - public Component getTopestUI() { - return getUI(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIModel.java deleted file mode 100644 index 2fa294e..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIModel.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.content.transmit; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.List; - -import org.jdesktop.beans.AbstractBean; - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; - -/** - * Model for mail folder chooser UI. - * - * @author Eric Chatellier - */ -public class MailFolderChooserUIModel extends AbstractBean { - - protected static final String PROPERTY_MAIL_FOLDER = "mailFolder"; - protected static final String PROPERTY_DEMANDE_U_I_MODELS = "demandeUIModels"; - - /** Le dossier de destination du mail après validation de l'action .*/ - protected MailFolder mailFolder; - - /** L'ensemble des demandes concernées par le déplacement. */ - protected List<DemandeUIModel> demandeUIModels; - - public void setMailFolder(MailFolder mailFolder) { - MailFolder oldValue = this.mailFolder; - this.mailFolder = mailFolder; - firePropertyChange(PROPERTY_MAIL_FOLDER, oldValue, mailFolder); - } - - public MailFolder getMailFolder() { - return mailFolder; - } - - public void setDemandeUIModels(List<DemandeUIModel> demandeUIModels) { - this.demandeUIModels = demandeUIModels; - firePropertyChange(PROPERTY_DEMANDE_U_I_MODELS, null, demandeUIModels); - } - - public List<DemandeUIModel> getDemandeUIModels() { - return demandeUIModels; - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailBeanUIModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailBeanUIModel.java deleted file mode 100644 index 19eb817..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailBeanUIModel.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.jdesktop.beans.AbstractSerializableBean; -import org.nuiton.jaxx.application.listener.PropagatePropertyChangeListener; -import org.nuiton.util.beans.Binder; - -/** - * Abstract UI model to edit a bean. - * - * @author kmorin - morin@codelutin.com - * - */ -public abstract class AbstractFaxToMailBeanUIModel<E, B extends AbstractFaxToMailBeanUIModel<E, B>> extends AbstractSerializableBean implements PropagatePropertyChangeListener.PropagatePropertyChange { - - private static final long serialVersionUID = 1L; - - public static final String PROPERTY_ID = "id"; - - public static final String PROPERTY_MODIFY = "modify"; - - public static final String PROPERTY_VALID = "valid"; - - protected String id; - - protected boolean modify; - - protected boolean valid; - - private final Binder<E, B> fromBeanBinder; - - private final Binder<B, E> toBeanBinder; - - protected AbstractFaxToMailBeanUIModel(Binder<E, B> fromBeanBinder, - Binder<B, E> toBeanBinder) { - this.fromBeanBinder = fromBeanBinder; - this.toBeanBinder = toBeanBinder; - } - - public void fromEntity(E entity) { - fromBean(entity); - } - - public E toEntity() { - return toBean(); - } - - public E toEntity(E entity) { - toBeanBinder.copy((B) this, entity); - return entity; - } - - public final void fromBean(E bean) { - fromBeanBinder.copy(bean, (B) this); - } - - public final E toBean() { - E result = newEntity(); - toBeanBinder.copy((B) this, result); - return result; - } - - protected abstract E newEntity(); - - public boolean isModify() { - return modify; - } - - public void setModify(boolean modify) { - Object oldValue = isModify(); - this.modify = modify; - firePropertyChange(PROPERTY_MODIFY, oldValue, modify); - } - - public boolean isValid() { - return valid; - } - - public void setValid(boolean valid) { - Object oldValue = isValid(); - this.valid = valid; - firePropertyChange(PROPERTY_VALID, oldValue, valid); - } - - public boolean isCreate() { - return id == null; - } - - //------------------------------------------------------------------------// - //-- Entity methods --// - //------------------------------------------------------------------------// - - public Integer getIdAsInt() { - return id == null ? null : Integer.valueOf(id); - } - - public void setId(Integer id) { - if (id == null) { - this.id = null; - } else { - this.id = id.toString(); - } - } - - public String getId() { - return id; - } - - public void setId(String id) { - Object oldValue = getId(); - this.id = id; - firePropertyChange(PROPERTY_ID, oldValue, id); - } - - //------------------------------------------------------------------------// - //-- PropagatePropertyChangeListener methods --// - //------------------------------------------------------------------------// - - @Override - public void firePropertyChanged(String propertyName, - Object oldValue, - Object newValue) { - firePropertyChange(propertyName, oldValue, newValue); - } - - /*protected <B> B getChild(Collection<B> child, int index) { - return CollectionUtil.getOrNull(child, index); - }*/ - - /*protected <B> B getChild(List<B> child, int index) { - return CollectionUtil.getOrNull(child, index); - }*/ - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java deleted file mode 100644 index 8e2641c..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java +++ /dev/null @@ -1,349 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.awt.Color; -import java.awt.Component; -import java.awt.Font; -import java.awt.Point; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.List; - -import javax.swing.JPopupMenu; -import javax.swing.JTable; -import javax.swing.SwingUtilities; -import javax.swing.event.ChangeListener; -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.TableCellRenderer; - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.EmailGroup; -import com.franciaflex.faxtomail.ui.swing.content.demande.demandgroup.DemandGroupCellRenderer; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; -import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.decorator.ColorHighlighter; -import org.jdesktop.swingx.decorator.ComponentAdapter; -import org.jdesktop.swingx.decorator.HighlightPredicate; -import org.jdesktop.swingx.decorator.Highlighter; -import org.jdesktop.swingx.table.DefaultTableColumnModelExt; -import org.jdesktop.swingx.table.TableColumnModelExt; -import org.nuiton.decorator.Decorator; -import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; -import org.nuiton.validator.NuitonValidator; -import org.nuiton.validator.NuitonValidatorFactory; -import org.nuiton.validator.NuitonValidatorResult; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.HasLabel; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.Priority; -import com.franciaflex.faxtomail.persistence.entities.RangeRow; -import com.franciaflex.faxtomail.persistence.entities.Reply; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeAction; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentCellEditor; -import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentCellRenderer; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.demande.replies.RepliesCellEditor; -import com.franciaflex.faxtomail.ui.swing.content.demande.replies.RepliesCellRenderer; -import com.google.common.base.Function; -import com.google.common.collect.Lists; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public abstract class AbstractFaxToMailDemandListHandler<M, UI extends FaxToMailUI<M, ?>> extends AbstractFaxToMailUIHandler<M, UI> { - - protected NuitonValidator<DemandeUIModel> demandeUIModelNuitonValidator = NuitonValidatorFactory.newValidator(DemandeUIModel.class);; - - public void initDemandeTable(final JXTable table, boolean sortable) { -// table.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN); - - populateColumnModel(table, sortable); - - table.getTableHeader().setReorderingAllowed(false); - - Highlighter highlighter = new Highlighter() { - @Override - public Component highlight(Component renderer, ComponentAdapter adapter) { - int viewRow = adapter.row; - int modelRow = adapter.convertRowIndexToModel(viewRow); - DemandeUIModel row = ((AbstractApplicationTableModel<DemandeUIModel>) table.getModel()).getEntry(modelRow); - boolean highlight = row.getTakenBy() == null; - if (highlight) { - Font font = renderer.getFont(); - renderer.setFont(font.deriveFont(Font.BOLD)); - } - highlight = row.getArchiveDate() != null; - if (highlight) { - Font font = renderer.getFont(); - renderer.setFont(font.deriveFont(Font.ITALIC)); - renderer.setForeground(adapter.isSelected() ? Color.WHITE : new Color(96, 96, 96)); - } - return renderer; - } - - @Override - public void addChangeListener(ChangeListener l) { - } - - @Override - public void removeChangeListener(ChangeListener l) { - } - - @Override - public ChangeListener[] getChangeListeners() { - return new ChangeListener[0]; - } - }; - table.addHighlighter(highlighter); - - HighlightPredicate rowIsInvalidPredicate = new HighlightPredicate() { - @Override - public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { - int viewRow = adapter.row; - int modelRow = adapter.convertRowIndexToModel(viewRow); - DemandeUIModel row = ((AbstractApplicationTableModel<DemandeUIModel>) table.getModel()).getEntry(modelRow); - return !row.isValid() && row.getTakenBy() != null; - } - }; - Color color = new Color(255, 51, 51); - table.addHighlighter(new ColorHighlighter(rowIsInvalidPredicate, color, Color.WHITE, color.darker(), Color.WHITE)); - - table.addMouseListener(getDataTableMouseListener()); - } - - public abstract List<MailField> getColumns(); - - public String populateColumnModel(JXTable table, boolean sortable) { - List<MailField> columns = getColumns(); - - TableColumnModelExt columnModel = new DefaultTableColumnModelExt(); - - if (CollectionUtils.isEmpty(columns)) { - columns = Lists.newArrayList(MailField.getTableFields()); - } - - for (MailField columnName : columns) { - - if (MailField.PRIORITY.equals(columnName)) { - FaxToMailServiceContext serviceContext = getContext().newServiceContext(); - addComboDataColumnToModel(columnModel, - DemandeTableModel.COLUMN_IDENTIFIERS.get(columnName), - getDecorator(Priority.class, null), - serviceContext.getReferentielService().getAllPriority()).setSortable(sortable); - - } else if (MailField.ATTACHMENT.equals(columnName)) { - addColumnToModel(columnModel, - AttachmentCellEditor.newEditor(ui), - AttachmentCellRenderer.newRender(getDecorator(Attachment.class, null)), - DemandeTableModel.COLUMN_IDENTIFIERS.get(columnName)).setSortable(sortable); - - } else if (MailField.REPLIES.equals(columnName)) { - addColumnToModel(columnModel, - RepliesCellEditor.newEditor(ui), - RepliesCellRenderer.newRender(getDecorator(Reply.class, null)), - DemandeTableModel.COLUMN_IDENTIFIERS.get(columnName)).setSortable(sortable); - - } else if (MailField.GROUP.equals(columnName)) { - addColumnToModel(columnModel, - null, - DemandGroupCellRenderer.newRender(), - DemandeTableModel.COLUMN_IDENTIFIERS.get(columnName)).setSortable(sortable); - - } else { - TableCellRenderer tableCellRenderer; - switch (columnName) { - case RECEPTION_DATE: - tableCellRenderer = newTableCellRender(Date.class); - break; - - case PF_NB: - tableCellRenderer = new QuantityTableCellRenderer(new Function<RangeRow, Integer>() { - @Override - public Integer apply(RangeRow input) { - return input != null ? input.getProductQuantity() : null; - } - }); - break; - case SAV_NB: - tableCellRenderer = new QuantityTableCellRenderer(new Function<RangeRow, Integer>() { - @Override - public Integer apply(RangeRow input) { - return input != null ? input.getSavQuantity() : null; - } - }); - break; - - case DEMAND_STATUS: - tableCellRenderer = newTableCellRender(DemandStatus.class); - break; - - case DEMAND_TYPE: - case WAITING_STATE: - tableCellRenderer = newTableCellRender(HasLabel.class); - break; - - case TAKEN_BY: - case LAST_ATTACHMENT_OPENING_IN_THIS_FOLDER_USER: - tableCellRenderer = newTableCellRender(FaxToMailUser.class); - break; - - default: - tableCellRenderer = newTableCellRender(new Decorator<Object>(Object.class) { - @Override - public String toString(Object bean) { - return bean == null ? "" : bean.toString(); - } - }); - } - addColumnToModel(columnModel, - null, - tableCellRenderer, - DemandeTableModel.COLUMN_IDENTIFIERS.get(columnName)).setSortable(sortable); - } - } - - final AbstractApplicationTableModel<DemandeUIModel> tableModel = new DemandeTableModel(columnModel, - getEditableTableProperties()); - table.setModel(tableModel); - table.setColumnModel(columnModel); - - return StringUtils.join(columns, "-"); - } - - protected MouseListener getDataTableMouseListener() { - return new MouseAdapter() { - public void mouseClicked(MouseEvent evt) { - if (evt.getClickCount() == 2) { - JXTable table = (JXTable) evt.getSource(); - int rowIndex = table.getSelectedRow(); - if (rowIndex < 0 || rowIndex >= table.getRowCount()) { - return; - } - rowIndex = table.convertRowIndexToModel(rowIndex); - - AbstractApplicationTableModel<DemandeUIModel> tableModel = - (AbstractApplicationTableModel<DemandeUIModel>) table.getModel(); - DemandeUIModel selectedEmail = tableModel.getEntry(rowIndex); - onDoubleClickOnDemande(selectedEmail); - - openDemand(selectedEmail); - } - } - }; - } - - /** - * Auto select closest row near clic-mouse position and display popup menu. - */ - @Override - public void autoSelectRowInTable(MouseEvent e, JPopupMenu popup) { - boolean rightClick = SwingUtilities.isRightMouseButton(e); - if (rightClick) { - // get the coordinates of the mouse click - Point p = e.getPoint(); - - JXTable source = (JXTable) e.getSource(); - - int[] selectedRows = source.getSelectedRows(); - - // get the row index at this point - int rowIndex = source.rowAtPoint(p); - if (rowIndex == -1 || !ArrayUtils.contains(selectedRows, rowIndex)) { - source.clearSelection(); - } - } - - super.autoSelectRowInTable(e, popup); - } - - protected abstract MailField[] getEditableTableProperties(); - - protected void onDoubleClickOnDemande(DemandeUIModel selectedEmail) { - } - - protected void openDemand(DemandeUIModel selectedEmail) { - - FaxToMailUIContext context = getContext(); - - context.setCurrentEmail(selectedEmail); - context.getActionEngine().runAction(new ShowDemandeAction(context.getMainUI().getHandler())); - } - - public boolean isDemandeValid(DemandeUIModel d) { - NuitonValidatorResult result = demandeUIModelNuitonValidator.validate(d); - return result.isValid(); - } - - public class QuantityTableCellRenderer extends DefaultTableCellRenderer { - - protected Function<RangeRow, Integer> getQuantityFunction; - - public QuantityTableCellRenderer(Function<RangeRow, Integer> getQuantityFunction) { - this.getQuantityFunction = getQuantityFunction; - } - - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasfocus, int row, int column) { - super.getTableCellRendererComponent(table, value, isSelected, hasfocus, row, column); - - AbstractApplicationTableModel<DemandeUIModel> tableModel = (AbstractApplicationTableModel<DemandeUIModel>) table.getModel(); - int rowInModel = table.convertRowIndexToModel(row); - DemandeUIModel demande = tableModel.getEntry(rowInModel); - - String tooltipText = null; - - List<String> ranges = new ArrayList<String>(); - Collection<RangeRow> rangeRows = demande.getRangeRow(); - if (rangeRows != null) { - for (RangeRow rangeRow : rangeRows) { - Integer qty = getQuantityFunction.apply(rangeRow); - if (qty != null && qty > 0) { - ranges.add(rangeRow.getRange().getLabel() + " : " + qty); - } - } - } - - if (!ranges.isEmpty()) { - tooltipText = "<html><body>" + StringUtils.join(ranges, "<br/>") + "</body></html>"; - } - setToolTipText(tooltipText); - - return this; - } - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java deleted file mode 100644 index 998f919..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java +++ /dev/null @@ -1,489 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.Serializable; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import javax.swing.*; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.TableColumnModel; -import javax.swing.text.JTextComponent; - -import com.google.common.collect.Lists; -import jaxx.runtime.JAXXUtil; -import jaxx.runtime.SwingUtil; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; -import jaxx.runtime.validator.swing.SwingValidator; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor; -import org.jdesktop.swingx.autocomplete.ObjectToStringConverter; -import org.jdesktop.swingx.table.TableColumnExt; -import org.nuiton.decorator.Decorator; -import org.nuiton.jaxx.application.ApplicationDataUtil; -import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler; -import org.nuiton.jaxx.application.swing.ApplicationUI; -import org.nuiton.jaxx.application.swing.action.AbstractApplicationAction; -import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; -import org.nuiton.jaxx.application.swing.util.Cancelable; -import org.nuiton.jaxx.application.swing.util.CloseableUI; -import org.nuiton.util.beans.BeanUtil; -import org.nuiton.validator.bean.simple.SimpleBeanValidator; - -import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.persistence.entities.Configuration; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.HasLabel; -import com.franciaflex.faxtomail.persistence.entities.MailAction; -import com.franciaflex.faxtomail.services.DecoratorService; -import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.content.MainUI; -import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.google.common.base.Preconditions; -import com.google.common.collect.Sets; - -/** - * Contract of any UI handler. - * - * @author kmorin - morin@codelutin.com - * - */ -public abstract class AbstractFaxToMailUIHandler<M, UI extends FaxToMailUI<M, ?>> - extends AbstractApplicationUIHandler<M, UI> implements UIMessageNotifier { - - /** Logger. */ - private static final Log log = - LogFactory.getLog(AbstractFaxToMailUIHandler.class); - - @Override - public void showInformationMessage(String message) { - getContext().showInformationMessage(message); - } - - public FaxToMailUIContext getContext() { - return (FaxToMailUIContext) super.getContext(); - } - - public FaxToMailConfiguration getConfig() { - return getContext().getConfig(); - } - - @Override - public Component getTopestUI() { - return getContext().getMainUI(); - } - - public void clearValidators() { - MainUI main = getContext().getMainUI(); - Preconditions.checkNotNull( - main, "No mainUI registred in application context"); - MainUIHandler handler = main.getHandler(); - handler.clearValidators(); - } - - @Override - public <O> Decorator<O> getDecorator(Class<O> type, String name) { - DecoratorService decoratorService = getContext().newServiceContext().getDecoratorService(); - - Preconditions.checkNotNull(type); - - Decorator<O> decorator = decoratorService.getDecoratorByType(type, name); - return decorator; - } - - // sonar signale cette methode comme inutile, mais elle augmente la visibilité en fait - // il ne faut pas la supprimer - public String decorate(Serializable s) { - return super.decorate(s); - } - - public String decorateUser(FaxToMailUser user, boolean systemIfNull) { - if (user == null && systemIfNull) { - return t("faxtomail.systemUser"); - } - return decorate(user); - } - - public void setText(ItemEvent e, String property) { - String value = JAXXUtil.getStringValue(e.getItem()); - ApplicationDataUtil.setProperty(getModel(), property, value); - } - - @Override - public void setText(KeyEvent event, String property) { - JTextComponent field = (JTextComponent) event.getSource(); - if (field.isEditable()) { - super.setText(event, property); - } - } - - //------------------------------------------------------------------------// - //-- Internal methods --// - //------------------------------------------------------------------------// - - protected void registerValidators(SwingValidator... validators) { - MainUI main = getContext().getMainUI(); - Preconditions.checkNotNull( - main, "No mainUI registred in application context"); - MainUIHandler handler = main.getHandler(); - handler.clearValidators(); - for (SwingValidator validator : validators) { - handler.registerValidator(validator); - } - } - - protected void listenValidatorValid(SimpleBeanValidator validator, - final AbstractFaxToMailBeanUIModel model) { - validator.addPropertyChangeListener(SimpleBeanValidator.VALID_PROPERTY, new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (log.isDebugEnabled()) { - log.debug("Model [" + model + - "] pass to valid state [" + - evt.getNewValue() + "]"); - } - model.setValid((Boolean) evt.getNewValue()); - } - }); - } - - protected void listenValidationTableHasNoFatalError(final SimpleBeanValidator validator, - final AbstractFaxToMailBeanUIModel model) { - getContext().getMainUI().getValidatorMessageWidget().addTableModelListener(new TableModelListener() { - @Override - public void tableChanged(TableModelEvent e) { - boolean valid = !validator.hasFatalErrors(); - if (log.isDebugEnabled()) { - log.debug("Model [" + model + - "] pass to valid state [" + valid + "]"); - } - model.setValid(valid); - } - }); - } - - protected void listModelIsModify(AbstractFaxToMailBeanUIModel model) { - model.addPropertyChangeListener(new PropertyChangeListener() { - - final Set<String> excludeProperties = getPropertiesToIgnore(); - - @Override - public void propertyChange(PropertyChangeEvent evt) { - Object newValue = evt.getNewValue(); - Object oldValue = evt.getOldValue(); - if (!excludeProperties.contains(evt.getPropertyName()) - //check that the new value and old value are not both null - && newValue != oldValue) { - ((AbstractFaxToMailBeanUIModel) evt.getSource()).setModify(true); - } - } - }); - } - - protected Set<String> getPropertiesToIgnore() { - return Sets.newHashSet( - AbstractFaxToMailBeanUIModel.PROPERTY_MODIFY, - AbstractFaxToMailBeanUIModel.PROPERTY_VALID); - } - - public void openFrame(ApplicationUI dialogContent, - String title, Dimension dim) { - - JFrame result = new JFrame(); - result.setResizable(true); - getContext().setSecondaryFrame(result); - - result.setTitle(title); - result.setContentPane((Container) dialogContent); - - result.setSize(dim); - - final AbstractApplicationUIHandler handler = dialogContent.getHandler(); - - if (handler instanceof Cancelable) { - - // add a auto-close action - JRootPane rootPane = result.getRootPane(); - - KeyStroke shortcutClosePopup = getContext().getConfiguration().getShortcutClosePopup(); - - rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( - shortcutClosePopup, "close"); - rootPane.getActionMap().put("close", new AbstractAction() { - private static final long serialVersionUID = 1L; - - @Override - public void actionPerformed(ActionEvent e) { - ((org.nuiton.jaxx.application.swing.util.Cancelable) handler).cancel(); - } - }); - } - SwingUtil.center(getContext().getMainUI(), result); - result.setVisible(true); - } - - /** - * Open frame and disable parent frame - */ - public JFrame openModalFrame(final ApplicationUI dialogContent, String title, Dimension dim) { - JFrame result = new JFrame(); - result.setResizable(true); - getContext().setSecondaryFrame(result); - - final JFrame parentContainer = getParentContainer(JFrame.class); - parentContainer.setEnabled(false); - parentContainer.setFocusableWindowState(false); - - result.setTitle(title); - result.setContentPane((Container) dialogContent); - - final AbstractApplicationUIHandler handler = dialogContent.getHandler(); - - if (handler instanceof Cancelable) { - - // add a auto-close action - JRootPane rootPane = result.getRootPane(); - - KeyStroke shortcutClosePopup = getContext().getConfiguration().getShortcutClosePopup(); - - rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( - shortcutClosePopup, "close"); - rootPane.getActionMap().put("close", new AbstractAction() { - private static final long serialVersionUID = 1L; - - @Override - public void actionPerformed(ActionEvent e) { - ((Cancelable) handler).cancel(); - } - }); - } - - SwingUtil.center(getContext().getMainUI(), result); - - result.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - result.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - closeFrame(getContext().getSecondaryFrame(), handler); - } - - @Override - public void windowClosed(WindowEvent e) { - parentContainer.setEnabled(true); - parentContainer.setFocusableWindowState(true); - parentContainer.toFront(); - - Component ui = (Component) e.getSource(); - if (log.isDebugEnabled()) { - log.debug("Destroy ui " + ui); - } - JAXXUtil.destroy(ui); - } - }); - - result.setSize(dim); - SwingUtil.center(parentContainer, result); - result.setVisible(true); - - return result; - } - - /** - * Gros copier/coller de quitScreen() pour appeler runActionAndWait au lieu de saveAction.actionPerformed(null); par defaut - * pour tenter de corriger un problème de concurrence entre l'action de sauvegarde de l'email - * et l'action de rechargement de l'arbre qui fait un closeTransaction au même moment. - * - * @param modelIsValid - * @param modelIsModify - * @param askGiveUpMessage - * @param askSaveMessage - * @param saveAction - * @return - */ - protected boolean quitScreen2(boolean modelIsValid, boolean modelIsModify, String askGiveUpMessage, String askSaveMessage, - AbstractApplicationAction saveAction) { - boolean result; - - if (!modelIsValid) { - - // model is not valid - // ask user to qui or not - result = askCancelEditBeforeLeaving(askGiveUpMessage); - - } else if (modelIsModify) { - - // something is modify ask user what to do - int answer = askSaveBeforeLeaving(askSaveMessage); - switch (answer) { - case JOptionPane.YES_OPTION: - - // ok save - //saveAction.actionPerformed(null); - //XXX echatellier 2010731 : action bloquante - if (getContext().isActionInProgress(null)) { - getContext().getActionEngine().runInternalAction(saveAction); - } else { - getContext().getActionEngine().runActionAndWait(saveAction); - } - result = true; - break; - case JOptionPane.NO_OPTION: - - // do not save but can still quit the screen (so nothing to do) - result = true; - break; - default: - // do not save and stay here (so nothing to do) - result = false; - - } - } else { - - // model is valid and not modify, can safely quit screen - result = true; - } - return result; - } - - public void closeFrame() { - JFrame frame = getParentContainer(JFrame.class); - closeFrame(frame, this); - } - - protected void closeFrame(JFrame frame, AbstractApplicationUIHandler handler) { - if (frame != null) { - boolean canClose = true; - if (handler instanceof CloseableUI) { - canClose = ((CloseableUI) handler).quitUI(); - } - if (canClose) { - frame.dispose(); - } - } - } - - protected <HL extends HasLabel> void initCheckBoxComboBox(final JComboBox<HL> comboBox, - java.util.List<HL> values, - java.util.List<HL> selection, - String property, - boolean addNull) { - - java.util.List<HL> universe = new ArrayList<HL>(); - if (addNull) { - universe.add(null); - } - if (values != null) { - universe.addAll(values); - } - final ComboBoxModel<HL> comboModel = new CheckBoxComboBoxModel<HL>(universe, selection); - comboBox.setModel(comboModel); - comboBox.setRenderer(new CheckBoxListCellRenderer<HL>() { - @Override - protected boolean isCheckBoxSelected(Object value) { - return ((java.util.List<Object>) comboModel.getSelectedItem()).contains(value); - } - }); - final Method mutator = BeanUtil.getMutator(getModel(), property); - comboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - //reopen the combo - SwingUtilities.invokeLater(new Runnable() { - public void run() { - comboBox.showPopup(); - } - }); - - if (e.getStateChange() == ItemEvent.SELECTED) { - BeanUIUtil.invokeMethod(mutator, - getModel(), - e.getItem()); - } - } - }); - } - - public boolean isActionEnabled(DemandeUIModel model, MailAction action, Configuration config) { - - WaitingState waitingState = model.getWaitingState(); - boolean valid = model.isValid(); - - boolean enabled = - waitingState == null && (valid || !FaxToMailServiceUtils.contains(config.getInvalidFormDisabledActions(), action)) - || waitingState != null && - (valid && !FaxToMailServiceUtils.contains(waitingState.getValidFormDisabledActions(), action) - || !valid && !FaxToMailServiceUtils.contains(waitingState.getInvalidFormDisabledActions(), action)); - - return enabled; - } - - protected <R, B> TableColumnExt addComboDataColumnToModel(TableColumnModel model, - ColumnIdentifier<R> identifier, - Decorator<B> decorator, - List<B> data) { - JComboBox comboBox = new JComboBox(); - comboBox.setMaximumRowCount(20); - comboBox.setRenderer(newListCellRender(decorator)); - - List<B> dataToList = Lists.newArrayList(data); - - // add a null value at first position - if (!dataToList.isEmpty() && dataToList.get(0) != null) { - dataToList.add(0, null); - } - SwingUtil.fillComboBox(comboBox, dataToList, null); - - ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator); - BeanUIUtil.decorate(comboBox, converter); - ComboBoxCellEditor editor = new ComboBoxCellEditor(comboBox); - - return addColumnToModel(model, - editor, - newTableCellRender(decorator), - identifier); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupButton.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupButton.java deleted file mode 100644 index 1524e9f..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupButton.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import jaxx.runtime.SwingUtil; - -import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import java.awt.*; -import java.awt.event.HierarchyBoundsAdapter; -import java.awt.event.HierarchyEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public abstract class AbstractToolbarPopupButton<UI extends AbstractToolbarPopupUI> extends JToggleButton { - - private static final long serialVersionUID = 1L; - - protected final UI popup; - - protected boolean popupMoving; - - public AbstractToolbarPopupButton() { - - ImageIcon actionIcon = SwingUtil.createActionIcon(getActionIcon()); - setIcon(actionIcon); - setDisabledIcon(actionIcon); - - popup = createNewPopup(); - - popup.addWindowListener(new WindowAdapter() { - - @Override - public void windowOpened(WindowEvent e) { - setSelected(true); - } - - @Override - public void windowClosing(WindowEvent e) { - setSelected(false); - } - - @Override - public void windowClosed(WindowEvent e) { - setSelected(false); - } - }); - - addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - if (isSelected()) { - if (!popup.isVisible()) { - popup.openEditor(AbstractToolbarPopupButton.this); - } - } else { - popup.closeEditor(); - } - } - }); - - addHierarchyBoundsListener(new HierarchyBoundsAdapter() { - - @Override - public void ancestorMoved(HierarchyEvent e) { - if (popup.isShowing()) { - - // place dialog just under the button - Point point = new Point(getLocationOnScreen()); - point.translate(-popup.getWidth() + getWidth(), getHeight()); - popupMoving = true; - try { - popup.setLocation(point); - } finally { - popupMoving = false; - } - } - } - }); - } - - protected abstract String getActionIcon(); - - protected abstract UI createNewPopup(); - - public void onCloseUI() { - setSelected(false); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupHandler.java deleted file mode 100644 index 944104d..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupHandler.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import jaxx.runtime.SwingUtil; -import jaxx.runtime.swing.ComponentMover; -import jaxx.runtime.swing.ComponentResizer; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public abstract class AbstractToolbarPopupHandler<M, UI extends AbstractToolbarPopupUI<M, ?>> extends AbstractFaxToMailUIHandler<M,UI> { - - public static final String CLOSE_DIALOG_ACTION = "closeDialog"; - - public static final String SHOW_DIALOG_ACTION = "showDialog"; - - @Override - public void afterInit(UI ui) { - - initUI(ui); - - ui.pack(); - ui.setResizable(true); - - ComponentResizer cr = new ComponentResizer(); - cr.registerComponent(ui); - ComponentMover cm = new ComponentMover(); - cm.setDragInsets(cr.getDragInsets()); - cm.registerComponent(ui); - - JRootPane rootPane = ui.getRootPane(); - - KeyStroke shortcutClosePopup = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); - - rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( - shortcutClosePopup, CLOSE_DIALOG_ACTION); - - closeAction = new AbstractAction() { - private static final long serialVersionUID = 1L; - - @Override - public void actionPerformed(ActionEvent e) { - AbstractToolbarPopupHandler.this.ui.dispose(); - AbstractToolbarPopupHandler.this.ui.setVisible(false); - } - }; - - openAction = new AbstractAction() { - - private static final long serialVersionUID = 1L; - - @Override - public void actionPerformed(ActionEvent e) { - AbstractToolbarPopupHandler.this.ui.setVisible(true); - } - }; - - ImageIcon actionIcon = SwingUtil.createActionIcon("close-dialog"); - closeAction.putValue(Action.SMALL_ICON, actionIcon); - closeAction.putValue(Action.LARGE_ICON_KEY, actionIcon); - closeAction.putValue(Action.ACTION_COMMAND_KEY, "close"); - closeAction.putValue(Action.NAME, "close"); - closeAction.putValue(Action.SHORT_DESCRIPTION, t("faxtomail.attachmentEditor.action.closeAttachment.tip")); - - rootPane.getActionMap().put(CLOSE_DIALOG_ACTION, closeAction); - rootPane.getActionMap().put(SHOW_DIALOG_ACTION, openAction); - - JButton closeButton = new JButton(closeAction); - closeButton.setText(null); - closeButton.setFocusPainted(false); - closeButton.setRequestFocusEnabled(false); - closeButton.setFocusable(false); - - JToolBar jToolBar = new JToolBar(); - jToolBar.setOpaque(false); - jToolBar.add(closeAction); - jToolBar.setBorderPainted(false); - jToolBar.setFloatable(false); - ui.getBody().setRightDecoration(jToolBar); - } - - protected Action closeAction; - - protected Action openAction; - - public void closeEditor() { - - closeAction.actionPerformed(null); - } - - public void openEditor(JComponent component) { - - if (component != null) { - place(component); - } - openAction.actionPerformed(null); - } - - public void place(JComponent component) { - // Computes the location of bottom left corner of the cell - Component comp = component; - int x = 0; - int y = component.getHeight(); - while (comp != null) { - x += comp.getX(); - y += comp.getY(); - comp = comp.getParent(); - } - - ui.pack(); - // if the editor is too big on the right, - // then align its right side to the right side of the cell - if (x + ui.getWidth() > ui.getOwner().getX() + ui.getOwner().getWidth()) { - x = x - ui.getWidth() + component.getWidth(); - } - ui.setLocation(x, y); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.css b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.css deleted file mode 100644 index b53504d..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.css +++ /dev/null @@ -1,27 +0,0 @@ -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#dialog { - undecorated: true; - //alwaysOnTop: true; -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.jaxx b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.jaxx deleted file mode 100644 index 627420f..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractToolbarPopupUI.jaxx +++ /dev/null @@ -1,56 +0,0 @@ -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JDialog layout='{new BorderLayout()}' - id='dialog' - abstract='true' - genericType="M, H extends AbstractToolbarPopupHandler<M, ?>" - implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<M, H>'> - - <import> - com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext - com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil - - org.jdesktop.swingx.JXTitledPanel - javax.swing.JComponent - </import> - - <script><![CDATA[ - -public AbstractToolbarPopupUI(FaxToMailUIContext context) { - super(context.getMainUI()); - FaxToMailUIUtil.setApplicationContext(this, context); -} - -public void openEditor(JComponent component) { - getHandler().openEditor(component); -} - -public void closeEditor() { - getHandler().closeEditor(); -} - ]]></script> - - <JXTitledPanel id='body' constraints='BorderLayout.CENTER'> - </JXTitledPanel> -</JDialog> diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxComboBoxModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxComboBoxModel.java deleted file mode 100644 index 0afc687..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxComboBoxModel.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.HasLabel; -import com.google.common.collect.Iterables; - -import javax.swing.*; -import java.util.ArrayList; -import java.util.List; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class CheckBoxComboBoxModel<HL extends HasLabel> extends AbstractListModel<HL> implements ComboBoxModel<HL> { - - private List<Object> selection; - private List<HL> values; - - public CheckBoxComboBoxModel(List<HL> values, List<HL> selection) { - this.values = new ArrayList<HL>(); - if (values != null) { - this.values.addAll(values); - } - - this.selection = new ArrayList<Object>(); - if (selection != null) { - this.selection.addAll(selection); - } - } - - @Override - public void setSelectedItem(Object anItem) { - selection = new ArrayList<Object>(selection); - if (selection.contains(anItem)) { - selection.remove(anItem); - - // do not add the item if it si not in the universe values - } else if (values.contains(anItem)) { - selection.add(anItem); - } - } - - @Override - public Object getSelectedItem() { - return selection; - } - - @Override - public int getSize() { - return values.size(); - } - - @Override - public HL getElementAt(int index) { - return Iterables.get(values, index); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java deleted file mode 100644 index 1dd21ed..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CheckBoxListCellRenderer.java +++ /dev/null @@ -1,526 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import javax.swing.*; -import javax.swing.border.*; - -import java.awt.*; - -import java.io.Serializable; - -import com.franciaflex.faxtomail.persistence.entities.HasLabel; -import com.google.common.base.Function; -import com.google.common.collect.Lists; -import org.apache.commons.lang3.StringUtils; - -import static org.nuiton.i18n.I18n.t; - - -/** - * Renders an item in a list. - * <p> - * <strong><a name="override">Implementation Note:</a></strong> - * This class overrides - * <code>invalidate</code>, - * <code>validate</code>, - * <code>revalidate</code>, - * <code>repaint</code>, - * <code>isOpaque</code>, - * and - * <code>firePropertyChange</code> - * solely to improve performance. - * If not overridden, these frequently called methods would execute code paths - * that are unnecessary for the default list cell renderer. - * If you write your own renderer, - * take care to weigh the benefits and - * drawbacks of overriding these methods. - * - * <p> - * - * <strong>Warning:</strong> - * Serialized objects of this class will not be compatible with - * future Swing releases. The current serialization support is - * appropriate for short term storage or RMI between applications running - * the same version of Swing. As of 1.4, support for long term storage - * of all JavaBeans<sup><font style="font-size: -2">TM</font></sup> - * has been added to the <code>java.beans</code> package. - * Please see {@link java.beans.XMLEncoder}. - * - * @author Philip Milne - * @author Hans Muller - */ -public abstract class CheckBoxListCellRenderer<HL extends HasLabel> - implements ListCellRenderer<Object>, Serializable { - /** - * An empty <code>Border</code>. This field might not be used. To change the - * <code>Border</code> used by this renderer override the - * <code>getListCellRendererComponent</code> method and set the border - * of the returned component directly. - */ - private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); - private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); - protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER; - - protected CheckBoxListCellRendererLabel label = new CheckBoxListCellRendererLabel(); - protected CheckBoxListCellRendererCheckBox checkbox = new CheckBoxListCellRendererCheckBox(); - - /** - * Constructs a default renderer object for an item - * in a list. - */ - public CheckBoxListCellRenderer() { - super(); - label.setText(""); - label.setName("List.cellRenderer"); - checkbox.setName("List.cellRenderer"); - } - - private Border getNoFocusBorder() { - Border border = UIManager.getBorder("List.cellNoFocusBorder"); - if (System.getSecurityManager() != null) { - if (border != null) return border; - return SAFE_NO_FOCUS_BORDER; - } else { - if (border != null && - (noFocusBorder == null || - noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) { - return border; - } - return noFocusBorder; - } - } - - protected abstract boolean isCheckBoxSelected(Object value); - - public Component getListCellRendererComponent( - JList<?> list, - Object value, - final int index, - boolean isSelected, - boolean cellHasFocus) { - - String decorate = ""; - JComponent component = label; - //ComponentUI ui = label.getUI(); - - final String noneLabel = t("faxtomail.common.none.label"); - if (value == null || HasLabel.class.isAssignableFrom(value.getClass())) { - decorate = value != null ? ((HasLabel) value).getLabel() : noneLabel; - checkbox.setSelected(isCheckBoxSelected(value)); - checkbox.setText(decorate); - component = checkbox; - //ui = checkbox.getUI(); - - - } else { - if (value != null && java.util.List.class.isAssignableFrom(value.getClass())) { - java.util.List<HL> etats = (java.util.List<HL>) value; - java.util.List<String> e = Lists.transform(etats, new Function<HL, String>() { - @Override - public String apply(HL input) { - return input != null ? input.getLabel() : noneLabel; - } - }); - decorate = StringUtils.join(e, " ou "); - label.setText(decorate); - } - - Color bg = null; - Color fg = null; - - JList.DropLocation dropLocation = list.getDropLocation(); - if (dropLocation != null - && !dropLocation.isInsert() - && dropLocation.getIndex() == index) { - - bg = UIManager.getColor("List.dropCellBackground"); - fg = UIManager.getColor("List.dropCellForeground"); - - isSelected = true; - } - - if (isSelected) { - component.setBackground(bg == null ? list.getSelectionBackground() : bg); - component.setForeground(fg == null ? list.getSelectionForeground() : fg); - } else { - component.setBackground(list.getBackground()); - component.setForeground(list.getForeground()); - } - } - - component.setComponentOrientation(list.getComponentOrientation()); - - component.setEnabled(list.isEnabled()); - component.setFont(list.getFont()); - - Border border = null; - if (cellHasFocus) { - if (isSelected) { - border = UIManager.getBorder("List.focusSelectedCellHighlightBorder"); - } - if (border == null) { - border = UIManager.getBorder("List.focusCellHighlightBorder"); - } - } else { - border = getNoFocusBorder(); - } - component.setBorder(border); - - return component; - } - - protected class CheckBoxListCellRendererLabel extends JLabel { - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - * - * @return <code>true</code> if the background is completely opaque - * and differs from the JList's background; - * <code>false</code> otherwise - */ - @Override - public boolean isOpaque() { - Color back = getBackground(); - Component p = getParent(); - if (p != null) { - p = p.getParent(); - } - // p should now be the JList. - boolean colorMatch = (back != null) && (p != null) && - back.equals(p.getBackground()) && - p.isOpaque(); - return !colorMatch && super.isOpaque(); - } - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void validate() {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - * - */ - @Override - public void invalidate() {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - * - */ - @Override - public void repaint() {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void revalidate() {} - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void repaint(long tm, int x, int y, int width, int height) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void repaint(Rectangle r) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { - // Strings get interned... - if (propertyName == "text" - || ((propertyName == "font" || propertyName == "foreground") - && oldValue != newValue - && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) { - - super.firePropertyChange(propertyName, oldValue, newValue); - } - } - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, char oldValue, char newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, short oldValue, short newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, int oldValue, int newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, long oldValue, long newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, float oldValue, float newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, double oldValue, double newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {} - - } - - protected class CheckBoxListCellRendererCheckBox extends JCheckBox { - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - * - * @return <code>true</code> if the background is completely opaque - * and differs from the JList's background; - * <code>false</code> otherwise - */ - @Override - public boolean isOpaque() { - Color back = getBackground(); - Component p = getParent(); - if (p != null) { - p = p.getParent(); - } - // p should now be the JList. - boolean colorMatch = (back != null) && (p != null) && - back.equals(p.getBackground()) && - p.isOpaque(); - return !colorMatch && super.isOpaque(); - } - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void validate() {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - * - */ - @Override - public void invalidate() {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - * - */ - @Override - public void repaint() {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void revalidate() {} - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void repaint(long tm, int x, int y, int width, int height) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void repaint(Rectangle r) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { - // Strings get interned... - if (propertyName == "text" - || ((propertyName == "font" || propertyName == "foreground") - && oldValue != newValue - && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) { - - super.firePropertyChange(propertyName, oldValue, newValue); - } - } - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, char oldValue, char newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, short oldValue, short newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, int oldValue, int newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, long oldValue, long newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, float oldValue, float newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, double oldValue, double newValue) {} - - /** - * Overridden for performance reasons. - * See the <a href="#override">Implementation Note</a> - * for more information. - */ - @Override - public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {} - - } - - /** - * A subclass of DefaultListCellRenderer that implements UIResource. - * DefaultListCellRenderer doesn't implement UIResource - * directly so that applications can safely override the - * cellRenderer property with DefaultListCellRenderer subclasses. - * <p> - * <strong>Warning:</strong> - * Serialized objects of this class will not be compatible with - * future Swing releases. The current serialization support is - * appropriate for short term storage or RMI between applications running - * the same version of Swing. As of 1.4, support for long term storage - * of all JavaBeans<sup><font style="font-size: -2">TM</font></sup> - * has been added to the <code>java.beans</code> package. - * Please see {@link java.beans.XMLEncoder}. - */ - public static class UIResource extends DefaultListCellRenderer - implements javax.swing.plaf.UIResource - { - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java deleted file mode 100644 index 505d022..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import org.jdesktop.swingx.table.TableColumnModelExt; -import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel; -import org.nuiton.jaxx.application.swing.table.ColumnIdentifier; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.nuiton.i18n.I18n.n; - -/** - * @author kmorin - kmorin@codelutin.com - * - */ -public class DemandeTableModel extends AbstractApplicationTableModel<DemandeUIModel> { - - public static final Map<MailField, ColumnIdentifier<Email>> COLUMN_IDENTIFIERS = new HashMap<MailField, ColumnIdentifier<Email>>() {{ - put(MailField.SENDER, - ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_SENDER, - n("faxtomail.demandeList.table.header.sender"), - n("faxtomail.demandeList.table.header.sender.tip"))); - - put(MailField.OBJECT, - ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_OBJECT, - n("faxtomail.demandeList.table.header.object"), - n("faxtomail.demandeList.table.header.object.tip"))); - - put(MailField.RECEPTION_DATE, - ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_RECEPTION_DATE, - n("faxtomail.demandeList.table.header.receptionDate"), - n("faxtomail.demandeList.table.header.receptionDate.tip"))); - - put(MailField.RECIPIENT, - ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_RECIPIENT, - n("faxtomail.demandeList.table.header.recipient"), - n("faxtomail.demandeList.table.header.recipient.tip"))); - - put(MailField.CLIENT_CODE, - ColumnIdentifier.<Email>newReadOnlyId( - DemandeUIModel.PROPERTY_CLIENT_CODE, - n("faxtomail.demandeList.table.header.client"), - n("faxtomail.demandeList.table.header.client.tip"))); - - put(MailField.CLIENT_BRAND, - ColumnIdentifier.<Email>newReadOnlyId( - DemandeUIModel.PROPERTY_CLIENT_BRAND, - n("faxtomail.demandeList.table.header.brand"), - n("faxtomail.demandeList.table.header.brand.tip"))); - - put(MailField.DEMAND_STATUS, - ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_DEMAND_STATUS, - n("faxtomail.demandeList.table.header.status"), - n("faxtomail.demandeList.table.header.status.tip"))); - - put(MailField.DEMAND_TYPE, - ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_DEMAND_TYPE, - n("faxtomail.demandeList.table.header.type"), - n("faxtomail.demandeList.table.header.type.tip"))); - - put(MailField.EDI_RETURN, - ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_EDI_ERROR, - n("faxtomail.demandeList.table.header.ediCodeNumber"), - n("faxtomail.demandeList.table.header.ediCodeNumber.tip"))); - - put(MailField.WAITING_STATE, - ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_WAITING_STATE, - n("faxtomail.demandeList.table.header.waitingState"), - n("faxtomail.demandeList.table.header.waitingState.tip"))); - - put(MailField.TAKEN_BY, - ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_TAKEN_BY, - n("faxtomail.demandeList.table.header.user"), - n("faxtomail.demandeList.table.header.user.tip"))); - - put(MailField.PRIORITY, - ColumnIdentifier.<Email>newId( - Email.PROPERTY_PRIORITY, - n("faxtomail.demandeList.table.header.priority"), - n("faxtomail.demandeList.table.header.priority.tip"))); - - put(MailField.PROJECT_REFERENCE, - ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_PROJECT_REFERENCE, - n("faxtomail.demandeList.table.header.projectReference"), - n("faxtomail.demandeList.table.header.projectReference.tip"))); - - put(MailField.COMPANY_REFERENCE, - ColumnIdentifier.<Email>newReadOnlyId( - Email.PROPERTY_COMPANY_REFERENCE, - n("faxtomail.demandeList.table.header.companyReference"), - n("faxtomail.demandeList.table.header.companyReference.tip"))); - - put(MailField.REFERENCE, - ColumnIdentifier.<Email>newReadOnlyId( - DemandeUIModel.PROPERTY_REFERENCE, - n("faxtomail.demandeList.table.header.reference"), - n("faxtomail.demandeList.table.header.reference.tip"))); - - put(MailField.PF_NB, - ColumnIdentifier.<Email>newReadOnlyId( - DemandeUIModel.PROPERTY_PF_NB, - n("faxtomail.demandeList.table.header.pfNb"), - n("faxtomail.demandeList.table.header.pfNb.tip"))); - - put(MailField.SAV_NB, - ColumnIdentifier.<Email>newReadOnlyId( - DemandeUIModel.PROPERTY_SAV_NB, - n("faxtomail.demandeList.table.header.savNb"), - n("faxtomail.demandeList.table.header.savNb.tip"))); - - put(MailField.QUOTATION_NB, - ColumnIdentifier.<Email>newReadOnlyId( - DemandeUIModel.PROPERTY_QUOTATION_NB, - n("faxtomail.demandeList.table.header.quotationNb"), - n("faxtomail.demandeList.table.header.quotationNb.tip"))); - - put(MailField.REPLIES, - ColumnIdentifier.<Email>newId( - Email.PROPERTY_REPLIES, - n("faxtomail.demandeList.table.header.replies"), - n("faxtomail.demandeList.table.header.replies.tip"))); - - put(MailField.ATTACHMENT, - ColumnIdentifier.<Email>newId( - Email.PROPERTY_ATTACHMENT, - n("faxtomail.demandeList.table.header.attachment"), - n("faxtomail.demandeList.table.header.attachment.tip"))); - - put(MailField.GROUP, - ColumnIdentifier.<Email>newId( - DemandeUIModel.PROPERTY_GROUPED_DEMANDES, - n("faxtomail.demandeList.table.header.emailGroup"), - n("faxtomail.demandeList.table.header.emailGroup.tip"))); - - put(MailField.LAST_ATTACHMENT_OPENING_IN_THIS_FOLDER_USER, - ColumnIdentifier.<Email>newId( - Email.PROPERTY_LAST_ATTACHMENT_OPENER, - n("faxtomail.demandeList.table.header.lastAttachmentOpeningUser"), - n("faxtomail.demandeList.table.header.lastAttachmentOpeningUser.tip"))); - - put(MailField.COMMENT, - ColumnIdentifier.<Email>newId( - Email.PROPERTY_COMMENT, - n("faxtomail.demandeList.table.header.comment"), - n("faxtomail.demandeList.table.header.comment.tip"))); - - }}; - - public DemandeTableModel(TableColumnModelExt columnModel, MailField... editableProperties) { - super(columnModel, false, false); - List<ColumnIdentifier> nonEditableColumns = new ArrayList<ColumnIdentifier>(COLUMN_IDENTIFIERS.values()); - for (MailField editableProperty : editableProperties) { - nonEditableColumns.remove(COLUMN_IDENTIFIERS.get(editableProperty)); - } - setNoneEditableCols(nonEditableColumns.toArray(new ColumnIdentifier[nonEditableColumns.size()])); - } - - @Override - public DemandeUIModel createNewRow() { - return new DemandeUIModel(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailExceptionHandler.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailExceptionHandler.java deleted file mode 100644 index d453180..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailExceptionHandler.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.ui.swing.actions.AbstractChangeScreenAction; -import com.franciaflex.faxtomail.ui.swing.actions.AbstractFaxToMailAction; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.jaxx.application.swing.action.ApplicationActionException; -import org.nuiton.jaxx.application.swing.util.ApplicationErrorHelper; -import org.nuiton.jaxx.application.swing.util.ApplicationExceptionHandler; - -/** - * FaxToMail global exception handler. - * - * Catch all application uncaught and display it in a custom JoptionPane - * or JXErrorPane. - * - * See http://stackoverflow.com/a/4448569/1165234 for details. - * - * @author kmorin - morin@codelutin.com - */ -public class FaxToMailExceptionHandler extends ApplicationExceptionHandler { - - private static final Log log = - LogFactory.getLog(FaxToMailExceptionHandler.class); - - public FaxToMailExceptionHandler(ApplicationErrorHelper errorHelper) { - super(errorHelper); - } - - protected void handleException(String tname, Throwable ex) { - if (log.isErrorEnabled()) { - log.error("Global application exception [" + tname + "]", ex); - } - - Throwable cause = getCause(ex); - - boolean backToScreen = false; - - AbstractFaxToMailAction action = null; - - if (cause instanceof ApplicationActionException) { - - ApplicationActionException actionException = (ApplicationActionException) cause; - cause = cause.getCause(); - - if (log.isDebugEnabled()) { - log.debug("Action error cause:", cause); - } - - action = (AbstractFaxToMailAction) actionException.getAction(); - - if (action instanceof AbstractChangeScreenAction) { - backToScreen = true; - } - } - - showErrorDialog(cause != null ? cause.getMessage() : "", cause); - - if (backToScreen) { - -// action.getContext().setFallBackScreen(); - } - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUI.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUI.java deleted file mode 100644 index 19cc642..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUI.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.nuiton.jaxx.application.swing.ApplicationUI; - -/** - * Contract to place on each generated jaxx ui. - * - * @author kmorin - morin@codelutin.com - * - */ -public interface FaxToMailUI<M, H extends AbstractFaxToMailUIHandler<M, ?>> extends ApplicationUI<M, H> { - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java deleted file mode 100644 index b606ee9..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java +++ /dev/null @@ -1,720 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import java.awt.Color; -import java.awt.Component; -import java.awt.Desktop; -import java.awt.Font; -import java.awt.image.RenderedImage; -import java.awt.print.Book; -import java.awt.print.PageFormat; -import java.awt.print.Paper; -import java.awt.print.PrinterException; -import java.awt.print.PrinterJob; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URI; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.regex.Pattern; - -import javax.media.jai.PlanarImage; -import javax.print.PrintService; -import javax.print.attribute.HashPrintRequestAttributeSet; -import javax.print.attribute.PrintRequestAttributeSet; -import javax.print.attribute.standard.JobName; -import javax.swing.Icon; -import javax.swing.JTextPane; -import javax.swing.JTree; -import javax.swing.event.HyperlinkEvent; -import javax.swing.event.HyperlinkListener; -import javax.swing.text.html.HTMLEditorKit; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; - -import com.itextpdf.text.RectangleReadOnly; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.JAXXUtil; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.collections4.Predicate; -import org.apache.commons.io.Charsets; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.SystemUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.pdmodel.PDDocument; -import org.nuiton.jaxx.application.ApplicationTechnicalException; -import org.nuiton.jaxx.application.swing.util.ApplicationUIUtil; -import org.nuiton.util.FileUtil; -import org.nuiton.util.StringUtil; - -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.ExtensionCommand; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.Reply; -import com.franciaflex.faxtomail.persistence.entities.ReplyContent; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; -import com.franciaflex.faxtomail.services.service.ConfigurationService; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.demande.RangeRowModel; -import com.google.common.base.Function; -import com.google.common.collect.Lists; -import com.google.common.collect.Ordering; -import com.itextpdf.text.Document; -import com.itextpdf.text.DocumentException; -import com.itextpdf.text.PageSize; -import com.itextpdf.text.Paragraph; -import com.itextpdf.text.pdf.PdfWriter; -import com.sun.media.jai.codec.ByteArraySeekableStream; -import com.sun.media.jai.codec.ImageCodec; -import com.sun.media.jai.codec.ImageDecoder; -import com.sun.media.jai.codec.SeekableStream; - -/** - * @author kmorin - morin@codelutin.com - * - */ -public final class FaxToMailUIUtil extends ApplicationUIUtil { - - /** Logger. */ - private static final Log log = LogFactory.getLog(FaxToMailUIUtil.class); - - public static final List<String> EDITABLE_EXTENSIONS = Lists.newArrayList("PDF", "PNG", "JPG", "JPEG", "GIF", - "TIF", "BMP", "TXT"); - - private FaxToMailUIUtil() { - // never instanciate util class - } - - public static FaxToMailUIContext getApplicationContext(JAXXObject ui) { - return (FaxToMailUIContext) ApplicationUIUtil.getApplicationContext(ui); - } - - public static void setParentUI(JAXXObject ui, FaxToMailUI<?, ?> parentUI) { - JAXXUtil.initContext(ui, parentUI); - setApplicationContext(ui, parentUI.getHandler().getContext()); - } - - public static Map<MailFolder, FolderTreeNode> initFolderTree(final FaxToMailUIContext context, - JTree navigationTree, - Collection<MailFolder> folders, - final boolean colorNotAffectedFolders) { - DefaultMutableTreeNode root = new DefaultMutableTreeNode("root"); - - List<MailFolder> foldersToExpand = context.getExpandedFolders(); - Map<MailFolder, FolderTreeNode> nodesByFolder = new HashMap<MailFolder, FolderTreeNode>(); - List<MailFolder> orderedFolders = new ArrayList<MailFolder>(folders); - Collections.sort(orderedFolders, Ordering.natural().onResultOf(new Function<MailFolder, Comparable>() { - @Override - public Comparable apply(MailFolder folder) { - return folder.getName(); - } - })); - for (MailFolder folder : orderedFolders) { - nodesByFolder.putAll(FaxToMailUIUtil.createFolderTree(root, folder)); - - FolderTreeNode node = nodesByFolder.get(folder); - MailFolder parent = folder.getParent(); - - while (parent != null) { - FolderTreeNode parentNode = nodesByFolder.get(parent); - if (parentNode == null) { - parentNode = new FolderTreeNode(parent); - parentNode.setCanRead(false); - parentNode.setCanSelect(true); - nodesByFolder.put(parent, parentNode); - } - - parentNode.add(node); - node = parentNode; - parent = parent.getParent(); - } - root.add(node); - } - - TreeModel treeModel = new DefaultTreeModel(root); - navigationTree.setModel(treeModel); - - // use the folder icon for the leaf - DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer() { - @Override - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, - boolean expanded, boolean leaf, int row, boolean hasFocus) { - Component component = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); - - if (FolderTreeNode.class.isAssignableFrom(value.getClass())) { - FolderTreeNode node = (FolderTreeNode) value; - setEnabled(node.isCanSelect()); - - // En italic si l'utilsateur n'a pas le droit de lecture (sur un parent par exemple) - Font font = component.getFont(); - if (node.isCanRead()) { - font = font.deriveFont(Font.PLAIN); - } else { - font = font.deriveFont(Font.ITALIC); - } - component.setFont(font); - - // Affichage en gris par defaut, mais en noir si le dossier est vraiment affecté - // à l'utilisateur - Color foreground; - if (!colorNotAffectedFolders - || context.getCurrentUser().isAffectedFoldersEmpty() - || context.getCurrentUser().containsAffectedFolders(node.getMailFolder())) { - - foreground = sel ? Color.WHITE : Color.BLACK; - - } else { - foreground = Color.GRAY; - } - component.setForeground(foreground); - - } - - return component; - } - }; - Icon folderIcon = renderer.getDefaultClosedIcon(); - renderer.setLeafIcon(folderIcon); - navigationTree.setCellRenderer(renderer); - - // expand nodes - for (MailFolder folder : foldersToExpand) { - DefaultMutableTreeNode node = nodesByFolder.get(folder); - // le node peut être null, s'il n'est pas dans l'arbre car - // l'utilisateur n'a pas les droits de déplacement par exemple - if (node != null) { - TreePath treePath = new TreePath(node.getPath()); - navigationTree.expandPath(treePath); - } - } - - return nodesByFolder; - } - - /** - * Creates the tree nodes and returns a map of the nodes by folder - * @param parent the node parent - * @param folder the folder to add to the tree - * @return the map of the nodes by folder - */ - protected static Map<MailFolder, FolderTreeNode> createFolderTree(DefaultMutableTreeNode parent, - MailFolder folder) { - Map<MailFolder, FolderTreeNode> result = new HashMap<MailFolder, FolderTreeNode>(); - - FolderTreeNode node = new FolderTreeNode(folder); - node.setCanSelect(true); - node.setCanRead(true); - result.put(folder, node); - - parent.add(node); - if (folder.isChildrenNotEmpty()) { - List<MailFolder> children = new ArrayList<MailFolder>(folder.getChildren()); - CollectionUtils.filter(children, new Predicate<MailFolder>() { - @Override - public boolean evaluate(MailFolder object) { - return !object.isArchiveFolder(); - } - }); - Collections.sort(children, new Comparator<MailFolder>() { - @Override - public int compare(MailFolder o1, MailFolder o2) { - return o1.getName().compareTo(o2.getName()); - } - }); - for (MailFolder child : children) { - result.putAll(createFolderTree(node, child)); - } - } - return result; - } - - public static Map<String, Integer> computeQuantities(Collection<RangeRowModel> rangeRows) { - int quotationNb = 0; - int pfNb = 0; - int savNb = 0; - for (RangeRowModel rangeRow : rangeRows) { - if (rangeRow.isValid()) { - Integer quotationQuantity = rangeRow.getQuotationQuantity(); - if (quotationQuantity != null) { - quotationNb += quotationQuantity; - } - - Integer productQuantity = rangeRow.getProductQuantity(); - if (productQuantity != null) { - pfNb += productQuantity; - } - - Integer savQuantity = rangeRow.getSavQuantity(); - if (savQuantity != null) { - savNb += savQuantity; - } - } - } - Map<String, Integer> result = new HashMap<String, Integer>(); - result.put(DemandeUIModel.PROPERTY_QUOTATION_NB, quotationNb); - result.put(DemandeUIModel.PROPERTY_PF_NB, pfNb); - result.put(DemandeUIModel.PROPERTY_SAV_NB, savNb); - return result; - } - - public static boolean isFileAPDF(AttachmentFile file) { - return FileUtil.extension(file.getFilename()).toUpperCase().equals("PDF"); - } - - public static boolean isFileATxt(AttachmentFile file) { - return FileUtil.extension(file.getFilename()).toUpperCase().equals("TXT"); - } - - public static boolean isFileATif(AttachmentFile file) { - return FileUtil.extension(file.getFilename()).toUpperCase().equals("TIF"); - } - - public static boolean isFileTypeEditable(String fileName) { - String extension = FileUtil.extension(fileName); - return EDITABLE_EXTENSIONS.contains(extension.toUpperCase()); - } - - public static void setEmailContentInTextPane(DemandeUIHandler handler, JTextPane textPane, DemandeUIModel demandeUIModel) { - String content = demandeUIModel.getHtmlContent(); - if (content != null) { - textPane.setContentType("text/html"); - - HTMLEditorKit htmlEditorKit = new HTMLEditorKit(); - textPane.setEditorKit(htmlEditorKit); - textPane.addHyperlinkListener(new HyperlinkListener() { - @Override - public void hyperlinkUpdate(HyperlinkEvent e) { - if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { - FaxToMailUIUtil.openLink(e.getURL()); - } - } - }); - - // the meta tag makes the content is not displayed - content = content.replaceAll("<meta (.*?)>(</meta>)?", ""); - - if (log.isTraceEnabled()) { - log.trace("Content before mail = " + content); - } - - for (Attachment attachment : demandeUIModel.getAttachment()) { - String key = attachment.getContentId(); - if (key == null) { - key = attachment.getOriginalFileName(); - } - - // get file content - forceAttachmentFileLoading(handler.getContext(), attachment); - AttachmentFile attachmentFile = attachment.getOriginalFile(); - File file = attachmentFile.getFile(); - - // replace the inline attachments with the extracted attachment file url - // match les patterns: - // <td background="cid:bg.gif" height="52"> - // <img border=0 src="cid:bg.gif" /> - // <img src='cid:5e9ef859-ea65-4f9b-a9fa-30d4a2c5837c' - content = content.replaceAll("(\\w+)=([\"'])cid:" + Pattern.quote(key) + "([\"'])", "$1=$2file://" + file.getAbsolutePath() + "$3"); - - if (log.isDebugEnabled()) { - log.debug("Mapping attachment id " + key + " to file " + file.getAbsolutePath()); - } - } - - if (log.isTraceEnabled()) { - log.trace("Content after mail = " + content); - } - - } else { - content = demandeUIModel.getPlainContent(); - } - textPane.setText(content); - } - - /** - * Force le chargement des attachmentFile (edited and original) pour un attachment. - * - * @param context context - * @param attachment attachment - */ - public static void forceAttachmentFileLoading(FaxToMailUIContext context, Attachment attachment) { - if (log.isDebugEnabled()) { - log.debug("Force attachment loading " + attachment.getOriginalFileName()); - } - if (attachment.isPersisted()) { - FaxToMailServiceContext serviceContext = context.newServiceContext(); - EmailService service = serviceContext.getEmailService(); - if (attachment.getOriginalFile() == null) { - AttachmentFile file = service.getAttachmentFile(attachment.getTopiaId(), true); - attachment.setOriginalFile(file); - } - if (attachment.getEditedFile() == null) { - AttachmentFile file = service.getAttachmentFile(attachment.getTopiaId(), false); - attachment.setEditedFile(file); - } - } - } - - /** - * Force le chargement des contenu source binaire des réponses. - * - * @param context context - * @param reply reply - */ - public static void forceReplyContentLoading(FaxToMailUIContext context, Reply reply) { - if (log.isDebugEnabled()) { - log.debug("Force source loading " + reply.getSubject()); - } - if (reply.isPersisted() && reply.getReplyContent() == null) { - FaxToMailServiceContext serviceContext = context.newServiceContext(); - EmailService service = serviceContext.getEmailService(); - ReplyContent replyContent = service.getReplyContent(reply.getTopiaId()); - reply.setReplyContent(replyContent); - } - } - - /** - * Imprime un attachment file. - * - * @param attachmentFile - * @param defaultPrinter if {@code true}, do not display print dialog and print with default printer - * @return true if file has been printed, false otherwise - */ - public static boolean print(AttachmentFile attachmentFile, boolean defaultPrinter) { - boolean result = false; - FileInputStream fileInputStream = null; - try { - File file; - if (!FaxToMailUIUtil.isFileAPDF(attachmentFile)) { - file = convertFileToPdf(attachmentFile); - } else { - file = attachmentFile.getFile(); - } - - fileInputStream = new FileInputStream(file); - - result = printWithPdfRenderer(attachmentFile.getFilename(), fileInputStream, defaultPrinter); - - } catch (IOException | DocumentException e) { - throw new ApplicationTechnicalException( - t("jaxx.application.error.cannot.print"), e); - - } finally { - IOUtils.closeQuietly(fileInputStream); - } - return result; - } - - /** - * Imprime du texte. - * - * @param printName print job name - * @param text text to print - * @param defaultPrinter if {@code true}, do not display print dialog and print with default printer - * @return true if file has been printed, false otherwise - */ - public static boolean printText(String printName, String text, boolean defaultPrinter) { - boolean result = false; - FileInputStream fileInputStream = null; - ByteArrayInputStream byteArrayInputStream = null; - - try { - // convert text content to inputstream - byte[] content = text.getBytes(Charsets.UTF_8); - byteArrayInputStream = new ByteArrayInputStream(content); - - File file = convertFileToPdf(byteArrayInputStream, FileType.TEXT); - - fileInputStream = new FileInputStream(file); - result = printWithPdfRenderer(printName, fileInputStream, defaultPrinter); - - } catch (IOException | DocumentException e) { - throw new ApplicationTechnicalException( - t("jaxx.application.error.cannot.print"), e); - - } finally { - IOUtils.closeQuietly(fileInputStream); - IOUtils.closeQuietly(byteArrayInputStream); - } - return result; - } - - /** - * Imprime un attachment file. - * - * @param printName print job name - * @param fis stream to print - * @param defaultPrinter if {@code true}, do not display print dialog and print with default printer - * @return true if file has been printed, false otherwise - */ - protected static boolean printWithPdfRenderer(String printName, FileInputStream fis, boolean defaultPrinter) { - boolean result = false; - - PDDocument document = null; - try { - - PrinterJob pjob = PrinterJob.getPrinterJob(); - pjob.setJobName(printName); - - document = PDDocument.load(fis); - if (defaultPrinter) { - document.silentPrint(pjob); - } else { - document.print(pjob); - } - result = true; - - } catch (PrinterException | IOException e) { - if (log.isErrorEnabled()) { - log.error("can't print", e); - } - - } finally { - IOUtils.closeQuietly(document); - } - return result; - } - - public static File convertFileToPdf(AttachmentFile attachmentFile) throws IOException, DocumentException { - File file = attachmentFile.getFile(); - FileType type; - if (FaxToMailUIUtil.isFileATxt(attachmentFile)) { - type = FileType.TEXT; - - } else if (FaxToMailUIUtil.isFileATif(attachmentFile)) { - type = FileType.TIF; - - } else { - type = FileType.OTHER; - } - File result = convertFileToPdf(new FileInputStream(file), type); - return result; - } - - protected enum FileType { - TEXT, TIF, OTHER - } - - protected static File convertFileToPdf(InputStream inputStream, FileType type) throws IOException, DocumentException { - File target = File.createTempFile("faxtomail-", ".tmp"); - target.deleteOnExit(); - - Document document = new Document(); - FileOutputStream fos = new FileOutputStream(target); - PdfWriter writer = PdfWriter.getInstance(document, fos); - writer.open(); - - document.setPageSize(PageSize.A4); - document.open(); - - if (type == FileType.TEXT) { - BufferedReader br = null; - try { - br = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); - StringBuilder text = new StringBuilder(); - String line = br.readLine(); - while (line != null) { - text.append(line).append("\n"); - line = br.readLine(); - } - document.add(new Paragraph(text.toString())); - br.close(); - - } finally { - IOUtils.closeQuietly(br); - } - - } else if (type == FileType.TIF) { - try { - FileInputStream fis = (FileInputStream) inputStream; - FileChannel channel = fis.getChannel(); - ByteBuffer buffer = ByteBuffer.allocate((int) channel.size()); - channel.read(buffer); - SeekableStream stream = new ByteArraySeekableStream(buffer.array()); - String[] names = ImageCodec.getDecoderNames(stream); - ImageDecoder tifImageDecoder = ImageCodec.createImageDecoder(names[0], stream, null); - - for (int i = 0 ; i < tifImageDecoder.getNumPages() ; i++) { - RenderedImage renderedImage = tifImageDecoder.decodeAsRenderedImage(i); - java.awt.Image awtImage = PlanarImage.wrapRenderedImage(renderedImage).getAsBufferedImage(); - document.newPage(); - com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance(writer, awtImage, 1.0f); - image.scaleToFit(PageSize.A4.getWidth() - document.leftMargin() - document.rightMargin(), - PageSize.A4.getHeight() - document.topMargin() - document.bottomMargin()); - document.add(image); - } - fis.close(); - } finally { - IOUtils.closeQuietly(inputStream); - } - - } else { - byte[] bytes = IOUtils.toByteArray(inputStream); - com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance(bytes); - float pageWidth = document.getPageSize().getWidth()- document.leftMargin() - document.rightMargin(); - float pageHeight = document.getPageSize().getHeight()- document.topMargin() - document.bottomMargin(); - float imageWidth = image.getWidth(); - float imageHeight = image.getHeight(); - if (pageWidth < imageWidth || pageHeight < imageHeight) { - float scaler = Math.min(pageWidth / imageWidth, pageHeight / imageHeight) * 100; - image.scalePercent(scaler); - } - document.add(image); - } - - document.close(); - writer.close(); - - return target; - } - - - public static String getEditedFileName(String originalFileName) { - return t("faxtomail.attachment.editedFile.name", originalFileName) + "-.pdf"; - } - - /** - * Ouvre un attachment en fonction de la configuration des extensions, ou à default le open système. - * - * @param context - * @param attachment - */ - public static void openFile(FaxToMailUIContext context, AttachmentFile attachment) { - - File file = attachment.getFile(); - String filename = attachment.getFilename(); - String extension = FilenameUtils.getExtension(filename); - - // get configuration extension command - ExtensionCommand extCommand = null; - if (StringUtils.isNotBlank(extension)) { - FaxToMailServiceContext serviceContext = context.newServiceContext(); - ConfigurationService service = serviceContext.getConfigurationService(); - extCommand = service.getExtensionCommand(extension); - } - - // open file - if (extCommand != null && StringUtils.isNotBlank(extCommand.getOpenAttachmentCommand())) { - String command = extCommand.getOpenAttachmentCommand(); - String[] args = StringUtil.split(command, " "); - List<String> comArgs = new ArrayList<String>(); - for (String arg : args) { - String localArg = arg; - localArg = localArg.replace("%f", file.getAbsolutePath()); - comArgs.add(localArg); - } - ProcessBuilder pb = new ProcessBuilder(comArgs); - // run process - if (log.isDebugEnabled()) { - log.debug("Open attachment with command : " + comArgs); - } - try { - pb.start(); - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("Cannot run convert command", e); - } - } - } else { - - try { - if (SystemUtils.IS_OS_WINDOWS) { - // tentative pour résoudre http://forge.codelutin.com/issues/5650 - // pas d'idée précise du bug, mais ca semble mieux fonctionner à l'arrache - String command = "rundll32 SHELL32.DLL,ShellExec_RunDLL "+ file.getAbsoluteFile(); - if (log.isDebugEnabled()) { - log.debug("Opening file with command : " + command); - } - Runtime.getRuntime().exec(command); - } else { - // version to use for xfce - // DesktopUtil.open(file); - Desktop desktop = getDesktopForOpen(); - desktop.open(file); - } - } catch (Exception ex) { - throw new ApplicationTechnicalException( - t("jaxx.application.error.cannot.open"), ex); - } - } - } - - /** - * Send email. - * - * @param subject - * @param body - */ - public static void email(String subject, String body) { - - try { - URI mailtoURI = new URI("mailto", null, null, "subject=" + subject + "&body=" + body, null); - Desktop desktop = getDesktopForMail(); - desktop.mail(mailtoURI); - - // version for xfce - // DesktopUtil.mail(mailtoURI); - - } catch (Exception e) { - - throw new ApplicationTechnicalException( - t("jaxx.application.error.cannot.mail"), e); - } - } - - public static boolean isRangePanelVisible(DemandType demandType) { - return demandType != null && FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.RANGE_ROW); - } - -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FolderTreeNode.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FolderTreeNode.java deleted file mode 100644 index 13bf133..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FolderTreeNode.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.MailFolder; - -import javax.swing.tree.DefaultMutableTreeNode; - -/** - * @author kmorin - kmorin@codelutin.com - * - */ -public class FolderTreeNode extends DefaultMutableTreeNode { - - protected boolean canSelect; - protected boolean canRead; - - public FolderTreeNode(MailFolder folder) { - super(folder); - } - - public MailFolder getMailFolder() { - return (MailFolder) userObject; - } - - public boolean isCanSelect() { - return canSelect; - } - - public void setCanSelect(boolean canSelect) { - this.canSelect = canSelect; - } - - public boolean isCanRead() { - return canRead; - } - - public void setCanRead(boolean canRead) { - this.canRead = canRead; - } - - @Override - public String toString() { - MailFolder folder = (MailFolder) userObject; - return folder.getName(); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/JImagePanel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/JImagePanel.java deleted file mode 100644 index 63e1052..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/JImagePanel.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.imageio.ImageIO; -import javax.swing.*; -import java.awt.*; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; - -/** - * @author Kevin Morin (Code Lutin) - * - */ -public class JImagePanel extends JPanel { - - private static final Log log = LogFactory.getLog(JImagePanel.class); - - protected Image image; - protected Image scaledImage; - protected int rotation = 0; - - protected boolean scaleImageToFitPanel; - - protected ComponentAdapter resizeAdapter = new ComponentAdapter() { - @Override - public void componentResized(ComponentEvent e) { - Component component = e.getComponent(); - if (image != null) { - int srcWidth = component.getWidth(); - int srcHeight = component.getHeight(); - int newWidth = rotation % 180 == 0 ? srcWidth : srcHeight; - int newHeight = rotation % 180 == 0 ? srcHeight : srcWidth; - scaledImage = image.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH); - } - repaint(); - } - }; - - public void setRotation(int rotation) { - this.rotation = rotation; - } - - public boolean isScaleImageToFitPanel() { - return scaleImageToFitPanel; - } - - public void setScaleImageToFitPanel(boolean scaleImageToFitPanel) { - if (this.scaleImageToFitPanel != scaleImageToFitPanel) { - if (scaleImageToFitPanel) { - addComponentListener(resizeAdapter); - } else { - removeComponentListener(resizeAdapter); - } - } - this.scaleImageToFitPanel = scaleImageToFitPanel; - } - - public Image getImage() { - return image; - } - - public Image getScaledImage() { - return scaledImage; - } - - public void setImage(File img) { - BufferedImage bufferedImage; - try { - bufferedImage = ImageIO.read(img); - - } catch (IOException e) { - log.error("error while reading image " + img.getAbsolutePath(), e); - bufferedImage = null; - } - if (bufferedImage != null) { - setImage(bufferedImage); - } - } - - public void setImage(Image img) { - this.image = img; - this.scaledImage = img; - - int srcWidth = img.getWidth(null); - int srcHeight = img.getHeight(null); - int newWidth = rotation % 180 == 0 ? srcWidth : srcHeight; - int newHeight = rotation % 180 == 0 ? srcHeight : srcWidth; - - Dimension size = new Dimension(newWidth, newHeight); - setPreferredSize(size); - setMinimumSize(size); - setMaximumSize(size); - setSize(size); - } - - public void setImage(String img) { - setImage(new ImageIcon(img).getImage()); - } - - @Override - public void paintComponent(Graphics g) { - if (scaledImage != null) { - Graphics2D g2d = (Graphics2D) g; - - double width = getSize().getWidth(); - double height = getSize().getHeight(); - - double translateX; - double translateY; - - switch (rotation) { - case 90: - translateX = width; - translateY = 0; - break; - - case 180: - translateX = width; - translateY = height; - break; - - case 270: - translateX = 0; - translateY = height; - break; - - default: - translateX = 0; - translateY = 0; - } - g2d.translate(translateX, translateY); - g2d.rotate(Math.toRadians(rotation), 0, 0); - - Insets insets = getInsets(); - int leftInset = rotation % 180 == 0 ? insets.left : insets.top; - int topInset = rotation % 180 == 0 ? insets.top : insets.left; - g2d.drawImage(scaledImage, leftInset, topInset, this); - - } - - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/PaginationComboModel.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/PaginationComboModel.java deleted file mode 100644 index dbe5cc3..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/PaginationComboModel.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import javax.swing.DefaultComboBoxModel; - -/** - * Combo box model contenant les nombres de resultats par page par defaut. - */ -public class PaginationComboModel extends DefaultComboBoxModel<Integer> { - - /** serialVersionUID. */ - private static final long serialVersionUID = 5197282481327291647L; - - public PaginationComboModel() { - super(new Integer[] {50, 100, 150, 200, 250}); - } -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/RemoveablePropertyChangeListener.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/RemoveablePropertyChangeListener.java deleted file mode 100644 index 9e7ad42..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/RemoveablePropertyChangeListener.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.beans.PropertyChangeListener; - -/** - * Use this contract when you want the listener to be removed when closing an ui. - * - * @author kmorin - morin@codelutin.com - */ -public abstract class RemoveablePropertyChangeListener implements PropertyChangeListener { -} diff --git a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/UIMessageNotifier.java b/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/UIMessageNotifier.java deleted file mode 100644 index f0d4d93..0000000 --- a/trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/UIMessageNotifier.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.franciaflex.faxtomail.ui.swing.util; - -/* - * #%L - * FaxToMail :: UI - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * To notify somemessage in ui. - * - * @author kmorin - morin@codelutin.com - */ -public interface UIMessageNotifier { - - void showInformationMessage(String message); -} diff --git a/trunk/faxtomail-ui-swing/src/main/resources/PoetsenOne-Regular.ttf b/trunk/faxtomail-ui-swing/src/main/resources/PoetsenOne-Regular.ttf deleted file mode 100644 index a24f91d..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/PoetsenOne-Regular.ttf and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel-error-validation.xml b/trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel-error-validation.xml deleted file mode 100644 index 273a409..0000000 --- a/trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel-error-validation.xml +++ /dev/null @@ -1,111 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - - -<!DOCTYPE validators PUBLIC - "-//Apache Struts//XWork Validator 1.0.3//EN" - "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> - -<validators> - - <field name="demandType"> - <field-validator type="required" short-circuit="true"> - <message>faxtomail.validator.error.email.demandType.required</message> - </field-validator> - </field> - - <field name="clientCode"> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ isValid("clientCode") ]]> - </param> - <message>faxtomail.validator.error.email.clientCode.required</message> - </field-validator> - </field> - - <field name="projectReference"> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ isValid("projectReference") ]]> - </param> - <message>faxtomail.validator.error.email.projectReference.required</message> - </field-validator> - </field> - - <field name="object"> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ isValid("object") ]]> - </param> - <message>faxtomail.validator.error.email.object.required</message> - </field-validator> - </field> - - <field name="validRangeRowModels"> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ isValid("validRangeRowModels") ]]> - </param> - <message>faxtomail.validator.error.email.rangeRow.required</message> - </field-validator> - </field> - - <field name="priority"> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ isValid("priority") ]]> - </param> - <message>faxtomail.validator.error.email.priority.required</message> - </field-validator> - </field> - - <field name="waitingState"> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ isValid("waitingState") ]]> - </param> - <message>faxtomail.validator.error.email.waitingState.required</message> - </field-validator> - </field> - - <field name="comment"> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ isValid("comment") ]]> - </param> - <message>faxtomail.validator.error.email.comment.required</message> - </field-validator> - </field> - - <field name="companyReference"> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ isValid("companyReference") ]]> - </param> - <message>faxtomail.validator.error.email.companyReference.required</message> - </field-validator> - </field> - -</validators> diff --git a/trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml b/trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml deleted file mode 100644 index d01fefd..0000000 --- a/trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIModel-error-validation.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - -<!DOCTYPE validators PUBLIC - "-//Apache Struts//XWork Validator 1.0.3//EN" - "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> - -<validators> - - <field name="to"> - <field-validator type="requiredstring" short-circuit="true"> - <message>faxtomail.validator.error.reply.to.required</message> - </field-validator> - <field-validator type="email" short-circuit="true"> - <message>faxtomail.validator.error.reply.to.email</message> - </field-validator> - </field> - - <field name="cc"> - <field-validator type="email" short-circuit="true"> - <message>faxtomail.validator.error.reply.cc.email</message> - </field-validator> - </field> - - <field name="cci"> - <field-validator type="email" short-circuit="true"> - <message>faxtomail.validator.error.reply.cci.email</message> - </field-validator> - </field> - - <field name="from"> - <field-validator type="requiredstring" short-circuit="true"> - <message>faxtomail.validator.error.reply.from.required</message> - </field-validator> - <field-validator type="fieldexpression" short-circuit="true"> - <param name="expression"> - <![CDATA[ isValid("from") ]]> - </param> - <message>faxtomail.validator.error.reply.from.invalidDomain</message> - </field-validator> - <field-validator type="email" short-circuit="true"> - <message>faxtomail.validator.error.reply.from.email</message> - </field-validator> - </field> - - <field name="subject"> - <field-validator type="requiredstring" short-circuit="true"> - <message>faxtomail.validator.error.reply.subject.required</message> - </field-validator> - </field> - -</validators> diff --git a/trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties b/trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties deleted file mode 100644 index eb0b192..0000000 --- a/trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties +++ /dev/null @@ -1,332 +0,0 @@ -\ X\ = -\ |\ = -/= -\:= -application.action.create.error= -application.error.ui.business.warning= -faxtomail.about.bottomText=Copyright %s - %s - version %s -faxtomail.about.message=<h3>FaxToMail</h3><p><strong>Outil de gestion d'emails.</strong></p><br/><p>Ce logiciel permet de router les emails reçus vers des dossiers et de les transformer en formulaires. Ils peuvent être déplacés entre dossiers pour êtres remplis par différentes personnes puis archivés.</p><p>Ce projet a été initiée en 2014 par le groupe MAC et réalisé par la société Code Lutin.</p> -faxtomail.about.title=À propos de FaxToMail -faxtomail.action.archive.tip=Archiver l'élément -faxtomail.action.attachment.edit.tip=Edition du fichier %s -faxtomail.action.attachment.open.tip=Ouverture du fichier %s -faxtomail.action.computeQuantitiesByRange.tip=Calculer les quantités par gamme -faxtomail.action.exit.tip=Quitter l'application -faxtomail.action.generateAnnotatedAttachment.tip=Générer le pdf annoté -faxtomail.action.goto.demand.tip=Aller au détail de l'élément -faxtomail.action.goto.demandList.tip=Aller à la liste des éléments -faxtomail.action.goto.previousScreen.tip=Retourner à l'écran précédent -faxtomail.action.goto.search.tip=Aller à l'écran de recherche -faxtomail.action.group.tip=Grouper l'élément -faxtomail.action.loadFolderEmails.tip=Chargement des demandes du dossier %s -faxtomail.action.openMailFolderChooser.tip=Ouverture de la fenêtre de sélection du dossier de destination -faxtomail.action.print.notPrintableDemands.message=<html>Les éléments suivant n'ont pas été imprimés car ils n'étaient pas valides \:<br/>%s</html> -faxtomail.action.print.notPrintableDemands.title=Éléments non imprimés -faxtomail.action.print.tip=Impression -faxtomail.action.reloadFaxToMail=Recharger FaxToMail -faxtomail.action.reply.tip=Envoyer la réponse -faxtomail.action.save.tip=Enregistrer -faxtomail.action.search.tip=Rechercher -faxtomail.action.transmit.tip=Déplacer l'élément -faxtomail.alert.alreadyLockedBy.message=L'élément est déjà verrouillé par %s, vous ne pouvez pas l'ouvrir. -faxtomail.alert.alreadyLockedBy.title=Document déjà verrouillé -faxtomail.alert.alreadyTakenBy.help=Voulez-vous le prendre ?<ul><li><strong>Annuler</strong> pour retourner à la liste</li><li><strong>Non</strong> pour visualiser l'élément en lecture seule</li><li><strong>Oui</strong> pour le prendre</li></ul> -faxtomail.alert.alreadyTakenBy.message=L'élément est déjà pris par %s. -faxtomail.alert.alreadyTakenBy.title=Document déjà pris -faxtomail.alert.archiveConfirmation.message=<html>Êtes vous sûr de vouloir archiver cet élément ?<br/>L'archivage est définitif.</html> -faxtomail.alert.archiveConfirmation.title=Confirmation de l'archivage -faxtomail.alert.archivesConfirmation.message=<html>Êtes vous sûr de vouloir archiver ces éléments ?<br/>L'archivage est définitif.</html> -faxtomail.alert.archivesWithNotArchivableConfirmation.message=<html>Les éléments suivants ne peuvent pas être archivés car ils ne sont pas valides \:<br/>%sÊtes vous sûr de vouloir archiver les autres éléments ?<br/>L'archivage est définitif.</html> -faxtomail.alert.demandsNotTransmittable.message=<html>Les éléments suivant ne seront pas déplacés \:<br/>%s</html> -faxtomail.alert.demandsNotTransmittable.title=Éléments non déplaçables -faxtomail.alert.emailMoved.message=<html>Depuis que vous avez chargé les éléments du dossier %1$s, l'élément<br/>%3$s<br/>a été déplacé dans le dossier %2$s.</html> -faxtomail.alert.emailMoved.title=Élément déplacé -faxtomail.alert.groupConfirmation.message=<html>Êtes vous sûr de vouloir grouper les éléments<br/>%1$s et<br/>%2$s ?<br/>Le groupement est définitif.</html> -faxtomail.alert.groupConfirmation.title=Confirmation du groupement -faxtomail.alert.noDemandToArchive.message=<html>Les éléments suivants ne peuvent pas être archivés car ils ne sont pas valides \:<br/>%sIl n'y a pas d'autres éléments à archiver.</html> -faxtomail.alert.noDemandToArchive.title=Aucun élément à archiver -faxtomail.alert.noDemandToTransmit.message=<html>Les éléments suivants ne seront pas déplacés \:<br/>%sIl n'y a pas d'autres éléments à déplacer.</html> -faxtomail.alert.noDemandToTransmit.title=Aucun élément à déplacer -faxtomail.alert.transmit.groupedDemandsInSameFolder.message=<html>L'élément %1$s a un ou plusieurs éléments groupés dans le même dossier \:<br/>%2$sVoulez-vous les déplacer aussi ?</html> -faxtomail.alert.transmit.groupedDemandsInSameFolder.title=Déplacer les éléments groupés -faxtomail.alert.userNotAuthorizedToReadEmail.message=Vous n'avez pas le droit de lire les éléments du dossier %s -faxtomail.alert.userNotAuthorizedToReadEmail.title=Dossier interdit -faxtomail.attachment.editedFile.name=%s-annoté -faxtomail.attachmentCellRenderer.text=(%s) -faxtomail.attachmentEditor.action.add.tip=Ajouter une pièce jointe -faxtomail.attachmentEditor.action.closeAttachment.tip=Fermer la fenêtre des pièces-jointes -faxtomail.attachmentEditor.action.edit.tip=Editer la pièce jointe -faxtomail.attachmentEditor.action.open.tip=Ouvrir la pièce jointe -faxtomail.attachmentEditor.action.openedited.tip=Ouvrir la pièce jointe éditée -faxtomail.attachmentEditor.action.remove.tip=Supprimer la pièce jointe -faxtomail.attachmentEditor.action.tip=Pièces jointes -faxtomail.attachmentEditor.attachments.empty=Aucune pièce jointe -faxtomail.attachmentEditor.deleteAttachment.message=Êtes-vous sûr de vouloir supprimer la pièce-jointe %s ? -faxtomail.attachmentEditor.deleteAttachment.title=Suppression de pièce-jointe -faxtomail.attachmentEditor.field.file=Fichier -faxtomail.attachmentEditor.none.tip=Aucune pièce-jointe -faxtomail.attachmentEditor.text=Pièces jointes (%s) -faxtomail.attachmentEditor.title=Pièces jointes -faxtomail.chooseAttachmentToPrint.action.cancel=Annuler -faxtomail.chooseAttachmentToPrint.action.cancel.tip=Annuler et fermer la popup -faxtomail.chooseAttachmentToPrint.action.validate=Valider -faxtomail.chooseAttachmentToPrint.action.validate.tip=Valider et imprimer les pièces-jointes -faxtomail.chooseAttachmentToPrint.message=Choisissez les pièces-jointes à imprimer \: -faxtomail.chooseAttachmentToPrint.title=Pièces-jointes à imprimer -faxtomail.chooseMailFolder.action.cancel=Annuler -faxtomail.chooseMailFolder.action.cancel.tip=Annuler et fermer la popup -faxtomail.chooseMailFolder.action.validate=Valider -faxtomail.chooseMailFolder.action.validate.tip=Valider et transférer l'élément -faxtomail.chooseMailFolder.message=Choisissez le dossier où transférer l'élément \: -faxtomail.chooseMailFolder.title=Dossier de destination -faxtomail.common.by.label=par -faxtomail.common.none.label=Sans -faxtomail.common.on.label=le -faxtomail.demand.title=Détail -faxtomail.demandGroup.action.tip=Éléments groupés avec l'élément courant -faxtomail.demandGroup.empty=Aucun élément groupé -faxtomail.demandGroup.text=Groupe (%s) -faxtomail.demandGroup.title=Groupe -faxtomail.demandGroupCellRenderer.text=(%s) -faxtomail.demandReplies.action.forward.tip=Transmettre la réponse -faxtomail.demandReplies.action.open.tip=Visualiser la réponse -faxtomail.demandReplies.action.tip=Réponses envoyées -faxtomail.demandReplies.empty=Aucune réponse envoyée -faxtomail.demandReplies.error= -faxtomail.demandReplies.text=Réponses (%s) -faxtomail.demandReplies.title=Réponses envoyées -faxtomail.demandRepliesCellRenderer.text=(%s) -faxtomail.demande.archive.button.label=Archiver -faxtomail.demande.archivedBy.label=Archivé par -faxtomail.demande.askCancelEditBeforeLeaving.cancelSave=L'élément n'est pas valide et ne peut être sauvé. -faxtomail.demande.askSaveBeforeLeaving.save=Vous avez modifié l'élément mais vous n'avez pas enregistré ces modifications. -faxtomail.demande.attachment.label=Pièces-jointes -faxtomail.demande.back.button.label=Quitter -faxtomail.demande.body.label=Corps du mail -faxtomail.demande.ccRecipients.label=Copie à \: -faxtomail.demande.client.label=Code client -faxtomail.demande.clientBrand.label=Marque -faxtomail.demande.clientCode.label=Client -faxtomail.demande.commandNb.label=Numéro de commande/devis -faxtomail.demande.comment.label=Message -faxtomail.demande.companyReference.label=Notre référence -faxtomail.demande.demandStatus.label=Statut -faxtomail.demande.demandType.label=Type -faxtomail.demande.docType.label=Type -faxtomail.demande.ediError.label=Retour EDI -faxtomail.demande.fax.label=Fax -faxtomail.demande.firstOpened.label=Première ouverture -faxtomail.demande.gamme.label=Gamme -faxtomail.demande.group.button.label=Grouper -faxtomail.demande.group.successful=Groupement réussi -faxtomail.demande.history.action.send.tip=Envoyer l'historique par email -faxtomail.demande.history.send.body=L'historique de l'élément a été copié dans le presse-papier. Vous pouvez le coller dans cet email en appuyant sur les touches Ctrl+V ou ou en cliquant sur le menu "Édition -> Coller" -faxtomail.demande.history.send.subject=Historique de %s -faxtomail.demande.lastAttachmentOpening.label=Dernière ouverture de pièce-jointe -faxtomail.demande.lastModified.label=Dernière modification -faxtomail.demande.localReference.label=Référence -faxtomail.demande.mailFolder.label=Dossier -faxtomail.demande.object.label=Objet -faxtomail.demande.print.button.label=Imprimer -faxtomail.demande.printedBy.label=Imprimé par -faxtomail.demande.priority.label=Priorité -faxtomail.demande.projectReference.label=Référence chantier -faxtomail.demande.rangeRow.label=Gammes -faxtomail.demande.receivedDate.label=Reçu le -faxtomail.demande.receptionDate.label=Date de réception -faxtomail.demande.recipient.label=Destinataire -faxtomail.demande.repliedBy.label=Réponse par -faxtomail.demande.reply.button.label=Répondre -faxtomail.demande.save.button.label=Enregistrer -faxtomail.demande.sender.label=Émetteur -faxtomail.demande.sender.manualCreation=Création manuelle -faxtomail.demande.status.label=Statut -faxtomail.demande.subject.label=Sujet \: -faxtomail.demande.takenBy.label=Pris par -faxtomail.demande.toRecipients.label=À \: -faxtomail.demande.transferBy.label=Déplacé par -faxtomail.demande.transmit.button.label=Déplacer -faxtomail.demande.waitingState.label=État attente -faxtomail.demandeList.action.archive=Archiver -faxtomail.demandeList.action.archive.tip=Archiver l'élément -faxtomail.demandeList.action.computeQuantitiesByRange=Calculer les quantités par gamme -faxtomail.demandeList.action.computeQuantitiesByRange.tip=Calculer les quantités par gamme -faxtomail.demandeList.action.newDemand=Créer une nouvelle demande -faxtomail.demandeList.action.newDemand.tip=Créer une nouvelle demande -faxtomail.demandeList.action.print=Imprimer -faxtomail.demandeList.action.print.tip=Imprimer -faxtomail.demandeList.action.reply=Répondre -faxtomail.demandeList.action.reply.tip=Répondre -faxtomail.demandeList.action.transmit=Déplacer -faxtomail.demandeList.action.transmit.tip=Déplacer -faxtomail.demandeList.demandNbLabel=Nombre de demandes -faxtomail.demandeList.goToNextPage=> -faxtomail.demandeList.goToPreviousPage=< -faxtomail.demandeList.noRigthsFound=Aucun permission n'a été trouvée pour vous. Veuillez contacter l'administrateur pour résoudre ce problème \! -faxtomail.demandeList.pages=Pages \: -faxtomail.demandeList.pfNbLabel=Nombre de produits finis -faxtomail.demandeList.quotationNbLabel=Nombre de devis -faxtomail.demandeList.resultPerPage=Nombre de résultat par page \: -faxtomail.demandeList.savNbLabel=Nombre de SAV -faxtomail.demandeList.table.header.attachment=PJ -faxtomail.demandeList.table.header.attachment.tip=Pièces-jointes -faxtomail.demandeList.table.header.brand=Marque -faxtomail.demandeList.table.header.brand.tip=Marque -faxtomail.demandeList.table.header.client=Client -faxtomail.demandeList.table.header.client.tip=Client -faxtomail.demandeList.table.header.comment=Commentaire -faxtomail.demandeList.table.header.comment.tip=Commentaire -faxtomail.demandeList.table.header.companyReference=Notre ref -faxtomail.demandeList.table.header.companyReference.tip=Notre référence -faxtomail.demandeList.table.header.ediCodeNumber=Retour EDI -faxtomail.demandeList.table.header.ediCodeNumber.tip=Retour EDI -faxtomail.demandeList.table.header.emailGroup=Groupe -faxtomail.demandeList.table.header.emailGroup.tip=Éléments groupés -faxtomail.demandeList.table.header.lastAttachmentOpeningUser=Dernier à ouvrir une PJ -faxtomail.demandeList.table.header.lastAttachmentOpeningUser.tip=Dernier utilisateur à avoir ouvert une pièce-jointe -faxtomail.demandeList.table.header.object=Objet -faxtomail.demandeList.table.header.object.tip=Objet -faxtomail.demandeList.table.header.pfNb=Qté produits -faxtomail.demandeList.table.header.pfNb.tip=Quantité de produits -faxtomail.demandeList.table.header.priority=P -faxtomail.demandeList.table.header.priority.tip=Priorité -faxtomail.demandeList.table.header.projectReference=Ref chantier -faxtomail.demandeList.table.header.projectReference.tip=Référence chantier -faxtomail.demandeList.table.header.quotationNb=Qté devis -faxtomail.demandeList.table.header.quotationNb.tip=Quantité de devis -faxtomail.demandeList.table.header.receptionDate=Date de réception -faxtomail.demandeList.table.header.receptionDate.tip=Date de réception -faxtomail.demandeList.table.header.recipient=Destinataire -faxtomail.demandeList.table.header.recipient.tip=Addresse email ou numéro de fax du destinataire -faxtomail.demandeList.table.header.reference=Référence -faxtomail.demandeList.table.header.reference.tip=Référence (notre référence + numéros de commande) -faxtomail.demandeList.table.header.replies=Réponses -faxtomail.demandeList.table.header.replies.tip=Réponses envoyées -faxtomail.demandeList.table.header.savNb=Qté SAV -faxtomail.demandeList.table.header.savNb.tip=Quantité de SAV -faxtomail.demandeList.table.header.sender=Émetteur -faxtomail.demandeList.table.header.sender.tip=Addresse email ou numéro de fax de l'émetteur -faxtomail.demandeList.table.header.status=Statut -faxtomail.demandeList.table.header.status.tip=Statut -faxtomail.demandeList.table.header.type=Type -faxtomail.demandeList.table.header.type.tip=Type -faxtomail.demandeList.table.header.user=Pris par -faxtomail.demandeList.table.header.user.tip=Pris par -faxtomail.demandeList.table.header.waitingState=État attente -faxtomail.demandeList.table.header.waitingState.tip=État attente -faxtomail.demandeList.title=Liste des éléments -faxtomail.demandeList.totalCount=Nombre de demandes \: -faxtomail.historyList.action.tip=Historique -faxtomail.historyList.text=Historique (%s) -faxtomail.historyList.title=Historique -faxtomail.main.action.about=À propos -faxtomail.main.action.about.tip=À propos -faxtomail.main.action.demandeList=Gestion des fax -faxtomail.main.action.demandeList.tip=Gestion des fax -faxtomail.main.action.exit=Quitter -faxtomail.main.action.exit.tip=Quitter l'application -faxtomail.main.action.recherche=Recherche -faxtomail.main.action.recherche.tip=Recherche parmi tous les éléments -faxtomail.main.title.application=FaxToMail -faxtomail.main.title.applicationName=FaxToMail -faxtomail.pdfEditor.action.cancel=Annuler -faxtomail.pdfEditor.action.cancel.tip=Ne pas enregistrer les changements et fermer -faxtomail.pdfEditor.action.validate=Enregistrer -faxtomail.pdfEditor.action.validate.tip=Enregistrer les changements et fermer -faxtomail.pdfEditor.askSaveBeforeLeaving.save=Les modifications apportées n'ont pas été sauvegardées. -faxtomail.pdfEditor.button.addCross.tip=Ajouter une croix -faxtomail.pdfEditor.button.addHLine.tip=Ajouter une ligne horizontale -faxtomail.pdfEditor.button.addHighlighter.tip=Ajouter un surlignement -faxtomail.pdfEditor.button.addNote.tip=Ajouter une note -faxtomail.pdfEditor.button.addVLine.tip=Ajouter une ligne verticale -faxtomail.pdfEditor.button.nextPage=Page suivante -faxtomail.pdfEditor.button.previousPage=Page précédente -faxtomail.pdfEditor.button.print=Imprimer -faxtomail.pdfEditor.button.rotateAntiClockwise=Rotation sens anti-horaire -faxtomail.pdfEditor.button.rotateClockwise=Rotation sens horaire -faxtomail.pdfEditor.button.zoomIn=Agrandir -faxtomail.pdfEditor.button.zoomOut=Réduire -faxtomail.pdfEditor.convertToPdf.error=Erreur lors de la conversion en PDF -faxtomail.pdfEditor.readPdf.error=Erreur lors de la lecture du PDF -faxtomail.print.success.message=%s fichiers ont été imprimés -faxtomail.quantitiesByRange.button.text=OK -faxtomail.quantitiesByRange.title=Quantités par gamme -faxtomail.rangeRows.table.header.commandNumber=N° commande / devis -faxtomail.rangeRows.table.header.commandNumber.tip=N° commande / devis -faxtomail.rangeRows.table.header.productColumn=Qté produits -faxtomail.rangeRows.table.header.productColumn.tip=Quantité de produits -faxtomail.rangeRows.table.header.quotationColumn=Qté devis -faxtomail.rangeRows.table.header.quotationColumn.tip=Quantité de devis -faxtomail.rangeRows.table.header.range=Gamme -faxtomail.rangeRows.table.header.range.tip=Gamme -faxtomail.rangeRows.table.header.savQuantity=Qté SAV -faxtomail.rangeRows.table.header.savQuantity.tip=Quantité de SAV -faxtomail.reply.action.cancel=Annuler -faxtomail.reply.action.cancel.tip=Annuler et fermer la popup -faxtomail.reply.action.close=Fermer -faxtomail.reply.action.close.tip=Fermer -faxtomail.reply.action.forward=Transférer -faxtomail.reply.action.forward.tip=Retransférer la réponse vers une autre adresse email -faxtomail.reply.action.validate=Envoyer -faxtomail.reply.action.validate.tip=Envoyer la réponse au mail -faxtomail.reply.attachment.label=%1$s (%2$s ko) -faxtomail.reply.attachments.add.label=Ajouter des pièces jointes -faxtomail.reply.attachments.title=Pièces-jointes (%1$s / %2$s ko autorisés) -faxtomail.reply.forward=Transfert de la réponse \: %s -faxtomail.reply.forwardsubject=Tr\: %s -faxtomail.reply.label.cc=Copie \: -faxtomail.reply.label.cci=Copie cachée \: -faxtomail.reply.label.from=De \: -faxtomail.reply.label.subject=Objet \: -faxtomail.reply.label.to=À \: -faxtomail.reply.message=\nLe %1$s, %2$s a écrit \:\n> %3$s -faxtomail.reply.subject=Re \: %s -faxtomail.reply.title=Réponse à \: %s -faxtomail.search.action.error=Erreur lors de la recherche -faxtomail.search.action.gotoFolder=Aller au dossier -faxtomail.search.action.gotoFolder.tip=Aller au dossier -faxtomail.search.addGroupedElement.label=Ajouter les éléments groupés aux résultats -faxtomail.search.archivedBetween.label=Archivé entre le -faxtomail.search.between2ndPart.label=et le -faxtomail.search.button.label=Rechercher -faxtomail.search.button.mnemonic=R -faxtomail.search.hideAdvancedSearch.label=Cacher la recherche avancée -faxtomail.search.modifiedBetween.label=Modifié entre le -faxtomail.search.modifiedBy.label=Modifié par -faxtomail.search.printedBetween.label=Imprimé entre le -faxtomail.search.receivedBetween.label=Reçu entre le -faxtomail.search.repliedBetween.label=Réponse entre le -faxtomail.search.showAdvancedSearch.label=Afficher la recherche avancée -faxtomail.search.title=Recherche -faxtomail.search.transferBetween.label=Transmis entre le -faxtomail.searchToGroup.action.cancel=Annuler -faxtomail.searchToGroup.action.cancel.tip=Fermer la fenêtre sans grouper l'élément -faxtomail.searchToGroup.action.group=Grouper -faxtomail.searchToGroup.action.group.tip=Grouper avec l'élément courant -faxtomail.searchToGroup.title=Recherche de l'élément avec lequel grouper l'élément %s -faxtomail.systemUser=Système -faxtomail.validator.error.email.clientCode.required=Code client requis -faxtomail.validator.error.email.comment.required=Message requis -faxtomail.validator.error.email.companyReference.required=Notre référence requis -faxtomail.validator.error.email.demandType.required=Type de demande requis -faxtomail.validator.error.email.object.required=Objet requis -faxtomail.validator.error.email.priority.required=Priorité requise -faxtomail.validator.error.email.projectReference.required=Référence chantier requise -faxtomail.validator.error.email.rangeRow.required=Tableau des gammes requis -faxtomail.validator.error.email.waitingState.required=État d'attente requis -faxtomail.validator.error.reply.cc.email=Le champ 'Copie\:' doit être une adresse email valide \! -faxtomail.validator.error.reply.cci.email=Le champ 'opie cachée\:' doit être une adresse email valide \! -faxtomail.validator.error.reply.from.email= -faxtomail.validator.error.reply.from.invalidDomain= -faxtomail.validator.error.reply.from.required= -faxtomail.validator.error.reply.subject.required= -faxtomail.validator.error.reply.to.email=Le champ 'A\:' doit être une adresse email valide \! -faxtomail.validator.error.reply.to.required=Le champ 'A\:' est requis \! -jaxx.application.error.cannot.mail=Erreur lors de l'ouverture du client mail -jaxx.application.error.cannot.open=Erreur lors de l'ouverture de la pièce jointe -jaxx.application.error.cannot.print=Erreur lors de l'impression -jaxx.application.error.desktop.edit.not.supported=L'action d'edition des fichiers par le système n'est pas supporté -jaxx.application.error.desktop.not.supported=L'ouverture des fichiers par le système n'est pas supporté -jaxx.application.error.desktop.print.not.supported=Erreur lors de l'impression -jaxx.application.error.noPrinter=Erreur lors de l'impression -swing.error.cannot.copy.file=Erreur lors de la copie des fichiers diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-about.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-about.png deleted file mode 100644 index 0d826bb..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-about.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-archive.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-archive.png deleted file mode 100644 index 8606ff0..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-archive.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-attachment.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-attachment.png deleted file mode 100644 index ea897cc..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-attachment.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-cancel.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-cancel.png deleted file mode 100644 index c149c2b..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-cancel.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-collapse.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-collapse.png deleted file mode 100644 index f88a24a..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-collapse.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-compute.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-compute.png deleted file mode 100644 index 701a60a..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-compute.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-config.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-config.png deleted file mode 100755 index 9460dfc..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-config.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-cross.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-cross.png deleted file mode 100644 index 856b762..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-cross.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-delete.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-delete.png deleted file mode 100644 index 08f2493..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-delete.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-edit.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-edit.png deleted file mode 100644 index 0bfecd5..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-edit.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-email-group.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-email-group.png deleted file mode 100644 index 2c49f78..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-email-group.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-email.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-email.png deleted file mode 100644 index 7b6f981..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-email.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-exit.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-exit.png deleted file mode 100755 index a77152b..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-exit.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-expand.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-expand.png deleted file mode 100644 index 3c19e48..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-expand.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-folder_edit.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-folder_edit.png deleted file mode 100644 index ad669cc..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-folder_edit.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-group.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-group.png deleted file mode 100644 index 25eacb7..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-group.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-highlighter.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-highlighter.png deleted file mode 100644 index 3d30d80..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-highlighter.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-hline.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-hline.png deleted file mode 100644 index 5860e7b..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-hline.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-import.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-import.png deleted file mode 100644 index cafac61..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-import.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-left.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-left.png deleted file mode 100644 index 5dc6967..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-left.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-line.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-line.png deleted file mode 100644 index 5860e7b..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-line.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-list.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-list.png deleted file mode 100644 index 473cee3..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-list.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-new-demand.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-new-demand.png deleted file mode 100644 index aa23dde..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-new-demand.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-note.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-note.png deleted file mode 100644 index 244e6ca..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-note.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-open-file.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-open-file.png deleted file mode 100644 index 784e8fa..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-open-file.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-open.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-open.png deleted file mode 100755 index 1ef6e11..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-open.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-print.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-print.png deleted file mode 100644 index a350d18..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-print.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-application.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-application.png deleted file mode 100644 index b3d8ce0..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-application.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-shortcut.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-shortcut.png deleted file mode 100644 index 898d402..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-shortcut.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-ui.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-ui.png deleted file mode 100644 index ab92010..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-ui.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-reply.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-reply.png deleted file mode 100644 index 4a6c5d3..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-reply.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-right.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-right.png deleted file mode 100644 index b1a1819..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-right.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-anticlockwise.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-anticlockwise.png deleted file mode 100644 index 46c75aa..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-anticlockwise.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-clockwise.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-clockwise.png deleted file mode 100644 index aa65210..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-rotate-clockwise.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-save.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-save.png deleted file mode 100644 index 99d532e..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-save.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-search.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-search.png deleted file mode 100644 index 908612e..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-search.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-transmit.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-transmit.png deleted file mode 100644 index 34a736f..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-transmit.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-user.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-user.png deleted file mode 100644 index 79f35cc..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-user.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-validate.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-validate.png deleted file mode 100644 index a9925a0..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-validate.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-view-history.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-view-history.png deleted file mode 100644 index cd05f19..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-view-history.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-vline.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-vline.png deleted file mode 100644 index a46f838..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-vline.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-in.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-in.png deleted file mode 100644 index af4fe07..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-in.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-out.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-out.png deleted file mode 100644 index 81f2819..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/action-zoom-out.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/add.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/add.png deleted file mode 100644 index 6332fef..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/add.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/application_home.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/application_home.png deleted file mode 100644 index b60d0c8..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/application_home.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/cross_blue.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/cross_blue.png deleted file mode 100644 index b961917..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/cross_blue.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/cross_red.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/cross_red.png deleted file mode 100644 index 4b8907e..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/cross_red.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/email.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/email.png deleted file mode 100644 index 7348aed..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/email.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/icons/house.png b/trunk/faxtomail-ui-swing/src/main/resources/icons/house.png deleted file mode 100644 index fed6221..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/icons/house.png and /dev/null differ diff --git a/trunk/faxtomail-ui-swing/src/main/resources/log4j2.xml b/trunk/faxtomail-ui-swing/src/main/resources/log4j2.xml deleted file mode 100644 index cb38397..0000000 --- a/trunk/faxtomail-ui-swing/src/main/resources/log4j2.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: UI - $Id: log4j2.xml 532 2014-08-12 16:39:47Z echatellier $ - $HeadURL: https://svn.codelutin.com/faxtomail/trunk/faxtomail-ui-swing/src/main/resour... $ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - -<Configuration> - - <Appenders> - <Console name="Console" target="SYSTEM_OUT"> - <PatternLayout pattern="%d{yyyy/MM/dd HH:mm:ss} %5p (%c:%L) - %m%n" /> - </Console> - - <RollingFile name="File" fileName="${sys:user.home}/.faxtomail/faxtomail.log" - filePattern="${sys:user.home}/.faxtomail/faxtomail-%d{yyyyMMdd}-%i.log"> - <PatternLayout> - <pattern>%d{yyyy/MM/dd HH:mm:ss} %5p (%c:%L) - %m%n</pattern> - </PatternLayout> - <Policies> - <TimeBasedTriggeringPolicy /> - <SizeBasedTriggeringPolicy size="10 MB"/> - </Policies> - <DefaultRolloverStrategy max="5"/> - </RollingFile> - </Appenders> - - <Loggers> - <Logger name="com.franciaflex.faxtomail" level="info"/> - <!-- <Logger name="com.franciaflex.faxtomail.services" level="debug"/> --> - - <Root level="error"> - <AppenderRef ref="Console" /> - <AppenderRef ref="File" /> - </Root> - </Loggers> -</Configuration> diff --git a/trunk/faxtomail-ui-swing/src/main/resources/splashscreen.png b/trunk/faxtomail-ui-swing/src/main/resources/splashscreen.png deleted file mode 100644 index aeb70e3..0000000 Binary files a/trunk/faxtomail-ui-swing/src/main/resources/splashscreen.png and /dev/null differ diff --git a/trunk/faxtomail-ui-web/LICENSE.txt b/trunk/faxtomail-ui-web/LICENSE.txt deleted file mode 100644 index 94a9ed0..0000000 --- a/trunk/faxtomail-ui-web/LICENSE.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/trunk/faxtomail-ui-web/README.txt b/trunk/faxtomail-ui-web/README.txt deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/faxtomail-ui-web/pom.xml b/trunk/faxtomail-ui-web/pom.xml deleted file mode 100644 index 33cf26a..0000000 --- a/trunk/faxtomail-ui-web/pom.xml +++ /dev/null @@ -1,403 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: Web - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>com.franciaflex</groupId> - <artifactId>faxtomail</artifactId> - <version>1.0</version> - </parent> - - <groupId>com.franciaflex.faxtomail</groupId> - <artifactId>faxtomail-ui-web</artifactId> - <packaging>war</packaging> - - <name>FaxToMail :: Web</name> - <description>faxToMail Web Module</description> - - <properties> - <redmine.releaseFiles> - target/${project.build.finalName}.war - </redmine.releaseFiles> - - <deployFiles>target/${project.build.finalName}.war</deployFiles> - - <defaultWebContextPath>faxtomail</defaultWebContextPath> - <defaultSiteUrl>http://localhost:8080/${defaultWebContextPath}</defaultSiteUrl> - - <devMode>true</devMode> - <jsMinimize>false</jsMinimize> - <jsCachePeriod>1</jsCachePeriod> - <jsPreProcessors>preProcessors=forceCssDataUri,cssUrlRewriting,cssImport,semicolonAppender</jsPreProcessors> - <jsPostProcessors>postProcessors=cssVariables</jsPostProcessors> - </properties> - - <dependencies> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>faxtomail-persistence</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>faxtomail-service</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.nuiton.topia</groupId> - <artifactId>topia-persistence</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-validator</artifactId> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.i18n</groupId> - <artifactId>nuiton-i18n</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-decorator</artifactId> - </dependency> - - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-core</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.struts.xwork</groupId> - <artifactId>xwork-core</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-collections4</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - </dependency> - - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - </dependency> - - <dependency> - <groupId>com.jgeppert.struts2.jquery</groupId> - <artifactId>struts2-jquery-plugin</artifactId> - </dependency> - - <dependency> - <groupId>com.jgeppert.struts2.bootstrap</groupId> - <artifactId>struts2-bootstrap-plugin</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-convention-plugin</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-sitemesh-plugin</artifactId> - </dependency> - - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-jcl</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - </dependency> - - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.web</groupId> - <artifactId>nuiton-struts2</artifactId> - </dependency> - - <dependency> - <groupId>org.quartz-scheduler</groupId> - <artifactId>quartz</artifactId> - </dependency> - - <dependency> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - </dependency> - - <dependency> - <groupId>javax.activation</groupId> - <artifactId>activation</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-wro</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-jquery</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-jquery-ui</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-bootstrap</artifactId> - </dependency> - - <dependency> - <groupId>org.webjars</groupId> - <artifactId>select2</artifactId> - <exclusions> - <exclusion> - <artifactId>jquery</artifactId> - <groupId>org.webjars</groupId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-angularjs</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-angular-ui-tree</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-font-awesome</artifactId> - </dependency> - - <dependency> - <groupId>org.webjars</groupId> - <artifactId>angular-ui-bootstrap</artifactId> - <exclusions> - <exclusion> - <artifactId>bootstrap</artifactId> - <groupId>org.webjars</groupId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.webjars</groupId> - <artifactId>angular-ui-sortable</artifactId> - <exclusions> - <exclusion> - <artifactId>jquery-ui</artifactId> - <groupId>org.webjars</groupId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-html5shiv</artifactId> - </dependency> - - <dependency> - <groupId>org.webjars</groupId> - <artifactId>respond</artifactId> - </dependency> - - <dependency> - <groupId>com.itextpdf</groupId> - <artifactId>itextpdf</artifactId> - </dependency> - - <dependency> - <groupId>org.xhtmlrenderer</groupId> - <artifactId>flying-saucer-pdf-itext5</artifactId> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>gui.ava</groupId> - <artifactId>html2image</artifactId> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - </dependencies> - - <build> - <finalName>faxtomail-${project.version}</finalName> - - <resources> - <resource> - <directory>src/main/resources</directory> - <includes> - <include>*.properties</include> - </includes> - <filtering>true</filtering> - </resource> - <resource> - <directory>src/main/resources</directory> - <excludes> - <exclude>*.properties</exclude> - </excludes> - <filtering>false</filtering> - </resource> - </resources> - - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.tomcat.maven</groupId> - <artifactId>tomcat7-maven-plugin</artifactId> - <configuration> - <path>/${defaultWebContextPath}</path> - <systemProperties> - <siteUrl>${defaultSiteUrl}</siteUrl> - </systemProperties> - <uriEncoding>UTF-8</uriEncoding> - </configuration> - </plugin> - - </plugins> - </pluginManagement> - - <plugins> - <plugin> - <groupId>org.nuiton.i18n</groupId> - <artifactId>i18n-maven-plugin</artifactId> - <executions> - <execution> - <id>parseJsp</id> - <goals> - <goal>parserStruts2</goal> - </goals> - <configuration> - <acceptKeyFormat>^faxtomail\..*$</acceptKeyFormat> - </configuration> - </execution> - <execution> - <id>parseOthersAndGen</id> - <configuration> - <entries> - <entry> - <specificGoal>parserValidation</specificGoal> - <basedir>${maven.src.dir}/main/java/</basedir> - <includes> - <param>**/**-validation.xml</param> - </includes> - </entry> - </entries> - </configuration> - <goals> - <goal>parserJava</goal> - <goal>gen</goal> - <goal>bundle</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <profiles> - - <profile> - <id>disable-devMode-release-profile</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - <properties> - <devMode>false</devMode> - <jsMinimize>true</jsMinimize> - <jsCachePeriod>0</jsCachePeriod> - <jsPreProcessors> </jsPreProcessors> <!-- Vide pour ne pas inclure la propriété en release --> - <jsPostProcessors> </jsPostProcessors> <!-- Vide pour ne pas inclure la propriété en release --> - </properties> - </profile> - - </profiles> -</project> diff --git a/trunk/faxtomail-ui-web/src/license/THIRD-PARTY.properties b/trunk/faxtomail-ui-web/src/license/THIRD-PARTY.properties deleted file mode 100644 index 9737b02..0000000 --- a/trunk/faxtomail-ui-web/src/license/THIRD-PARTY.properties +++ /dev/null @@ -1,70 +0,0 @@ -### -# #%L -# FaxToMail :: Web -# %% -# Copyright (C) 2014 Mac-Groupe, Code Lutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### -# Generated by org.codehaus.mojo.license.AddThirdPartyMojo -#------------------------------------------------------------------------------- -# Already used licenses in project : -# - AL 2.0 -# - Apache License 2.0 -# - Apache License, version 2.0 -# - BSD License -# - BSD-style license -# - CDDL -# - CDDL + GPLv2 with classpath exception -# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 -# - Common Development and Distribution License -# - Common Public License Version 1.0 -# - Copyright 2012 Igor Vaynberg -# - Eclipse Distribution License (EDL), Version 1.0 -# - Eclipse Public License (EPL), Version 1.0 -# - Eclipse Public License, Version 1.0 -# - GNU Affero General Public License v3 -# - GNU General Public License version 2 (GPLv2) -# - GNU General Public License, Version 2 with the Classpath Exception -# - GNU Lesser General Public License (LGPL), version 2.1 -# - GNU Lesser General Public License version 2.1 (LGPLv2.1) -# - GNU Lesser General Public License, Version 2.1 -# - GNU Library or Lesser General Public License -# - GPLv2+CE -# - General Public License (GPL) -# - Indiana University Extreme! Lab Software License, vesion 1.1.1 -# - Lesser General Public License (LGPL) -# - Lesser General Public License (LGPL) v 3.0 -# - Lesser General Public License (LPGL) -# - Lesser General Public License (LPGL) v 2.1 -# - MIT License -# - MPL 1.1 -# - New BSD License -# - Public Domain -# - SIL Open Font License (OFL) -# - The Apache Software License, Version 1.1 -# - The Apache Software License, Version 2.0 -# - The H2 License, Version 1.0 -# - UnboundID LDAP SDK Free Use License -#------------------------------------------------------------------------------- -# Please fill the missing licenses for dependencies : -# -# -#Fri Jul 25 10:54:33 CEST 2014 -commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 -dom4j--dom4j--1.6.1=BSD License -gui.ava--html2image--2.0.1=GNU Lesser General Public License, Version 2.1 -oro--oro--2.0.8=The Apache Software License, Version 2.0 diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/FaxToMailApplicationContext.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/FaxToMailApplicationContext.java deleted file mode 100644 index 302056e..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/FaxToMailApplicationContext.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.franciaflex.faxtomail; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.ServletContext; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.flyway.TopiaFlywayService; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaApplicationContext; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.InitFaxToMailService; -import com.franciaflex.faxtomail.services.service.migration.FaxtomailFlywayMigrationService; - -public class FaxToMailApplicationContext { - - private static Log log = LogFactory.getLog(FaxToMailApplicationContext.class); - - public static final String APPLICATION_CONTEXT_PARAMETER = "faxToMailApplicationContext"; - - protected FaxToMailTopiaApplicationContext topiaApplicationContext; - - protected FaxToMailConfiguration applicationConfig; - - public FaxToMailConfiguration getApplicationConfig() { - return applicationConfig; - } - - public FaxToMailTopiaApplicationContext getTopiaApplicationContext() { - return topiaApplicationContext; - } - - public FaxToMailTopiaPersistenceContext newPersistenceContext() { - - FaxToMailTopiaPersistenceContext persistenceContext = getTopiaApplicationContext().newPersistenceContext(); - - return persistenceContext; - - } - - public FaxToMailServiceContext newServiceContext(FaxToMailTopiaPersistenceContext persistenceContext) { - - // FIXME AThimel 05/08/14 Check if newDirectServiceContext or newServiceContext must be used - FaxToMailServiceContext newServiceContext = - FaxToMailServiceContext.newDirectServiceContext(persistenceContext); - - FaxToMailConfiguration applicationConfig = getApplicationConfig(); - - newServiceContext.setApplicationConfig(applicationConfig); - - return newServiceContext; - - } - - public void close() { - if (topiaApplicationContext != null) { - topiaApplicationContext.close(); - } - } - - public void init(ServletContext servletContext) { - - applicationConfig = new FaxToMailConfiguration("faxToMail.properties"); - - // it's set here for only web application to migrate schema, not client - Map<String, String> properties = new HashMap<>(); - properties.put("topia.service.migration", FaxtomailFlywayMigrationService.class.getName()); - properties.put("topia.service.migration." + TopiaFlywayService.USE_MODEL_VERSION, "false"); - - // add configuration properties after to allow override - properties.putAll(applicationConfig.getTopiaProperties()); - - // create application - topiaApplicationContext = new FaxToMailTopiaApplicationContext(properties); - - /*if (getApplicationConfig().isLogConfigurationProvided()) { - - File log4jConfigurationFile = getApplicationConfig().getLogConfigurationFile(); - - String log4jConfigurationFileAbsolutePath = log4jConfigurationFile.getAbsolutePath(); - - if (log4jConfigurationFile.exists()) { - - if (log.isInfoEnabled()) { - log.info("will use logging configuration " + log4jConfigurationFileAbsolutePath); - } - - // reset logger configuration - LogManager.resetConfiguration(); - - // use generate log config file - PropertyConfigurator.configure(log4jConfigurationFileAbsolutePath); - - log = LogFactory.getLog(FaxToMailApplicationContext.class); - - } else { - if (log.isWarnEnabled()) { - log.warn("there is no file " + log4jConfigurationFileAbsolutePath + ". Default logging configuration will be used."); - } - } - - } else { - log.info("will use default logging configuration"); - }*/ - -// I18nInitializer initializer = new DefaultI18nInitializer("faxtomail"); - -// I18n.init(initializer, Locale.FRANCE); - -// LocalizedTextUtil.addDefaultResourceBundle("i18n.faxtomail-web"); - - FaxToMailTopiaApplicationContext topiaAppContext = getTopiaApplicationContext(); - if (topiaAppContext.isSchemaEmpty()) { - if (log.isInfoEnabled()) { - log.info("Create application schema"); - } - topiaAppContext.createSchema(); - } - - FaxToMailTopiaPersistenceContext persistenceContext = newPersistenceContext(); - - FaxToMailServiceContext serviceContext = newServiceContext(persistenceContext); - - InitFaxToMailService initFaxToMailService = - serviceContext.getInitFaxToMailService(); - - initFaxToMailService.init(); - - persistenceContext.close(); - - } - -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java deleted file mode 100644 index e6b2576..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.franciaflex.faxtomail.web; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.Map; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserAbstract; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.convention.annotation.Result; -import org.apache.struts2.convention.annotation.Results; -import org.nuiton.topia.persistence.TopiaEntity; - -import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailEntityEnum; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.MailFolderAbstract; -import com.franciaflex.faxtomail.web.json.HibernateProxyTypeAdapter; -import com.franciaflex.faxtomail.web.json.TopiaEntityAdapter; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Maps; -import com.google.common.collect.Multimap; -import com.google.gson.ExclusionStrategy; -import com.google.gson.FieldAttributes; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.opensymphony.xwork2.ActionSupport; - -@Results({ - @Result(name="login", type="redirectAction", params = { "actionName", "login-input", "namespace", "/authentication"}) -}) -public class FaxToMailActionSupport extends ActionSupport { - - private static final Log log = LogFactory.getLog(FaxToMailActionSupport.class); - - public static final String SAVE = "save"; - - public static final String NEXT = "next"; - - protected static final Multimap<Class<?>, String> GSON_EXCLUSIONS = HashMultimap.create(); - - static { - // Fill exclusion map - GSON_EXCLUSIONS.put(FaxToMailUserAbstract.class, FaxToMailUser.PROPERTY_AFFECTED_FOLDERS); - GSON_EXCLUSIONS.put(MailFolderAbstract.class, MailFolder.PROPERTY_PARENT); - } - - protected static final ExclusionStrategy EXCLUSION_STRATEGY = new ExclusionStrategy() { - @Override - public boolean shouldSkipField(FieldAttributes f) { - Class<?> declaringClass = f.getDeclaringClass(); - String attributeName = f.getName(); - boolean result = GSON_EXCLUSIONS.containsEntry(declaringClass, attributeName); - return result; - } - - @Override - public boolean shouldSkipClass(Class<?> clazz) { - return false; - } - }; - - protected FaxToMailConfiguration applicationConfig; - - protected FaxToMailSession session; - - protected static Gson gson; - - public void setApplicationConfig(FaxToMailConfiguration applicationConfig) { - this.applicationConfig = applicationConfig; - } - - public FaxToMailConfiguration getApplicationConfig() { - return applicationConfig; - } - - protected FaxToMailSession getSession() { - return session; - } - - public void setSession(FaxToMailSession session) { - this.session = session; - } - - public boolean isAuthenticated() { - return session.getAuthenticatedFaxToMailUser() != null; - } - - public boolean isAdmin() { - return session.isAdmin(); - } - - public FaxToMailUser getAuthenticatedUser() { - return session.getAuthenticatedFaxToMailUser(); - } - - public String toJson(Object element) { - String result = null; - try { - result = getGson().toJson(element); - } catch (Exception e) { - log.warn("Can't convert object to json", e); - } - return result; - } - - public static Gson getGson() { - if (gson == null) { - GsonBuilder builder = new GsonBuilder(); - // exclusion - builder.addSerializationExclusionStrategy(EXCLUSION_STRATEGY); - - // Renseigne a gson comment instancier les Impl à partir des interfaces Topia - FaxToMailEntityEnum[] classes = FaxToMailEntityEnum.getContracts(); - for (FaxToMailEntityEnum clazz : classes) { - Class<? extends TopiaEntity> type = clazz.getContract(); - Class<? extends TopiaEntity> implementationClass = clazz.getImplementation(); - TopiaEntityAdapter adapter = new TopiaEntityAdapter(implementationClass); - builder.registerTypeAdapter(type, adapter); - } - - // Type adapters : Hibernate proxies - builder.registerTypeAdapterFactory(HibernateProxyTypeAdapter.FACTORY); - - gson = builder.create(); - } - return gson; - } - - /** - * Transform enumeration values into map with i18n value for each enum value. - * - * i18n key is fqn.NAME - * - * @param values values to transform - * @return map (enum value > i18n text) - */ - protected <T> Map<T, String> getEnumAsMap(T... values) { - Map<T, String> valuesMap = Maps.newLinkedHashMap(); - for (T value : values) { - String i18n = value.getClass().getName() + "." + value.toString(); - String trans = getText(i18n); - valuesMap.put(value, trans); - } - return valuesMap; - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java deleted file mode 100644 index 41b79bc..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.franciaflex.faxtomail.web; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.quartz.CronScheduleBuilder; -import org.quartz.JobBuilder; -import org.quartz.JobDataMap; -import org.quartz.JobDetail; -import org.quartz.Scheduler; -import org.quartz.SchedulerException; -import org.quartz.Trigger; -import org.quartz.TriggerBuilder; -import org.quartz.impl.StdSchedulerFactory; - -import com.franciaflex.faxtomail.FaxToMailApplicationContext; -import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.web.job.ClientUpdateJob; -import com.franciaflex.faxtomail.web.job.EDIManagementJob; -import com.franciaflex.faxtomail.web.job.MailFilterJob; - -public class FaxToMailApplicationListener implements ServletContextListener { - - private static final Log log = LogFactory.getLog(FaxToMailApplicationListener.class); - - protected FaxToMailApplicationContext applicationContext; - - protected Scheduler scheduler; - - @Override - public void contextInitialized(ServletContextEvent sce) { - - if (log.isInfoEnabled()) { - log.info("init FaxToMail web ui"); - } - - log.debug("scheduler launched"); - - ServletContext sc = sce.getServletContext(); - applicationContext = new FaxToMailApplicationContext(); - applicationContext.init(sc); - - sce.getServletContext().setAttribute( - FaxToMailApplicationContext.APPLICATION_CONTEXT_PARAMETER, - applicationContext); - - FaxToMailConfiguration config = applicationContext.getApplicationConfig(); - - JobDataMap data = new JobDataMap(); - - data.put(MailFilterJob.APPLICATION_CONTEXT, applicationContext); - - JobDetail mailFilteringJob = JobBuilder.newJob(MailFilterJob.class) - .usingJobData(data) - .withIdentity("faxToMailJobs", "mailFilteringJob") - .build(); - - JobDetail ediManagementJob = JobBuilder.newJob(EDIManagementJob.class) - .usingJobData(data) - .withIdentity("faxToMailJobs", "ediManagementJob") - .build(); - - JobDetail clientUpdateJob = JobBuilder.newJob(ClientUpdateJob.class) - .usingJobData(data) - .withIdentity("faxToMailJobs", "clientUpdateJob") - .build(); - - try { - - scheduler = new StdSchedulerFactory().getScheduler(); - - // schedule mail job (toutes les 5 minutes) - Trigger trigger = TriggerBuilder - .newTrigger() - .withIdentity("mailFiltering", "mailFilteringTrigger") - .withSchedule(CronScheduleBuilder.cronSchedule(config.getJobMailExpression())) - .build(); - - scheduler.scheduleJob(mailFilteringJob, trigger); - - // schedule EDI job (toutes les 5 minutes) - trigger = TriggerBuilder - .newTrigger() - .withIdentity("ediManagement", "ediManagementTrigger") - .withSchedule(CronScheduleBuilder.cronSchedule(config.getJobEdiExpression())) - .build(); - - scheduler.scheduleJob(ediManagementJob, trigger); - - // schedule client updates (toutes les 15 minutes) - trigger = TriggerBuilder - .newTrigger() - .withIdentity("clientUpdates", "clientUpdatesTrigger") - .withSchedule(CronScheduleBuilder.cronSchedule(config.getJobCientExpression())) - .build(); - - scheduler.scheduleJob(clientUpdateJob, trigger); - - scheduler.start(); - log.debug("schedulers launched"); - - } catch (SchedulerException e) { - log.error("Error while launching the mail filter job", e); - } - - } - - @Override - public void contextDestroyed(ServletContextEvent sce) { - - if (scheduler != null) { - if (log.isInfoEnabled()) { - if (log.isInfoEnabled()) { - log.info("Stopping quartz sheduler"); - } - } - - try { - // wait for thread to complete - scheduler.shutdown(); - } catch (SchedulerException e) { - if (log.isWarnEnabled()) { - log.warn("Can't stop quartz", e); - } - } - } - - if (log.isInfoEnabled()) { - log.info("Closing web ui application context"); - } - - applicationContext.close(); - - } - -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java deleted file mode 100644 index 26d7bf2..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.franciaflex.faxtomail.web; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.beans.PropertyDescriptor; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.beans.BeanUtil; - -import com.franciaflex.faxtomail.FaxToMailApplicationContext; -import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; -import com.franciaflex.faxtomail.services.FaxToMailService; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.LdapService; -import com.google.common.base.Preconditions; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.ActionProxy; -import com.opensymphony.xwork2.interceptor.Interceptor; - -public class FaxToMailInterceptor implements Interceptor { - - private static final Log log = LogFactory.getLog(FaxToMailInterceptor.class); - - public static final String SESSION_LAST_LOCATION = "lastLocation"; - - @Override - public void init() { - - if (log.isDebugEnabled()) { - log.debug("init " + this); - } - - } - - @Override - public String intercept(ActionInvocation invocation) throws Exception { - Object action = invocation.getAction(); - - if (action instanceof FaxToMailActionSupport) { - - FaxToMailServiceContext serviceContext = null; - try { - FaxToMailActionSupport faxToMailAction = (FaxToMailActionSupport) action; - - serviceContext = newServiceContext(invocation); - - FaxToMailSession faxToMailSession = getFaxToMailSession(invocation); - populateUser(faxToMailSession, serviceContext); - - if (CollectionUtils.isNotEmpty(faxToMailSession.getMessages())) { - for (String message : faxToMailSession.getMessages()) { - faxToMailAction.addActionMessage(message); - } - faxToMailSession.getMessages().clear(); - } - - if (CollectionUtils.isNotEmpty(faxToMailSession.getErrorMessages())) { - for (String message : faxToMailSession.getErrorMessages()) { - faxToMailAction.addActionError(message); - } - faxToMailSession.getErrorMessages().clear(); - } - - Set<PropertyDescriptor> descriptors = - BeanUtil.getDescriptors( - action.getClass(), - BeanUtil.IS_WRITE_DESCRIPTOR); - - for (PropertyDescriptor propertyDescriptor : descriptors) { - - Class<?> propertyType = propertyDescriptor.getPropertyType(); - Object toInject = null; - - if (FaxToMailService.class.isAssignableFrom(propertyType)) { - Class<? extends FaxToMailService> serviceClass = - (Class<? extends FaxToMailService>) propertyType; - toInject = serviceContext.newService(serviceClass); - - } else if (FaxToMailSession.class.isAssignableFrom(propertyType)) { - toInject = faxToMailSession; - - } else if (FaxToMailConfiguration.class.isAssignableFrom(propertyType)) { - toInject = getFaxToMailApplicationContext(invocation).getApplicationConfig(); - } else if (FaxToMailApplicationContext.class.isAssignableFrom(propertyType)) { - toInject = getFaxToMailApplicationContext(invocation); - } - - if (toInject != null) { - if (log.isTraceEnabled()) { - log.trace("injecting " + toInject + " in action " + action); - } - propertyDescriptor.getWriteMethod().invoke(action, toInject); - } - } - - return invocation.invoke(); - } finally { - if (serviceContext != null) { - serviceContext.getPersistenceContext().close(); - } - } - - } else { - - // not an action, just process - saveLastAction(invocation); - return invocation.invoke(); - - } - - } - - protected void populateUser(FaxToMailSession faxToMailSession, FaxToMailServiceContext serviceContext) { - if (StringUtils.isNotBlank(faxToMailSession.getAuthenticatedUserId())) { - LdapService ldapService = serviceContext.getLdapService(); - // return can be null - FaxToMailUser user = ldapService.getUserBean(faxToMailSession.getAuthenticatedUserId()); - faxToMailSession.setAuthenticatedFaxToMailUser(user); - - // test si l'utilisateur est admin - List<String> adminGroups = serviceContext.getApplicationConfig().getLdapAdminGroups(); - if (user != null && CollectionUtils.isNotEmpty(adminGroups) && user.getUserGroups() != null) { - for (FaxToMailUserGroup group : user.getUserGroups()) { - if (adminGroups.contains(group.getCompleteName())) { - faxToMailSession.setAdmin(true); - } - } - } - } - } - - protected void saveLastAction(ActionInvocation invocation) { - Map<String, Object> session = invocation.getInvocationContext().getSession(); - ActionProxy proxy = invocation.getProxy(); - String lastLocation = proxy.getNamespace() + "/" + proxy.getActionName() + "!" + proxy.getMethod() + "?"; - Map<String, Object> parameters = invocation.getInvocationContext().getParameters(); - for (String key : parameters.keySet()) { - Object[] value = (Object[]) parameters.get(key); - lastLocation += key + "=" + value[0] + "&"; - } - session.put(SESSION_LAST_LOCATION, lastLocation); - } - - protected FaxToMailSession getFaxToMailSession(ActionInvocation invocation) { - - FaxToMailSession session = (FaxToMailSession) invocation.getInvocationContext().getSession().get(FaxToMailSession.SESSION_PARAMETER); - - if (session == null) { - session = new FaxToMailSession(); - invocation.getInvocationContext().getSession().put(FaxToMailSession.SESSION_PARAMETER, session); - } - - return session; - - } - - protected FaxToMailApplicationContext getFaxToMailApplicationContext(ActionInvocation invocation) { - - FaxToMailApplicationContext applicationContext = - (FaxToMailApplicationContext) invocation - .getInvocationContext() - .getApplication() - .get(FaxToMailApplicationContext.APPLICATION_CONTEXT_PARAMETER); - - Preconditions.checkNotNull(applicationContext, - "application context must be initialized before calling an action"); - - return applicationContext; - - } - - protected FaxToMailServiceContext newServiceContext(ActionInvocation invocation) { - - FaxToMailApplicationContext extranetEncAhiApplicationContext = getFaxToMailApplicationContext(invocation); - FaxToMailTopiaPersistenceContext persistenceContext = extranetEncAhiApplicationContext.newPersistenceContext(); - FaxToMailServiceContext serviceContext = - extranetEncAhiApplicationContext.newServiceContext(persistenceContext); - - return serviceContext; - } - - @Override - public void destroy() { - if (log.isDebugEnabled()) { - log.debug("destroy " + this); - } - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonAction.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonAction.java deleted file mode 100644 index 77e61c6..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonAction.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.franciaflex.faxtomail.web; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.struts2.convention.annotation.Result; -import org.apache.struts2.convention.annotation.Results; - -import com.opensymphony.xwork2.Action; - - -/** - * Abstract action used to render custom objects as json string using gson directly in response output stream. - * - * @author Eric Chatellier - */ -@Results({ - @Result(type = "faxtomail-json", name = Action.SUCCESS), - @Result(type = "faxtomail-json", name = Action.ERROR) -}) -public abstract class FaxToMailJsonAction extends FaxToMailActionSupport { - - /** - * Method to override to get object data to render as json. Method HAS to be public because result support will use - * this method. - * - * @return object to render as json - */ - public abstract Object getJsonData(); - -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonResultSupport.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonResultSupport.java deleted file mode 100644 index 49b9293..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonResultSupport.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.franciaflex.faxtomail.web; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.IOException; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.dispatcher.StrutsResultSupport; - -import com.google.common.base.Charsets; -import com.opensymphony.xwork2.Action; -import com.opensymphony.xwork2.ActionInvocation; - -public class FaxToMailJsonResultSupport extends StrutsResultSupport { - - private static final Log log = LogFactory.getLog(FaxToMailJsonResultSupport.class); - - @Override - protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { - Object jsonData = invocation.getStack().findValue("jsonData"); - - String json = FaxToMailActionSupport.getGson().toJson(jsonData); - - // Work-arround for IE to not display download dialog for json result - // see https://github.com/blueimp/jQuery-File-Upload/issues/1795 - HttpServletRequest servletRequest = (HttpServletRequest) invocation.getInvocationContext().get(HTTP_REQUEST); - HttpServletResponse servletResponse = (HttpServletResponse) invocation.getInvocationContext().get(HTTP_RESPONSE); - servletResponse.setCharacterEncoding(Charsets.UTF_8.name()); - if (servletRequest.getHeader("accept").indexOf("application/json") != -1) { - servletResponse.setContentType("application/json"); - } else { - // IE workaround - servletResponse.setContentType("text/plain"); - } - - // manage error code - if (!Action.SUCCESS.equals(invocation.getResultCode())) { - servletResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - } - - try { - ServletOutputStream outputStream = servletResponse.getOutputStream(); - byte[] jsonBytes = json.getBytes(Charsets.UTF_8); // On transforme en bytes pour assurer l'encodage - outputStream.write(jsonBytes); - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("Unable to write JSON output into Servlet Response"); - } - } - - } - -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailLoginInterceptor.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailLoginInterceptor.java deleted file mode 100644 index 4f4508f..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailLoginInterceptor.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.franciaflex.faxtomail.web; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.Interceptor; - -/** - * Authentication interceptor. - * - * @author Eric Chatellier - */ -public class FaxToMailLoginInterceptor implements Interceptor { - - /** serialVersionUID. */ - private static final long serialVersionUID = -5760224375232019437L; - - /* - * @see com.opensymphony.xwork2.interceptor.Interceptor#init() - */ - @Override - public void init() { - - } - - public String intercept(ActionInvocation invocation) throws Exception { - ActionContext context = invocation.getInvocationContext(); - FaxToMailSession session = (FaxToMailSession) context.getSession().get(FaxToMailSession.SESSION_PARAMETER); - if (session == null || session.getAuthenticatedFaxToMailUser() == null) { - return "redirect-to-login"; - } else { - return invocation.invoke(); - } - } - - /* - * @see com.opensymphony.xwork2.interceptor.Interceptor#destroy() - */ - @Override - public void destroy() { - - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailSession.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailSession.java deleted file mode 100644 index d69a8d9..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailSession.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.franciaflex.faxtomail.web; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.google.common.collect.Lists; - -import java.io.Serializable; -import java.util.Collection; - -public class FaxToMailSession implements Serializable { - - public static final String SESSION_PARAMETER = "faxToMailSession"; - - protected Collection<String> messages; - - protected Collection<String> errorMessages; - - protected String authenticatedUserId; - - protected transient FaxToMailUser authenticatedFaxToMailUser; - - protected transient boolean admin; - - public Collection<String> getMessages() { - if (messages == null) { - messages = Lists.newLinkedList(); - } - return messages; - } - - public void addMessage(String message) { - getMessages().add(message); - } - - public Collection<String> getErrorMessages() { - if (errorMessages == null) { - errorMessages = Lists.newLinkedList(); - } - return errorMessages; - } - - public void addErrorMessages(String errorMessage) { - getErrorMessages().add(errorMessage); - } - - public String getAuthenticatedUserId() { - return authenticatedUserId; - } - - public void setAuthenticatedUserId(String authenticatedUserId) { - this.authenticatedUserId = authenticatedUserId; - } - - public FaxToMailUser getAuthenticatedFaxToMailUser() { - return authenticatedFaxToMailUser; - } - - public void setAuthenticatedFaxToMailUser(FaxToMailUser authenticatedFaxToMailUser) { - this.authenticatedFaxToMailUser = authenticatedFaxToMailUser; - } - - public void logout() { - setAuthenticatedUserId(null); - setAuthenticatedFaxToMailUser(null); - } - - public boolean isAdmin() { - return admin; - } - - public void setAdmin(boolean admin) { - this.admin = admin; - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/IndexAction.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/IndexAction.java deleted file mode 100644 index df2e9bb..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/IndexAction.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.franciaflex.faxtomail.web.action; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.web.FaxToMailActionSupport; - -import org.apache.struts2.convention.annotation.InterceptorRef; -import org.apache.struts2.convention.annotation.InterceptorRefs; - -@InterceptorRefs({ - @InterceptorRef("faxToMailInterceptor"), - @InterceptorRef("loginInterceptor"), - @InterceptorRef("paramsPrepareParamsStack") -}) -public class IndexAction extends FaxToMailActionSupport { - - @Override - public String execute() { - return SUCCESS; - } - -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LoginAction.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LoginAction.java deleted file mode 100644 index 509a162..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LoginAction.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.franciaflex.faxtomail.web.action; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.Result; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.services.service.LdapService; -import com.franciaflex.faxtomail.services.service.ldap.AuthenticationException; -import com.franciaflex.faxtomail.web.FaxToMailActionSupport; - -public class LoginAction extends FaxToMailActionSupport { - - protected LdapService ldapService; - - protected String login; - - protected String password; - - public void setLdapService(LdapService ldapService) { - this.ldapService = ldapService; - } - - public void setLogin(String login) { - this.login = login; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - @Action("login-input") - public String input() throws Exception { - return super.input(); - } - - @Override - @Action(results = { - @Result(type = "redirectAction", params = {"actionName", "index", "namespace", "/"})}) - public String execute() { - - String result = SUCCESS; - try { - FaxToMailUser user = ldapService.authenticateUser(login, password); - getSession().setAuthenticatedUserId(user.getTopiaId()); - } catch (AuthenticationException ex) { - result = INPUT; - addActionError("Impossible de se connecter (Le serveur à répondu : " + ex.getMessage() + ")"); - } - return result; - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LogoutAction.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LogoutAction.java deleted file mode 100644 index dae1934..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LogoutAction.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.franciaflex.faxtomail.web.action; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.Result; - -import com.franciaflex.faxtomail.web.FaxToMailActionSupport; - -public class LogoutAction extends FaxToMailActionSupport { - - @Override - @Action(results = { - @Result(type = "redirectAction", params = {"actionName", "index", "namespace", "/"})}) - public String execute() { - getSession().logout(); - return SUCCESS; - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java deleted file mode 100644 index bb3c8ab..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.franciaflex.faxtomail.web.action.admin; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.lang.reflect.Type; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.InterceptorRef; -import org.apache.struts2.convention.annotation.InterceptorRefs; -import org.apache.struts2.convention.annotation.Result; - -import com.franciaflex.faxtomail.persistence.entities.Configuration; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.EmailAccount; -import com.franciaflex.faxtomail.persistence.entities.EmailProtocol; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; -import com.franciaflex.faxtomail.persistence.entities.MailAction; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.MailFilter; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.Range; -import com.franciaflex.faxtomail.services.service.ConfigurationService; -import com.franciaflex.faxtomail.services.service.MailFolderService; -import com.franciaflex.faxtomail.services.service.ReferentielService; -import com.franciaflex.faxtomail.services.service.UserService; -import com.franciaflex.faxtomail.web.FaxToMailActionSupport; -import com.google.gson.reflect.TypeToken; -import com.opensymphony.xwork2.Preparable; - -/** - * @author kmorin - kmorin@codelutin.com - * - */ -@InterceptorRefs({ - @InterceptorRef("faxToMailInterceptor"), - @InterceptorRef("loginInterceptor"), - @InterceptorRef("paramsPrepareParamsStack") -}) -public class ConfigurationAction extends FaxToMailActionSupport implements Preparable { - - protected ConfigurationService configurationService; - - protected UserService userService; - - protected ReferentielService referentielService; - - protected MailFolderService mailFolderService; - - protected Configuration configuration; - - protected List<WaitingState> waitingStates; - - protected Map<String, Long> waitingStatesUsage; - - protected List<DemandType> demandTypes; - - protected List<Range> ranges; - - protected List<MailFolder> mailFolders; - - protected Map<String, Long> mailFoldersUsage; - - protected List<MailFilter> mailFilters; - - protected List<EmailAccount> emailAccounts; - - protected List<FaxToMailUser> users; - - protected List<FaxToMailUserGroup> groups; - - @Override - public void prepare() throws Exception { - // check authorization - if (!getSession().isAdmin()) { - throw new RuntimeException("Not authorized"); - } - } - - @Override - @Action("configuration-input") - public String input() throws Exception { - waitingStates = referentielService.getAllWaitingState(); - waitingStatesUsage = referentielService.getWaitingStatesUsage(); - demandTypes = referentielService.getAllDemandType(); - ranges = referentielService.getAllRange(); - mailFolders = mailFolderService.getRootMailFolders(); - mailFoldersUsage = mailFolderService.getMailFoldersUsage(); - emailAccounts = configurationService.getEmailAccountsWithoutPasswords(); - mailFilters = configurationService.getMailFilters(); - configuration = configurationService.getConfiguration(); - users = userService.getAllActiveUsers(); - groups = userService.getAllActiveUserGroups(); - return INPUT; - } - - @Override - @Action(results = {@Result(type = "redirectAction", params = {"actionName", "configuration-input"})}) - public String execute() throws Exception { - String result = super.execute(); - - configurationService.save(configuration, demandTypes, waitingStates, mailFolders, mailFilters, emailAccounts); - - return result; - } - - public void setConfigurationService(ConfigurationService configurationService) { - this.configurationService = configurationService; - } - - public void setUserService(UserService userService) { - this.userService = userService; - } - - public void setReferentielService(ReferentielService referentielService) { - this.referentielService = referentielService; - } - - public void setMailFolderService(MailFolderService mailFolderService) { - this.mailFolderService = mailFolderService; - } - - public Configuration getConfiguration() { - return configuration; - } - - public void setConfigurationJson(String json) { - this.configuration = getGson().fromJson(json, Configuration.class); - } - - public List<WaitingState> getWaitingStates() { - return waitingStates; - } - - public void setWaitingStatesJson(String json) { - Type type = new TypeToken<List<WaitingState>>() {}.getType(); - this.waitingStates = getGson().fromJson(json, type); - } - - public Map<String, Long> getWaitingStatesUsage() { - return waitingStatesUsage; - } - - public List<DemandType> getDemandTypes() { - return demandTypes; - } - - public void setDemandTypesJson(String json) { - Type type = new TypeToken<List<DemandType>>() {}.getType(); - this.demandTypes = getGson().fromJson(json, type); - } - - public List<Range> getRanges() { - return ranges; - } - - public List<MailFolder> getMailFolders() { - return mailFolders; - } - - public void setMailFoldersJson(String json) { - Type type = new TypeToken<List<MailFolder>>() {}.getType(); - this.mailFolders = getGson().fromJson(json, type); - } - - public List<MailFilter> getMailFilters() { - return mailFilters; - } - - public void setMailFiltersJson(String json) { - Type type = new TypeToken<List<MailFilter>>() {}.getType(); - this.mailFilters = getGson().fromJson(json, type); - } - - public Map<String, Long> getMailFoldersUsage() { - return mailFoldersUsage; - } - - public List<EmailAccount> getEmailAccounts() { - return emailAccounts; - } - - public void setEmailAccountsJson(String json) { - Type type = new TypeToken<List<EmailAccount>>() {}.getType(); - this.emailAccounts = getGson().fromJson(json, type); - } - - public List<FaxToMailUser> getUsers() { - return users; - } - - public List<FaxToMailUserGroup> getGroups() { - return groups; - } - - public Map<MailAction, String> getMailActions() { - return getEnumAsMap(MailAction.values()); - } - - public Map<MailField, String> getCanBeRequiredMailFields() { - return getEnumAsMap(MailField.getCanBeRequiredMailFields()); - } - - public Map<MailField, String> getTableMailFields() { - return getEnumAsMap(MailField.getTableFields()); - } - - public Map<EmailProtocol, Integer> getEmailProtocolPorts() { - Map<EmailProtocol, Integer> result = new LinkedHashMap<>(); - for (EmailProtocol protocol : EmailProtocol.values()) { - result.put(protocol, protocol.getDefaultPort()); - } - return result; - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java deleted file mode 100644 index 6d7e12e..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.franciaflex.faxtomail.web.action.admin; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.struts2.convention.annotation.Action; - -import com.franciaflex.faxtomail.persistence.entities.EmailAccount; -import com.franciaflex.faxtomail.services.service.ConfigurationService; -import com.franciaflex.faxtomail.web.FaxToMailJsonAction; - -public class ConfigurationJsonAction extends FaxToMailJsonAction { - - protected ConfigurationService configurationService; - - /** Directory path to check existence and writability. */ - protected String path; - - protected EmailAccount emailAccount; - - protected Object jsonData; - - public void setConfigurationService(ConfigurationService configurationService) { - this.configurationService = configurationService; - } - - public void setPath(String path) { - this.path = path; - } - - public void setEmailAccount(String json) { - this.emailAccount = getGson().fromJson(json, EmailAccount.class); - } - - @Action("configuration-check-directory-json") - public String checkDirectory() { - jsonData = configurationService.checkDirectory(path); - return SUCCESS; - } - - @Action("configuration-check-mailaccount-json") - public String checkMail() { - jsonData = configurationService.checkMailaccount(emailAccount); - return SUCCESS; - } - - @Override - public Object getJsonData() { - return jsonData; - } - -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java deleted file mode 100644 index 0053672..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.franciaflex.faxtomail.web.action.admin; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; - -import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.InterceptorRef; -import org.apache.struts2.convention.annotation.InterceptorRefs; -import org.apache.struts2.convention.annotation.Result; - -import com.franciaflex.faxtomail.services.service.ReferentielService; -import com.franciaflex.faxtomail.web.FaxToMailActionSupport; -import com.opensymphony.xwork2.Preparable; - -@InterceptorRefs({ - @InterceptorRef("faxToMailInterceptor"), - @InterceptorRef("loginInterceptor"), - @InterceptorRef("paramsPrepareParamsStack") -}) -public class ImportAction extends FaxToMailActionSupport implements Preparable { - - protected ReferentielService referentielService; - - protected File clientFile; - protected File demandTypeFile; - protected File rangeFile; - protected File priorityFile; - protected File waitingStateFile; - - public void setReferentielService(ReferentielService referentielService) { - this.referentielService = referentielService; - } - - public void setClientFile(File clientFile) { - this.clientFile = clientFile; - } - - public void setDemandTypeFile(File demandTypeFile) { - this.demandTypeFile = demandTypeFile; - } - - public void setRangeFile(File rangeFile) { - this.rangeFile = rangeFile; - } - - public void setPriorityFile(File priorityFile) { - this.priorityFile = priorityFile; - } - - public void setWaitingStateFile(File waitingStateFile) { - this.waitingStateFile = waitingStateFile; - } - - @Override - public void prepare() throws Exception { - // check authorization - if (!getSession().isAdmin()) { - throw new RuntimeException("Not authorized"); - } - } - - @Override - @Action("import-input") - public String input() throws Exception { - return INPUT; - } - - @Override - @Action(results = {@Result(type = "redirectAction", params = {"actionName", "import-input"})}) - public String execute() throws Exception { - - // clientFile - if (clientFile != null) { - try (InputStream is = new FileInputStream(clientFile)) { - referentielService.importClients(is); - getSession().addMessage("Fichier client importé avec succes"); - } catch (Exception ex) { - addActionError(ex.getMessage()); - } - } - - // demandTypeFile - if (demandTypeFile != null) { - try (InputStream is = new FileInputStream(demandTypeFile)) { - referentielService.importDemandTypes(is); - getSession().addMessage("Fichier type de demande importé avec succes"); - } catch (Exception ex) { - addActionError(ex.getMessage()); - } - } - - // rangeFile - if (rangeFile != null) { - try (InputStream is = new FileInputStream(rangeFile)) { - referentielService.importRanges(is); - getSession().addMessage("Fichier gamme importé avec succes"); - } catch (Exception ex) { - addActionError(ex.getMessage()); - } - } - - // priorityFile - if (priorityFile != null) { - try (InputStream is = new FileInputStream(priorityFile)) { - referentielService.importPriorities(is); - getSession().addMessage("Fichier priorité importé avec succes"); - } catch (Exception ex) { - addActionError(ex.getMessage()); - } - } - - // waitingStateFile - if (waitingStateFile != null) { - try (InputStream is = new FileInputStream(waitingStateFile)) { - referentielService.importWaitingStates(is); - getSession().addMessage("Fichier état attente importé avec succes"); - } catch (Exception ex) { - addActionError(ex.getMessage()); - } - } - - return hasErrors() ? super.input() : super.execute(); - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportArchiveAction.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportArchiveAction.java deleted file mode 100644 index f343d10..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportArchiveAction.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.franciaflex.faxtomail.web.action.admin; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.InterceptorRef; -import org.apache.struts2.convention.annotation.InterceptorRefs; -import org.apache.struts2.convention.annotation.Result; - -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.web.FaxToMailActionSupport; -import com.opensymphony.xwork2.Preparable; - -/** - * Action de reprise des archives. - * - * @author Eric Chatellier - */ -@InterceptorRefs({ - @InterceptorRef("faxToMailInterceptor"), - @InterceptorRef("loginInterceptor"), - @InterceptorRef("paramsPrepareParamsStack") -}) -public class ImportArchiveAction extends FaxToMailActionSupport implements Preparable { - - private static final Log log = LogFactory.getLog(ImportArchiveAction.class); - - protected String attachmentBase; - - protected File archiveFile; - - protected EmailService emailService; - - protected boolean disabledImport; - - public void setEmailService(EmailService emailService) { - this.emailService = emailService; - } - - public void setArchiveFile(File archiveFile) { - this.archiveFile = archiveFile; - } - - public void setAttachmentBase(String attachmentBase) { - this.attachmentBase = attachmentBase; - } - - public boolean isDisabledImport() { - return disabledImport; - } - - @Override - public void prepare() throws Exception { - // check authorization - if (!getSession().isAdmin()) { - throw new RuntimeException("Not authorized"); - } - } - - @Override - @Action("import-archive-input") - public String input() throws Exception { - checkDisabled(); - return super.input(); - } - - protected boolean checkDisabled() { - - // pour eviter les erreurs, on considere que si 1000 mails archivés sont présents, il - // proviennent de la reprise des archives - if (emailService.getArchivedMailCount() > 1000) { - disabledImport = true; - } - return disabledImport; - } - - @Override - public void validate() { - if (StringUtils.isNotEmpty(attachmentBase) && !new File(attachmentBase).isDirectory()) { - addActionError("Le répertoire de base des pièces jointes n'est pas un répertoire lisible !"); - } - if (archiveFile == null) { - addActionError("Le fichier d'archive est obligatoire !"); - } - - checkDisabled(); - } - - @Action(results = {@Result(type = "redirectAction", params = {"actionName", "import-archive-input"})}) - @Override - public String execute() throws Exception { - String result = INPUT; - - if (!checkDisabled()) { - try (InputStream is = new FileInputStream(archiveFile)) { - File file = new File(attachmentBase); - emailService.importArchive(is, file); - result = SUCCESS; - } catch (Exception ex) { - if (log.isErrorEnabled()) { - log.error("Can't import archive file", ex); - } - addActionError("Can't import archive " + ex.getMessage()); - } - } - return result; - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LdapAction.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LdapAction.java deleted file mode 100644 index fda886b..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LdapAction.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.franciaflex.faxtomail.web.action.admin; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.InterceptorRef; -import org.apache.struts2.convention.annotation.InterceptorRefs; -import org.apache.struts2.convention.annotation.Result; - -import com.franciaflex.faxtomail.FaxToMailApplicationContext; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.LdapService; -import com.franciaflex.faxtomail.services.service.UserService; -import com.franciaflex.faxtomail.web.FaxToMailActionSupport; -import com.opensymphony.xwork2.Preparable; - -@InterceptorRefs({ - @InterceptorRef("faxToMailInterceptor"), - @InterceptorRef("loginInterceptor"), - @InterceptorRef("paramsPrepareParamsStack"), - @InterceptorRef(value="execAndWait", - params={"excludeMethods","input"}) -}) -public class LdapAction extends FaxToMailActionSupport implements Preparable { - - protected UserService userService; - - protected long userCount; - - protected long groupCount; - - protected FaxToMailApplicationContext applicationContext; - - public void setApplicationContext(FaxToMailApplicationContext applicationContext) { - this.applicationContext = applicationContext; - } - - public void setUserService(UserService userService) { - this.userService = userService; - } - - public long getUserCount() { - return userCount; - } - - public long getGroupCount() { - return groupCount; - } - - @Override - public void prepare() throws Exception { - // check authorization - if (!getSession().isAdmin()) { - throw new RuntimeException("Not authorized"); - } - } - - @Override - @Action("ldap-input") - public String input() throws Exception { - userCount = userService.getActiveUserCount(); - groupCount = userService.getActiveGroupCount(); - return INPUT; - } - - @Override - @Action(results = { - @Result(name="wait", location="/WEB-INF/content/admin/ldap-wait.jsp"), - @Result(type = "redirectAction", params = {"actionName", "ldap-input"})}) - public String execute() throws Exception { - - // cette methode doit ouvrir sa propre connexion sinon l'interceptor va la fermer - // and cause du execAndWait - FaxToMailTopiaPersistenceContext persistenceContext = applicationContext.newPersistenceContext(); - try { - persistenceContext = applicationContext.newPersistenceContext(); - FaxToMailServiceContext serviceContext = applicationContext.newServiceContext(persistenceContext); - LdapService ldapService2 = serviceContext.newService(LdapService.class); - ldapService2.updateLdapData(); - } finally { - persistenceContext.close(); - } - - return SUCCESS; - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LockAction.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LockAction.java deleted file mode 100644 index 2b38c6b..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LockAction.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.franciaflex.faxtomail.web.action.admin; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.util.List; - -import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.InterceptorRef; -import org.apache.struts2.convention.annotation.InterceptorRefs; -import org.apache.struts2.convention.annotation.Result; - -import com.franciaflex.faxtomail.persistence.entities.MailLock; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.web.FaxToMailActionSupport; -import com.opensymphony.xwork2.Preparable; - -@InterceptorRefs({ - @InterceptorRef("faxToMailInterceptor"), - @InterceptorRef("loginInterceptor"), - @InterceptorRef("paramsPrepareParamsStack") -}) -public class LockAction extends FaxToMailActionSupport implements Preparable { - - protected EmailService emailService; - - protected List<MailLock> activeLocks; - - protected List<String> mailLockIds; - - public void setEmailService(EmailService emailService) { - this.emailService = emailService; - } - - @Override - public void prepare() throws Exception { - // check authorization - if (!getSession().isAdmin()) { - throw new RuntimeException("Not authorized"); - } - } - - @Override - @Action("lock-input") - public String input() throws Exception { - activeLocks = emailService.getAllMailLocks(); - return INPUT; - } - - @Override - @Action(results = {@Result(type = "redirectAction", params = {"actionName", "lock-input"})}) - public String execute() throws Exception { - if (mailLockIds != null) { - emailService.unlockMails(mailLockIds); - } - return SUCCESS; - } - - public List<MailLock> getActiveLocks() { - return activeLocks; - } - - public void setMailLockIds(List<String> mailLockIds) { - this.mailLockIds = mailLockIds; - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java deleted file mode 100644 index 392a0f0..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.franciaflex.faxtomail.web.action.admin; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.lang.reflect.Type; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.InterceptorRef; -import org.apache.struts2.convention.annotation.InterceptorRefs; -import org.apache.struts2.convention.annotation.Result; - -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.services.service.ConfigurationService; -import com.franciaflex.faxtomail.services.service.MailFolderService; -import com.franciaflex.faxtomail.web.FaxToMailActionSupport; -import com.google.gson.reflect.TypeToken; - -@InterceptorRefs({ - @InterceptorRef("faxToMailInterceptor"), - @InterceptorRef("loginInterceptor"), - @InterceptorRef("paramsPrepareParamsStack") -}) -public class UserFolderAction extends FaxToMailActionSupport { - - protected ConfigurationService configurationService; - - protected MailFolderService mailFolderService; - - protected List<MailFolder> mailFolders; - - protected Set<FaxToMailUser> users; - - protected Map<String, Collection<MailFolder>> userFolders; - - public void setConfigurationService(ConfigurationService configurationService) { - this.configurationService = configurationService; - } - - public void setMailFolderService(MailFolderService mailFolderService) { - this.mailFolderService = mailFolderService; - } - - @Override - @Action("user-folder-input") - public String input() throws Exception { - mailFolders = mailFolderService.getRootMailFolders(); - users = configurationService.getUserManagedUsers(getSession().getAuthenticatedFaxToMailUser()); - - // build display map - userFolders = new HashMap<>(); - for (FaxToMailUser user : users) { - userFolders.put(user.getTopiaId(), CollectionUtils.emptyIfNull(user.getAffectedFolders())); - } - return INPUT; - } - - @Override - @Action(results = {@Result(type = "redirectAction", params = {"actionName", "user-folder-input"})}) - public String execute() throws Exception { - - configurationService.saveUserFolders(userFolders); - return SUCCESS; - } - - public List<MailFolder> getMailFolders() { - return mailFolders; - } - - public Set<FaxToMailUser> getUsers() { - return users; - } - - public Map<String, Collection<MailFolder>> getUserFolders() { - return userFolders; - } - - public void setUserFoldersJson(String json) { - Type type = new TypeToken<Map<String, Collection<MailFolder>>>() {}.getType(); - this.userFolders = getGson().fromJson(json, type); - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/AbstractFaxToMailJob.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/AbstractFaxToMailJob.java deleted file mode 100644 index 361c980..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/AbstractFaxToMailJob.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.franciaflex.faxtomail.web.job; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.quartz.Job; -import org.quartz.JobExecutionContext; - -import com.franciaflex.faxtomail.FaxToMailApplicationContext; - -public abstract class AbstractFaxToMailJob implements Job { - - public static final String APPLICATION_CONTEXT = "applicationContext"; - - protected FaxToMailApplicationContext getApplicationContext(JobExecutionContext jobExecutionContext) { - FaxToMailApplicationContext applicationContext = (FaxToMailApplicationContext) jobExecutionContext.getMergedJobDataMap().get(APPLICATION_CONTEXT); - return applicationContext; - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/ClientUpdateJob.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/ClientUpdateJob.java deleted file mode 100644 index f6020bb..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/ClientUpdateJob.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.franciaflex.faxtomail.web.job; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.quartz.DisallowConcurrentExecution; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -import com.franciaflex.faxtomail.FaxToMailApplicationContext; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.ClientService; - -/** - * @author Kevin Morin (Code Lutin) - */ -@DisallowConcurrentExecution -public class ClientUpdateJob extends AbstractFaxToMailJob { - - private static final Log log = LogFactory.getLog(ClientUpdateJob.class); - - protected FaxToMailApplicationContext applicationContext; - - @Override - public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - - applicationContext = getApplicationContext(jobExecutionContext); - FaxToMailTopiaPersistenceContext persistenceContext = null; - - try { - persistenceContext = applicationContext.newPersistenceContext(); - FaxToMailServiceContext serviceContext = applicationContext.newServiceContext(persistenceContext); - - if (log.isInfoEnabled()) { - log.info("Running ClientUpdateJob at " + serviceContext.getNow()); - } - - ClientService clientService = serviceContext.getClientService(); - clientService.updateNewClients(); - - if (log.isDebugEnabled()) { - log.debug("ClientUpdateJob ended at " + serviceContext.getNow()); - } - } finally { - if (persistenceContext != null) { - persistenceContext.close(); - } - } - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/EDIManagementJob.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/EDIManagementJob.java deleted file mode 100644 index d17a384..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/EDIManagementJob.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.franciaflex.faxtomail.web.job; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.franciaflex.faxtomail.FaxToMailApplicationContext; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.service.EmailService; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.quartz.DisallowConcurrentExecution; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -/** - * @author Kevin Morin (Code Lutin) - */ -@DisallowConcurrentExecution -public class EDIManagementJob extends AbstractFaxToMailJob { - - private static final Log log = LogFactory.getLog(EDIManagementJob.class); - - protected FaxToMailApplicationContext applicationContext; - - @Override - public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - applicationContext = getApplicationContext(jobExecutionContext); - FaxToMailTopiaPersistenceContext persistenceContext = null; - - try { - persistenceContext = applicationContext.newPersistenceContext(); - FaxToMailServiceContext serviceContext = applicationContext.newServiceContext(persistenceContext); - if (log.isInfoEnabled()) { - log.info("Running EDIManagementJob at " + serviceContext.getNow()); - } - - EmailService emailService = serviceContext.getEmailService(); - emailService.transmitPendingDemandsToEdi(); - - if (log.isDebugEnabled()) { - log.debug("Transmission over"); - } - - emailService.updateRangeRowsWithEdiReturns(); - - if (log.isDebugEnabled()) { - log.debug("End of EDIManagementJob"); - } - } finally { - if (persistenceContext != null) { - persistenceContext.close(); - } - } - } - -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java deleted file mode 100644 index cbe2929..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java +++ /dev/null @@ -1,846 +0,0 @@ -package com.franciaflex.faxtomail.web.job; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import static org.nuiton.i18n.I18n.t; - -import gui.ava.html.Html2Image; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.nio.charset.Charset; -import java.text.DateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Date; -import java.util.Enumeration; -import java.util.List; -import java.util.Properties; -import java.util.regex.Pattern; - -import javax.activation.DataHandler; -import javax.activation.DataSource; -import javax.mail.Address; -import javax.mail.Flags; -import javax.mail.Folder; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.Part; -import javax.mail.Session; -import javax.mail.Store; -import javax.mail.internet.MimeBodyPart; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMultipart; -import javax.mail.internet.MimeUtility; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.ObjectUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.decorator.Decorator; -import org.nuiton.util.StringUtil; -import org.quartz.DisallowConcurrentExecution; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; -import org.xhtmlrenderer.pdf.ITextRenderer; - -import com.franciaflex.faxtomail.FaxToMailApplicationContext; -import com.franciaflex.faxtomail.FaxToMailConfiguration; -import com.franciaflex.faxtomail.persistence.entities.Attachment; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; -import com.franciaflex.faxtomail.persistence.entities.AttachmentFileImpl; -import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl; -import com.franciaflex.faxtomail.persistence.entities.Client; -import com.franciaflex.faxtomail.persistence.entities.DemandStatus; -import com.franciaflex.faxtomail.persistence.entities.Email; -import com.franciaflex.faxtomail.persistence.entities.EmailAccount; -import com.franciaflex.faxtomail.persistence.entities.EmailImpl; -import com.franciaflex.faxtomail.persistence.entities.ExtensionCommand; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.MailFilter; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.services.DecoratorService; -import com.franciaflex.faxtomail.services.FaxToMailServiceContext; -import com.franciaflex.faxtomail.services.FaxToMailServiceUtils; -import com.franciaflex.faxtomail.services.service.ClientService; -import com.franciaflex.faxtomail.services.service.ConfigurationService; -import com.franciaflex.faxtomail.services.service.EmailService; -import com.franciaflex.faxtomail.services.service.MailFolderService; -import com.itextpdf.text.Document; -import com.itextpdf.text.DocumentException; -import com.itextpdf.text.PageSize; -import com.itextpdf.text.Paragraph; -import com.itextpdf.text.pdf.PdfWriter; - -/** - * @author Kevin Morin (Code Lutin) - */ -@DisallowConcurrentExecution -public class MailFilterJob extends AbstractFaxToMailJob { - - private static final Log log = LogFactory.getLog(MailFilterJob.class); - - protected FaxToMailApplicationContext applicationContext; - - protected FaxToMailConfiguration config; - - protected ConfigurationService configurationService; - - protected EmailService emailService; - - protected MailFolderService mailFolderService; - - protected ClientService clientService; - - protected DecoratorService decoratorService; - - @Override - public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - applicationContext = getApplicationContext(jobExecutionContext); - FaxToMailTopiaPersistenceContext persistenceContext = null; - - - try { - persistenceContext = applicationContext.newPersistenceContext(); - FaxToMailServiceContext serviceContext = applicationContext.newServiceContext(persistenceContext); - config = serviceContext.getApplicationConfig(); - - if (log.isInfoEnabled()) { - log.info("Running MailFilterJob at " + serviceContext.getNow()); - } - - emailService = serviceContext.getEmailService(); - mailFolderService = serviceContext.getMailFolderService(); - configurationService = serviceContext.getConfigurationService(); - clientService = serviceContext.getClientService(); - decoratorService = serviceContext.getDecoratorService(); - - Collection<EmailAccount> emailAccounts = configurationService.getEmailAccounts(); - - for (EmailAccount account : emailAccounts) { - checkEmails(account); - } - - if (log.isDebugEnabled()) { - log.debug("MailFilterJob ended at " + serviceContext.getNow()); - } - } catch (Exception ex) { - if (log.isErrorEnabled()) { - log.error("Can't run quartz job", ex); - } - } finally { - if (persistenceContext != null) { - persistenceContext.close(); - } - } - } - - /** - * Checks the emails of the account - * @param account - */ - public void checkEmails(EmailAccount account) { - Properties properties = new Properties(); - - switch (account.getProtocol()) { - case IMAPS: - properties.setProperty("mail.imap.ssl.enable", "true"); - case IMAP: - properties.setProperty("mail.store.protocol", "imap"); - properties.setProperty("mail.imap.host", account.getHost()); - properties.setProperty("mail.imap.port", String.valueOf(account.getPort())); - properties.setProperty("mail.imap.connectiontimeout", "2000"); - break; - case POP3S: - properties.setProperty("mail.pop3.ssl.enable", "true"); - case POP3: - properties.setProperty("mail.store.protocol", "pop3"); - properties.setProperty("mail.pop3.host", account.getHost()); - properties.setProperty("mail.pop3.port", String.valueOf(account.getPort())); - properties.setProperty("mail.pop3.connectiontimeout", "2000"); - break; - } - - Session session = Session.getInstance(properties); - Store store = null; - Folder defaultFolder = null; - Folder inbox = null; - - try { - store = session.getStore(); - store.connect(account.getLogin(), account.getPassword()); - defaultFolder = store.getDefaultFolder(); - inbox = defaultFolder.getFolder("INBOX"); - checkEmailsOfFolder(account, inbox); - - } catch (Exception e) { - log.error("Error while getting emails from the mailbox", e); - - } finally { - close(inbox); - close(defaultFolder); - try { - if (store != null && store.isConnected()) { - store.close(); - } - } catch (MessagingException e) { - log.error("Error while closing the store", e); - } - } - - } - - protected void close(Folder folder) { - if (folder != null && folder.isOpen()) { - try { - boolean expunge = config.isMailExpunge(); - folder.close(expunge); - } catch (Exception e) { - log.error("Error while closing the folder", e); - } - } - } - - /** - * Check the emails of teh folder, create the emails in the database and delete the email in the folder. - * - * @param emailAccount email account currently checked - * @param folder the folder to check - */ - protected void checkEmailsOfFolder(EmailAccount emailAccount, Folder folder) { - - int importedCount = 0; - - try { - folder.open(Folder.READ_WRITE); - - int count = folder.getMessageCount(); - int unread = folder.getUnreadMessageCount(); - - if (log.isDebugEnabled()) { - log.debug(count + " messages, " + unread + " unread"); - } - - for (int i = 0 ; i < count ; i++) { - try { - Email email = new EmailImpl(); - email.setFax(emailAccount.isFaxAccountType()); - - int messageNumber = count - i; - Message message = folder.getMessage(messageNumber); - - Charset charset = FaxToMailServiceUtils.getCharset(message); - - List<String> modifiedProperties = new ArrayList<>(); - - if (log.isDebugEnabled()) { - log.debug(String.format("Message %d/%d : %s", i, count, message.getSubject())); - } - - List<Address> recipients = new ArrayList<>(); - Address[] toRecipients = message.getRecipients(Message.RecipientType.TO); - if (toRecipients != null) { - recipients.addAll(Arrays.asList(toRecipients)); - } - Address[] ccRecipients = message.getRecipients(Message.RecipientType.CC); - if (ccRecipients != null) { - recipients.addAll(Arrays.asList(ccRecipients)); - } - - MailFilter filter = null; - for (Address address : recipients) { - - String recipient = address.toString(); - - // some recipient are like "toto tutu<toto.tutu73@gmail.com>" - // the regex is to extract email address from it - recipient = recipient.replaceFirst("^.*<(.*)>$", "$1"); - recipient = recipient.toLowerCase(); - - Collection<MailFilter> filters = mailFolderService.getFiltersForRecipient(recipient); - - if (CollectionUtils.isNotEmpty(filters)) { - filter = filters.iterator().next(); - email.setRecipient(recipient); - modifiedProperties.add(Email.PROPERTY_RECIPIENT); - break; - } - - } - if (filter == null) { - if (log.isDebugEnabled()) { - log.debug(" ==> No filter found for this message"); - if (log.isTraceEnabled()) { - for (Address address : recipients) { - log.trace(" - for recipient " + address.toString()); - } - } - } - - // on garde le mail sur le serveur pour le traiter suite à l'ajout d'un futur filtre - continue; - } - - // find company of the filter folder - MailFolder filterFolder = filter.getMailFolder(); - while (!filterFolder.isUseCurrentLevelCompany() && filterFolder.getParent() != null) { - filterFolder = filterFolder.getParent(); - } - String company = filterFolder.getCompany(); - - Address[] addresses = message.getFrom(); - if (addresses != null && addresses.length > 0) { - String sender = addresses[0].toString(); - // some sender are like "toto tutu<toto.tutu73@gmail.com>" - // the regex is to extract email address from it - sender = sender.replaceFirst("^.*<(.*)>$", "$1"); - sender = sender.toLowerCase(); - - // Identification du client en fonction du numéro de fax appelant ou de l'adresse e-mail émettrice - Client client = clientService.getClientForEmailAddress(sender, email, company); - modifiedProperties.add(Email.PROPERTY_SENDER); - - String object; - if (client != null) { - //TODO echatellier : a valider que l'on affiche bien le premier mail du client - String contact = sender; - if (email.isFax()) { - String faxNumber = contact.substring(0, contact.indexOf('@')).replaceAll(" ", ""); - // NumberUtils.isNumber peut echouer (notation octal) - if (StringUtils.isNumeric(faxNumber)) { - contact = StringUtils.leftPad(faxNumber, 10, '0'); - } - } - - List<String> objectItems = new ArrayList<>(); - if (StringUtils.isNotEmpty(client.getCaracteristic1())) { - objectItems.add(client.getCaracteristic1()); - } - if (StringUtils.isNotEmpty(client.getCaracteristic2())) { - objectItems.add(client.getCaracteristic2()); - } - if (StringUtils.isNotEmpty(client.getCaracteristic3())) { - objectItems.add(client.getCaracteristic3()); - } - if (StringUtils.isNotEmpty(client.getCode())) { - objectItems.add(client.getCode()); - } - if (StringUtils.isNotEmpty(client.getName())) { - objectItems.add(client.getName()); - } - objectItems.add(contact); - objectItems.add(DateFormat.getDateInstance(DateFormat.MEDIUM).format(new Date())); - - object = StringUtils.join(objectItems, " / "); - - modifiedProperties.add(Email.PROPERTY_CLIENT); - - } else { - object = t("faxtomail.email.object.noClient"); - } - email.setObject(object); - email.setClient(client); - modifiedProperties.add(Email.PROPERTY_OBJECT); - - MailFolder mailFolder = null; - if (!filter.isFilterFolderPriority() && client != null) { - FaxToMailUser personInCharge = client.getPersonInCharge(); - if (personInCharge != null) { - mailFolder = mailFolderService.getFolderForFaxToMailUser(personInCharge); - } - } - - if (mailFolder == null) { - // to default folder - mailFolder = filter.getMailFolder(); - } - - email.setMailFolder(mailFolder); - modifiedProperties.add(Email.PROPERTY_MAIL_FOLDER); - - // if client is null and folder - if (client == null && emailAccount.isRejectAllowed()) { - Boolean reject = null; - String rejectMessage = null; - String senderEmail = null; - - // find reject conf - MailFolder rejectMailFolder = mailFolder; - while (!Boolean.FALSE.equals(reject) && rejectMailFolder != null - && (reject == null - || !rejectMailFolder.isUseCurrentLevelRejectResponseMessage() - || !rejectMailFolder.isUseCurrentLevelRejectResponseMailAddress())) { - - if (reject == null) { - reject = rejectMailFolder.getRejectUnknownSender(); - } - if (rejectMessage == null && rejectMailFolder.isUseCurrentLevelRejectResponseMessage()) { - rejectMessage = rejectMailFolder.getRejectResponseMessage(); - } - if (senderEmail == null && rejectMailFolder.isUseCurrentLevelRejectResponseMailAddress()) { - senderEmail = rejectMailFolder.getRejectResponseMailAddress(); - } - rejectMailFolder = rejectMailFolder.getParent(); - } - - if (Boolean.TRUE.equals(reject)) { - - if (StringUtils.isAnyBlank(senderEmail, rejectMessage)) { - if (log.isWarnEnabled()) { - log.warn("Can't send reject message due to invalid configuration"); - } - } else { - // unknown client -> message rejected - String recipient = email.getSender(); - if (email.isFax()) { - recipient = FaxToMailServiceUtils.addFaxDomainToFaxNumber(recipient, mailFolder); - } - emailService.rejectEmail(senderEmail, recipient, t("faxtomail.email.subject.re", message.getSubject()), rejectMessage); - - // important, delete mail - deleteMail(message); - } - - continue; - } - } - - } - - Date receivedDate = new Date(); - email.setReceptionDate(receivedDate); - modifiedProperties.add(Email.PROPERTY_RECEPTION_DATE); - - Date now = new Date(); - - Decorator<Date> dateDecorator = decoratorService.getDecoratorByType(Date.class, DecoratorService.DATE); - String projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(now)); - email.setProjectReference(projectRef); - modifiedProperties.add(Email.PROPERTY_PROJECT_REFERENCE); - - email.setDemandStatus(DemandStatus.UNTREATED); - modifiedProperties.add(Email.PROPERTY_DEMAND_STATUS); - - StringBuilder emailSource = new StringBuilder(); - Enumeration<String> headerLines = ((MimeMessage)message).getAllHeaderLines(); - while (headerLines.hasMoreElements()) { - String headerLine = headerLines.nextElement(); - emailSource.append(headerLine).append("\n"); - } - String originalContent = IOUtils.toString(message.getInputStream(), charset); - emailSource.append("\n").append(originalContent); - email.setOriginalEmail(emailSource.toString()); - - List<Attachment> attachments = new ArrayList<>(); - if (message.isMimeType("multipart/*")) { - - // manage boundary id - String htmlContent = decomposeMultipartEmail(attachments, message, email, emailService); - if (htmlContent != null) { - if (log.isDebugEnabled()) { - log.debug("Converting html content to pdf : " + message.getSubject()); - } - Attachment attachment = convertHTMLToPdf(attachments, htmlContent, t("faxtomail.email.content.attachment.htmlfileName")); - if (attachment != null) { - //remove text plain attachement if exists, to avoid having twice the mail content in the attachments - String plainTextFileName = t("faxtomail.email.content.attachment.plainfileName") + ".pdf"; - for (Attachment a : attachments) { - if (plainTextFileName.equals(a.getOriginalFileName())) { - attachments.remove(a); - break; - } - } - attachments.add(attachment); - } - } - } else { - // convertit le contenu texte en PDF - String content = IOUtils.toString(message.getInputStream(), charset); - Attachment attachment = convertTextToPdf(content, t("faxtomail.email.content.attachment.plainfileName")); - attachments.add(0, attachment); - } - - emailService.saveEmail(email, - attachments, - null, - email.getClient() != null ? email.getClient().getCode() : null, - null, - modifiedProperties.toArray(new String[modifiedProperties.size()])); - importedCount++; - - if (log.isDebugEnabled()) { - log.debug(" ==> Message placé dans le dossier " + email.getMailFolder().getName()); - } - - // important, delete mail - deleteMail(message); - - } catch (Exception e) { - log.error("Error while reading the email", e); - } - } - if (log.isDebugEnabled()) { - log.debug("End of emails"); - } - - } catch (Exception e) { - log.error("Error while reading the emails", e); - } - - // usefull log info (do not remove) - if (importedCount > 0 && log.isInfoEnabled()) { - log.info(String.format("Imported %d mail for account %s@%s", importedCount, emailAccount.getLogin(), emailAccount.getHost())); - } - } - - /** - * Supprime le mail sur le serveur (si nécéssaire). - * - * @param message message to delete - * @throws MessagingException - */ - protected void deleteMail(Message message) throws MessagingException { - // suppression des mails sur le serveur distant (non actif par default) - if (config.isMailDelete()) { - message.setFlag(Flags.Flag.DELETED, true); - } - } - - /** - * Decompose a multipart part. - * - sets the email content if the part contains a text bodypart - * - adds attachments to the email - * - * @param part the part to decompose - * @param email the email object to fill with the attachments or content - * @param emailService email service - * @throws Exception - */ - protected String decomposeMultipartEmail(List<Attachment> attachments, Part part, Email email, EmailService emailService) throws Exception { - String result = null; - - - DataSource dataSource = part.getDataHandler().getDataSource(); - MimeMultipart mimeMultipart = new MimeMultipart(dataSource); - int multiPartCount = mimeMultipart.getCount(); - - for (int j = 0; j < multiPartCount; j++) { - MimeBodyPart bp = (MimeBodyPart) mimeMultipart.getBodyPart(j); - - // if it is a text part, then this is the email content - String disposition = bp.getDisposition(); - if (bp.isMimeType("text/*") && !Part.ATTACHMENT.equals(disposition)) { - - Charset charset = FaxToMailServiceUtils.getCharset(bp); - String content = IOUtils.toString(bp.getInputStream(), charset); - - if (bp.isMimeType("text/plain")) { - Attachment attachment = convertTextToPdf(content, t("faxtomail.email.content.attachment.plainfileName")); - attachments.add(attachment); - - } else { - result = content; - } - - // if it is multipart part, decompose it - } else if (bp.isMimeType("multipart/*")) { - String htmlContent = decomposeMultipartEmail(attachments, bp, email, emailService); - if (htmlContent != null) { - result = htmlContent; - } - - // else, this is an attachment - } else { - String fileName = bp.getFileName(); - - // parse Content-ID (content identifier in html mail content) - String[] headers = bp.getHeader("Content-ID"); - String contentID = null; - if (headers != null) { - contentID = headers[0]; - contentID = contentID.replaceFirst("^<(.*)>$", "$1"); - } - - // remove the guillemets between the id - - if (fileName == null && contentID == null) { - break; - } else if (fileName == null) { - fileName = contentID; - } - - try { - fileName = MimeUtility.decodeText(fileName); - if (log.isDebugEnabled()) { - log.debug("FileName : " + fileName + ", Content-ID : " + contentID); - } - } catch (UnsupportedEncodingException ex) { - // don't care, use filename raw value - if (log.isWarnEnabled()) { - log.warn("Can't debug email file name", ex); - } - } - - DataHandler dh = bp.getDataHandler(); - - // create new attachment - Attachment attachment = new AttachmentImpl(); - attachment.setAddedByUser(false); - AttachmentFile attachmentFile = emailService.getAttachmentFileFromStream(dh.getInputStream()); - attachmentFile.setFilename(fileName); - attachment.setOriginalFile(attachmentFile); - attachment.setContentId(contentID); - - // convert attachment if defined by admin - convertIfNecessary(attachment); - - // save attachment - attachments.add(attachment); - } - } - return result; - } - - /** - * Retourne un input stream sur une piece jointe convertie ou pas. - * - * @param attachment to convert - * @return attachment - * @throws IOException - */ - protected Attachment convertIfNecessary(Attachment attachment) throws IOException { - - // get file extension - String filename = attachment.getOriginalFileName(); - String extension = FilenameUtils.getExtension(filename); - - if (StringUtils.isNotBlank(extension)) { - ExtensionCommand command = configurationService.getExtensionCommand(extension); - - // si une extension est configurée avec une commande non vide - if (command != null && StringUtils.isNotBlank(command.getConvertToPdfCommand())) { - attachment = convertToPdf(attachment, command); - } - } - return attachment; - } - - /** - * Convert attachment to pdf. - * - * @param attachment attachment to convert - * @param extensionCommand command - * @return - * @throws IOException - */ - protected Attachment convertToPdf(Attachment attachment, ExtensionCommand extensionCommand) throws IOException { - - // get file extension - String filename = attachment.getOriginalFileName(); - String basename = FilenameUtils.getBaseName(filename); - String extension = FilenameUtils.getExtension(filename); - - // copy file to temp file - File file = File.createTempFile("faxtomail-" + basename, "." + extension); - file.deleteOnExit(); - // on creer un nouveau nom de fichier ou seulement le nom de l'extension change - // cela permet de fonctionner avec openoffice par exemple où il n'est pas possible - // de specifier le nom du fichier de sortie - String fullname = StringUtils.removeEnd(file.getAbsolutePath(), "." + extension); - File outfile = new File(fullname + ".pdf"); - outfile.deleteOnExit(); - FileUtils.writeByteArrayToFile(file, attachment.getOriginalFile().getContent()); - - // get process command - String command = extensionCommand.getConvertToPdfCommand(); - String[] args = StringUtil.split(command, " "); - List<String> comArgs = new ArrayList<String>(); - for (String arg : args) { - String localArg = arg; - localArg = localArg.replace("%f", file.getAbsolutePath()); - localArg = localArg.replace("%o", outfile.getAbsolutePath()); - comArgs.add(localArg); - } - ProcessBuilder pb = new ProcessBuilder(comArgs); - // run process - if (log.isDebugEnabled()) { - log.debug("Convert attachment with command : " + comArgs); - } - try { - Process process = pb.start(); - process.waitFor(); - - // read output to save into attachment - byte[] outContent = FileUtils.readFileToByteArray(outfile); - - // on va dire que normalement un pdf ca fait plus de 1 octet - if (outContent.length >= 1) { - AttachmentFile editedFile = new AttachmentFileImpl(); - editedFile.setContent(outContent); - editedFile.setFilename(basename + "-converted.pdf"); - attachment.setEditedFile(editedFile); - } else if (log.isWarnEnabled()) { - log.warn("Can't convert extension to pdf (content is empty)"); - } - - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("Cannot run convert command", e); - } - } catch (InterruptedException e) { - if (log.isErrorEnabled()) { - log.error("Cannot run convert command", e); - } - } - - // cleanup - file.delete(); - outfile.delete(); - - return attachment; - } - - protected Attachment convertTextToPdf(String content, String name) throws IOException, DocumentException { - //File target = File.createTempFile("faxtomail-", ".tmp"); - //target.deleteOnExit(); - - Document document = new Document(); - //FileOutputStream fos = new FileOutputStream(target); - ByteArrayOutputStream os = new ByteArrayOutputStream(); - PdfWriter writer = PdfWriter.getInstance(document, os); - writer.open(); - - document.setPageSize(PageSize.A4); - document.open(); - - document.add(new Paragraph(content)); - - document.close(); - writer.close(); - - // convert content to blob - AttachmentFile attachmentFileNew = new AttachmentFileImpl(); - attachmentFileNew.setContent(os.toByteArray()); - attachmentFileNew.setFilename(name + ".pdf"); - - Attachment attachment = new AttachmentImpl(); - attachment.setOriginalFile(attachmentFileNew); - attachment.setOriginalFileName(name + ".pdf"); - attachment.setAddedByUser(false); - - //target.delete(); - - return attachment; - } - - /** - * Convert html content to image. - * - * @param attachments attachment content to link content to - * @param content html content - * @param name result attachment name - * @return image attachment or {@code null} if content can't be converted - * @throws IOException - */ - protected Attachment convertHTMLToPdf(List<Attachment> attachments, String content, String name) throws IOException { - - - Attachment result = null; - ByteArrayOutputStream os = new ByteArrayOutputStream(); - Collection<File> fileToDelete = new ArrayList<File>(); - try { - content = content.replaceAll("<meta (.*?)>(</meta>)?", ""); - - for (Attachment attachment : attachments) { - String key = attachment.getContentId(); - if (key == null) { - key = attachment.getOriginalFileName(); - } - - // get file content - AttachmentFile attachmentFile = attachment.getOriginalFile(); - File file = attachmentFile.getFile(); - fileToDelete.add(file); - - // replace the inline attachments with the extracted attachment file url - // match les patterns: - // <td background="cid:bg.gif" height="52"> - // <img border=0 src="cid:bg.gif" /> - // <img src='cid:5e9ef859-ea65-4f9b-a9fa-30d4a2c5837c' - content = content.replaceAll("(\\w+)=([\"'])cid:" + Pattern.quote(key) + "([\"'])", "$1=$2file://" + file.getAbsolutePath() + "$3"); - - if (log.isDebugEnabled()) { - log.debug("Mapping attachment id " + key + " to file " + file.getAbsolutePath()); - } - } - - Html2Image image = Html2Image.fromHtml(content); - //ImageRenderer imageRenderer = image.getImageRenderer(); - //imageRenderer.saveImage(os, true); - org.w3c.dom.Document doc = image.getParser().getDocument(); - - // convert to pdf - ITextRenderer renderer = new ITextRenderer(); - renderer.setDocument(doc, null); - renderer.layout(); - renderer.createPDF(os); - - // convert content to blob - AttachmentFile attachmentFileNew = new AttachmentFileImpl(); - attachmentFileNew.setContent(os.toByteArray()); - attachmentFileNew.setFilename(name + ".pdf"); - - result = new AttachmentImpl(); - result.setOriginalFile(attachmentFileNew); - result.setOriginalFileName(name + ".pdf"); - result.setAddedByUser(false); - } catch (OutOfMemoryError er) { - // certains mails (spam) très compliqué ne peuvent pas être convertit en images - if (log.isWarnEnabled()) { - log.warn("Can't convert html content to pdf", er); - } - } catch (DocumentException ex) { - if (log.isWarnEnabled()) { - log.warn("Can't convert html content to pdf", ex); - } - } finally { - // on supprime les fichiers avant le delete on exit pour eviter que le disque ne se remplissent trop vite - for (File file : fileToDelete) { - file.delete(); - } - } - - return result; - } -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/HibernateProxyTypeAdapter.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/HibernateProxyTypeAdapter.java deleted file mode 100644 index 5b7159d..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/HibernateProxyTypeAdapter.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.franciaflex.faxtomail.web.json; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.io.IOException; - -import org.hibernate.Hibernate; -import org.hibernate.proxy.HibernateProxy; - -import com.google.gson.Gson; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -/** - * This TypeAdapter unproxies Hibernate proxied objects, and serializes them - * through the registered (or default) TypeAdapter of the base class. - * - * Voir : http://stackoverflow.com/a/13525550/2038100 - */ -public class HibernateProxyTypeAdapter extends TypeAdapter<HibernateProxy> { - - public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() { - @Override - @SuppressWarnings("unchecked") - public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { - return (HibernateProxy.class.isAssignableFrom(type.getRawType()) ? (TypeAdapter<T>) new HibernateProxyTypeAdapter(gson) : null); - } - }; - private final Gson context; - - private HibernateProxyTypeAdapter(Gson context) { - this.context = context; - } - - @Override - public HibernateProxy read(JsonReader in) throws IOException { - throw new UnsupportedOperationException("Not supported"); - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - public void write(JsonWriter out, HibernateProxy value) throws IOException { - if (value == null) { - out.nullValue(); - return; - } - // Retrieve the original (not proxy) class - Class<?> baseType = Hibernate.getClass(value); - // Get the TypeAdapter of the original class, to delegate the serialization - TypeAdapter delegate = context.getAdapter(TypeToken.get(baseType)); - // Get a filled instance of the original class - Object unproxiedValue = value.getHibernateLazyInitializer().getImplementation(); - // Serialize the value - delegate.write(out, unproxiedValue); - } - -} diff --git a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/TopiaEntityAdapter.java b/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/TopiaEntityAdapter.java deleted file mode 100644 index f5a3268..0000000 --- a/trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/TopiaEntityAdapter.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.franciaflex.faxtomail.web.json; - -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.lang.reflect.Type; - -import org.nuiton.topia.persistence.TopiaEntity; - -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -/** - * Gson topia entity adaptor that use a specific implementationClass to deserialize a topia entity interface. - * - * @author Eric Chatellier - */ -public class TopiaEntityAdapter implements JsonSerializer<TopiaEntity>, JsonDeserializer<TopiaEntity> { - - protected Class<? extends TopiaEntity> implementationClass; - - public TopiaEntityAdapter(Class<? extends TopiaEntity> implementationClass) { - this.implementationClass = implementationClass; - } - - @Override - public TopiaEntity deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { - TopiaEntity result = jsonDeserializationContext.deserialize(jsonElement, implementationClass); - return result; - } - - @Override - public JsonElement serialize(TopiaEntity object, Type type, JsonSerializationContext jsonSerializationContext) { - JsonElement result = jsonSerializationContext.serialize(object, object.getClass()); - return result; - } -} diff --git a/trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties b/trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties deleted file mode 100644 index de12351..0000000 --- a/trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties +++ /dev/null @@ -1,42 +0,0 @@ -com.franciaflex.faxtomail.persistence.entities.FolderAction.COMPUTE_RANGE=Calculer les quantités par gamme -com.franciaflex.faxtomail.persistence.entities.FolderAction.NEW_DEMANDE=Créer une nouvelle demande -com.franciaflex.faxtomail.persistence.entities.MailAction.ARCHIVE=Archiver -com.franciaflex.faxtomail.persistence.entities.MailAction.GROUP=Grouper -com.franciaflex.faxtomail.persistence.entities.MailAction.PRINT=Imprimer -com.franciaflex.faxtomail.persistence.entities.MailAction.REPLY=Repondre -com.franciaflex.faxtomail.persistence.entities.MailAction.SAVE=Sauver -com.franciaflex.faxtomail.persistence.entities.MailAction.TRANSMIT=Déplacer -com.franciaflex.faxtomail.persistence.entities.MailField.ARCHIVE_DATE=Date d'archive -com.franciaflex.faxtomail.persistence.entities.MailField.ATTACHMENT=Pièces jointes -com.franciaflex.faxtomail.persistence.entities.MailField.CLIENT=Client -com.franciaflex.faxtomail.persistence.entities.MailField.CLIENT_BRAND=Marque -com.franciaflex.faxtomail.persistence.entities.MailField.CLIENT_CODE=Code client -com.franciaflex.faxtomail.persistence.entities.MailField.COMMENT=Message -com.franciaflex.faxtomail.persistence.entities.MailField.COMPANY_REFERENCE=Notre référence -com.franciaflex.faxtomail.persistence.entities.MailField.DEMAND_STATUS=Statut de demande -com.franciaflex.faxtomail.persistence.entities.MailField.DEMAND_TYPE=Type de demande -com.franciaflex.faxtomail.persistence.entities.MailField.EDI_RETURN=Retour EDI -com.franciaflex.faxtomail.persistence.entities.MailField.FAX=Fax -com.franciaflex.faxtomail.persistence.entities.MailField.GROUP=Groupe -com.franciaflex.faxtomail.persistence.entities.MailField.LAST_ATTACHMENT_OPENING_IN_THIS_FOLDER_USER=Dernier à ouvrir une PJ -com.franciaflex.faxtomail.persistence.entities.MailField.MAIL_FOLDER=Dossier -com.franciaflex.faxtomail.persistence.entities.MailField.OBJECT=Objet -com.franciaflex.faxtomail.persistence.entities.MailField.ORIGINAL_EMAIL=Email original -com.franciaflex.faxtomail.persistence.entities.MailField.PF_NB=Quantité de produits -com.franciaflex.faxtomail.persistence.entities.MailField.PRIORITY=Priorité -com.franciaflex.faxtomail.persistence.entities.MailField.PROJECT_REFERENCE=Référence chantier -com.franciaflex.faxtomail.persistence.entities.MailField.QUOTATION_NB=Quantité de devis -com.franciaflex.faxtomail.persistence.entities.MailField.RANGE_ROW=Gamme -com.franciaflex.faxtomail.persistence.entities.MailField.RECEPTION_DATE=Date de réception -com.franciaflex.faxtomail.persistence.entities.MailField.RECIPIENT=Destinataire -com.franciaflex.faxtomail.persistence.entities.MailField.REFERENCE=Référence -com.franciaflex.faxtomail.persistence.entities.MailField.REPLIES=Réponses -com.franciaflex.faxtomail.persistence.entities.MailField.SAV_NB=Quantité de SAV -com.franciaflex.faxtomail.persistence.entities.MailField.SENDER=Émetteur -com.franciaflex.faxtomail.persistence.entities.MailField.TAKEN_BY=Pris par -com.franciaflex.faxtomail.persistence.entities.MailField.WAITING_STATE=État d'attente -faxtomail.email.content.attachment.htmlfileName=contenu html du mail -faxtomail.email.content.attachment.plainfileName=contenu texte du mail -faxtomail.email.object.noClient=Client non trouvé -faxtomail.email.projectReference.default= -faxtomail.email.subject.re=Re \: %s diff --git a/trunk/faxtomail-ui-web/src/main/resources/log4j2.xml b/trunk/faxtomail-ui-web/src/main/resources/log4j2.xml deleted file mode 100644 index 331ec19..0000000 --- a/trunk/faxtomail-ui-web/src/main/resources/log4j2.xml +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - -<Configuration> - - <Appenders> - <Console name="Console" target="SYSTEM_OUT"> - <PatternLayout pattern="%d{yyyy/MM/dd HH:mm:ss} %5p (%c:%L) - %m%n" /> - </Console> - - <!-- RollingFile name="File" fileName="${sys:user.home}/.faxtomail/faxtomail.log" - filePattern="${sys:user.home}/.faxtomail/faxtomail-%d{yyyyMMdd}-%i.log"> - <PatternLayout> - <pattern>%d %5p (%c:%L) - %m%n</pattern> - </PatternLayout> - <Policies> - <TimeBasedTriggeringPolicy /> - <SizeBasedTriggeringPolicy size="10 MB"/> - </Policies> - <DefaultRolloverStrategy max="5"/> - </RollingFile--> - </Appenders> - - <Loggers> - <Logger name="com.franciaflex.faxtomail" level="info"/> - - <!-- annoying errors --> - <Logger name="com.opensymphony.xwork2.interceptor.ParametersInterceptor" level="FATAL"/> - <Logger name="com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler" level="FATAL"/> - <Logger name="com.opensymphony.xwork2.ognl.OgnlValueStack" level="ERROR"/> - - <Root level="error"> - <AppenderRef ref="Console" /> - <!-- AppenderRef ref="File" /--> - </Root> - </Loggers> -</Configuration> diff --git a/trunk/faxtomail-ui-web/src/main/resources/nuiton-js.properties b/trunk/faxtomail-ui-web/src/main/resources/nuiton-js.properties deleted file mode 100644 index cad0abc..0000000 --- a/trunk/faxtomail-ui-web/src/main/resources/nuiton-js.properties +++ /dev/null @@ -1,34 +0,0 @@ -### -# #%L -# FaxToMail :: Web -# $Id$ -# $HeadURL$ -# %% -# Copyright (C) 2014 Mac-Groupe, Code Lutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### - -# dev -debug=${devMode} -cacheUpdatePeriod=${jsCachePeriod} -minimizeEnabled=${jsMinimize} -# dev : preProcessors=forceCssDataUri,cssUrlRewriting,cssImport,semicolonAppender -# prod : preProcessors=cssUrlRewriting,cssImport,semicolonAppender,cssMinJawr -${jsPreProcessors} -# dev : postProcessors=cssVariables -# prod : postProcessors=cssVariables,jsMin -${jsPostProcessors} diff --git a/trunk/faxtomail-ui-web/src/main/resources/quartz.properties b/trunk/faxtomail-ui-web/src/main/resources/quartz.properties deleted file mode 100644 index bfe4cca..0000000 --- a/trunk/faxtomail-ui-web/src/main/resources/quartz.properties +++ /dev/null @@ -1,28 +0,0 @@ -### -# #%L -# FaxToMail :: Web -# $Id$ -# $HeadURL$ -# %% -# Copyright (C) 2014 Mac-Groupe, Code Lutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### -org.quartz.scheduler.instanceName = FaxToMailScheduler - -org.quartz.threadPool.threadCount = 10 - -org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore diff --git a/trunk/faxtomail-ui-web/src/main/resources/struts.properties b/trunk/faxtomail-ui-web/src/main/resources/struts.properties deleted file mode 100644 index 103f478..0000000 --- a/trunk/faxtomail-ui-web/src/main/resources/struts.properties +++ /dev/null @@ -1,40 +0,0 @@ -### -# #%L -# FaxToMail :: Web -# $Id$ -# $HeadURL$ -# %% -# Copyright (C) 2014 Mac-Groupe, Code Lutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### -struts.ui.theme=bootstrap -struts.ognl.allowStaticMethodAccess=true - -# Help debugging -struts.devMode=${devMode} -struts.ognl.logMissingProperties=${devMode} -struts.el.throwExceptionOnFailure=${devMode} -struts.i18n.reload=${devMode} -struts.custom.i18n.resources=resources -struts.configuration.xml.reload=${devMode} -struts.convention.classes.reload=${devMode} - -# Performance tuning -# see http://struts.apache.org/2.2.3/docs/performance-tuning.html -struts.freemarker.templatesCache=true - -struts.convention.package.locators.basePackage=com.franciaflex.faxtomail.web.action diff --git a/trunk/faxtomail-ui-web/src/main/resources/struts.xml b/trunk/faxtomail-ui-web/src/main/resources/struts.xml deleted file mode 100644 index 56188d7..0000000 --- a/trunk/faxtomail-ui-web/src/main/resources/struts.xml +++ /dev/null @@ -1,66 +0,0 @@ -<!-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<!DOCTYPE struts PUBLIC - "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" - "http://struts.apache.org/dtds/struts-2.3.dtd"> -<struts> - - <bean class="org.nuiton.web.struts2.I18nTextProvider" name="i18nTextProvider" type="com.opensymphony.xwork2.TextProvider" /> - - <constant name="struts.convention.default.parent.package" value="faxtomail" /> - <constant name="struts.xworkTextProvider" value="i18nTextProvider" /> - <constant name="struts.multipart.maxSize" value="10485760" /> - - <package name="faxtomail" namespace="/" extends="struts-default"> - - <result-types> - <result-type name="faxtomail-json" default="false" - class="com.franciaflex.faxtomail.web.FaxToMailJsonResultSupport" /> - </result-types> - - <interceptors> - <interceptor name="faxToMailInterceptor" class="com.franciaflex.faxtomail.web.FaxToMailInterceptor"/> - <interceptor name="loginInterceptor" class="com.franciaflex.faxtomail.web.FaxToMailLoginInterceptor" /> - - <interceptor-stack name="faxToMailStack"> - <interceptor-ref name="faxToMailInterceptor" /> - <interceptor-ref name="paramsPrepareParamsStack" /> - </interceptor-stack> - </interceptors> - - <default-interceptor-ref name="faxToMailStack"/> - - <global-results> - <result name="redirect-to-login" type="redirect">/login-input</result> - </global-results> - - <!-- <global-exception-mappings> - <exception-mapping exception="com.franciaflex.faxtomail.web.FaxToMailNoIdException" result="NoIdException"></exception-mapping> - <exception-mapping exception="com.franciaflex.faxtomail.web.FaxToMailEntityNotFoundException" result="EntityNotFoundException"></exception-mapping> - <exception-mapping exception="com.franciaflex.faxtomail.web.FaxToMailIllegalAccessException" result="IllegalAccessException"></exception-mapping> - </global-exception-mappings>--> - - </package> - -</struts> diff --git a/trunk/faxtomail-ui-web/src/main/resources/validators.xml b/trunk/faxtomail-ui-web/src/main/resources/validators.xml deleted file mode 100644 index 928ab60..0000000 --- a/trunk/faxtomail-ui-web/src/main/resources/validators.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - - -<!DOCTYPE validators PUBLIC - "-//Apache Struts//XWork Validator Definition 1.0//EN" - "http://struts.apache.org/dtds/xwork-validator-definition-1.0.dtd"> - -<validators> - <!-- default validators from XWork framework --> - <!--validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/--> - <!--validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/--> - <validator name="int" class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/> - <validator name="long" class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/> - <validator name="short" class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/> - <validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/> - <validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/> - <validator name="expression" class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/> - <validator name="fieldexpression" class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/> - <!--validator name="email" class="com.opensymphony.xwork2.validator.validators.EmailValidator"/--> - <validator name="url" class="com.opensymphony.xwork2.validator.validators.URLValidator"/> - <validator name="visitor" class="com.opensymphony.xwork2.validator.validators.VisitorFieldValidator"/> - <validator name="conversion" class="com.opensymphony.xwork2.validator.validators.ConversionErrorFieldValidator"/> - <validator name="stringlength" class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/> - <validator name="regex" class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/> - <validator name="conditionalvisitor" - class="com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator"/> - - <!-- default nuiton-validator validators --> - <validator name="collectionFieldExpression" - class="org.nuiton.validator.xwork2.field.CollectionFieldExpressionValidator"/> - <validator name="collectionUniqueKey" class="org.nuiton.validator.xwork2.field.CollectionUniqueKeyValidator"/> - <validator name="requiredFile" class="org.nuiton.validator.xwork2.field.RequiredFileFieldValidator"/> - <validator name="existingFile" class="org.nuiton.validator.xwork2.field.ExistingFileFieldValidator"/> - <validator name="notExistingFile" class="org.nuiton.validator.xwork2.field.NotExistingFileFieldValidator"/> - <validator name="existingDirectory" class="org.nuiton.validator.xwork2.field.ExistingDirectoryFieldValidator"/> - <validator name="notExistingDirectory" class="org.nuiton.validator.xwork2.field.NotExistingDirectoryFieldValidator"/> - <validator name="fieldexpressionwithparams" - class="org.nuiton.validator.xwork2.field.FieldExpressionWithParamsValidator"/> - <validator name="phoneNumber" class="org.nuiton.validator.xwork2.field.FrenchPhoneNumberFieldValidator"/> - <validator name="email" class="org.nuiton.validator.xwork2.field.EmailFieldValidator"/> - <validator name="cityName" class="org.nuiton.validator.xwork2.field.FrenchCityNameFieldValidator"/> - <validator name="lastName" class="org.nuiton.validator.xwork2.field.FrenchLastNameFieldValidator"/> - <validator name="postCode" class="org.nuiton.validator.xwork2.field.FrenchPostCodeFieldValidator"/> - <validator name="vat" class="org.nuiton.validator.xwork2.field.VATIdentificationNumberFieldValidator"/> - <validator name="siret" class="org.nuiton.validator.xwork2.field.FrenchSiretFieldValidator"/> - <validator name="siren" class="org.nuiton.validator.xwork2.field.FrenchSirenFieldValidator"/> - <validator name="finess" class="org.nuiton.validator.xwork2.field.FrenchFinessFieldValidator"/> - <validator name="required" class="org.nuiton.validator.xwork2.field.SkipableRequiredFieldValidator"/> - <validator name="requiredstring" class="org.nuiton.validator.xwork2.field.SkipableRequiredStringFieldValidator"/> - -</validators> diff --git a/trunk/faxtomail-ui-web/src/main/resources/xwork-conversion.properties b/trunk/faxtomail-ui-web/src/main/resources/xwork-conversion.properties deleted file mode 100644 index 3434493..0000000 --- a/trunk/faxtomail-ui-web/src/main/resources/xwork-conversion.properties +++ /dev/null @@ -1,25 +0,0 @@ -### -# #%L -# FaxToMail :: Web -# $Id$ -# $HeadURL$ -# %% -# Copyright (C) 2014 Mac-Groupe, Code Lutin -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program. If not, see -# <http://www.gnu.org/licenses/gpl-3.0.html>. -# #L% -### -java.lang.Double=org.nuiton.web.struts2.converters.DoubleConverter -double=org.nuiton.web.struts2.converters.DoubleConverter diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp deleted file mode 100644 index 376364a..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp +++ /dev/null @@ -1,1249 +0,0 @@ -<%-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --%> -<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> -<!DOCTYPE html> -<%@taglib uri="/struts-tags" prefix="s" %> - -<html> - <head> - <title>Configuration</title> - - <link rel="stylesheet" type="text/css" href="<s:url value='/nuiton-js/faxtomail-configuration.css' />" /> - <script type="text/javascript" src="<s:url value='/nuiton-js/faxtomail-configuration.js' />"></script> - - <script type="text/javascript"> - ConfigurationModule.value('ConfigurationData', { - // enums - 'mailActions': <s:property value="toJson(mailActions)" escapeHtml="false"/>, - 'canBeRequiredMailFields': <s:property value="toJson(canBeRequiredMailFields)" escapeHtml="false"/>, - 'tableMailFields': <s:property value="toJson(tableMailFields)" escapeHtml="false"/>, - 'emailProtocolPorts': <s:property value="toJson(emailProtocolPorts)" escapeHtml="false"/>, - // datas - 'configuration': <s:property value="toJson(configuration)" escapeHtml="false"/>, - 'waitingStates': <s:property value="toJson(waitingStates)" escapeHtml="false"/>, - 'waitingStatesUsage': <s:property value="toJson(waitingStatesUsage)" escapeHtml="false"/>, - 'demandTypes': <s:property value="toJson(demandTypes)" escapeHtml="false"/>, - 'ranges': <s:property value="toJson(ranges)" escapeHtml="false"/>, - 'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>, - 'mailFoldersUsage': <s:property value="toJson(mailFoldersUsage)" escapeHtml="false"/>, - 'searchDisplayColumns': <s:property value="toJson(configuration.searchDisplayColumns)" escapeHtml="false"/>, - 'mailFilters': <s:property value="toJson(mailFilters)" escapeHtml="false"/>, - 'emailAccounts': <s:property value="toJson(emailAccounts)" escapeHtml="false"/>, - // referentiels - 'users': <s:property value="toJson(users)" escapeHtml="false"/>, - 'groups': <s:property value="toJson(groups)" escapeHtml="false"/>, - // remote service urls - 'remoteCheckFolder': "<s:url action="configuration-check-directory-json" />", - 'remoteCheckEmailAccount': "<s:url action="configuration-check-mailaccount-json" />" - }); - </script> - </head> - - <body> - - <div id="main-container" class="container" ng-app="ConfigurationModule"> - - <h1 class="page-header">Configuration</h1> - - <s:form id="main_form" action="configuration" method="post" ng-controller="ConfigurationController"> - - <!--<s:hidden name="activeTab"/>--> - - <ul id="tabs" class="nav nav-tabs"> - <li class="active"><a href="#tabs-general" data-toggle="tab">Général</a></li> - <li><a href="#tabs-waitingState" data-toggle="tab">États d'attente</a></li> - <li><a href="#tabs-demandType" data-toggle="tab">Types de demandes</a></li> - <li><a href="#tabs-tree" data-toggle="tab">Arborescence</a></li> - <li><a href="#tabs-filters" data-toggle="tab">Filtres de mail</a></li> - <li><a href="#tabs-search" data-toggle="tab">Recherche</a></li> - <li><a href="#tabs-mailaccounts" data-toggle="tab">Comptes mail</a></li> - <li><a href="#tabs-chefgroup" data-toggle="tab">Chef de groupe</a></li> - </ul> - - <div class="tab-content active" ng-controller="ConfigurationMiscController"> - <input type="hidden" name="configurationJson" value="{{configuration}}" /> - - <div id="tabs-general" class="tab-pane active"> - <!-- Général --> - <div class="form-group"> - <label class="control-label" for="configurationEmailMaxSizeField">Taille maximale des réponses (en octets)</label> - <input type="text" id="configurationEmailMaxSizeField" class="form-control" ng-model="configuration.emailMaxSize" fm-integer /> - </div> - - Actions autorisées lorsque la demande n'a pas d'état d'attente et est <strong>invalide</strong> : - <div class="checkbox" ng-repeat="(mailAction,label) in mailActions"> - <label> - <input type="checkbox" ng-checked="configuration.invalidFormDisabledActions.indexOf(mailAction) == -1" - ng-click="changeInvalidAction(mailAction)"> {{label}} - </label> - </div> - - <table class="table table-bordered"> - <caption>Commande de traitement des extensions de pièces jointes</caption> - <thead> - <tr> - <th>Extension</th> - <th>Commandes</th> - </tr> - </thead> - <tbody> - <tr ng-repeat="extensionCommand in configuration.extensionCommands"> - <td class="col-xs-2"> - {{extensionCommand.extension}} - <a class="pull-right btn btn-danger btn-xs " ng-click="deleteExtensionRow($index)" title="Supprimer l'extension"> - <span class="glyphicon glyphicon-remove"></span></a> - </td> - <td> - <div class="form-group"> - <label for="convertToToPdfField">Conversion en pdf :</label> - <input id="convertToToPdfField" type="text" class="form-control" ng-model="extensionCommand.convertToPdfCommand" placeholder="" /> - <p class="help-block">Utilisez <code>%f</code> et <code>%o</code> pour representer respectivement le fichier en entrée et en sortie de la commande</p> - </div> - <div class="form-group"> - <label for="openAttachmentCommandField">Ouverture :</label> - <input id="openAttachmentCommandField" type="text" class="form-control" ng-model="extensionCommand.openAttachmentCommand" placeholder="" /> - <p class="help-block">Utilisez <code>%f</code> pour representer le fichier en entrée de la commande</p> - </div> - </td> - </tr> - <tr ng-if="!configuration.extensionCommands || configuration.extensionCommands.length == 0"> - <td colspan="2" class="emptyTable">Aucune extension définie</td> - </tr> - </tbody> - <tfoot> - <tr> - <td colspan="2"> - <a class="pull-right btn btn-success btn-xs" ng-click="addExtensionRow()" > - <span class="glyphicon glyphicon-plus"></span> Ajouter une ligne</a> - </td> - </tr> - </tfoot> - </table> - </div> - - <div id="tabs-waitingState" class="tab-pane" ng-controller="ConfigurationWaitingStateController"> - <input type="hidden" name="waitingStatesJson" value="{{waitingStates}}" /> - - <div class="row"> - <div class="col-md-4"> - <h3>États d'attente <input type="button" class="btn btn-success btn-xs pull-right" value="Nouveau" ng-click="newWaitingState()" /></h3> - <table class="table table-hover"> - <tbody> - <tr ng-repeat="waitingState in waitingStates" - ng-class="{'info' : waitingState == selectedWaitingState}" - ng-click="editWaitingState(waitingState)"> - <td>{{waitingState.label}} - - <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteWaitingState(waitingState, $index)" - ng-disabled="waitingStatesUsage[waitingState.topiaId] > 0" - tooltip="{{waitingStatesUsage[waitingState.topiaId] > 0 && 'Cet état d\'attente est utilisé et ne peut pas être supprimé'|| 'Supprimer cet état d\'attente'}}"> - <span class="glyphicon glyphicon-remove"></span></a> - </td> - </tr> - </tbody> - </table> - </div> - - <div class="col-md-8" ng-if="selectedWaitingState"> - <h3>Édition de l'état d'attente {{selectedWaitingState.label}}</h3> - Actions autorisées lorsque la demande est <strong>valide</strong> : - <div class="checkbox" ng-repeat="(mailAction,label) in mailActions"> - <label> - <input type="checkbox" ng-checked="selectedWaitingState.validFormDisabledActions.indexOf(mailAction) == -1" - ng-click="changeWaitingStateValidAction(mailAction)"> {{label}} - </label> - </div> - - Actions autorisées lorsque la demande est <strong>invalide</strong> : - <div class="checkbox" ng-repeat="(mailAction,label) in mailActions"> - <label> - <input type="checkbox" ng-checked="selectedWaitingState.invalidFormDisabledActions.indexOf(mailAction) == -1" - ng-click="changeWaitingStateInvalidAction(mailAction)"> {{label}} - </label> - </div> - </div> - <div class="col-md-8" ng-if="!selectedWaitingState"> - <em>Sélectionnez un état d'attente.</em> - </div> - </div> - - </div> - - <div id="tabs-demandType" class="tab-pane" ng-controller="ConfigurationDemandTypeController"> - <input type="hidden" name="demandTypesJson" value="{{demandTypes}}" /> - - <div class="row"> - <div class="col-md-4"> - <h3>Type de demande <input type="button" class="btn btn-success btn-xs pull-right" value="Nouveau" ng-click="newDemandType()" /></h3> - <table class="table table-hover"> - <tbody> - <tr ng-repeat="demandType in demandTypes" - ng-class="{'info' : demandType == selectedDemandType}" - ng-click="editDemandType(demandType)"> - <td>{{demandType.label}}</td> - </tr> - </tbody> - </table> - </div> - - <div class="col-md-8" ng-if="selectedDemandType"> - <h3>Édition du type de demande {{selectedDemandType.label}}</h3> - Champs obligatoires pour le type de demande : - <div class="checkbox" ng-repeat="(mailField,label) in canBeRequiredMailFields"> - <label> - <input type="checkbox" ng-checked="selectedDemandType.requiredFields.indexOf(mailField) != -1" - ng-click="changeDemandTypeField(mailField)"> {{label}} - </label> - <span ng-show="mailField == 'RANGE_ROW'">(<label> - <input type="checkbox" ng-model="selectedDemandType.ediTransfer" - ng-disabled="selectedDemandType.requiredFields.indexOf(mailField) == -1"/> Autoriser le transfert EDI - <i class="fa fa-info-circle" tooltip="Si cette case est cochée, les demandes valides seront transférées à l'EDI pour le traitement des numéros de commande des gammes, sinon les demandes passerons directement dans le statut 'en cours'. Cette configuration n'est utilisée que si la société autorise également le transfert EDI."></i> - </label>)</span> - </div> - </div> - <div class="col-md-8" ng-if="!selectedDemandType"> - <em>Sélectionnez un type de demande.</em> - </div> - </div> - - </div> - - <div id="tabs-tree" class="tab-pane" ng-controller="ConfigurationTreeController"> - <input type="hidden" name="mailFoldersJson" value="{{mailFolders}}" /> - - <div class="row"> - <div class="col-md-4"> - <h3>Dossiers <a class="btn btn-xs btn-success pull-right" ng-click="newRoot()">Nouveau</a></h3> - <script type="text/ng-template" id="nodes_renderer.html"> - <div ui-tree-handle ng-class="{'bg-success' : mailFolder == selectedMailFolder}"> - <a class="btn btn-success btn-xs" data-nodrag ng-click="toggle(this)" ng-disabled="!mailFolder.children || mailFolder.children.length == 0"> - <span class="glyphicon" ng-class="{'glyphicon-chevron-right': !collapsed, 'glyphicon-chevron-down': collapsed}"></span> - </a> - <a ng-click="editMailFolder(mailFolder)">{{mailFolder.name}}</a> - <a class="pull-right btn btn-info btn-xs" data-nodrag ng-click="newArchiveSubFolder(this)" style="margin-left: 8px;" ng-show="!mailFolder.hasArchiveFolder && !mailFolder.archiveFolder" tooltip="Créer un dossier d'archive"><span class="glyphicon glyphicon-plus"></span></a> - <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="newSubFolder(this)" style="margin-left: 8px;" ng-show="!mailFolder.archiveFolder" tooltip="Créer un sous-dossier"><span class="glyphicon glyphicon-plus"></span></a> - <span class="pull-right" tooltip="{{mailFolder.$cumulativeCount > 0 && 'Ce dossier contient ' + mailFolder.$cumulativeCount + ' demandes et ne peut pas être supprimé !'|| 'Supprimer ce dossier'}}"> - <a class="btn btn-danger btn-xs" data-nodrag ng-click="deleteFolder(this)" ng-disabled="mailFolder.$cumulativeCount > 0"> - <span class="glyphicon glyphicon-remove"></span> - </a> - </span> - </div> - <ol ui-tree-nodes="options" ng-model="mailFolder.children" ng-class="{hidden: !collapsed}"> - <li ng-repeat="mailFolder in mailFolder.children" ui-tree-node ng-include="'nodes_renderer.html'"> - </li> - </ol> - </script> - <div ui-tree="options" data-drag-enabled="false"> - <ol ui-tree-nodes="" ng-model="mailFolders" id="tree-root"> - <li ng-repeat="mailFolder in mailFolders" ui-tree-node ng-include="'nodes_renderer.html'"></li> - </ol> - </div> - </div> - - <div class="col-md-8" ng-show="selectedMailFolder && !selectedMailFolder.archiveFolder"> - <h3>Édition du dossier {{selectedMailFolder.name}}</h3> - <div class="panel-group" id="accordion"> - - <!-- Général --> - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#collapse0"> - Généralité - </a> - </h4> - </div> - <div id="collapse0" class="panel-collapse collapse" ng-form="generalForm"> - <div class="panel-body"> - <div class="form-group" ng-if="selectedMailFolder.$parent"> - <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelCompany" ng-value="false" /> - Hériter de la société :</label> - <input type="text" class="form-control" disabled - ng-model="parentScopeValues.company" ng-if="!selectedMailFolder.useCurrentLevelCompany"> - </div> - <div class="form-group"> - <label> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelCompany" ng-value="true" ng-if="selectedMailFolder.$parent" /> - Définir la société :</label> - <input name="company" class="form-control" ng-model="selectedMailFolder.company" ng-if="selectedMailFolder.useCurrentLevelCompany || !selectedMailFolder.$parent"> - </div> - - <div class="form-group"> - <label class="control-label">Autoriser le déplacement de demandes vers ce dossier ?</label><br /> - <label class="radio-inline"> - <input type="radio" - ng-model="selectedMailFolder.allowMoveDemandIntoFolder" ng-value="true"> oui - </label> - <label class="radio-inline"> - <input type="radio" - ng-model="selectedMailFolder.allowMoveDemandIntoFolder" ng-value="false"> non - </label> - <label class="radio-inline" ng-if="selectedMailFolder.$parent"> - <input type="radio" - ng-model="selectedMailFolder.allowMoveDemandIntoFolder" ng-value="undefined"> hériter du dossier parent - ({{parentScopeValues.allowMoveDemandIntoFolder ? 'Oui' : 'Non'}}) - </label> - </div> - <div class="form-group"> - <label class="control-label">Autoriser la création de demandes dans ce dossier ?</label><br /> - <label class="radio-inline"> - <input type="radio" - ng-model="selectedMailFolder.allowCreateDemandIntoFolder" ng-value="true"> oui - </label> - <label class="radio-inline"> - <input type="radio" - ng-model="selectedMailFolder.allowCreateDemandIntoFolder" ng-value="false"> non - </label> - <label class="radio-inline" ng-if="selectedMailFolder.$parent"> - <input type="radio" - ng-model="selectedMailFolder.allowCreateDemandIntoFolder" ng-value="undefined"> hériter du dossier parent - ({{parentScopeValues.allowCreateDemandIntoFolder ? 'Oui' : 'Non'}}) - </label> - </div> - <div class="form-group"> - <label class="control-label">L'action imprimer est-elle équivalente à "prendre" ?</label><br /> - <label class="radio-inline"> - <input type="radio" - ng-model="selectedMailFolder.printActionEqualTakeAction" ng-value="true"> oui - </label> - <label class="radio-inline"> - <input type="radio" - ng-model="selectedMailFolder.printActionEqualTakeAction" ng-value="false"> non - </label> - <label class="radio-inline" ng-if="selectedMailFolder.$parent"> - <input type="radio" - ng-model="selectedMailFolder.printActionEqualTakeAction" ng-value="undefined"> hériter du dossier parent - ({{parentScopeValues.printActionEqualTakeAction ? 'Oui' : 'Non'}}) - </label> - </div> - - <div class="form-group"> - <label class="control-label">Ouvrir une pièce jointe sans prendre, met-il la ligne en orange ?</label><br /> - <label class="radio-inline"> - <input type="radio" - ng-model="selectedMailFolder.openAttachmentReportNoTaken" ng-value="true"> oui - </label> - <label class="radio-inline"> - <input type="radio" - ng-model="selectedMailFolder.openAttachmentReportNoTaken" ng-value="false"> non - </label> - <label class="radio-inline" ng-if="selectedMailFolder.$parent"> - <input type="radio" - ng-model="selectedMailFolder.openAttachmentReportNoTaken" ng-value="undefined"> hériter du dossier parent - ({{parentScopeValues.openAttachmentReportNoTaken ? 'Oui' : 'Non'}}) - </label> - </div> - - <div class="form-group" ng-if="selectedMailFolder.$parent"> - <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMailAddress" ng-value="false" /> - Hériter de l'adresse de réponse pour les rejets :</label> - <input type="text" class="form-control" disabled - ng-model="parentScopeValues.rejectResponseMailAddress" ng-if="!selectedMailFolder.useCurrentLevelRejectResponseMailAddress"> - </div> - <div class="form-group" ng-class="{'has-error': generalForm.rejectResponseMailAddress.$dirty && generalForm.rejectResponseMailAddress.$invalid, - 'has-success': generalForm.rejectResponseMailAddress.$dirty && generalForm.rejectResponseMailAddress.$valid}"> - <label> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMailAddress" ng-value="true" ng-if="selectedMailFolder.$parent" /> - Définir l'adresse de réponse pour les rejets :</label> - <input name="rejectResponseMailAddress" type="email" class="form-control" ng-model="selectedMailFolder.rejectResponseMailAddress" ng-if="selectedMailFolder.useCurrentLevelRejectResponseMailAddress || !selectedMailFolder.$parent"> - </div> - <div class="form-group" ng-if="selectedMailFolder.$parent"> - <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMessage" ng-value="false" /> - Hériter du message de réponse pour les rejets :</label> - <textarea type="text" class="form-control" disabled - ng-model="parentScopeValues.rejectResponseMessage" ng-if="!selectedMailFolder.useCurrentLevelRejectResponseMessage"></textarea> - </div> - <div class="form-group"> - <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMessage" ng-value="true" ng-if="selectedMailFolder.$parent" /> - Définir le message de réponse pour les rejets :</label> - <textarea class="form-control" ng-model="selectedMailFolder.rejectResponseMessage" ng-if="selectedMailFolder.useCurrentLevelRejectResponseMessage || !selectedMailFolder.$parent"></textarea> - </div> - - <hr /> - - <div class="form-group"> - <label class="control-label">Autoriser le transfert EDI ?</label> <i class="fa fa-info-circle" tooltip="Autorise le transfert des demandes à l'EDI si les demandes utilisent un type de demande qui autorise également le transfert EDI"></i><br /> - <label class="radio-inline"> - <input type="radio" - ng-model="selectedMailFolder.ediTransfer" ng-value="true"> oui - </label> - <label class="radio-inline"> - <input type="radio" - ng-model="selectedMailFolder.ediTransfer" ng-value="false"> non - </label> - <label class="radio-inline" ng-if="selectedMailFolder.$parent"> - <input type="radio" - ng-model="selectedMailFolder.ediTransfer" ng-value="undefined"> hériter du dossier parent - ({{parentScopeValues.ediTransfer ? 'Oui' : 'Non'}}) - </label> - </div> - - <div class="form-group" ng-if="selectedMailFolder.$parent"> - <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelEdiFolder" ng-value="false" /> - Hériter du dossier de dépôt des demandes EDI sur le serveur :</label> - <input type="text" class="form-control" disabled - ng-model="parentScopeValues.ediFolder" ng-if="!selectedMailFolder.useCurrentLevelEdiFolder" /> - </div> - <div class="form-group"> - <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelEdiFolder" ng-value="true" ng-if="selectedMailFolder.$parent" /> - Définir le dossier de dépôt des demandes EDI sur le serveur :</label> - <div class="input-group" ng-if="selectedMailFolder.useCurrentLevelEdiFolder || !selectedMailFolder.$parent"> - <input type="text" class="form-control" ng-model="selectedMailFolder.ediFolder"> - <span class="input-group-addon btn btn-info" ng-disabled="!selectedMailFolder.ediFolder" ng-click="checkRemotePath()"> - <i class="fa fa-cogs"></i> Test - </span> - </div> - </div> - - <hr /> - - <div class="form-group" ng-if="selectedMailFolder.$parent"> - <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelFaxDomain" ng-value="false" /> - Hériter du domaine des fax :</label> - <input type="text" class="form-control" disabled - ng-model="parentScopeValues.faxDomain" ng-if="!selectedMailFolder.useCurrentLevelFaxDomain"> - </div> - <div class="form-group"> - <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelFaxDomain" ng-value="true" ng-if="selectedMailFolder.$parent" /> - Définir le domaine des fax :</label> - <input type="text" class="form-control" ng-model="selectedMailFolder.faxDomain" ng-if="selectedMailFolder.useCurrentLevelFaxDomain || !selectedMailFolder.$parent"> - </div> - - </div> - </div> - </div> - - <!-- Liste des chargés de clientèle --> - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#collapse1"> - Liste des chargés de clientèle - </a> - </h4> - </div> - <div id="collapse1" class="panel-collapse collapse"> - <div class="panel-body"> - <table class="table table-bordered"> - <thead> - <tr> - <th>Utilisateur</th> - <th>Action</th> - </tr> - </thead> - <tbody> - <tr ng-repeat="customerResponsible in selectedMailFolder.customerResponsibles"> - <td> - <span class="fa fa-user"></span> - {{customerResponsible.firstName}} {{customerResponsible.lastName}}</td> - <td> - <a class="pull-right btn btn-danger btn-xs" ng-click="removeCustomerResponsible($index)"> - <span class="glyphicon glyphicon-remove"></span> - </a> - </td> - </tr> - <tr ng-if="!selectedMailFolder.customerResponsibles || selectedMailFolder.customerResponsibles.length == 0"> - <td colspan="2" class="emptyTable">Aucun chargé de clientelle défini</td> - </tr> - </tbody> - </table> - - <div class="form"> - <div class="form-group"> - <label for="newCustomerResponsibleField" class="control-label">Nouveau :</label> - <select id="newCustomerResponsibleField" ui-select2 ng-model="newCustomerResponsible" - ng-options="user as user.firstName + ' ' + user.lastName for user in users|filter:filterByAlreadyInCollection(selectedMailFolder.customerResponsibles)"></select> - - <a class="btn btn-success btn-xs" ng-click="addCustomerResponsible()" ng-disabled="!newCustomerResponsible"> - <span class="glyphicon glyphicon-plus"></span> - </a> - </div> - </div> - </div> - </div> - </div> - - <!-- Liste des emails expéditeur --> - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#collapse2"> - Liste des adresses email expéditeur (pour les réponses) - </a> - </h4> - </div> - <div id="collapse2" class="panel-collapse collapse"> - <div class="panel-body"> - <table class="table table-bordered"> - <thead> - <tr> - <th>Adresse email</th> - <th>Action</th> - </tr> - </thead> - <tbody> - <tr ng-repeat="replyAddress in parentScopeValues.replyAddresses" class="parentInfos"> - <td> - <span class="glyphicon glyphicon-user"></span> - {{replyAddress}}</td> - <td> - - </td> - </tr> - <tr ng-repeat="replyAddress in selectedMailFolder.replyAddresses"> - <td> - <span class="glyphicon glyphicon-user"></span> - {{replyAddress}}</td> - <td> - <a class="pull-right btn btn-danger btn-xs" ng-click="removeReplyAddress($index)"> - <span class="glyphicon glyphicon-remove"></span> - </a> - </td> - </tr> - <tr ng-if="!selectedMailFolder.replyAddresses || selectedMailFolder.replyAddresses.length == 0"> - <td colspan="2" class="emptyTable">Aucune adresse définie</td> - </tr> - </tbody> - </table> - - <div class="form-inline" ng-form="addAddressForm" role="form"> - <div class="form-group" - ng-class="{'has-error': addAddressForm.address.$dirty && addAddressForm.address.$invalid, - 'has-success': addAddressForm.address.$dirty && addAddressForm.address.$valid}"> - <label for="newAddressField" class="control-label">Nouvelle adresse : </label> - <input id="newAddressField" class="form-control" name="address" type="email" ng-model="newReplyAddress" placeholder="nom.prenom@franciaflex.fr" /> - </div> - <a class="btn btn-success btn-xs" ng-click="addReplyAddress()" ng-disabled="!newReplyAddress"> - <span class="glyphicon glyphicon-plus"></span> - </a> - </div> - - <br /> - - <table class="table table-bordered"> - <thead> - <tr> - <th>Nom de domaine</th> - <th>Action</th> - </tr> - </thead> - <tbody> - <tr ng-repeat="replyDomain in parentScopeValues.replyDomains" class="parentInfos"> - <td> - <span class="glyphicon glyphicon-globe"></span> - {{replyDomain}}</td> - <td> - - </td> - </tr> - <tr ng-repeat="replyDomain in selectedMailFolder.replyDomains"> - <td> - <span class="glyphicon glyphicon-globe"></span> - {{replyDomain}}</td> - <td> - <a class="pull-right btn btn-danger btn-xs" ng-click="removeReplyDomain($index)"> - <span class="glyphicon glyphicon-remove"></span> - </a> - </td> - </tr> - <tr ng-if="!selectedMailFolder.replyDomains || selectedMailFolder.replyDomains.length == 0"> - <td colspan="2" class="emptyTable">Aucune domaine défini</td> - </tr> - </tbody> - </table> - - <div class="form-inline" ng-form="addDomainForm" role="form"> - <div class="form-group" - ng-class="{'has-error': addDomainForm.domain.$dirty && addDomainForm.domain.$invalid, - 'has-success': addDomainForm.domain.$dirty && addDomainForm.domain.$valid}"> - <label for="newDomainField" class="control-label">Nouveau domaine : </label> - <input id="newDomainField" class="form-control" type="text" name="domain" ng-model="newReplyDomain" placeholder="franciaflex.fr" /> - </div> - <a class="btn btn-success btn-xs" ng-click="addReplyDomain()" ng-disabled="!newReplyDomain"> - <span class="glyphicon glyphicon-plus"></span> - </a> - </div> - </div> - </div> - </div> - - <!-- Sélection des états d'attentes possibles pour ce dossier --> - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#collapse3"> - Sélection des états d'attentes possibles pour ce dossier - </a> - </h4> - </div> - <div id="collapse3" class="panel-collapse collapse"> - <div class="panel-body"> - <label ng-if="selectedMailFolder.$parent"> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelWaitingState" - ng-value="false" ng-change="initFolderWaitingState()" /> - Hériter des états d'attente déclarés sur les dossiers parent : - </label> - <div class="checkbox" ng-repeat="waitingState in waitingStates" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelWaitingState"> - <label> - <input type="checkbox" ng-checked="parentScopeValues.waitingStates.containsByTopiaId(waitingState)" - disabled> {{waitingState.label}} - </label> - </div> - <label> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelWaitingState" ng-value="true" - ng-change="initFolderWaitingState()" ng-if="selectedMailFolder.$parent" /> - Définir les états d'attente pour ce dossier : - </label> - <div class="checkbox" ng-repeat="waitingState in waitingStates" ng-if="selectedMailFolder.useCurrentLevelWaitingState || !selectedMailFolder.$parent"> - <label> - <input type="checkbox" ng-checked="selectedMailFolder.waitingStates.containsByTopiaId(waitingState)" - ng-click="changeFolderWaitingState(waitingState)"> {{waitingState.label}} - </label> - </div> - </div> - </div> - </div> - - <!-- Sélection des types de demandes possibles pour ce dossier --> - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#collapse4"> - Sélection des types de demandes possibles pour ce dossier - </a> - </h4> - </div> - <div id="collapse4" class="panel-collapse collapse"> - <div class="panel-body"> - <label ng-if="selectedMailFolder.$parent"> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelDemandType" - ng-value="false" ng-change="initFolderDemandTypes()" /> - Hériter des types de demande déclarés sur les dossiers parent : - </label> - <div class="checkbox" ng-repeat="demandType in demandTypes" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelDemandType"> - <label> - <input type="checkbox" ng-checked="parentScopeValues.demandTypes.containsByTopiaId(demandType)" - disabled> {{demandType.label}} - </label> - </div> - <label> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelDemandType" ng-value="true" - ng-change="initFolderDemandTypes()" ng-if="selectedMailFolder.$parent" /> - Définir les types de demande pour ce dossier : - </label> - <div class="checkbox" ng-repeat="demandType in demandTypes" ng-if="selectedMailFolder.useCurrentLevelDemandType || !selectedMailFolder.$parent"> - <label> - <input type="checkbox" ng-checked="selectedMailFolder.demandTypes.containsByTopiaId(demandType)" - ng-click="changeFolderDemandType(demandType)"> {{demandType.label}} - </label> - </div> - </div> - </div> - </div> - - <!-- Sélection des gammes possibles pour ce dossier --> - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#collapse5"> - Sélection des gammes possibles pour ce dossier - </a> - </h4> - </div> - <div id="collapse5" class="panel-collapse collapse"> - <div class="panel-body"> - <label ng-if="selectedMailFolder.$parent"> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelRange" - ng-value="false" ng-change="initFolderRanges()" /> - Hériter des gammes déclarées sur les dossiers parent : - </label> - <div class="checkbox" ng-repeat="range in ranges" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelRange"> - <label> - <input type="checkbox" ng-checked="parentScopeValues.ranges.containsByTopiaId(range)" - disabled> {{range.label}} - </label> - </div> - <div> - <label> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelRange" ng-value="true" - ng-change="initFolderRanges()" ng-if="selectedMailFolder.$parent" /> - Définir les gammes pour ce dossier : - </label> - <div class="checkbox" ng-repeat="range in ranges" ng-if="selectedMailFolder.useCurrentLevelRange || !selectedMailFolder.$parent"> - <label> - <input type="checkbox" ng-checked="selectedMailFolder.ranges.containsByTopiaId(range)" - ng-click="changeFolderRange(range)"> {{range.label}} - </label> - </div> - </div> - </div> - </div> - </div> - - <!-- configuration des colonnes a afficher --> - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#collapse6"> - Configuration des colonnes à afficher - </a> - </h4> - </div> - <div id="collapse6" class="panel-collapse collapse"> - <div class="panel-body"> - - <label ng-if="selectedMailFolder.$parent"> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelTableColumns" - ng-value="false" ng-change="initFolderColumns()" /> - Hériter des colonnes déclarées sur les dossiers parent : - </label> - - <div class="control-group" ng-show="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelTableColumns"> - <div class="controls"> - <input type="hidden" ui-select2-sortable ng-model="parentFolderTableColumns" - simple-query="getObjectsData" multiple sortable disabled> - </div> - </div> - - <div ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelTableColumns"> - <table id='table-snapshot' class="table table-bordered"> - <caption>Aperçu</caption> - <thead> - <tr> - <th ng-repeat="mailField in parentFolderTableColumns">{{tableMailFields[mailField.id]}}</th> - </tr> - </thead> - </table> - </div> - - <label> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelTableColumns" ng-value="true" - ng-change="initFolderColumns()" ng-if="selectedMailFolder.$parent" /> - Définir les colonnes à afficher pour ce dossier : - </label> - - <div class="control-group" ng-show="!selectedMailFolder.$parent || selectedMailFolder.useCurrentLevelTableColumns"> - <div class="controls"> - <input type="hidden" ui-select2-sortable ng-model="folderTableColumns" - simple-query="getObjectsData" multiple sortable> - <p class="help-block">(l'ordre peut être changé en faisant un glisser/déposer sur les champs)</p> - </div> - </div> - - <div ng-if="!selectedMailFolder.$parent || selectedMailFolder.useCurrentLevelTableColumns"> - <table id='table-snapshot' class="table table-bordered"> - <caption>Aperçu</caption> - <thead> - <tr> - <th ng-repeat="mailField in folderTableColumns">{{tableMailFields[mailField.id]}}</th> - </tr> - </thead> - </table> - </div> - </div> - </div> - </div> - - <!-- Droits --> - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#collapse7"> - Droits - </a> - </h4> - </div> - <div id="collapse7" class="panel-collapse collapse"> - <div class="panel-body"> - <!-- Droits d'accès --> - <table id="rights" class="table table-bordered"> - <thead> - <tr> - <th>Utilisateur ou groupe</th> - <th>Droits</th> - </tr> - </thead> - <tbody> - <tr ng-repeat="group in parentScopeValues.rightGroups" class="parentInfos"> - <td> - <span class="fa fa-users"></span> {{group.completeName}} - </td> - <td> - <label><input type="checkbox" ng-checked="parentScopeValues.readRightGroups.containsByTopiaId(group)" disabled> Lecture</label> - <label><input type="checkbox" ng-checked="parentScopeValues.writeRightGroups.containsByTopiaId(group)" disabled> Écriture</label> - <label><input type="checkbox" ng-checked="parentScopeValues.moveRightGroups.containsByTopiaId(group)" disabled> Déplacement</label> - </td> - </tr> - <tr ng-repeat="user in parentScopeValues.rightUsers" class="parentInfos"> - <td> - <span class="fa fa-user"></span> {{user.firstName}} {{user.lastName}} - </td> - <td> - <label><input type="checkbox" ng-checked="parentScopeValues.readRightUsers.containsByTopiaId(user)" disabled> Lecture</label> - <label><input type="checkbox" ng-checked="parentScopeValues.writeRightUsers.containsByTopiaId(user)" disabled> Écriture</label> - <label><input type="checkbox" ng-checked="parentScopeValues.moveRightUsers.containsByTopiaId(user)" disabled> Déplacement</label> - </td> - </tr> - </tbody> - <tbody> - <tr ng-repeat="group in selectedMailFolder.rightGroups"> - <td> - <span class="fa fa-users"></span> {{group.completeName}} - <a class="pull-right btn btn-danger btn-xs pull-right" ng-click="removeRightGroup($index, group)"> - <span class="glyphicon glyphicon-remove"></span> - </a> - </td> - <td> - <label><input type="checkbox" - ng-model="readRightGroup" - ng-checked="selectedMailFolder.readRightGroups.containsByTopiaId(group)" - ng-disabled="parentScopeValues.readRightGroups.containsByTopiaId(group) || selectedMailFolder.writeRightGroups.containsByTopiaId(group)" - ng-change="changeReadRightGroup(group)"> Lecture</label> - <label><input type="checkbox" - ng-model="writeRightGroup" - ng-checked="selectedMailFolder.writeRightGroups.containsByTopiaId(group)" - ng-disabled="parentScopeValues.writeRightGroups.containsByTopiaId(group)" - ng-change="changeWriteRightGroup(group)"> Écriture</label> - <label><input type="checkbox" - ng-model="moveRightGroup" - ng-checked="selectedMailFolder.moveRightGroups.containsByTopiaId(group)" - ng-disabled="parentScopeValues.moveRightGroups.containsByTopiaId(group)" - ng-change="changeMoveRightGroup(group)"> Déplacement</label> - </td> - </tr> - <tr ng-repeat="user in selectedMailFolder.rightUsers"> - <td> - <span class="fa fa-user"></span> {{user.firstName}} {{user.lastName}} - <a class="pull-right btn btn-danger btn-xs pull-right" ng-click="removeRightUser($index, user)"> - <span class="glyphicon glyphicon-remove"></span> - </a> - </td> - <td> - <label><input type="checkbox" - ng-model="readRightUser" - ng-checked="selectedMailFolder.readRightUsers.containsByTopiaId(user)" - ng-disabled="parentScopeValues.readRightUsers.containsByTopiaId(user) || selectedMailFolder.writeRightUsers.containsByTopiaId(user)" - ng-change="changeReadRightUser(user)"> Lecture</label> - <label><input type="checkbox" - ng-model="writeRightUser" - ng-checked="selectedMailFolder.writeRightUsers.containsByTopiaId(user)" - ng-disabled="parentScopeValues.writeRightUsers.containsByTopiaId(user)" - ng-change="changeWriteRightUser(user)"> Écriture</label> - <label><input type="checkbox" - ng-model="moveRightUser" - ng-checked="selectedMailFolder.moveRightUsers.containsByTopiaId(user)" - ng-disabled="parentScopeValues.moveRightUsers.containsByTopiaId(user)" - ng-change="changeMoveRightUser(user)"> Déplacement</label> - </td> - </tr> - </tbody> - </table> - <div class="form"> - <div class="form-group"> - <label for="newRightUserField" class="control-label">Nouveau utilisateur :</label> - <select id="newRightUserField" ui-select2 - ng-model="newRightUser" - ng-options="user as user.firstName + ' ' + user.lastName for user in users|filter:filterByAlreadyInCollection(selectedMailFolder.rightUsers)"> - </select> - <a class="btn btn-success btn-xs" ng-click="addRightUser()" ng-disabled="!newRightUser"> - <span class="glyphicon glyphicon-plus"></span> - </a> - </div> - </div> - - <div class="form"> - <div class="form-group"> - <label for="newRightGroupField" class="control-label">Nouveau groupe :</label> - <select id="newRightGroupField" ui-select2 - ng-model="newRightGroup" - ng-options="group as group.completeName for group in groups|filter:filterByAlreadyInCollection(selectedMailFolder.rightGroups)"> - </select> - <a class="btn btn-success btn-xs" ng-click="addRightGroup()" ng-disabled="!newRightGroup"> - <span class="glyphicon glyphicon-plus"></span> - </a> - </div> - </div> - </div> - </div> - </div> - </div> - </div> - <div class="col-md-8" ng-show="selectedMailFolder.archiveFolder"> - <h3>Édition du dossier {{selectedMailFolder.name}}</h3> - - <!-- Droits --> - <div class="panel panel-default"> - <div class="panel-heading"> - <h4 class="panel-title"> - Droits - </h4> - </div> - <div class="panel-body"> - <!-- Droits d'accès --> - <table id="rights" class="table table-bordered"> - <thead> - <tr> - <th>Utilisateur ou groupe</th> - <th>Droits</th> - </tr> - </thead> - <tbody> - <tr ng-repeat="group in selectedMailFolder.rightGroups"> - <td> - <span class="fa fa-users"></span> {{group.completeName}} - <a class="pull-right btn btn-danger btn-xs pull-right" ng-click="removeRightGroup($index, group)"> - <span class="glyphicon glyphicon-remove"></span> - </a> - </td> - <td> - <label><input type="checkbox" - ng-model="readRightGroup" - ng-checked="selectedMailFolder.readRightGroups.containsByTopiaId(group)" - ng-disabled="parentScopeValues.readRightGroups.containsByTopiaId(group)" - ng-change="changeReadRightGroup(group)"> Lecture</label> - </td> - </tr> - <tr ng-repeat="user in selectedMailFolder.rightUsers"> - <td> - <span class="fa fa-user"></span> {{user.firstName}} {{user.lastName}} - <a class="pull-right btn btn-danger btn-xs pull-right" ng-click="removeRightUser($index, user)"> - <span class="glyphicon glyphicon-remove"></span> - </a> - </td> - <td> - <label><input type="checkbox" - ng-model="readRightUser" - ng-checked="selectedMailFolder.readRightUsers.containsByTopiaId(user)" - ng-disabled="parentScopeValues.readRightUsers.containsByTopiaId(user) || selectedMailFolder.writeRightUsers.containsByTopiaId(user)" - ng-change="changeReadRightUser(user)"> Lecture</label> - </td> - </tr> - </tbody> - </table> - <div class="form"> - <div class="form-group"> - <label for="newRightUserField" class="control-label">Nouveau utilisateur :</label> - <select id="newRightUserField" ui-select2 - ng-model="newRightUser" - ng-options="user as user.firstName + ' ' + user.lastName for user in users|filter:filterByAlreadyInCollection(selectedMailFolder.rightUsers)"> - </select> - <a class="btn btn-success btn-xs" ng-click="addRightUser()" ng-disabled="!newRightUser"> - <span class="glyphicon glyphicon-plus"></span> - </a> - </div> - </div> - - <div class="form"> - <div class="form-group"> - <label for="newRightGroupField" class="control-label">Nouveau groupe :</label> - <select id="newRightGroupField" ui-select2 - ng-model="newRightGroup" - ng-options="group as group.completeName for group in groups|filter:filterByAlreadyInCollection(selectedMailFolder.rightGroups)"> - </select> - <a class="btn btn-success btn-xs" ng-click="addRightGroup()" ng-disabled="!newRightGroup"> - <span class="glyphicon glyphicon-plus"></span> - </a> - </div> - </div> - </div> - </div> - </div> - </div> - </div> - - <div id="tabs-filters" class="tab-pane" ng-controller="ConfigurationFilterController"> - <input type="hidden" name="mailFiltersJson" value="{{mailFilters}}" /> - - <div class="panel-group" id="accordionFilters"> - - <div class="panel panel-default" ng-repeat="mailFolder in mailFolders"> - <div class="panel-heading"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordionFilters" href="#mailFilerAccordion{{$index}}"> - Filtre du dossier {{mailFolder.name}} - </a> - </h4> - </div> - <div id="mailFilerAccordion{{$index}}" class="panel-collapse collapse"> - <div class="panel-body"> - <table class="table table-hover table-bordered"> - <thead> - <tr> - <th>Filtre</th> - <th>Dossier</th> - <th>Priorité au dossier de la règle</th> - <th/> - </tr> - </thead> - <tbody ui-sortable="sortableOptions" ng-model="rootFolderMailFilters[mailFolder.topiaId]"> - <tr ng-repeat="mailFilter in rootFolderMailFilters[mailFolder.topiaId]"> - <td>{{mailFilter.expression}}</td> - <td>{{mailFilter.mailFolder.$fullPath}}</td> - <td>{{mailFilter.filterFolderPriority ? 'Oui' : 'Non'}}</td> - <td><a class="btn btn-danger btn-xs" ng-click="removeFilter(mailFolder, mailFilter)"> - <span class="glyphicon glyphicon-remove"></span> - </a></td> - </tr> - </tbody> - </table> - - <div role="form"> - <div class="form-group"> - <label for="filterField">Filtre</label> - <input type="text" class="form-control" id="folderField" ng-model="newFilter.expression"> - <p class="help-block">Le fitre s'applique à l'adresse de reception de l'email. - Il peut commencer ou se terminer par <code>%</code> pour respectivement appliquer le filtre à la fin ou au début de l'adresse de réception</p> - </div> - <div class="form-group"> - <label for="folderField">Dossier de destination des email</label> - <select class="form-control" ng-model="newFilter.mailFolder" ng-options="mailFolder.$fullPath for mailFolder in flatMailFolders[mailFolder.topiaId]"></select> - </div> - <div class="form-group"> - <label for="filterFolderPriorityField">Utiliser le dossier de la règle en priorité : </label> - <label class="radio-inline"> - <input type="radio" - ng-model="newFilter.filterFolderPriority" ng-value="false"> non - </label> - <label class="radio-inline"> - <input type="radio" - ng-model="newFilter.filterFolderPriority" ng-value="true"> oui - </label> - </div> - </div> - <button type="button" class="btn btn-success" ng-disabled="!newFilter.expression || !newFilter.mailFolder" ng-click="addNewFilter(mailFolder)"> - <i class="glyphicon glyphicon-plus"></i> Ajouter - </button> - </div> - </div> - </div> - </div> - </div> - - <div id="tabs-search" class="tab-pane" ng-controller="ConfigurationSearchController"> - <!-- <input type="hidden" name="configuration.searchDisplayColumns" value="{{searchDisplayColumn.id}}" ng-repeat="searchDisplayColumn in searchDisplayColumns"/> --> - - <div class="control-group"> - <label class="control-label" for="tableColumns">Champs à afficher dans le tableau (l'ordre peut être changé en faisant un glisser/déposer sur les champs)</label> - - <div class="controls"> - <input type="hidden" ui-select2-sortable ng-model="searchDisplayColumns" simple-query="getObjectsData" multiple sortable> - </div> - - <div> - <table id='table-snapshot' class="table table-bordered"> - <caption>Aperçu</caption> - <thead> - <tr> - <th ng-repeat="mailField in searchDisplayColumns">{{tableMailFields[mailField.id]}}</th> - </tr> - </thead> - </table> - </div> - </div> - </div> - - <div id="tabs-mailaccounts" class="tab-pane" ng-controller="ConfigurationEmailAccountsController"> - <input type="hidden" name="emailAccountsJson" value="{{emailAccounts}}" /> - - <table id='table-snapshot' class="table table-bordered"> - <thead> - <tr> - <th>Protocole</th> - <th>Serveur</th> - <th>Port</th> - <th>Utilisateur</th> - <th>Options</th> - <th/> - </tr> - </thead> - <tbody> - <tr ng-repeat="emailAccount in emailAccounts"> - <td>{{emailAccount.protocol}}</td> - <td>{{emailAccount.host}}</td> - <td>{{emailAccount.port}}</td> - <td>{{emailAccount.login}}</td> - <td> - <span class="fa fa-fax" tooltip="Compte email ne recoit que des fax" ng-if="emailAccount.faxAccountType"></span> - <span class="fa fa-reply" tooltip="Le rejet des email est autorisé pour ce compte" ng-if="emailAccount.rejectAllowed"></span> - </td> - <td> - <a class="btn btn-danger btn-xs" ng-click="removeEmailAccount($index)"> - <span class="glyphicon glyphicon-remove"></span> - </a></td> - </tr> - <tr ng-if="!emailAccounts || emailAccounts.length == 0"> - <td class="emptyTable" colspan="6">Aucun compte email trouvé</td> - </tr> - </tbody> - </table> - - <div role="form" ng-form="addEmailAccountForm"> - <fieldset> - <legend>Nouveau compte email</legend> - <div class="form row"> - <div class="form-group col-xs-1"> - <label for="emailAccountProtocol" class="control-label">Protocole:</label> - <!-- <input type="text" class="form-control" ng-model="newAccount.protocol" /> --> - <select id="emailAccountProtocol" ng-model="newAccount.protocol" ng-options="protocol as protocol for (protocol, port) in emailProtocolPorts"></select> - </div> - <div class="form-group col-xs-4"> - <label for="emailAccountHost" class="control-label">Serveur:</label> - <input id="emailAccountHost" name="newAccountHost" type="text" class="form-control" ng-model="newAccount.host" ng-minlength="1" /> - </div> - <div class="form-group col-xs-1" - ng-class="{'has-error': addEmailAccountForm.newAccountPort.$dirty && addEmailAccountForm.newAccountPort.$invalid, - 'has-success': addEmailAccountForm.newAccountPort.$dirty && addEmailAccountForm.newAccountPort.$valid}"> - <label for="emailAccountPort" class="control-label">Port:</label> - <input id="emailAccountPort" name="newAccountPort" type="text" class="form-control" ng-model="newAccount.port" ng-pattern="/^\d+$/" /> - </div> - <div class="form-group col-xs-3"> - <label for="emailAccountUser" class="control-label">Utilisateur:</label> - <input id="emailAccountUser" type="text" class="form-control" ng-model="newAccount.login"/> - </div> - <div class="form-group col-xs-3"> - <label for="emailAccountPassword" class="control-label">Mot de passe:</label> - <input id="emailAccountPassword" type="password" class="form-control" ng-model="newAccount.password"> - </div> - </div> - <div class="form row"> - <div class="form-group col-xs-5"> - <label class="control-label">Réception de fax:</label> - <div class="checkbox"> - <label> - <input id="emailRejectAllowed" type="checkbox" ng-value="true" ng-model="newAccount.faxAccountType"> - ce compte email recoit seulement des fax - </label> - </div> - </div> - <div class="form-group col-xs-5"> - <label class="control-label">Rejet:</label> - <div class="checkbox"> - <label> - <input id="emailRejectAllowed" type="checkbox" ng-value="true" - ng-model="newAccount.rejectAllowed"> - autoriser les mails de ce compte à pouvoir être rejeté - </label> - </div> - </div> - <div class="form-group col-xs-2"> - <br /> - <button type="button" class="btn btn-info" ng-disabled="!newAccount.protocol || !newAccount.host || !newAccount.port || !newAccount.login || addEmailAccountForm.$invalid" - ng-click="checkEmailAccount()"> - <i class="fa fa-cogs"></i> Test - </button> - <button type="button" class="btn btn-success" ng-disabled="!newAccount.protocol || !newAccount.host || !newAccount.port || !newAccount.login || addEmailAccountForm.$invalid" ng-click="addEmailAccount()"> - <i class="fa fa-plus"></i> Ajouter - </button> - </div> - </div> - </fieldset> - </div> - </div> - - <div id="tabs-chefgroup" class="tab-pane" ng-controller="ConfigurationChefGroupController"> - - <div class="row"> - <div class="col-md-4"> - <h3>Chef de groupe <input type="button" class="btn btn-success btn-xs pull-right" value="Nouveau" ng-click="newGroupChef()" /></h3> - <table class="table table-hover"> - <tbody> - <tr ng-repeat="groupChef in configuration.chefs" - ng-class="{'info' : groupChef == selectedGroupChef}" - ng-click="editGroupChef(groupChef)"> - <td>{{groupChef.userGroup ? groupChef.userGroup.completeName : '(aucun groupe)'}} - <a class="btn btn-danger btn-xs pull-right" ng-click="removeGroupChef(groupChef, $index)"> - <span class="glyphicon glyphicon-remove"></span> - </a> - </td> - </tr> - <tr ng-if="!configuration.chefs || configuration.chefs.length == 0"> - <td class="emptyTable">Aucun chef de groupe</td> - </tr> - </tbody> - </table> - </div> - - <div class="col-md-8" ng-show="selectedGroupChef"> - <h3>Édition du chef de groupe</h3> - - <div class="form"> - <div class="form-group required"> - <label for="groupChefUserGroupField" class="control-label">Chef du groupe : </label> - <select id="groupChefUserGroupField" ui-select2 ng-required="selectedGroupChef" - ng-model="selectedGroupChef.userGroup" - ng-options="group as group.completeName for group in groups|filter:availableNewGroupChef"> - <option value=""></option> - </select> - </div> - </div> - - <hr /> - <table class="table table-hover"> - <thead> - <tr> - <th>Groupes gérés par le chef de groupe</th> - </tr> - </thead> - <tbody> - <tr ng-repeat="group in selectedGroupChef.managedGroups"> - <td> - <span class="fa fa-users"></span> - {{group.completeName}} - <a class="btn btn-danger btn-xs pull-right" ng-click="removeManagedGroup($index)"> - <span class="glyphicon glyphicon-remove"></span> - </a> - </td> - </tr> - <tr ng-if="!selectedGroupChef.managedGroups || selectedGroupChef.managedGroups.length == 0"> - <td class="emptyTable">Aucun groupe gérés</td> - </tr> - </tbody> - </table> - <div class="form"> - <div class="form-group"> - <label for="newManagedGroupField" class="control-label">Nouveau groupe :</label> - <select id="newManagedGroupField" ui-select2 - ng-model="newManagedGroup" - ng-options="group as group.completeName for group in groups|filter:filterByAlreadyInCollection(selectedGroupChef.managedGroups)"> - <option value=""></option> - </select> - <a class="btn btn-success btn-xs" ng-click="addManagedGroup()" ng-disabled="!newManagedGroup"> - <span class="glyphicon glyphicon-plus"></span> - </a> - </div> - </div> - </div> - </div> - </div> - - </div> - <nav class="navbar navbar-default navbar-fixed-bottom"> - <div class="container"> - <button type="submit" class="btn btn-primary navbar-btn pull-right">Valider</button> - </div> - </nav> - </s:form> - </div> - </body> -</html> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-archive-input.jsp b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-archive-input.jsp deleted file mode 100644 index 6e731e3..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-archive-input.jsp +++ /dev/null @@ -1,66 +0,0 @@ -<%-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --%> -<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> -<!DOCTYPE html> -<%@taglib uri="/struts-tags" prefix="s" %> - -<html> - <head> - <title>Reprise des archives</title> - </head> - - <body> - - <div id="main-container" class="container"> - - <h1 class="page-header">Reprise des archives</h1> - - <s:if test="disabledImport"> - <em>L'import des archives a déjà été effectué, il n'est plus disponible</em> - </s:if> - <s:else> - <s:form id="main_form" action="import-archive" method="post" enctype="multipart/form-data"> - - <s:actionmessage/> - <s:actionerror/> - - <div class="form-group"> - <label for="archiveFile" class="control-label">Fichier d'archive :</label> - <input type="file" id="archiveFile" name="archiveFile" class="form-control"> - <p class="help-block">Format du fichier csv : <code>receptionDate;projectReference;sender;fax;recipient;object;archiveDate;companyReference;originalEmail;comment;etatAttente;demandType;priority;mailFolder;client-code;client-brand;attachments</code><br /> - Encodage du fichier csv : <code>${applicationConfig.importFileEncoding}</code></p> - </div> - <div class="form-group"> - <label for="attachmentBase" class="control-label">Répertoire de base des pièces jointes :</label> - <input type="text" id="attachmentBase" name="attachmentBase" class="form-control"> - <p class="help-block">Dossier contenant les pièces jointes référencées dans le fichier d'archive</p> - </div> - <button type="submit" class="btn btn-primary navbar-btn">Valider</button> - <hr /> - - </s:form> - </s:else> - </div> - </body> -</html> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp deleted file mode 100644 index a11b143..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp +++ /dev/null @@ -1,91 +0,0 @@ -<%-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --%> -<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> -<!DOCTYPE html> -<%@taglib uri="/struts-tags" prefix="s" %> - -<html> - <head> - <title>Import</title> - </head> - - <body> - - <div id="main-container" class="container"> - - <h1 class="page-header">Import</h1> - - <s:form id="main_form" action="import" method="post" enctype="multipart/form-data"> - - <s:actionmessage/> - <s:actionerror/> - - <div class="form-group"> - <label for="clientField" class="control-label">Fichier client :</label> - <input type="file" id="clientField" name="clientFile" class="form-control"> - <p class="help-block">Format du fichier csv : <code>Societe;Marque;Nom;Caracteristique1;Caracteristique2;Caracteristique3;Numero_Fax;Adresse_Mail;Code_Client</code><br /> - Encodage du fichier csv : <code>${applicationConfig.importFileEncoding}</code></p> - </div> - <button type="submit" class="btn btn-primary navbar-btn">Valider</button> - <hr /> - - <div class="form-group"> - <label for="waitingStateField" class="control-label">Fichier état d'attente :</label> - <input type="file" id="waitingStateField" name="waitingStateFile" class="form-control"> - <p class="help-block">Format du fichier csv : <code>etatattente</code><br /> - Encodage du fichier csv : <code>${applicationConfig.importFileEncoding}</code></p> - </div> - <button type="submit" class="btn btn-primary navbar-btn">Valider</button> - <hr /> - - <div class="form-group"> - <label for="demandTypeField" class="control-label">Fichier types de demande :</label> - <input type="file" id="demandTypeField" name="demandTypeFile" class="form-control"> - <p class="help-block">Format du fichier csv : <code>demandetype</code><br /> - Encodage du fichier csv : <code>${applicationConfig.importFileEncoding}</code></p> - </div> - <button type="submit" class="btn btn-primary navbar-btn">Valider</button> - <hr /> - - <div class="form-group"> - <label for="rangeField" class="control-label">Fichier gamme :</label> - <input type="file" id="rangeField" name="rangeFile" class="form-control"> - <p class="help-block">Format du fichier csv : <code>gamme</code><br /> - Encodage du fichier csv : <code>${applicationConfig.importFileEncoding}</code></p> - </div> - <button type="submit" class="btn btn-primary navbar-btn">Valider</button> - <hr /> - - <div class="form-group"> - <label for="priorityField" class="control-label">Fichier priorite :</label> - <input type="file" id="priorityField" name="priorityFile" class="form-control"> - <p class="help-block">Format du fichier csv : <code>priorite</code><br /> - Encodage du fichier csv : <code>${applicationConfig.importFileEncoding}</code></p> - </div> - <button type="submit" class="btn btn-primary navbar-btn">Valider</button> - - </s:form> - </div> - </body> -</html> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/ldap-input.jsp b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/ldap-input.jsp deleted file mode 100644 index ce477f6..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/ldap-input.jsp +++ /dev/null @@ -1,56 +0,0 @@ -<%-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --%> -<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> -<!DOCTYPE html> -<%@taglib uri="/struts-tags" prefix="s" %> - -<html> - <head> - <title>Ldap</title> - </head> - - <body> - - <div id="main-container" class="container"> - - <h1 class="page-header">Active Directory</h1> - - La base de données contient actuellement : - <ul> - <li><strong>${userCount}</strong> utilisateurs - <li><strong>${groupCount}</strong> groupes - </ul> - - <hr /> - - <s:form id="main_form" action="ldap" method="post"> - - Cette action permet d'importer tout les utilisateurs et les groupes du serveur Active Directory dans l'application FaxToMail. Cette action peut prendre quelques minutes. - - <button id="submit_button" type="submit" class="btn btn-primary navbar-btn">Mettre à jour les groupes et utilisateurs</button> - - </s:form> - </div> - </body> -</html> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/ldap-wait.jsp b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/ldap-wait.jsp deleted file mode 100644 index 7c6bacc..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/ldap-wait.jsp +++ /dev/null @@ -1,44 +0,0 @@ -<%-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --%> -<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> -<!DOCTYPE html> -<%@taglib uri="/struts-tags" prefix="s" %> - -<html> - <head> - <title>Ldap</title> - <meta http-equiv="refresh" content="5;url=<s:url />"/> - </head> - - <body> - - <div id="main-container" class="container"> - - <h1 class="page-header">Active Directory</h1> - - <em>L'import des utilisateurs et groupes Active Directory est en cours...</em> - - </div> - </body> -</html> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/lock-input.jsp b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/lock-input.jsp deleted file mode 100644 index 1e2a88e..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/lock-input.jsp +++ /dev/null @@ -1,80 +0,0 @@ -<%-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --%> -<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> -<!DOCTYPE html> -<%@taglib uri="/struts-tags" prefix="s" %> - -<html> - <head> - <title>Verrouillages</title> - <link rel="stylesheet" type="text/css" href="<s:url value='/nuiton-js/faxtomail-lock.css' />" /> - </head> - - <body> - - <div id="main-container" class="container"> - - <h1 class="page-header">Liste des verrous actifs sur les demandes</h1> - - <s:form id="main_form" action="lock" method="post"> - - <table id='table-snapshot' class="table table-bordered"> - <thead> - <tr> - <th></th> - <th>Objet</th> - <th>Notre référence</th> - <th>Émetteur</th> - <th>Verrouillé par</th> - </tr> - </thead> - <tbody> - <s:iterator value="activeLocks"> - <tr> - <td><input type="checkbox" name="mailLockIds" value="<s:property value="topiaId" />" /> - <td><s:property value="lockOn.object" /></td> - <td><s:property value="lockOn.companyReference" /></td> - <td><s:property value="lockOn.sender" /></td> - <td> - <s:property value="lockBy.firstName" /> <s:property value="lockBy.lastName" /> - </td> - </tr> - </s:iterator> - <s:if test="activeLocks == null || activeLocks.empty"> - <tr class="emptyTable"> - <td colspan="5">Aucune demande n'est actuellement verrouillée.</td> - </tr> - </s:if> - </tbody> - </table> - - <nav class="navbar navbar-default navbar-fixed-bottom"> - <div class="container"> - <button type="submit" class="btn btn-primary navbar-btn pull-right">Supprimer les verrous</button> - </div> - </nav> - </s:form> - </div> - </body> -</html> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp deleted file mode 100644 index 840abe3..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp +++ /dev/null @@ -1,93 +0,0 @@ -<%-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --%> -<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> -<!DOCTYPE html> -<%@taglib uri="/struts-tags" prefix="s" %> - -<html> - <head> - <title>Dossiers mis en avant par utilisateur</title> - - <link rel="stylesheet" type="text/css" href="<s:url value='/nuiton-js/faxtomail-user-folder.css' />" /> - <script type="text/javascript" src="<s:url value='/nuiton-js/faxtomail-user-folder.js' />"></script> - - <script type="text/javascript"> - UserFolderModule.value('UserFolderData', { - 'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>, - 'users': <s:property value="toJson(users)" escapeHtml="false"/>, - 'userFolders': <s:property value="toJson(userFolders)" escapeHtml="false"/> - }); - </script> - - <!-- - Current user groups : - <s:iterator value="authenticatedUser.userGroups"> - - <s:property value="completeName" /> - </s:iterator> - --> - </head> - - <body> - - <div id="main-container" class="container" ng-app="UserFolderModule"> - - <h1 class="page-header">Dossiers mis en avant par utilisateur</h1> - - <s:form id="main_form" action="user-folder" method="post" ng-controller="UserFolderController"> - <s:hidden name="userFoldersJson" value="{{userFolders}}" /> - - Voici la liste des utilisateurs dont vous avez la gestion car vous faites partit d'un groupe - capable de gérer les utilisateurs suivants : - - <table id='table-snapshot' class="table table-bordered"> - <thead> - <tr> - <th>Utilisateur</th> - <th>Dossiers</th> - </tr> - </thead> - <tbody> - <tr ng-repeat="user in users"> - <th>{{user.firstName}} {{user.lastName}}</th> - <td> - <div class="controls"> - <input type="hidden" ui-select2-sortable ng-model="userFolders[user.topiaId]" simple-query="getObjectsData" multiple sortable> - </div> - </td> - </tr> - <tr ng-if="!users || users.length == 0"> - <td class="emptyTable" colspan="2">Aucun utilisateur trouvé</td> - </tr> - </tbody> - </table> - - <nav class="navbar navbar-default navbar-fixed-bottom"> - <div class="container"> - <button type="submit" class="btn btn-primary navbar-btn pull-right">Valider</button> - </div> - </nav> - </s:form> - </div> - </body> -</html> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/index.jsp b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/index.jsp deleted file mode 100644 index 573b8b4..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/index.jsp +++ /dev/null @@ -1,51 +0,0 @@ -<%-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --%> -<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> -<!DOCTYPE html> -<%@taglib uri="/struts-tags" prefix="s" %> -<html> - <head> - <title>Accueil</title> - </head> - <body> - <div id="main-container" class="container"> - <h1 class="page-header">Administration FaxToMail</h1> - - <ul> - <s:if test="admin"> - <li><a href="<s:url action='ldap-input' namespace="/admin" />"> - <span class="fa fa-database"></span> Active Directory</a></li> - <li><a href="<s:url action='configuration-input' namespace="/admin" />"> - <span class="fa fa-cog"></span> Configuration</a></li> - <li><a href="<s:url action='import-input' namespace="/admin" />"> - <span class="fa fa-file-excel-o"></span> Import</a></li> - <li><a href="<s:url action='lock-input' namespace="/admin" />"> - <span class="fa fa-unlock-alt"></span> Verrouillages</a></li> - </s:if> - <li><a href="<s:url action='user-folder-input' namespace="/admin" />"> - <span class="fa fa-folder-open"></span> Dossiers utilisateur</a></li> - </ul> - </div> - </body> -</html> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/login-input.jsp b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/login-input.jsp deleted file mode 100644 index 3892375..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/login-input.jsp +++ /dev/null @@ -1,69 +0,0 @@ -<%-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --%> -<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> -<!DOCTYPE html> -<%@taglib uri="/struts-tags" prefix="s" %> -<html> - <head> - <title>Connexion</title> - </head> - <body> - - <div id="main-container" class="container"> - <h1 class="page-header">Connexion</h1> - - <s:form id="main_form" action="login" method="post" role="form" class="form-horizontal"> - - <s:actionerror/> - - <div class="form-group"> - <label for="loginField" class="col-sm-2 control-label">Identifiant :</label> - <div class="col-sm-10"> - <input type="text" name="login" class="form-control" id="loginField" placeholder="ex: dpt" required> - </div> - </div> - <div class="form-group"> - <label for="passwordField" class="col-sm-2 control-label">Mot de passe :</label> - <div class="col-sm-10"> - <input type="password" name="password" class="form-control" id="passwordField" placeholder="ex: password" required> - </div> - </div> - <!-- <div class="form-group"> - <div class="col-sm-offset-2 col-sm-10"> - <div class="checkbox"> - <label> - <input type="checkbox"> Remember me - </label> - </div> - </div> - </div> --> - <div class="form-group"> - <div class="col-sm-offset-2 col-sm-10"> - <button type="submit" class="btn btn-primary">Connexion</button> - </div> - </div> - </s:form> - </div> - </body> -</html> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators.xml b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators.xml deleted file mode 100644 index 4ffcdde..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators.xml +++ /dev/null @@ -1,34 +0,0 @@ -<!-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<decorators defaultdir="/WEB-INF/decorators"> - <excludes> - <pattern>/css/*</pattern> - <pattern>/js/*</pattern> - <pattern>*-json*</pattern> - </excludes> - - <decorator name="layout" page="layout.jsp"> - <pattern>/*</pattern> - </decorator> -</decorators> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp deleted file mode 100644 index 5cd2fc4..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp +++ /dev/null @@ -1,90 +0,0 @@ -<%-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --%> -<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> -<!DOCTYPE html> -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %> -<html> - <head> - <meta charset="utf-8"> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>FaxToMail : <decorator:title default="FaxToMail"/></title> - <link rel="stylesheet" type="text/css" href="<s:url value='/nuiton-js/faxtomail.css' />" /> - <script type="text/javascript" src="<s:url value='/nuiton-js/faxtomail.js' />"></script> - <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> - <!--[if lt IE 9]> - <script type="text/javascript" src="<s:url value='/nuiton-js/faxtomail-ie8.js' />"></script> - <![endif]--> - <decorator:head/> - </head> - - <body> - <div id="wrap-global"> - <div id="wrap-main" class="<decorator:getProperty property="page.wide-display"/>"> - <div id="faxtomail-body"> - - <!-- navbar --> - <header class="navbar navbar-inverse navbar-static-top" role="banner"> - <div class="container"> - <div class="navbar-header"> - <a href="<s:url value='/' />" class="navbar-brand">FaxToMail</a> - </div> - <s:if test="authenticated"> - <nav class="collapse navbar-collapse" role="navigation"> - <ul class="nav navbar-nav"> - - <s:if test="admin"> - <li><a href="<s:url action='ldap-input' namespace="/admin" />"> - <span class="fa fa-database"></span> Active Directory</a></li> - <li><a href="<s:url action='configuration-input' namespace="/admin" />"> - <span class="fa fa-cog"></span> Configuration</a></li> - <li><a href="<s:url action='import-input' namespace="/admin" />"> - <span class="fa fa-file-excel-o"></span> Import</a></li> - <li><a href="<s:url action='lock-input' namespace="/admin" />"> - <span class="fa fa-unlock-alt"></span> Verrouillages</a></li> - </s:if> - - <li><a href="<s:url action='user-folder-input' namespace="/admin" />"> - <span class="fa fa-folder-open"></span> Dossiers utilisateur</a></li> - </ul> - - <ul class="nav navbar-nav navbar-right"> - <li><a><span class="fa fa-user"></span> - <s:property value="authenticatedUser.firstName" /> <s:property value="authenticatedUser.lastName" /></a></li> - <li><a href="<s:url action='logout' namespace="/" />"> - <span class="fa fa-power-off"></span> Déconnexion</a></li> - </ul> - </nav> - </s:if> - </div> - </header> - - <decorator:body/> - </div> - </div> - </div> - </body> -</html> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/web.xml b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 235857e..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" - version="3.0"> - - <display-name>FaxToMail ${project.version}</display-name> - - <session-config> - <session-timeout>600</session-timeout> - </session-config> - - <filter> - <filter-name>struts-prepare</filter-name> - <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class> - </filter> - - <filter> - <filter-name>sitemesh</filter-name> - <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class> - </filter> - - <filter> - <filter-name>struts-execute</filter-name> - <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class> - </filter> - - <filter-mapping> - <filter-name>struts-prepare</filter-name> - <url-pattern>/*</url-pattern> - </filter-mapping> - - <filter-mapping> - <filter-name>sitemesh</filter-name> - <url-pattern>/*</url-pattern> - </filter-mapping> - - <filter-mapping> - <filter-name>struts-execute</filter-name> - <url-pattern>/*</url-pattern> - </filter-mapping> - - <listener> - <description>Init</description> - <listener-class>com.franciaflex.faxtomail.web.FaxToMailApplicationListener</listener-class> - </listener> - -</web-app> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml b/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml deleted file mode 100644 index 34470be..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml +++ /dev/null @@ -1,94 +0,0 @@ -<!-- - #%L - FaxToMail :: Web - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<groups xmlns="http://www.isdc.ro/wro"> - - <group name='webjar-select2' abstract="true"> - <css>classpath:META-INF/resources/webjars/select2/3.5.1/select2.css</css> - <js>classpath:META-INF/resources/webjars/select2/3.5.1/select2.js</js> - <js>classpath:META-INF/resources/webjars/select2/3.5.1/select2_locale_fr.js</js> - </group> - - <group name='webjar-angular-ui-sortable' abstract="true"> - <js>classpath:META-INF/resources/webjars/angular-ui-sortable/0.12.7/sortable.min.js</js> - </group> - - <group name='webjar-angular-ui-bootstrap' abstract="true"> - <group-ref>bootstrap</group-ref> - <group-ref>angular</group-ref> - <js>classpath:META-INF/resources/webjars/angular-ui-bootstrap/0.11.0/ui-bootstrap.js</js> - <js>classpath:META-INF/resources/webjars/angular-ui-bootstrap/0.11.0/ui-bootstrap-tpls.js</js> - </group> - - <group name='select2' abstract="true"> - <group-ref>webjar-select2</group-ref> - <js>/js/select2.js</js> - </group> - - <group name='select2sortable' abstract="true"> - <group-ref>webjar-select2</group-ref> - <js>/js/select2sortable.js</js> - </group> - - <group name='webjar-respond' abstract="true"> - <js>classpath:META-INF/resources/webjars/respond/1.4.2/src/respond.js</js> - </group> - - - - <group name='faxtomail'> - <group-ref>jquery</group-ref> - <group-ref>jquery-ui</group-ref> - <group-ref>bootstrap</group-ref> - <group-ref>angular</group-ref> - <group-ref>webjar-angular-ui-bootstrap</group-ref> - <group-ref>angular-ui-tree</group-ref> - <group-ref>font-awesome</group-ref> - <js>/js/faxtomail.js</js> - </group> - - <group name='faxtomail-ie8'> - <group-ref>html5shiv</group-ref> - <group-ref>webjar-respond</group-ref> - </group> - - <group name='faxtomail-configuration'> - <group-ref>select2</group-ref> - <group-ref>select2sortable</group-ref> - <group-ref>webjar-angular-ui-sortable</group-ref> - <group-ref>font-awesome</group-ref> - <js>/js/configuration.js</js> - <css>/css/faxtomail.css</css> - </group> - - <group name='faxtomail-user-folder'> - <group-ref>select2sortable</group-ref> - <group-ref>font-awesome</group-ref> - <js>/js/user-folder.js</js> - <css>/css/faxtomail.css</css> - </group> - - <group name='faxtomail-lock'> - <css>/css/faxtomail.css</css> - </group> -</groups> diff --git a/trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css b/trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css deleted file mode 100644 index 82de3de..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css +++ /dev/null @@ -1,94 +0,0 @@ -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -input.ng-dirty.ng-invalid { - background-color: #FA787E !important; -} - -.full-width { - width: 100%; -} - -.tab-content { - padding-bottom: 70px; -} - -.page-header { - margin-bottom: 25px; -} - -.emptyTable { - text-align: center; - font-style: italic; -} - -table tr.parentInfos td { - background-color: #F5F5F5; - font-style: italic; -} - -.angular-ui-tree-handle { - background: #f8faff; - border: 1px solid #dae2ea; - color: #7c9eb2; - padding: 10px 10px; - cursor:default; -} - -.select2-container { - width: 70%; -} - -.select2-offscreen { - position: fixed !important; -} -/* select 2 sortable */ -.select2-container-multi { - width: 100%; -} - -.angular-ui-tree-handle:hover { - color: #438eb9; - background: #f4f6f7; - border-color: #dce2e8; -} -.angular-ui-tree-handle.bg-success { - background-color: #dff0d8; -} -.angular-ui-tree-handle.bg-success:hover { - background-color: #dff0d8; -} - -.ui-sortable { - cursor:move; -} - -.form-group.required .control-label:after { - content:"*"; - color:red; -} - -/*.chosen-container { - width:100%; -}*/ diff --git a/trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js b/trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js deleted file mode 100644 index c3804b4..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js +++ /dev/null @@ -1,1330 +0,0 @@ -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -var ConfigurationModule = angular.module('ConfigurationModule', ['FaxToMail', 'ui.tree', 'ui.select2', 'ui.sortable', 'ui.select2.sortable']); - -/** - * Global configuration controller. - */ -ConfigurationModule.controller('ConfigurationController', ['$scope', 'ConfigurationData', - function($scope, ConfigurationData) { - //{Object} L'object configuration - $scope.configuration = ConfigurationData.configuration; - //{Map} les actions possibles pour les etats d'attentes - $scope.mailActions = ConfigurationData.mailActions; - //{Map} les champs obligatoires possibles - $scope.canBeRequiredMailFields = ConfigurationData.canBeRequiredMailFields; - //{Map} les champs possibles du tableau - $scope.tableMailFields = ConfigurationData.tableMailFields; - //{Array} les etats d'attentes disponibles - $scope.waitingStates = ConfigurationData.waitingStates; - //{Array} les gammes disponibles - $scope.ranges = ConfigurationData.ranges; - //{Array} les types de documents - $scope.demandTypes = ConfigurationData.demandTypes; - //{Array} mail folders - $scope.mailFolders = ConfigurationData.mailFolders; - // {Map} Mail folder usage - $scope.mailFoldersUsage = ConfigurationData.mailFoldersUsage; - //{Map<MailFolder id, Array<MailFolder>>} liste des dossier (a plat, par dossier racine) - $scope.flatMailFolders; - //{Array} Current mail filter list - $scope.mailFilters = ConfigurationData.mailFilters; - //{Map} Folder mail fiters - $scope.rootFolderMailFilters = {}; - //{Array} All application users - $scope.users = ConfigurationData.users; - // {Array} All application groups - $scope.groups = ConfigurationData.groups; - - // method privée recursive pour retourner l'ensemble des dossiers en les modifiant pour ajouter - // des metadata (full path from root, and root node instance) - var recursiveAddMailFolder = function(result, mailFolders, rootFolder, prefix, parent) { - var cumulativeCount = 0; - if (mailFolders) { - angular.forEach(mailFolders, function(mailFolder) { - - // warning modify input object :( - // use $ from this, even not recommended because angular exlude those fields when jsonify - mailFolder.$fullPath = prefix + "/" + mailFolder.name; - // ha la la, modify input object again :( - // use $ from this, even not recommended because angular exlude those fields when jsonify - mailFolder.$rootFolder = rootFolder; - // encore pour le parent - mailFolder.$parent = parent; - - var folderCount = 0; - if ($scope.mailFoldersUsage.hasOwnProperty(mailFolder.topiaId)) { - folderCount += $scope.mailFoldersUsage[mailFolder.topiaId]; - } - - if (mailFolder.archiveFolder) { - parent.hasArchiveFolder = true; - - } else { - result.push(mailFolder); - } - - folderCount += recursiveAddMailFolder(result, mailFolder.children, rootFolder, mailFolder.$fullPath, mailFolder); - - // et on modifie encore (tant qu'on a commencé !!!) - mailFolder.$cumulativeCount = folderCount; - cumulativeCount += folderCount; - }); - } - return cumulativeCount; - }; - - // update $scope.flatMailFolders when $scope.mailFolders changes - $scope._updateFlatMailFolders = function() { - console.log("Update flatMailFolders map"); - $scope.flatMailFolders = {}; - angular.forEach($scope.mailFolders, function(mailFolder) { - $scope.flatMailFolders[mailFolder.topiaId] = []; - var cumulativeCount = recursiveAddMailFolder($scope.flatMailFolders[mailFolder.topiaId], mailFolder.children, mailFolder, mailFolder.name, mailFolder); - mailFolder.$cumulativeCount = cumulativeCount; - mailFolder.$fullPath = mailFolder.name; - }); - }; - $scope._updateFlatMailFolders(); - - - // replace filter instance with mailFolder filter instance to use same objects (filled with fullPathInfo) - var _updateMetaFilter = function() { - angular.forEach($scope.mailFilters, function(filter) { - // root folder - angular.forEach($scope.mailFolders, function(mailFolder) { - if (!$scope.rootFolderMailFilters.hasOwnProperty(mailFolder.topiaId)) { - $scope.rootFolderMailFilters[mailFolder.topiaId] = []; - } - angular.forEach($scope.flatMailFolders[mailFolder.topiaId], function(subFolder) { - if (subFolder.topiaId == filter.mailFolder.topiaId) { - filter.mailFolder = subFolder; - - $scope.rootFolderMailFilters[subFolder.$rootFolder.topiaId].push(filter); - } - }); - }); - }); - }; - - $scope.updateMetaFilter = function(news, olds) { - console.log("Udpate MetaFilter"); - $scope.rootFolderMailFilters = {}; - _updateMetaFilter(); - }; - - // update when root folder collection changes (and for init) - $scope.$watchCollection("mailFolders", $scope.updateMetaFilter); - - // filtre qui supprime les items déjà present dans une collection donnée - $scope.filterByAlreadyInCollection = function(coll) { - return function(item) { - return coll && !coll.containsByTopiaId(item); - } - }; -}]); - -/** - * Misc tab controller. - */ -ConfigurationModule.controller('ConfigurationMiscController', ['$scope', '$window', 'ConfigurationData', - function($scope, $window, ConfigurationData) { - - // initialisation de la configuration - if (!$scope.configuration.invalidFormDisabledActions) { - $scope.configuration.invalidFormDisabledActions = []; - } - - // selection/deselection d'une action - $scope.changeInvalidAction = function(action) { - var index = $scope.configuration.invalidFormDisabledActions.indexOf(action); - if (index != -1) { - $scope.configuration.invalidFormDisabledActions.splice(index, 1); - } else { - $scope.configuration.invalidFormDisabledActions.push(action); - } - }; - - // Ajout d'une nouvelle ligne vide d'extension - $scope.addExtensionRow = function() { - if (!$scope.configuration.extensionCommands) { - $scope.configuration.extensionCommands = []; - } - var extensionName = $window.prompt("Nouvelle extension"); - - if (extensionName) { - extensionName = extensionName.toLowerCase(); - var extension = {extension : extensionName}; - - // check if already exists - if ($scope.configuration.extensionCommands.indexOfBy('extension', extension) != -1) { - $window.alert("Cette extension existe déjà !"); - } else { - $scope.configuration.extensionCommands.push(extension); - } - } - }; - - // suppression d'un ligne - $scope.deleteExtensionRow = function(index) { - if ($window.confirm("Êtes-vous sûr de vouloir supprimer cette extension ?")) { - $scope.configuration.extensionCommands.splice(index, 1); - } - }; -}]); - -/** - * Etat attente tab controller. - */ -ConfigurationModule.controller('ConfigurationWaitingStateController', ['$scope', '$window', 'ConfigurationData', - function($scope, $window, ConfigurationData) { - //{Map} Usage des états d'attente - $scope.waitingStatesUsage = ConfigurationData.waitingStatesUsage; - //{Object} etat d'attente selectionné - $scope.selectedWaitingState; - - // edition de l'etat d'attent cliqué - $scope.editWaitingState = function(waitingState) { - $scope.selectedWaitingState = waitingState; - - // initialize le tableau d'action si vide - if (!$scope.selectedWaitingState.invalidFormDisabledActions) { - $scope.selectedWaitingState.invalidFormDisabledActions = []; - } - if (!$scope.selectedWaitingState.validFormDisabledActions) { - $scope.selectedWaitingState.validFormDisabledActions = []; - } - }; - - // ajout d'un nouvel etat d'attente - $scope.newWaitingState = function() { - var label = $window.prompt("Nom du nouvel état d'attente ?"); - if (label) { - // auto select new etat - var newWaitingState = { - topiaId : "new_" + guid(), - label: label - }; - - // check if already exists - if ($scope.waitingStates.indexOfBy('label', newWaitingState) != -1) { - $window.alert("Cet état d'attente existe déjà !"); - } else { - $scope.waitingStates.push(newWaitingState); - - // auto select - $scope.editWaitingState(newWaitingState); - } - } - }; - - // suppression de cet etat d'attente dans les mail folder (sinon, ca fait - // un resauvegarde d'un etat d'attente supprimé et donc un bug) - var removeWaitingStateFromMailFolder = function(waitingState, mailFolders) { - if (mailFolders) { - angular.forEach(mailFolders, function(mailFolder) { - var index = mailFolder.waitingStates.indexOfByTopiaId(waitingState); - if (index != -1) { - console.log("Remove etat from " + mailFolder.name); - mailFolder.waitingStates.splice(index, 1); - } - removeWaitingStateFromMailFolder(waitingState, mailFolder.children); - }); - } - }; - - // suppression d'un etat d'attente non utilisé - $scope.deleteWaitingState = function(waitingState, index) { - if ($window.confirm("Êtes-vous sûr de vouloir supprimer cet état d'attente ?")) { - $scope.waitingStates.splice(index, 1); - - // suppression de cet etat d'attente dans les mail folder (sinon, ca fait - // un resauvegarde d'un etat d'attente supprimé et donc un bug) - removeWaitingStateFromMailFolder(waitingState, $scope.mailFolders); - } - }; - - // selection/deselection d'une action - $scope.changeWaitingStateValidAction = function(action) { - var index = $scope.selectedWaitingState.validFormDisabledActions.indexOf(action); - if (index != -1) { - $scope.selectedWaitingState.validFormDisabledActions.splice(index, 1); - } else { - $scope.selectedWaitingState.validFormDisabledActions.push(action); - } - }; - - // selection/deselection d'une action - $scope.changeWaitingStateInvalidAction = function(action) { - var index = $scope.selectedWaitingState.invalidFormDisabledActions.indexOf(action); - if (index != -1) { - $scope.selectedWaitingState.invalidFormDisabledActions.splice(index, 1); - } else { - $scope.selectedWaitingState.invalidFormDisabledActions.push(action); - } - }; -}]); - - -/** - * Demand type tab controller. - */ -ConfigurationModule.controller('ConfigurationDemandTypeController', ['$scope', '$window', 'ConfigurationData', - function($scope, $window, ConfigurationData) { - //{Object} demand type selectionné - $scope.selectedDemandType; - - // edition d'un type de demande - $scope.editDemandType = function(demandType) { - $scope.selectedDemandType = demandType; - - // initialize le tableau d'action si vide - if (!$scope.selectedDemandType.requiredFields) { - $scope.selectedDemandType.requiredFields = []; - } - }; - - // ajout d'un nouvel etat d'attente - $scope.newDemandType = function() { - var label = $window.prompt("Nom du nouveau type de document ?"); - if (label) { - // auto select new etat - var newDemandType = { - topiaId : "new_" + guid(), - label: label - }; - - // check if already exists - if ($scope.demandTypes.indexOfBy('label', newDemandType) != -1) { - $window.alert("Ce type de demande existe déjà !"); - } else { - $scope.demandTypes.push(newDemandType); - - // auto select - $scope.editDemandType(newDemandType); - } - } - }; - - // selection/deselection d'un champ - $scope.changeDemandTypeField = function(mailField) { - - var index = $scope.selectedDemandType.requiredFields.indexOf(mailField); - if (index != -1) { - $scope.selectedDemandType.requiredFields.splice(index, 1); - } else { - $scope.selectedDemandType.requiredFields.push(mailField); - } - }; -}]); - - -/** - * Mail folder tab controller. - */ -ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$window', '$http', 'ConfigurationData', - function($scope, $window, $http, ConfigurationData) { - // {Object} selected mail folder - $scope.selectedMailFolder; - // {String} add new customer responsible form value - $scope.newCustomerResponsible; - // {String} add new customer responsible form value - $scope.newReplyAddress; - // {String} add new domain form value - $scope.newReplyDomain; - // {Array} Colonnes selectionnées pour le dossier courant - $scope.folderTableColumns; - // {Array} Colonnes selectionnées pour les dossiers parents - $scope.parentFolderTableColumns; - // {Object} Global parent wide configuration and values - $scope.parentScopeValues; - - // creation d'un nouveau noeud racine - $scope.newRoot = function() { - var name = $window.prompt("Nom du nouveau dossier racine ?"); - if (name) { - var newRoot = { - topiaId: "new_" + guid(), - name: name, - children: [], - useCurrentLevelWaitingState: true, - useCurrentLevelTableColumns: true, - useCurrentLevelFaxDomain: true, - useCurrentLevelEdiFolder: true, - useCurrentLevelRejectResponseMessage: true, - useCurrentLevelRejectResponseMailAddress: true, - useCurrentLevelCompany: true, - archiveFolder: false - }; - - // check if already exists - if ($scope.mailFolders.indexOfBy('name', newRoot) != -1) { - $window.alert("Un noeud de même nom existe déjà à ce niveau !"); - } else { - // add node - $scope.mailFolders.push(newRoot); - // update flat map - $scope._updateFlatMailFolders(); - // edition automatique - $scope.editMailFolder(newRoot); - } - }; - }; - - // new sub folder - $scope.newSubFolder = function(scope) { - var nodeData = scope.$modelValue; - var name = $window.prompt("Nom du nouveau noeud ? "); - if (name) { - var newNode = { - topiaId: "new_" + guid(), - name: name, - children: [], - useCurrentLevelWaitingState: false, - useCurrentLevelTableColumns: false, - useCurrentLevelFaxDomain: false, - useCurrentLevelEdiFolder: false, - useCurrentLevelRejectResponseMessage: false, - useCurrentLevelRejectResponseMailAddress: false, - useCurrentLevelCompany: false, - archiveFolder: false - }; - - // check if already exists - if (nodeData.children.indexOfBy('name', newNode) != -1) { - $window.alert("Un noeud de même nom existe déjà à ce niveau !"); - } else { - // extend node (in faxtomail collapsed = extended) - scope.collapse(); - // append new node - nodeData.children.push(newNode); - // update flat map - $scope._updateFlatMailFolders(); - // edition automatique - $scope.editMailFolder(newNode); - } - } - }; - - // new sub folder - $scope.newArchiveSubFolder = function(scope) { - var nodeData = scope.$modelValue; - if (!nodeData.hasArchiveFolder) { - var name = "Archives du dossier " + nodeData.name; - if (name) { - var newNode = { - topiaId: "new_" + guid(), - name: name, - children: [], - useCurrentLevelWaitingState: false, - useCurrentLevelTableColumns: false, - useCurrentLevelFaxDomain: false, - useCurrentLevelEdiFolder: false, - useCurrentLevelRejectResponseMessage: false, - useCurrentLevelRejectResponseMailAddress: false, - useCurrentLevelCompany: false, - useCurrentLevelDemandType: false, - useCurrentLevelRange: false, - archiveFolder: true - }; - - // check if already exists - if (nodeData.children.indexOfBy('name', newNode) != -1) { - $window.alert("Un noeud de même nom existe déjà à ce niveau !"); - } else { - // extend node (in faxtomail collapsed = extended) - scope.collapse(); - // append new node - nodeData.hasArchiveFolder = true; - nodeData.children.push(newNode); - // update flat map - $scope._updateFlatMailFolders(); - // edition automatique - $scope.editMailFolder(newNode); - } - } - } - }; - - // suppression d'un dossier - $scope.deleteFolder = function(scope) { - if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce dossier ?")) { - - var nodeData = scope.$modelValue; - - // suppression des filtres utilisant ce dossier comme cible - var index = -1; - var current = 0; - angular.forEach($scope.mailFilters, function(filter) { - if (filter.mailFolder.topiaId == nodeData.topiaId) { - index = current; - } - current++; - }); - if (index != -1) { - $scope.mailFilters.splice(index, 1); - } - - // suppression de la zone d'edition (si necessaire) - if ($scope.selectedMailFolder == nodeData) { - delete $scope.selectedMailFolder; - } - - // remove current folder - if (nodeData.archiveFolder) { - nodeData.$parent.hasArchiveFolder = false; - } - scope.remove(scope); - // update filter meta map - $scope.updateMetaFilter(); - } - }; - - // edit mail folder - $scope.editMailFolder = function(mailFolder) { - $scope.selectedMailFolder = mailFolder; - - // edit undefined collections - if (!$scope.selectedMailFolder.customerResponsibles) { - $scope.selectedMailFolder.customerResponsibles = []; - } - if (!$scope.selectedMailFolder.replyAddresses) { - $scope.selectedMailFolder.replyAddresses = []; - } - if (!$scope.selectedMailFolder.replyDomains) { - $scope.selectedMailFolder.replyDomains = []; - } - if (!$scope.selectedMailFolder.folderTableColumns) { - $scope.selectedMailFolder.folderTableColumns = []; - } - if (!$scope.selectedMailFolder.waitingStates) { - $scope.selectedMailFolder.waitingStates = []; - } - if (!$scope.selectedMailFolder.demandTypes) { - $scope.selectedMailFolder.demandTypes = []; - } - if (!$scope.selectedMailFolder.ranges) { - $scope.selectedMailFolder.ranges = []; - } - if (!$scope.selectedMailFolder.readRightUsers) { - $scope.selectedMailFolder.readRightUsers = []; - } - if (!$scope.selectedMailFolder.writeRightUsers) { - $scope.selectedMailFolder.writeRightUsers = []; - } - if (!$scope.selectedMailFolder.moveRightUsers) { - $scope.selectedMailFolder.moveRightUsers = []; - } - if (!$scope.selectedMailFolder.readRightGroups) { - $scope.selectedMailFolder.readRightGroups = []; - } - if (!$scope.selectedMailFolder.writeRightGroups) { - $scope.selectedMailFolder.writeRightGroups = []; - } - if (!$scope.selectedMailFolder.moveRightGroups) { - $scope.selectedMailFolder.moveRightGroups = []; - } - - - // initialise la liste des colonnes pour le dossier courant - $scope.folderTableColumns = []; - angular.forEach($scope.selectedMailFolder.folderTableColumns, function(folderTableColumn) { - $scope.folderTableColumns.push({ - id: folderTableColumn, - label: $scope.tableMailFields[folderTableColumn] - }); - }); - - // right - $scope.selectedMailFolder.rightUsers = []; - $scope.selectedMailFolder.rightGroups = []; - angular.forEach($scope.selectedMailFolder.readRightUsers, function(user) { - if ($scope.selectedMailFolder.rightUsers.indexOfByTopiaId(user) == -1) { - $scope.selectedMailFolder.rightUsers.push(user); - } - }); - angular.forEach($scope.selectedMailFolder.writeRightUsers, function(user) { - if ($scope.selectedMailFolder.rightUsers.indexOfByTopiaId(user) == -1) { - $scope.selectedMailFolder.rightUsers.push(user); - } - }); - angular.forEach($scope.selectedMailFolder.moveRightUsers, function(user) { - if ($scope.selectedMailFolder.rightUsers.indexOfByTopiaId(user) == -1) { - $scope.selectedMailFolder.rightUsers.push(user); - } - }); - angular.forEach($scope.selectedMailFolder.readRightGroups, function(group) { - if ($scope.selectedMailFolder.rightGroups.indexOfByTopiaId(group) == -1) { - $scope.selectedMailFolder.rightGroups.push(group); - } - }); - angular.forEach($scope.selectedMailFolder.writeRightGroups, function(group) { - if ($scope.selectedMailFolder.rightGroups.indexOfByTopiaId(group) == -1) { - $scope.selectedMailFolder.rightGroups.push(group); - } - }); - angular.forEach($scope.selectedMailFolder.moveRightGroups, function(group) { - if ($scope.selectedMailFolder.rightGroups.indexOfByTopiaId(group) == -1) { - $scope.selectedMailFolder.rightGroups.push(group); - } - }); - }; - - // on doit faire ca par l'ordre des watch angular et ne pas l'appeler dans le edit - // sinon, les champs $ ne sont pas valués - $scope.$watch("selectedMailFolder", function(newValue, oldValue) { - if (newValue) { - // initialise default values pour le noeud racines - if (!$scope.selectedMailFolder.$parent) { - $scope.selectedMailFolder.allowCreateDemandIntoFolder = $scope.selectedMailFolder.allowCreateDemandIntoFolder || false; - $scope.selectedMailFolder.allowMoveDemandIntoFolder = $scope.selectedMailFolder.allowMoveDemandIntoFolder || false; - $scope.selectedMailFolder.openAttachmentReportNoTaken = $scope.selectedMailFolder.openAttachmentReportNoTaken || false; - $scope.selectedMailFolder.printActionEqualTakeAction = $scope.selectedMailFolder.printActionEqualTakeAction || false; - $scope.selectedMailFolder.rejectUnknownSender = $scope.selectedMailFolder.rejectUnknownSender || false; - $scope.selectedMailFolder.ediTransfer = $scope.selectedMailFolder.ediTransfer|| false; - } - - // initialisation des valeurs du parent - $scope.parentScopeValues = { - replyAddresses: [], - replyDomains: [], - folderTableColumns: [], - waitingStates: [], - demandTypes: [], - ranges: [], - //rigths - readRightUsers: [], - readRightGroups: [], - writeRightUsers: [], - writeRightGroups: [], - moveRightUsers: [], - moveRightGroups: [] - }; - updateParentScopeValues($scope.selectedMailFolder.$parent); - - // init select 2 data for parent - if ($scope.parentScopeValues.folderTableColumns) { - $scope.parentFolderTableColumns = []; - angular.forEach($scope.parentScopeValues.folderTableColumns, function(folderTableColumn) { - $scope.parentFolderTableColumns.push({ - id: folderTableColumn, - label: $scope.tableMailFields[folderTableColumn] - }); - }); - } - - // parent rigths - $scope.parentScopeValues.rightUsers = []; - $scope.parentScopeValues.rightGroups = []; - angular.forEach($scope.parentScopeValues.readRightUsers, function(user) { - if ($scope.parentScopeValues.rightUsers.indexOfByTopiaId(user) == -1) { - $scope.parentScopeValues.rightUsers.push(user); - } - }); - angular.forEach($scope.parentScopeValues.writeRightUsers, function(user) { - if ($scope.parentScopeValues.rightUsers.indexOfByTopiaId(user) == -1) { - $scope.parentScopeValues.rightUsers.push(user); - } - }); - angular.forEach($scope.parentScopeValues.moveRightUsers, function(user) { - if ($scope.parentScopeValues.rightUsers.indexOfByTopiaId(user) == -1) { - $scope.parentScopeValues.rightUsers.push(user); - } - }); - angular.forEach($scope.parentScopeValues.readRightGroups, function(group) { - if ($scope.parentScopeValues.rightGroups.indexOfByTopiaId(group) == -1) { - $scope.parentScopeValues.rightGroups.push(group); - } - }); - angular.forEach($scope.parentScopeValues.writeRightGroups, function(group) { - if ($scope.parentScopeValues.rightGroups.indexOfByTopiaId(group) == -1) { - $scope.parentScopeValues.rightGroups.push(group); - } - }); - angular.forEach($scope.parentScopeValues.moveRightGroups, function(group) { - if ($scope.parentScopeValues.rightGroups.indexOfByTopiaId(group) == -1) { - $scope.parentScopeValues.rightGroups.push(group); - } - }); - } - }); - - var updateParentScopeValues = function(folder) { - if (folder) { - // take current folder first before parent values (warn about 'undefined' and 'false') - if (angular.isUndefined($scope.parentScopeValues.allowCreateDemandIntoFolder)) { - $scope.parentScopeValues.allowCreateDemandIntoFolder = folder.allowCreateDemandIntoFolder; - } - if (angular.isUndefined($scope.parentScopeValues.allowMoveDemandIntoFolder)) { - $scope.parentScopeValues.allowMoveDemandIntoFolder = folder.allowMoveDemandIntoFolder; - } - if (angular.isUndefined($scope.parentScopeValues.openAttachmentReportNoTaken)) { - $scope.parentScopeValues.openAttachmentReportNoTaken = folder.openAttachmentReportNoTaken; - } - if (angular.isUndefined($scope.parentScopeValues.printActionEqualTakeAction)) { - $scope.parentScopeValues.printActionEqualTakeAction = folder.printActionEqualTakeAction; - } - if (angular.isUndefined($scope.parentScopeValues.rejectUnknownSender)) { - $scope.parentScopeValues.rejectUnknownSender = folder.rejectUnknownSender; - } - if (angular.isUndefined($scope.parentScopeValues.ediTransfer)) { - $scope.parentScopeValues.ediTransfer = folder.ediTransfer; - } - if (!$scope.parentScopeValues.faxDomain) { - $scope.parentScopeValues.faxDomain = folder.faxDomain; - } - if (!$scope.parentScopeValues.ediFolder) { - $scope.parentScopeValues.ediFolder = folder.ediFolder; - } - if (angular.isUndefined($scope.parentScopeValues.rejectResponseMailAddress)) { - $scope.parentScopeValues.rejectResponseMailAddress = folder.rejectResponseMailAddress; - } - if (angular.isUndefined($scope.parentScopeValues.rejectResponseMessage)) { - $scope.parentScopeValues.rejectResponseMessage= folder.rejectResponseMessage; - } - if (angular.isUndefined($scope.parentScopeValues.company)) { - $scope.parentScopeValues.company = folder.company; - } - if ((!$scope.parentScopeValues.folderTableColumns || $scope.parentScopeValues.folderTableColumns.length == 0) && folder.folderTableColumns) { - $scope.parentScopeValues.folderTableColumns = folder.folderTableColumns; - } - if ((!$scope.parentScopeValues.waitingStates || $scope.parentScopeValues.waitingStates.length == 0) && folder.waitingStates) { - $scope.parentScopeValues.waitingStates = folder.waitingStates; - } - if ((!$scope.parentScopeValues.demandTypes || $scope.parentScopeValues.demandTypes.length == 0) && folder.demandTypes) { - $scope.parentScopeValues.demandTypes = folder.demandTypes; - } - if ((!$scope.parentScopeValues.ranges || $scope.parentScopeValues.ranges.length == 0) && folder.ranges) { - $scope.parentScopeValues.ranges = folder.ranges; - } - - // move to parent first to keed parent order for collection - if (folder.$parent) { - updateParentScopeValues(folder.$parent); - }; - - // parents values - if (folder.replyAddresses) { - $scope.parentScopeValues.replyAddresses = $scope.parentScopeValues.replyAddresses.concat(folder.replyAddresses); - } - if (folder.replyDomains) { - $scope.parentScopeValues.replyDomains = $scope.parentScopeValues.replyDomains.concat(folder.replyDomains); - } - // manage rigths - if (folder.readRightUsers) { - $scope.parentScopeValues.readRightUsers = $scope.parentScopeValues.readRightUsers.concat(folder.readRightUsers); - } - if (folder.readRightGroups) { - $scope.parentScopeValues.readRightGroups = $scope.parentScopeValues.readRightGroups.concat(folder.readRightGroups); - } - if (folder.writeRightUsers) { - $scope.parentScopeValues.writeRightUsers = $scope.parentScopeValues.writeRightUsers.concat(folder.writeRightUsers); - } - if (folder.writeRightGroups) { - $scope.parentScopeValues.writeRightGroups = $scope.parentScopeValues.writeRightGroups.concat(folder.writeRightGroups); - } - if (folder.moveRightUsers) { - $scope.parentScopeValues.moveRightUsers = $scope.parentScopeValues.moveRightUsers.concat(folder.moveRightUsers); - } - if (folder.moveRightGroups) { - $scope.parentScopeValues.moveRightGroups = $scope.parentScopeValues.moveRightGroups.concat(folder.moveRightGroups); - } - } - }; - - // vérifie sur le serveur que le répertoire existe et a les droits d'écriture - $scope.checkRemotePath = function() { - $http.get(ConfigurationData.remoteCheckFolder + - "?path=" + encodeURIComponent($scope.selectedMailFolder.ediFolder), {cache:true}) - .success(function(data, status, headers, config) { - if (data.isDirectory) { - if (data.canWrite) { - $window.alert("Le dossier existe et dispose des droits d'écriture."); - } else { - $window.alert("Le dossier existe, mais ne dispose pas des droits d'écriture !"); - } - } else { - $window.alert("Le dossier n'existe pas !"); - } - }); - }; - - // utilisé pour mettre à jour $scope.selectedMailFolder.folderTableColumns si $scope.folderTableColumns change - $scope.$watch("folderTableColumns", function(newValue, oldValue) { - if (newValue != oldValue) { - $scope.selectedMailFolder.folderTableColumns = []; - angular.forEach(newValue, function(elem) { - $scope.selectedMailFolder.folderTableColumns.push(elem.id); - }); - } - }, true); - - // fonction retournant l'ensemble des options disponibles - $scope.getObjectsData = function(term, result) { - var resultArray = []; - angular.forEach($scope.tableMailFields, function(label, field) { - resultArray.push({ - id: field, - label: label - }); - }); - result(resultArray); - }; - - // recursive find folder where user is already responsible - var checkUserResponsible = function(folders, user) { - var result; - angular.forEach(folders, function(folder) { - if (folder.customerResponsibles) { - angular.forEach(folder.customerResponsibles, function(responsible) { - if (responsible.topiaId == user.topiaId) { - result = folder; - } - }); - } - if (!result && folder.children) { - result = checkUserResponsible(folder.children, user); - } - }); - return result; - }; - - // add customer responsible - $scope.addCustomerResponsible = function() { - - // check it user is already responsible of another folder - var otherFolder = checkUserResponsible($scope.mailFolders, $scope.newCustomerResponsible); - if (angular.isDefined(otherFolder)) { - if ($window.confirm("Cet utilisateur est déjà reponsable du dossier '" + otherFolder.$fullPath + - "'. Voulez-vous continuer et changer son dossier de responsabilité ?")) { - - // remove from previous - var index = otherFolder.customerResponsibles.indexOf($scope.newCustomerResponsible); - otherFolder.customerResponsibles.splice(index, 1); - - // add to current - $scope.selectedMailFolder.customerResponsibles.push($scope.newCustomerResponsible); - delete $scope.newCustomerResponsible; - } - } else { - $scope.selectedMailFolder.customerResponsibles.push($scope.newCustomerResponsible); - delete $scope.newCustomerResponsible; - } - }; - - // remove customer responsible - $scope.removeCustomerResponsible = function(index) { - if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce chargé de clientelle ?")) { - $scope.selectedMailFolder.customerResponsibles.splice(index, 1); - } - }; - - // add reply address - $scope.addReplyAddress = function() { - // check if already exists - if ($scope.selectedMailFolder.replyAddresses.indexOf($scope.newReplyAddress) != -1) { - $window.alert("Cette adresse existe déjà !"); - } else { - $scope.selectedMailFolder.replyAddresses.push($scope.newReplyAddress); - delete $scope.newReplyAddress; - $scope.addAddressForm.$setPristine(); - } - }; - - // remove customer responsible - $scope.removeReplyAddress = function(index) { - if ($window.confirm("Êtes-vous sûr de vouloir supprimer cette adresse ?")) { - $scope.selectedMailFolder.replyAddresses.splice(index, 1); - } - }; - - // add reply domain - $scope.addReplyDomain = function() { - // check if already exists - if ($scope.selectedMailFolder.replyDomains.indexOf($scope.newReplyDomain) != -1) { - $window.alert("Ce domaine existe déjà !"); - } else if ($scope.newReplyDomain.indexOf("@") != -1) { - $window.alert("Le nom de domaine ne doit pas contenir le symbole @ !"); - } else { - $scope.selectedMailFolder.replyDomains.push($scope.newReplyDomain); - delete $scope.newReplyDomain; - $scope.addDomainForm.$setPristine(); - } - }; - - // remove customer responsible - $scope.removeReplyDomain = function(index) { - if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce domaine ?")) { - $scope.selectedMailFolder.replyDomains.splice(index, 1); - } - }; - - // initialise la liste des etats d'attente avec celle des niveaux supérieurs - $scope.initFolderWaitingState = function() { - if ($scope.selectedMailFolder.useCurrentLevelWaitingState) { - if ($scope.parentScopeValues.waitingStates) { - $scope.selectedMailFolder.waitingStates = $scope.parentScopeValues.waitingStates.slice(); // soft copy - } - } else { - delete $scope.selectedMailFolder.waitingStates; - } - }; - - // selection/deselection d'un état d'attente possible pour ce dossier - $scope.changeFolderWaitingState = function(waitingState) { - var index = $scope.selectedMailFolder.waitingStates.indexOfByTopiaId(waitingState); - if (index != -1) { - $scope.selectedMailFolder.waitingStates.splice(index, 1); - } else { - $scope.selectedMailFolder.waitingStates.push(waitingState); - } - }; - - // initialise la liste des types de demandes avec celle des niveaux supérieurs - $scope.initFolderDemandTypes = function() { - if ($scope.selectedMailFolder.useCurrentLevelDemandType) { - if ($scope.parentScopeValues.demandTypes) { - $scope.selectedMailFolder.demandTypes = $scope.parentScopeValues.demandTypes.slice(); // soft copy - } - } else { - delete $scope.selectedMailFolder.demandTypes; - } - }; - - // selection/deselection d'un type de demande possible pour ce dossier - $scope.changeFolderDemandType = function(demandType) { - var index = $scope.selectedMailFolder.demandTypes.indexOfByTopiaId(demandType); - if (index != -1) { - $scope.selectedMailFolder.demandTypes.splice(index, 1); - } else { - $scope.selectedMailFolder.demandTypes.push(demandType); - } - }; - - // initialise la liste des gammes avec celle des niveaux supérieurs - $scope.initFolderRanges = function() { - if ($scope.selectedMailFolder.useCurrentLevelRange) { - if ($scope.parentScopeValues.ranges) { - $scope.selectedMailFolder.ranges = $scope.parentScopeValues.ranges.slice(); // soft copy - } - } else { - delete $scope.selectedMailFolder.ranges; - } - }; - - // selection/deselection d'une gamme possible pour ce dossier - $scope.changeFolderRange = function(range) { - var index = $scope.selectedMailFolder.ranges.indexOfByTopiaId(range); - if (index != -1) { - $scope.selectedMailFolder.ranges.splice(index, 1); - } else { - $scope.selectedMailFolder.ranges.push(range); - } - }; - - // initialise la liste des colonnes sélectionnées avec celle des niveaux supérieurs - $scope.initFolderColumns = function() { - if ($scope.selectedMailFolder.useCurrentLevelTableColumns) { - if ($scope.parentScopeValues.folderTableColumns) { - $scope.selectedMailFolder.folderTableColumns = $scope.parentScopeValues.folderTableColumns.slice(); // soft copy - - // init select2 data - $scope.folderTableColumns = []; - angular.forEach($scope.selectedMailFolder.folderTableColumns, function(folderTableColumn) { - $scope.folderTableColumns.push({ - id: folderTableColumn, - label: $scope.tableMailFields[folderTableColumn] - }); - }); - } - } else { - delete $scope.selectedMailFolder.folderTableColumns; - } - }; - - // add user write right - $scope.addRightUser = function() { - $scope.selectedMailFolder.rightUsers.push($scope.newRightUser); - delete $scope.newRightUser; - }; - - // remove user write right - $scope.removeRightUser = function(index, user) { - if ($window.confirm("Êtes-vous sur de vouloir supprimer les droits de cet utilisateur ?")) { - $scope.selectedMailFolder.rightUsers.splice(index, 1); - - // suppression des droits réels - var index = $scope.selectedMailFolder.readRightUsers.indexOfByTopiaId(user); - if (index != -1) { - $scope.selectedMailFolder.readRightUsers.splice(index, 1); - } - index = $scope.selectedMailFolder.writeRightUsers.indexOfByTopiaId(user); - if (index != -1) { - $scope.selectedMailFolder.writeRightUsers.splice(index, 1); - } - index = $scope.selectedMailFolder.moveRightUsers.indexOfByTopiaId(user); - if (index != -1) { - $scope.selectedMailFolder.moveRightUsers.splice(index, 1); - } - } - }; - - // add group write right - $scope.addRightGroup = function() { - $scope.selectedMailFolder.rightGroups.push($scope.newRightGroup); - delete $scope.newRightGroup; - }; - - // remove group write right - $scope.removeRightGroup = function(index, group) { - if ($window.confirm("Êtes-vous sur de vouloir supprimer les droits de ce groupe ?")) { - $scope.selectedMailFolder.rightGroups.splice(index, 1); - - // suppression des droits réels - var index = $scope.selectedMailFolder.readRightGroups.indexOfByTopiaId(group); - if (index != -1) { - $scope.selectedMailFolder.readRightGroups.splice(index, 1); - } - index = $scope.selectedMailFolder.writeRightGroups.indexOfByTopiaId(group); - if (index != -1) { - $scope.selectedMailFolder.writeRightGroups.splice(index, 1); - } - index = $scope.selectedMailFolder.moveRightGroups.indexOfByTopiaId(group); - if (index != -1) { - $scope.selectedMailFolder.moveRightGroups.splice(index, 1); - } - } - }; - - // change le droit de lecture du groupe - $scope.changeReadRightGroup = function(group) { - var index = $scope.selectedMailFolder.readRightGroups.indexOfByTopiaId(group); - if (index != -1) { - $scope.selectedMailFolder.readRightGroups.splice(index, 1); - } else { - $scope.selectedMailFolder.readRightGroups.push(group); - } - }; - // change le droit d'écriture du groupe - $scope.changeWriteRightGroup = function(group) { - var index = $scope.selectedMailFolder.writeRightGroups.indexOfByTopiaId(group); - if (index != -1) { - $scope.selectedMailFolder.writeRightGroups.splice(index, 1); - } else { - // ajout automatique du droit de lecture pour un droit d'ecriture - if ($scope.selectedMailFolder.readRightGroups.indexOfByTopiaId(group) == -1) { - $scope.selectedMailFolder.readRightGroups.push(group); - } - $scope.selectedMailFolder.writeRightGroups.push(group); - } - }; - // change le droit de déplacement du groupe - $scope.changeMoveRightGroup = function(group) { - var index = $scope.selectedMailFolder.moveRightGroups.indexOfByTopiaId(group); - if (index != -1) { - $scope.selectedMailFolder.moveRightGroups.splice(index, 1); - } else { - $scope.selectedMailFolder.moveRightGroups.push(group); - } - }; - // change le droit de lecture d'un utilisateur - $scope.changeReadRightUser = function(user) { - var index = $scope.selectedMailFolder.readRightUsers.indexOfByTopiaId(user); - if (index != -1) { - $scope.selectedMailFolder.readRightUsers.splice(index, 1); - } else { - $scope.selectedMailFolder.readRightUsers.push(user); - } - }; - // change le droit d'écriture d'un utilisateur - $scope.changeWriteRightUser = function(user) { - var index = $scope.selectedMailFolder.writeRightUsers.indexOfByTopiaId(user); - if (index != -1) { - $scope.selectedMailFolder.writeRightUsers.splice(index, 1); - } else { - // ajout automatique du droit de lecture pour un droit d'ecriture - if ($scope.selectedMailFolder.readRightUsers.indexOfByTopiaId(user) == -1) { - $scope.selectedMailFolder.readRightUsers.push(user); - } - $scope.selectedMailFolder.writeRightUsers.push(user); - } - }; - // change le droit de déplacement d'un utilisateur - $scope.changeMoveRightUser = function(user) { - var index = $scope.selectedMailFolder.moveRightUsers.indexOfByTopiaId(user); - if (index != -1) { - $scope.selectedMailFolder.moveRightUsers.splice(index, 1); - } else { - $scope.selectedMailFolder.moveRightUsers.push(user); - } - }; -}]); - - -/** - * Mail filter tab controller. - */ -ConfigurationModule.controller('ConfigurationFilterController', ['$scope', '$window', 'ConfigurationData', - function($scope, $window, ConfigurationData) { - //{Object} New accout empty filter - $scope.newFilter = { filterFolderPriority: false }; - - // option de la configuration 'sortable' - $scope.sortableOptions = { - stop: function(e, ui) { - $scope.mailFilters = []; - // update global $scope.mailFilters list - angular.forEach($scope.rootFolderMailFilters, function(folderFilters, rootFolderId) { - $scope.mailFilters = $scope.mailFilters.concat(folderFilters); - }); - } - }; - - // add new filter action - $scope.addNewFilter = function(rootMailFolder) { - // check if already exists - if ($scope.mailFilters.indexOfBy('expression', $scope.newFilter) != -1) { - $window.alert("Ce filtre existe déjà !"); - } else { - $scope.mailFilters.push($scope.newFilter); - if (!$scope.rootFolderMailFilters.hasOwnProperty(rootMailFolder.topiaId)) { - $scope.rootFolderMailFilters[rootMailFolder.topiaId] = []; - } - $scope.rootFolderMailFilters[rootMailFolder.topiaId].push($scope.newFilter); - // clear form - $scope.newFilter = { filterFolderPriority: false }; - } - }; - - // remove filter - $scope.removeFilter = function(rootMailFolder, filter) { - if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce filtre ?")) { - var index = $scope.mailFilters.indexOf(filter); - $scope.mailFilters.splice(index, 1); - var index2 = $scope.rootFolderMailFilters[rootMailFolder.topiaId].indexOf(filter); - $scope.rootFolderMailFilters[rootMailFolder.topiaId].splice(index2, 1); - } - }; -}]); - - -/** - * Search tab controller. - */ -ConfigurationModule.controller('ConfigurationSearchController', ['$scope', 'ConfigurationData', - function($scope, ConfigurationData) { - //{Array} Options actuelle - $scope.searchDisplayColumns = []; - if ($scope.configuration.searchDisplayColumns) { - angular.forEach($scope.configuration.searchDisplayColumns, function(searchDisplayColumn) { - $scope.searchDisplayColumns.push({ - id: searchDisplayColumn, - label: $scope.tableMailFields[searchDisplayColumn] - }); - }); - } - - $scope.$watch("searchDisplayColumns", function(newValue, oldValue) { - if (newValue) { - $scope.configuration.searchDisplayColumns = []; - angular.forEach(newValue, function(elem) { - $scope.configuration.searchDisplayColumns.push(elem.id); - }); - } - }); - - // fonction retournant l'ensemble des options disponibles - $scope.getObjectsData = function(term, result) { - var resultArray = []; - angular.forEach($scope.tableMailFields, function(label, mailField) { - resultArray.push({ - id: mailField, - label: label - }); - }); - result(resultArray); - }; -}]); - - -/** - * Email accounts controller. - */ -ConfigurationModule.controller('ConfigurationEmailAccountsController', ['$scope', '$window', '$http', 'ConfigurationData', - function($scope, $window, $http, ConfigurationData) { - //{Array} Email accounts - $scope.emailAccounts = ConfigurationData.emailAccounts; - //{Array} Port par défaut des protocols - $scope.emailProtocolPorts = ConfigurationData.emailProtocolPorts; - //{Object} New accout empty object - $scope.newAccount = {}; - - // ajout d'un nouveau compte - $scope.addEmailAccount = function() { - $scope.emailAccounts.push($scope.newAccount); - $scope.newAccount = {}; - $scope.addEmailAccountForm.$setPristine(); - }; - - // suppression d'un compte - $scope.removeEmailAccount = function(index) { - if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce compte email ?")) { - $scope.emailAccounts.splice(index, 1); - } - }; - - // test de connexion au serveur de mail - $scope.checkEmailAccount = function() { - $http.post(ConfigurationData.remoteCheckEmailAccount, "emailAccount=" + angular.toJson($scope.newAccount), - {headers: {'Content-Type': 'application/x-www-form-urlencoded'}}) - .success(function(data, status, headers, config) { - console.log(data, status, headers, config); - if (data.ok) { - $window.alert("Le test de connexion est passé avec succès."); - } else { - $window.alert("Impossible de se connecter au serveur : " + data.error); - } - }); - }; - - // selection d'un protocol - $scope.$watch("newAccount.protocol", function(newValue, oldValue) { - // auto remplissage du port par defaut - if (newValue && ((oldValue && $scope.newAccount.port == $scope.emailProtocolPorts[oldValue]) || !$scope.newAccount.port)) { - $scope.newAccount.port = $scope.emailProtocolPorts[newValue]; - } - }); -}]); - - -/** - * Chef de groupe controller. - */ -ConfigurationModule.controller('ConfigurationChefGroupController', ['$scope', '$window', 'ConfigurationData', - function($scope, $window, ConfigurationData) { - //{Object} Chef de group en cours d'edition - $scope.selectedGroupChef; - //{Object} Nouveau group selectionné - $scope.newManagedGroup; - - // change instances - if (!$scope.configuration.chefs) { - $scope.configuration.chefs = []; - } - angular.forEach($scope.groups, function(group) { - angular.forEach($scope.configuration.chefs, function(chef) { - if (chef.userGroup.topiaId == group.topiaId) { - chef.userGroup = group; - } - // managedGroups is not necessary to change here - }); - }); - - // filtre pour retourner seulement les groupes pouvant être chef (pas déjà utilisé) - $scope.availableNewGroupChef = function(item) { - // si c'est le groupe sélectionné, on l'autorise - var result = - $scope.selectedGroupChef && $scope.selectedGroupChef.userGroup && - $scope.selectedGroupChef.userGroup.topiaId == item.topiaId; - // sinon on refuse les groupes utilisé par d'autre chef - if (!result) { - result = true; - angular.forEach($scope.configuration.chefs, function(group) { - if (group.userGroup && group.userGroup.topiaId == item.topiaId) { - result = false; - } - }); - } - return result; - }; - - // ajout d'un nouveau chef de groupe - $scope.newGroupChef = function() { - var groupChef = { - managedGroups : [] - }; - $scope.configuration.chefs.push(groupChef); - $scope.editGroupChef(groupChef); - }; - - // edition d'un chef de groupe - $scope.editGroupChef = function(groupChef) { - $scope.selectedGroupChef = groupChef; - }; - - // suppression d'un chef de groupe - $scope.removeGroupChef = function(groupChef, index) { - if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce chef de groupe ?")) { - $scope.configuration.chefs.splice(index, 1); - if (groupChef == $scope.selectedGroupChef) { - delete $scope.selectedGroupChef; - } - } - }; - - // Ajout d'un nouveau group géré - $scope.addManagedGroup = function() { - $scope.selectedGroupChef.managedGroups.push($scope.newManagedGroup); - delete $scope.newManagedGroup; - }; - - // Suppression d'un group gérés - $scope.removeManagedGroup = function(index) { - if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce groupe gérés ?")) { - $scope.selectedGroupChef.managedGroups.splice(index, 1); - } - }; -}]); - - - - -function isLocalStorageAvailable() { - var result; - try { - result = 'localStorage' in window && window['localStorage'] !== null; - } catch (e) { - // can happen with IE 11 in desktop mode - result = false; - } - return result; -} - -$(function() { - if (isLocalStorageAvailable()) { - - // save tab hash in local storage - $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { - var hash = e.target.hash; - localStorage.setItem("configuration-tab", hash); - }); - - // restore tab if present - var current = localStorage.getItem("configuration-tab"); - if (current) { - $('#tabs a[href="' + current + '"]').tab('show'); - } - } -}); diff --git a/trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js b/trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js deleted file mode 100644 index 0a4616e..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js +++ /dev/null @@ -1,94 +0,0 @@ -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -/** - * Generates a GUID string, according to RFC4122 standards. - * @returns {String} The generated GUID. - * @example af8a8416-6e18-a307-bd9c-f2c947bbb3aa - * @author Slavik Meltser (slavik@meltser.info). - * @link http://slavik.meltser.info/?p=142 - */ -function guid() { - function _p8(s) { - var p = (Math.random().toString(16)+"000000000").substr(2,8); - return s ? "-" + p.substr(0,4) + "-" + p.substr(4,4) : p ; - } - return _p8() + _p8(true) + _p8(true) + _p8(); -} - -/** - * Cherche un element par egalité de champ sur le champ spécifié. - */ -Array.prototype.indexOfBy = function(field, obj) { - var i = this.length; - while (i--) { - if (this[i][field] == obj[field]) { - return i; - } - } - return -1; -}; - -/** - * Même fonction que indexOf mais qui compare par topiaId au lieu des références. - */ -Array.prototype.indexOfByTopiaId = function(obj) { - return this.indexOfBy('topiaId', obj); -}; - -/** - * Method contains par topiaId. - */ -Array.prototype.containsByTopiaId = function(obj) { - return this.indexOfByTopiaId(obj) != -1; -}; - - -/** Mail faxtomail application module. */ -var FaxToMailModule = angular.module('FaxToMail', ['ui.bootstrap']); - -/** - * Directive de validation d'un champ en entier. - */ -FaxToMailModule.directive('fmInteger', function() { - return { - require: 'ngModel', - link: function(scope, elm, attrs, ctrl) { - ctrl.$parsers.unshift(function(viewValue) { - if (/^\d+$/.test(viewValue)) { - // it is valid - ctrl.$setValidity('integer', true); - return viewValue; - } else if (viewValue.length == 0) { - ctrl.$setValidity('integer', true); - return undefined; - } else { - // it is invalid, return undefined (no model update) - ctrl.$setValidity('integer', false); - return undefined; - } - }); - } - }; -}); diff --git a/trunk/faxtomail-ui-web/src/main/webapp/js/select2.js b/trunk/faxtomail-ui-web/src/main/webapp/js/select2.js deleted file mode 100644 index f19fe31..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/js/select2.js +++ /dev/null @@ -1,193 +0,0 @@ -/** %%Ignore-License - * - * C'est une version patché de ui.select2 pour supporter le ng-options. - * En attendant https://github.com/angular-ui/ui-select2/issues/46 - */ -(function () { - "use strict"; - var module = angular.module('ui.select2', []); - - module.value('uiSelect2Config', {}) - - module.directive('uiSelect2', ['uiSelect2Config', '$timeout', '$compile', '$parse', '$q', '$rootScope', - function (uiSelect2Config, $timeout, $compile, $parse, $q, $rootScope) { - var options = {}; - if (uiSelect2Config) { - angular.extend(options, uiSelect2Config); - } - return { - require: '?ngModel', - link: function(scope, element, attrs, ngModel) { - - // instance-specific options - var opts = setupOptions(); - setupAttributeAndClassSynchronization(); - setupCleanupOnDestroy(); - - if (attrs.isOpen) { - setupIsOpenBinding(); - } - - if (attrs.query) { - setupQueryHandler(); - } else { - scheduleResyncAfterEveryDigest(); - } - - element.select2(opts); - return; - - - //Privates - function setupOptions() { - return angular.extend({}, options, scope.$eval(attrs.uiSelect2)); - } - - function scheduleResyncAfterEveryDigest() { - //After every digest make sure that select2's value is in sync - var scheduledValue = false; - scope.$watch(function() { - //Only schedule once per digest cycle regardles of times watch is called; - if (!scheduledValue) { - scheduledValue = true; - $timeout(function() { - element.select2('val', element.val()); - scheduledValue = false; - }, 0, false); - } - }); - } - - - function setupIsOpenBinding() { - var isOpen = false; - var isOpenExpression = $parse(attrs.isOpen); - scope.$watch(isOpenExpression, function(value) { - if (value && !isOpen) { - $timeout(function() { - isOpen = true; - element.select2('open'); - }, 0, false); - - } - if (!value && isOpen) { - $timeout(function() { - element.select2('close'); - isOpen = false; - element.select2('close'); - }, 0, false); - } - }); - - element.on('select2-open.select2', function() { - scope.$apply(function() { - isOpen = true; - isOpenExpression.assign(scope, true); - }); - }); - - element.on('select2-close.select2', function() { - scope.$apply(function() { - isOpen = false; - isOpenExpression.assign(scope, false); - }); - }); - } - - - function setupCleanupOnDestroy() { - element.on("$destroy", function() { - element.select2("destroy"); - element.off('.select2'); - }); - } - - - function setupAttributeAndClassSynchronization() { - attrs.$observe('disabled', function(value) { - element.select2('enable', !value); - }); - - attrs.$observe('readonly', function(value) { - element.select2('readonly', !!value); - }); - - // Update valid and dirty statuses - if (ngModel) { - ngModel.$parsers.push(function(value) { - var div = element.select2("container"); - div - .toggleClass('ng-invalid', !ngModel.$valid) - .toggleClass('ng-valid', ngModel.$valid) - .toggleClass('ng-invalid-required', !ngModel.$valid) - .toggleClass('ng-valid-required', ngModel.$valid) - .toggleClass('ng-dirty', ngModel.$dirty) - .toggleClass('ng-pristine', ngModel.$pristine); - return value; - }); - } - } - - - function setupQueryHandler() { - var queryResults = []; - ngModel.$parsers.unshift(function(value) { - var result = queryResults[value]; - return result; - }); - - ngModel.$formatters.push(function(value) { - if (value) { - var label = scope.$eval(attrs.queryLabel, { - option: value - }); - element.select2('data', { - text: label - }); - } - }); - - opts.query = function(query) { - if (query.page === 1) { - queryResults = []; - } - - var queryOptions = { - term: query.term, - page: query.page, - context: query.context - }; - var resultPromiseOrObject = scope.$eval(attrs.query, { - query: queryOptions - }); - - $q.when(resultPromiseOrObject).then(function(result) { - var select2Results = []; - var i = queryResults.length; - - angular.forEach(result.results, function(option) { - var context = { - option: option - }; - var label = scope.$eval(attrs.queryLabel, context); - select2Results.push({ - id: i, - text: label - }); - i++; - }); - - queryResults = queryResults.concat(result.results); - query.callback({ - results: select2Results, - more: result.more - }); - }); - }; - } - - } - }; - } - ]); -})(); diff --git a/trunk/faxtomail-ui-web/src/main/webapp/js/select2sortable.js b/trunk/faxtomail-ui-web/src/main/webapp/js/select2sortable.js deleted file mode 100644 index e7189a3..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/js/select2sortable.js +++ /dev/null @@ -1,254 +0,0 @@ -/** %%Ignore-License - * Enhanced Select2 Dropmenus - * - * @AJAX Mode - When in this mode, your value will be an object (or array of objects) of the data used by Select2 - * This change is so that you do not have to do an additional query yourself on top of Select2's own query - * @params [options] {object} The configuration options passed to $.fn.select2(). Refer to the documentation - */ -angular.module('ui.select2.sortable', []).directive('uiSelect2Sortable', ['$timeout', '$filter', function ($timeout, $filter) { - return { - require: 'ngModel', - restrict: 'A', - transclude: true, - scope: { - ngModel: '=', - allowClear: '=?', - simpleQuery: '=?', - simpleData: '=?', - query: '=?', - toId: '=?', - toText: '=?', - sortResults: '=?', - minimumInputLength: '=?', - onSelect: '=?' - }, - link: function (scope, element, attrs, ngModel) { - //create a function to find an id into object - if (!scope.toId) { - scope.toId = function (item) { - if (item._id) { - return item._id; - } - if (item.id) { - return item.id; - } - if (item.uri) { - return item.uri; - } - if (item.href) { - return item.href; - } - if (item.resource) { - return item.resource; - } - return item; - }; - } - - //create a function to find display value into object - if (!scope.toText) { - scope.toText = function (item) { - if (item.text) { - return item.text; - } - if (item.name) { - return item.name; - } - if (item.label) { - return item.label; - } - return item; - }; - } - - //create a function to find display value into object - //this js function is slower than the underscoreJS function below. - //I recommand you to override this function by the underscoreJS one - -// $scope.sortResults = function (results, container, query) { -// return _.sortBy(results, function(item) { -// return item.text; -// }); -// }; - - if (!scope.sortResults) { - scope.sortResults = function (results, container, query) { - // use the built in javascript sort function - return results.sort(function (a, b) { - if (a.text > b.text) { - return 1; - } else if (a.text < b.text) { - return -1; - } else { - return 0; - } - }); - }; - } - - //prepare options for the select2 element - scope.opts = { - multiple: angular.isDefined(attrs.multiple) || false, - sortable: angular.isDefined(attrs.sortable) || false, - minimumInputLength: scope.minimumInputLength || 0, - query: scope.query, - sortResults: scope.sortResults, - allowClear: scope.allowClear || false - }; - - // Convert from Select2 view-model to Angular view-model. - scope.convertToAngularModel = function (select2_data) { - var model; - if (angular.isArray(select2_data)) { - model = []; - angular.forEach(select2_data, function (value) { - model.push(value._data); - }); - } else { - if (select2_data && select2_data._data) { - model = select2_data._data; - } else { - model = select2_data; - } - } - return model; - }; - - // Convert from Angular view-model to Select2 view-model. - scope.convertToSelect2Model = function (angular_data) { - if (angular.isArray(angular_data)) { - var model = []; - angular.forEach( - angular_data, - function (value) { - model.push({ - id: scope.toId(value), - text: scope.toText(value), - _data: value - }); - }); - return model; - } else if (angular.isObject(angular_data)) { - return { - id: scope.toId(angular_data), - text: scope.toText(angular_data), - _data: angular_data - }; - } else if (angular.isString(angular_data)) { - return { - id: angular_data, - text: angular_data, - _data: angular_data - }; - } - - return angular_data; - }; - - //allow user to create a simple query - //just use simpleQuery : function(term, callback) { callback(array_of_dummy_objects; } - if (scope.simpleQuery) { - scope.opts.query = function (query) { - scope.simpleQuery(query.term, function (values) { - query.callback({ results: scope.convertToSelect2Model(values) }); - }); - }; - } else if (scope.simpleData) { - //Use this if you want to filter on the text field without ajax query - //Just use data : [Object object] and the toText function - scope.opts.query = function (query) { - query.callback({ - results: $filter('filter')(scope.convertToSelect2Model(scope.simpleData), {text: query.term}, 'text') - }); - }; - } - - // call select2 function to set data and all properties - scope.render = function () { - if (scope.opts.multiple) { - element.select2('data', scope.convertToSelect2Model(ngModel.$viewValue)); - } else { - if (angular.isObject(ngModel.$viewValue)) { - element.select2('data', scope.convertToSelect2Model(ngModel.$viewValue)); - } else if (!ngModel.$viewValue) { - element.select2('data', null); - } else { - element.select2('data', scope.convertToSelect2Model(ngModel.$viewValue)); - } - } - if (scope.opts.sortable) { - element.select2("container").find("ul.select2-choices").sortable({ - containment: 'parent', - start: function () { - element.select2("onSortStart"); - }, - update: function () { - element.select2("onSortEnd"); - element.trigger('change'); - } - }); - } - }; - - // Set the view and model value and update the angular template manually for the ajax/multiple select2. - element.bind("change", function (event) { - if (scope.$$phase) { - return; - } - var e = event; - scope.$apply(function () { - var values = element.select2('data'); - if (e && e.removed && values) { - for (var i = 0; i < values.length; i++) { - if (values[i] === e.removed) { - values.splice(i, 1); - } - } - } - if (values && (angular.isArray(values) || values._data)) { - values = scope.convertToAngularModel(values); - } - ngModel.$setViewValue(values); - }); - }); - - // Watch the model for programmatic changes - scope.$watch(function () { - return ngModel.$viewValue; - }, function (current, old) { - if (current === old) { - return; - } - scope.render(); - }, true); - - element.bind("$destroy", function () { - element.select2("destroy"); - }); - - //watch disabled attrs to send event to select2 - attrs.$observe('disabled', function (value) { - element.select2('enable', !value); - }); - - // add an onSelect element which retreive model object into e.added or e.removed - if (scope.onSelect) { - element.on("change", function (e) { - if (e.added) { - e.added = scope.convertToAngularModel(e.added); - } - if (e.removed) { - e.removed = scope.convertToAngularModel(e.removed); - } - scope.onSelect(e); - }); - } - - // Initialize the plugin late so that the injected DOM does not disrupt the template compiler - $timeout(function () { - element.select2(scope.opts); - scope.render(); - }); - } - }; -}]); \ No newline at end of file diff --git a/trunk/faxtomail-ui-web/src/main/webapp/js/user-folder.js b/trunk/faxtomail-ui-web/src/main/webapp/js/user-folder.js deleted file mode 100644 index ea7cb37..0000000 --- a/trunk/faxtomail-ui-web/src/main/webapp/js/user-folder.js +++ /dev/null @@ -1,116 +0,0 @@ -/* - * #%L - * FaxToMail :: Web - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2014 Mac-Groupe, Code Lutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -var UserFolderModule = angular.module('UserFolderModule', ['FaxToMail', 'ui.select2.sortable']); - -/** - * Global configuration controller. - */ -UserFolderModule.controller('UserFolderController', ['$scope', '$http', 'UserFolderData', - function($scope, $http, UserFolderData) { - // {Array} mail folders - $scope.mailFolders = UserFolderData.mailFolders; - // {Array} Liste des utilisateurs ldap - $scope.users = UserFolderData.users; - // {Array} Group list - $scope.groups = UserFolderData.groups; - // {Map<MailFolder id, Array<MailFolder>>} liste des dossiers classé par topia Id du noeud racine - $scope.flatMailFolders; - // {Map<MailFolder id, MailFolder>} dossier accessible par topia id - $scope.flatMailFolders2; - // {Map} user id : mailFolders - $scope.userFolders = UserFolderData.userFolders; - - - // method privée recursive pour retourner l'ensemble des dossiers en les modifiant pour ajouter - // des metadata (full path from root, and root node instance) - var recursiveAddMailFolder = function(result, mailFolders, rootFolder, prefix, parent) { - if (mailFolders) { - angular.forEach(mailFolders, function(mailFolder) { - - // warning modify input object :( - // use $ from this, even not recommended because angular exclude those fields when jsonify - mailFolder.$fullPath = prefix + "/" + mailFolder.name; - // ha la la, modify input object again :( - // use $ from this, even not recommended because angular exclude those fields when jsonify - mailFolder.$rootFolder = rootFolder; - // encore pour le parent - mailFolder.$parent = parent; - - result.push(mailFolder); - $scope.flatMailFolders2[mailFolder.topiaId] = mailFolder; - recursiveAddMailFolder(result, mailFolder.children, rootFolder, mailFolder.$fullPath, mailFolder); - }); - } - }; - - // update $scope.flatMailFolders when $scope.mailFolders changes - $scope._updateFlatMailFolders = function() { - console.log("Update flatMailFolders map"); - $scope.flatMailFolders = {}; - $scope.flatMailFolders2 = {}; - angular.forEach($scope.mailFolders, function(mailFolder) { - $scope.flatMailFolders[mailFolder.topiaId] = []; - recursiveAddMailFolder($scope.flatMailFolders[mailFolder.topiaId], mailFolder.children, mailFolder, mailFolder.name, mailFolder); - }); - }; - $scope._updateFlatMailFolders(); - - // mise à jour des configurations actuelle des dossiers pour inclure les metas info des dossiers - $scope._updateUserFolders = function() { - angular.forEach($scope.userFolders, function(value, key) { - angular.forEach(value, function(folder) { - var realFolder = $scope.flatMailFolders2[folder.topiaId]; - // update text with full path - folder.text = realFolder.$fullPath; - }); - }); - }; - $scope._updateUserFolders(); - - // fonction retournant l'ensemble des options disponibles - $scope.getObjectsData = function(term, result) { - var resultArray = []; - angular.forEach($scope.mailFolders, function(mailFolder) { - // select 2 require an id field - mailFolder.id = mailFolder.topiaId; - // select 2 can use 'name' for display, so it's ok - - // push root - resultArray.push(mailFolder); - - // build children map - if ($scope.flatMailFolders.hasOwnProperty(mailFolder.topiaId)) { - angular.forEach($scope.flatMailFolders[mailFolder.topiaId], function(childFolder) { - childFolder.id = childFolder.topiaId; - // defined text for display - childFolder.text = childFolder.$fullPath; - resultArray.push(childFolder); - }); - } - - }); - result(resultArray); - }; -}]); diff --git a/trunk/pom.xml b/trunk/pom.xml deleted file mode 100644 index 9adbc2d..0000000 --- a/trunk/pom.xml +++ /dev/null @@ -1,875 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.nuiton</groupId> - <artifactId>mavenpom4redmine</artifactId> - <version>5.1</version> - </parent> - - <groupId>com.franciaflex</groupId> - <artifactId>faxtomail</artifactId> - <version>1.0</version> - <packaging>pom</packaging> - - <name>FaxToMail</name> - <description> - Système de traîtement des fax et emails entrants - </description> - <url>http://forge.codelutin.com/projects/faxtomail</url> - <inceptionYear>2014</inceptionYear> - <licenses> - <license> - <name>General Public License (GPL)</name> - <url>http://www.gnu.org/licenses/gpl.txt</url> - <distribution>repo</distribution> - </license> - </licenses> - - <developers> - <developer> - <id>morin</id> - <name>Kevin Morin</name> - <email>morin at codelutin dot com</email> - <organization>CodeLutin</organization> - <organizationUrl>http://www.codelutin.com</organizationUrl> - <roles> - <role>developer</role> - </roles> - <timezone>Europe/Paris</timezone> - </developer> - </developers> - - <modules> - <module>faxtomail-persistence</module> - <module>faxtomail-service</module> - <module>faxtomail-ui-web</module> - <module>faxtomail-ui-swing</module> - </modules> - - <scm> - <url>https://svn.codelutin.com/faxtomail/tags/faxtomail-1.0</url> - <connection>scm:svn:https://svn.codelutin.com/faxtomail/tags/faxtomail-1.0</connection> - <developerConnection>scm:svn:http://svn.codelutin.com/faxtomail/tags/faxtomail-1.0</developerConnection> - </scm> - <distributionManagement> - <site> - <id>${siteDeployId}</id> - <url>${siteDeployUrl}</url> - </site> - <snapshotRepository> - <id>nuiton-nexus-deploy</id> - <url> - http://nexus.nuiton.org/nexus/content/repositories/faxtomail-snapshot - </url> - </snapshotRepository> - </distributionManagement> - - <properties> - - <platform>codelutin.com</platform> - <projectId>faxtomail</projectId> - <siteDeployClassifier /> - <sitePluginVersion>3.3</sitePluginVersion> - - <!-- libraries version --> - <nuitonI18nVersion>3.3</nuitonI18nVersion> - <nuitonConfigVersion>3.0-rc-2</nuitonConfigVersion> - <nuitonCsvVersion>3.0-rc-4</nuitonCsvVersion> - <nuitonDecoratorVersion>3.0-alpha-3</nuitonDecoratorVersion> - <nuitonUpdaterVersion>3.0-rc-1</nuitonUpdaterVersion> - <nuitonUtilsVersion>3.0-rc-8</nuitonUtilsVersion> - <nuitonValidatorVersion>3.0-rc-2</nuitonValidatorVersion> - <nuitonWebVersion>1.17</nuitonWebVersion> - - <eugeneVersion>2.13</eugeneVersion> - <topiaVersion>3.0-beta-13</topiaVersion> - <hibernateVersion>4.3.6.Final</hibernateVersion> - <h2Version>1.3.176</h2Version> - <guavaVersion>18.0</guavaVersion> - - <jaxxVersion>2.14</jaxxVersion> - <!-- do not upgrade to 1.6.5-1 --> - <swingXVersion>1.6.4</swingXVersion> - <xworkVersion>2.3.16.3</xworkVersion> - <struts2Version>2.3.16.3</struts2Version> - <jqueryPluginVersion>3.7.1</jqueryPluginVersion> - <bootstrapPluginVersion>2.0.0</bootstrapPluginVersion> - <slf4jVersion>1.7.7</slf4jVersion> - <log4jVersion>2.0.2</log4jVersion> - <postgresqlDriverVersion>9.3-1102-jdbc41</postgresqlDriverVersion> - <commonsEmailVersion>1.3.3</commonsEmailVersion> - - <i18n.bundles>fr_FR,en_GB</i18n.bundles> - <i18n.silent>true</i18n.silent> - - <!-- license header configuration --> - <license.organizationName>Mac-Groupe, Code Lutin</license.organizationName> - <license.licenseName>gpl_v3</license.licenseName> - - <!-- Java version --> - <maven.compiler.source>1.7</maven.compiler.source> - <maven.compiler.target>1.7</maven.compiler.target> - <signatureArtifactId>java17</signatureArtifactId> - <signatureVersion>1.0</signatureVersion> - </properties> - - <repositories> - <repository> - <id>faxtomail-public-group</id> - <url>http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/</url> - <snapshots> - <enabled>true</enabled> - <checksumPolicy>fail</checksumPolicy> - </snapshots> - <releases> - <enabled>true</enabled> - <checksumPolicy>fail</checksumPolicy> - </releases> - </repository> - </repositories> - - <pluginRepositories> - <pluginRepository> - <id>faxtomail-public-group</id> - <url>http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/</url> - <snapshots> - <enabled>true</enabled> - <checksumPolicy>fail</checksumPolicy> - </snapshots> - <releases> - <enabled>true</enabled> - <checksumPolicy>fail</checksumPolicy> - </releases> - </pluginRepository> - </pluginRepositories> - - <dependencyManagement> - <dependencies> - - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <version>${h2Version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.postgresql</groupId> - <artifactId>postgresql</artifactId> - <version>${postgresqlDriverVersion}</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>net.sourceforge.jtds</groupId> - <artifactId>jtds</artifactId> - <version>1.3.1</version> - <scope>runtime</scope> - </dependency> - - <!-- librairies utils --> - - <dependency> - <groupId>org.nuiton.topia</groupId> - <artifactId>topia-persistence</artifactId> - <version>${topiaVersion}</version> - </dependency> - - <dependency> - <groupId>org.nuiton.topia</groupId> - <artifactId>topia-service-flyway</artifactId> - <version>${topiaVersion}</version> - </dependency> - - <dependency> - <groupId>org.flywaydb</groupId> - <artifactId>flyway-core</artifactId> - <version>3.0</version> - </dependency> - - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - <version>${hibernateVersion}</version> - <exclusions> - <exclusion> - <artifactId>xml-apis</artifactId> - <groupId>xml-apis</groupId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-c3p0</artifactId> - <version>${hibernateVersion}</version> - <scope>runtime</scope> - <exclusions> - <exclusion> - <groupId>c3p0</groupId> - <artifactId>c3p0</artifactId> - </exclusion> - </exclusions> - </dependency> - - <!-- Temp update for log4j 2 detection --> - <dependency> - <groupId>org.jboss.logging</groupId> - <artifactId>jboss-logging</artifactId> - <version>3.2.0.Beta1</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>com.mchange</groupId> - <artifactId>c3p0</artifactId> - <version>0.9.5-pre8</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - <version>${nuitonUtilsVersion}</version> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-decorator</artifactId> - <version>${nuitonDecoratorVersion}</version> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-config</artifactId> - <version>${nuitonConfigVersion}</version> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-updater</artifactId> - <version>${nuitonUpdaterVersion}</version> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-csv</artifactId> - <version>${nuitonCsvVersion}</version> - </dependency> - - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>${guavaVersion}</version> - </dependency> - - <dependency> - <groupId>org.nuiton.i18n</groupId> - <artifactId>nuiton-i18n</artifactId> - <version>${nuitonI18nVersion}</version> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-validator</artifactId> - <version>${nuitonValidatorVersion}</version> - </dependency> - - <dependency> - <groupId>com.itextpdf</groupId> - <artifactId>itextpdf</artifactId> - <version>5.5.2</version> - </dependency> - - <dependency> - <groupId>org.apache.pdfbox</groupId> - <artifactId>pdfbox</artifactId> - <version>1.8.7</version> - </dependency> - - <!-- librairie Jaxx --> - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime</artifactId> - <version>${jaxxVersion}</version> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-validator</artifactId> - <version>${jaxxVersion}</version> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-widgets</artifactId> - <version>${jaxxVersion}</version> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-widgets-extra</artifactId> - <version>${jaxxVersion}</version> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-application-api</artifactId> - <version>${jaxxVersion}</version> - </dependency> - - <dependency> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-application-swing</artifactId> - <version>${jaxxVersion}</version> - </dependency> - - <!-- swing widgets --> - - <dependency> - <groupId>org.swinglabs.swingx</groupId> - <artifactId>swingx-core</artifactId> - <version>${swingXVersion}</version> - </dependency> - - <dependency> - <groupId>org.swinglabs.swingx</groupId> - <artifactId>swingx-common</artifactId> - <version>${swingXVersion}</version> - </dependency> - - <dependency> - <groupId>org.swinglabs.swingx</groupId> - <artifactId>swingx-autocomplete</artifactId> - <version>${swingXVersion}</version> - </dependency> - - <!-- Logging --> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>${log4jVersion}</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-jcl</artifactId> - <version>${log4jVersion}</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - <version>${log4jVersion}</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${slf4jVersion}</version> - </dependency> - - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commonsIoVersion}</version> - </dependency> - - <!-- web module --> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>3.0.1</version> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>org.nuiton.web</groupId> - <artifactId>nuiton-struts2</artifactId> - <version>${nuitonWebVersion}</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-core</artifactId> - <version>${struts2Version}</version> - <exclusions> - <!-- prevent java.lang.ClassCastException: cannot be cast to javassist.util.proxy.Proxy --> - <exclusion> - <groupId>javassist</groupId> - <artifactId>javassist</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>com.jgeppert.struts2.jquery</groupId> - <artifactId>struts2-jquery-plugin</artifactId> - <version>${jqueryPluginVersion}</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>com.jgeppert.struts2.bootstrap</groupId> - <artifactId>struts2-bootstrap-plugin</artifactId> - <version>${bootstrapPluginVersion}</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-convention-plugin</artifactId> - <version>${struts2Version}</version> - </dependency> - - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-sitemesh-plugin</artifactId> - <version>${struts2Version}</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.struts.xwork</groupId> - <artifactId>xwork-core</artifactId> - <version>${struts2Version}</version> - <exclusions> - <exclusion> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - </exclusion> - - <!-- prevent java.lang.ClassCastException: cannot be cast to javassist.util.proxy.Proxy --> - <exclusion> - <groupId>javassist</groupId> - <artifactId>javassist</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <version>2.3</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.quartz-scheduler</groupId> - <artifactId>quartz</artifactId> - <version>2.2.1</version> - <exclusions> - <exclusion> - <groupId>c3p0</groupId> - <artifactId>c3p0</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - <version>1.4.7</version> - </dependency> - - <dependency> - <groupId>javax.activation</groupId> - <artifactId>activation</artifactId> - <version>1.1.1</version> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-wro</artifactId> - <version>1.0.3</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-jquery</artifactId> - <version>1.11.1-1</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-bootstrap</artifactId> - <version>3.2.0-1</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.webjars</groupId> - <artifactId>angular-ui-sortable</artifactId> - <version>0.12.7</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.webjars</groupId> - <artifactId>angular-ui-bootstrap</artifactId> - <version>0.11.0-2</version> - <scope>runtime</scope> - <exclusions> - <exclusion> - <artifactId>angularjs</artifactId> - <groupId>org.webjars</groupId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-jquery-ui</artifactId> - <version>1.11.1-1</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.webjars</groupId> - <artifactId>select2</artifactId> - <version>3.5.1</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-angularjs</artifactId> - <version>1.2.25-1</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-font-awesome</artifactId> - <version>4.2.0-1</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-html5shiv</artifactId> - <version>3.7.2-1</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.webjars</groupId> - <artifactId>respond</artifactId> - <version>1.4.2</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.nuiton.js</groupId> - <artifactId>nuiton-js-angular-ui-tree</artifactId> - <version>2.1.4-1</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>com.unboundid</groupId> - <artifactId>unboundid-ldapsdk</artifactId> - <version>2.3.6</version> - </dependency> - - <dependency> - <groupId>com.github.spullara.mustache.java</groupId> - <artifactId>compiler</artifactId> - <version>0.8.16</version> - </dependency> - - <dependency> - <groupId>gui.ava</groupId> - <artifactId>html2image</artifactId> - <version>2.0.1</version> - <exclusions> - <exclusion> - <artifactId>core-renderer</artifactId> - <groupId>org.xhtmlrenderer</groupId> - </exclusion> - <exclusion> - <artifactId>xml-apis</artifactId> - <groupId>xml-apis</groupId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.xhtmlrenderer</groupId> - <artifactId>flying-saucer-pdf-itext5</artifactId> - <version>9.0.6</version> - </dependency> - </dependencies> - - </dependencyManagement> - - <build> - - <pluginManagement> - <plugins> - - <!-- plugin site --> - <plugin> - <artifactId>maven-site-plugin</artifactId> - <dependencies> - <dependency> - <groupId>org.nuiton.jrst</groupId> - <artifactId>doxia-module-jrst</artifactId> - <version>${jrstPluginVersion}</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - <version>${hibernateVersion}</version> - </dependency> - </dependencies> - </plugin> - - <plugin> - <groupId>org.nuiton.i18n</groupId> - <artifactId>i18n-maven-plugin</artifactId> - <version>${nuitonI18nVersion}</version> - <configuration> - <bundles>fr_FR</bundles> - </configuration> - </plugin> - - <plugin> - <groupId>org.nuiton.eugene</groupId> - <artifactId>eugene-maven-plugin</artifactId> - <version>${eugeneVersion}</version> - <dependencies> - <dependency> - <groupId>org.nuiton.topia</groupId> - <artifactId>topia-templates</artifactId> - <version>${topiaVersion}</version> - </dependency> - </dependencies> - </plugin> - - <plugin> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <version>${jaxxVersion}</version> - </plugin> - - </plugins> - </pluginManagement> - <extensions> - <!-- Enabling the use of scpexe with maven 3.0 --> - <extension> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-ssh-external</artifactId> - <version>1.0</version> - </extension> - </extensions> - </build> - - <reporting> - <excludeDefaults>true</excludeDefaults> - </reporting> - - <profiles> - - <profile> - <id>check-release-profile</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - - <build> - <plugins> - <!--<plugin>--> - <!--<artifactId>maven-enforcer-plugin</artifactId>--> - <!--<executions>--> - <!--<execution>--> - <!--<id>check-release-properties</id>--> - <!--<goals>--> - <!--<goal>enforce</goal>--> - <!--</goals>--> - <!--<phase>initialize</phase>--> - <!--<configuration>--> - <!--<rules>--> - <!--<requireProperty>--> - <!--<property>jreVersion</property>--> - <!--<message>You must set a jreVersion property!</message>--> - <!--</requireProperty>--> - <!--<requireProperty>--> - <!--<property>dbVersion</property>--> - <!--<message>You must set a dbVersion property!</message>--> - <!--</requireProperty>--> - <!--<requireProperty>--> - <!--<property>reportVersion</property>--> - <!--<message>You must set a reportVersion property!</message>--> - <!--</requireProperty>--> - <!--</rules>--> - <!--<ignoreCache>true</ignoreCache>--> - <!--<failFast>true</failFast>--> - <!--<fail>true</fail>--> - - <!--</configuration>--> - <!--</execution>--> - <!--</executions>--> - <!--</plugin>--> - </plugins> - </build> - - </profile> - <profile> - <id>license-profile</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - - <build> - <defaultGoal>generate-resources</defaultGoal> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>license-maven-plugin</artifactId> - <executions> - <execution> - <id>update-file-header-on-pom</id> - <goals> - <goal>update-file-header</goal> - </goals> - <phase>generate-resources</phase> - <configuration> - <roots> - <root>${project.basedir}</root> - </roots> - <includes> - <include>pom.xml</include> - </includes> - <addSvnKeyWords>false</addSvnKeyWords> - <verbose>false</verbose> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - - <profile> - <id>reporting</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - - <reporting> - <plugins> - - <plugin> - <artifactId>maven-project-info-reports-plugin</artifactId> - <version>${projectInfoReportsPluginVersion}</version> - <reportSets> - <reportSet> - <reports> - <report>project-team</report> - <report>mailing-list</report> - <report>cim</report> - <report>issue-tracking</report> - <report>license</report> - <report>scm</report> - <report>dependencies</report> - <report>dependency-convergence</report> - <report>dependency-info</report> - <report>plugin-management</report> - <report>plugins</report> - <report>dependency-management</report> - <report>summary</report> - </reports> - </reportSet> - </reportSets> - </plugin> - - </plugins> - </reporting> - - </profile> - - <profile> - <id>update-file-header</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - - <properties> - <license.descriptor>src/license/project.xml</license.descriptor> - </properties> - <build> - <defaultGoal>process-resources</defaultGoal> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>license-maven-plugin</artifactId> - <executions> - <execution> - <id>update-file-header</id> - <goals> - <goal>update-file-header</goal> - </goals> - <configuration> - <addSvnKeyWords>true</addSvnKeyWords> - <excludes> - <exclude>**/i18n/*.properties</exclude> - <exclude>**/help/*.properties</exclude> - <exclude>**/THIRD-PARTY.properties</exclude> - <!-- since sh scripts must begins by the line #!/bin/sh, - can not use the mojo for the mojo --> - <exclude>**/*.sh</exclude> - </excludes> - </configuration> - <phase>process-resources</phase> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - - </profiles> -</project> diff --git a/trunk/src/site/resources/img/notepad.png b/trunk/src/site/resources/img/notepad.png deleted file mode 100644 index 49321ca..0000000 Binary files a/trunk/src/site/resources/img/notepad.png and /dev/null differ diff --git a/trunk/src/site/resources/img/txt-to-csv.png b/trunk/src/site/resources/img/txt-to-csv.png deleted file mode 100644 index e49035c..0000000 Binary files a/trunk/src/site/resources/img/txt-to-csv.png and /dev/null differ diff --git a/trunk/src/site/rst/import.rst b/trunk/src/site/rst/import.rst deleted file mode 100644 index 553ca5d..0000000 --- a/trunk/src/site/rst/import.rst +++ /dev/null @@ -1,98 +0,0 @@ -.. - -.. * #%L -.. * FaxToMail -.. * $Id$ -.. * $HeadURL$ -.. * %% -.. * Copyright (C) 2014 Mac-Groupe, Code Lutin -.. * %% -.. * This program is free software: you can redistribute it and/or modify -.. * it under the terms of the GNU General Public License as -.. * published by the Free Software Foundation, either version 3 of the -.. * License, or (at your option) any later version. -.. * -.. * This program is distributed in the hope that it will be useful, -.. * but WITHOUT ANY WARRANTY; without even the implied warranty of -.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -.. * GNU General Public License for more details. -.. * -.. * You should have received a copy of the GNU General Public -.. * License along with this program. If not, see -.. * <http://www.gnu.org/licenses/gpl-3.0.html>. -.. * #L% -.. - - -Import par fichier CSV -====================== - -Format ------- - -Les fichiers d'import doivent être formater suivant le standart CSV (Comma-separated values) et -utiliser le séparateur ``;``. - -Exemple avec le fichier d'import des États d'attente:: - - etatattente - etat 1 - etat 2 - etat 3 - -Ce fichier ne comporte qu'une seule colonne ``etatattente``, les séparateurs ``;`` ne sont donc pas requis. - -Voici un exemple plus complet avec le fichier client:: - - Id_Correspondance;Societe;Nom;Caracteristique1;Caracteristique2;Caracteristique3;Numero_Fax;Adresse_Mail;Code_Client - 253042;FX;John Doe;A;71 Allo;NULL;03 12 34 56 78;john@doe.fr;99153 - 253142;FX;Gerard Menvussa;A+;40 Nabi;NULL;05 12 23 34 45;gerard.menvussa@code.com;99154 - 253242;FX;Ella Elli;NULL;38 LA;NULL;04 98 87 76 65;NULL;99184 - -Ce fichier comporte 9 colonnes séparée par le séparateur ``;``. Il comporte une ligne d'entete et -3 lignes de données. - - -Encodage --------- - -Il est très difficile de déterminé le format d'encodage du fichier texte (CSV). L'application FaxToMail -impose donc l'utilisation du format d'encodage standardisé unicode (UTF-8). - -Cependant, certains système d'exploitation, comme Windows, n'utilisent pas ce standard. - -Il faut donc spécifier lors de l'enregistrement du fichier: - * l'encodage des caractères à utiliser - * le format du fichier (séparateur ``;``, délimiteur...) - -notepad++ -~~~~~~~~~ - -Pour éditer un fichier au format texte, le logiciel `notepad++`_ est plus évolué que les outils -basique mis à la disposition par défaut par Windows. Il dispose de plus d'une option pour spécifier -le format d'encodage lors de la sauvegarde. - -.. _notepad++: http://notepad-plus-plus.org/ - -.. image:: img/notepad.png - -Openoffice/Libreoffice -~~~~~~~~~~~~~~~~~~~~~~ - -Openoffice et Libreoffice sont deux equivalents libre de la suite bureautique Microsoft Office. Ce -logiciel propose plus facilement les options d'encodage lors de l'enregistrement du fichier CSV. - -Il s'agit d'une simple option à sélection dans la fenêtre de sauvegarde. - -Excel -~~~~~ - -Pour spécifier l'encodage sous Microsoft Excel, c'est un peu compliqué car l'option n'est pas -facilement accessible. - -Pour pouvoir changer cette option, il faut: - * ouvrir la boite de dialogue "Enregistrer sous..." - * Choisir de sauver le document en type "Tous les fichiers (*.*) - * modifier le nom du fichier en xxx.csv - -comme montré dans cette image: - -.. image:: http://www.ablebits.com/_img-blog/excel-csv/txt-to-csv.png diff --git a/trunk/src/site/rst/index.rst b/trunk/src/site/rst/index.rst deleted file mode 100644 index c3fa3c4..0000000 --- a/trunk/src/site/rst/index.rst +++ /dev/null @@ -1,29 +0,0 @@ -.. - -.. * #%L -.. * FaxToMail -.. * $Id$ -.. * $HeadURL$ -.. * %% -.. * Copyright (C) 2014 Mac-Groupe, Code Lutin -.. * %% -.. * This program is free software: you can redistribute it and/or modify -.. * it under the terms of the GNU General Public License as -.. * published by the Free Software Foundation, either version 3 of the -.. * License, or (at your option) any later version. -.. * -.. * This program is distributed in the hope that it will be useful, -.. * but WITHOUT ANY WARRANTY; without even the implied warranty of -.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -.. * GNU General Public License for more details. -.. * -.. * You should have received a copy of the GNU General Public -.. * License along with this program. If not, see -.. * <http://www.gnu.org/licenses/gpl-3.0.html>. -.. * #L% -.. - - -Accueil -======= - -Bienvenue sur le site de FaxToMail. Il contient certaines documentation utilisateur et technique -concernant l'installation et l'utilisation de l'application FaxToMail. diff --git a/trunk/src/site/rst/install.rst b/trunk/src/site/rst/install.rst deleted file mode 100644 index 0e69fae..0000000 --- a/trunk/src/site/rst/install.rst +++ /dev/null @@ -1,98 +0,0 @@ -.. - -.. * #%L -.. * FaxToMail -.. * $Id$ -.. * $HeadURL$ -.. * %% -.. * Copyright (C) 2014 Mac-Groupe, Code Lutin -.. * %% -.. * This program is free software: you can redistribute it and/or modify -.. * it under the terms of the GNU General Public License as -.. * published by the Free Software Foundation, either version 3 of the -.. * License, or (at your option) any later version. -.. * -.. * This program is distributed in the hope that it will be useful, -.. * but WITHOUT ANY WARRANTY; without even the implied warranty of -.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -.. * GNU General Public License for more details. -.. * -.. * You should have received a copy of the GNU General Public -.. * License along with this program. If not, see -.. * <http://www.gnu.org/licenses/gpl-3.0.html>. -.. * #L% -.. - - -Installation du serveur FaxToMail (Windows) -=========================================== - -Téléchargement --------------- - -* Installer Java JRE 7 (minimum) : http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-18802... -* Télécharger Tomcat 7 : http://apache.crihan.fr/dist/tomcat/tomcat-7/v7.0.53/bin/apache-tomcat-7.0.5... -* Télécharger Apache 2.4 : http://www.apachelounge.com/download/VC11/binaries/httpd-2.4.9-win64-VC11.zi... - -* Installer Java -* Installer tomcat. Tomcat s'installe automatiquement en tant que service windows. -* Décompresser httpd-2.4.9-win64-VC11.zip dans ''C:\Apache24'' -* Installer apache en tant que service windows : ''httpd.exe -k install'': - - * Si un message à propos de msvcr110.dll s'affiche, c'est que "Microsoft Visual C++ Redistributable" n'est pas installé - * http://answers.microsoft.com/en-us/windows/forum/windows_8-winapps/the-progr... - * http://www.microsoft.com/en-us/download/details.aspx?id=30679 -* Démarrer les services "Apache tomcat 7.0 Tomcat7" et "Apache2.4" - -À ce stade, les adresses http://localhost/ et http://localhost:8080 doivent répondre. - -Apache ------- - -Étapes: - -* Dans le fichier 'C:\Apache24\conf\httpd.conf', décommenter les lignes - -:: - - LoadModule proxy_module modules/mod_proxy.so - LoadModule proxy_ajp_module modules/mod_proxy_ajp.so - -* Ajouter à la fin du fichier - -:: - - Include conf/extra/httpd-faxtomail.conf - -* Créer le fichier ''conf/extra/httpd-faxtomail.conf'' avec en contenu - -:: - - <VirtualHost *:80> - ServerAdmin webmaster@franciaflex.com - ServerName 192.168.100.247 - #ServerAlias faxtomailsrv - ErrorLog "logs/faxtomail-error.log" - CustomLog "logs/faxtomail-access.log" common - - # lien vers tomcat - ProxyRequests On - ProxyVia On - ProxyPass / ajp://localhost:8009/ - ProxyPassReverse / ajp://localhost:8009/ - </VirtualHost> - -À ce stade, l'adresse http://192.168.100.247/ devrait répondre par tomcat. - -Tomcat ------- - -* Télécharger le war depuis l'adresse : http://forge.codelutin.com/projects/faxtomail/files -* Enregistrez le dans le dossier ''C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\'' avec le nom ''ROOT.war'' (supprimer le dossier ROOT) -* Créer le fichier ''C:\Windows\System32\faxToMail.properties'' avec en contenu - -:: - - faxtomail.storage=C:\\faxtomail\\data - -* Relancer le service ''Apache Tomcat 7.0 Tomcat7'' - -L'application doit maintenant être installée et répondre sur l'adresse : http://192.168.100.247/ diff --git a/trunk/src/site/rst/mssql.rst b/trunk/src/site/rst/mssql.rst deleted file mode 100644 index d5b5ba7..0000000 --- a/trunk/src/site/rst/mssql.rst +++ /dev/null @@ -1,41 +0,0 @@ -.. - -.. * #%L -.. * FaxToMail -.. * $Id$ -.. * $HeadURL$ -.. * %% -.. * Copyright (C) 2014 Mac-Groupe, Code Lutin -.. * %% -.. * This program is free software: you can redistribute it and/or modify -.. * it under the terms of the GNU General Public License as -.. * published by the Free Software Foundation, either version 3 of the -.. * License, or (at your option) any later version. -.. * -.. * This program is distributed in the hope that it will be useful, -.. * but WITHOUT ANY WARRANTY; without even the implied warranty of -.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -.. * GNU General Public License for more details. -.. * -.. * You should have received a copy of the GNU General Public -.. * License along with this program. If not, see -.. * <http://www.gnu.org/licenses/gpl-3.0.html>. -.. * #L% -.. - - -Déploiement sur MS-SQL Server -============================= - -Le serveur testé a été :: - - Microsoft SQL Server 2008 (SP3) - 10.0.5500.0 (X64) - Sep 21 2011 22:45:45 - Copyright (c) 1988-2008 Microsoft Corporation - Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (VM) - -La configuration à ajouter dans le fichier de configuration ``C:\Windows\System32\faxToMail.properties``:: - - hibernate.dialect=org.hibernate.dialect.SQLServer2008Dialect - hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver - hibernate.connection.url=jdbc:jtds:sqlserver://192.168.100.247:1433/faxtomail - hibernate.connection.username=user - hibernate.connection.password=pass diff --git a/trunk/src/site/site_fr.xml b/trunk/src/site/site_fr.xml deleted file mode 100644 index 85997f1..0000000 --- a/trunk/src/site/site_fr.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - FaxToMail - $Id$ - $HeadURL$ - %% - Copyright (C) 2014 Mac-Groupe, Code Lutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> - - -<project name="${project.name}"> - - <skin> - <groupId>org.apache.maven.skins</groupId> - <artifactId>maven-fluido-skin</artifactId> - <version>1.3.1</version> - </skin> - - <publishDate format="dd/MM/yyyy" position="right" /> - <version position="right" /> - - <poweredBy> - <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png" /> - </poweredBy> - - <body> - - <breadcrumbs> - <item name="${project.name}" href="${project.url}" /> - </breadcrumbs> - - <menu name="Documentation"> - <item name="Accueil" href="index.html" /> - - <item name="Utilisateur" href="import.html"> - <item name="Import" href="import.html" /> - </item> - - <item name="Développeur" href="install.html"> - <item name="Installation" href="install.html" /> - <item name="SQL Serveur" href="mssql.html" /> - </item> - </menu> - - <menu ref="reports" /> - - </body> - -</project> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See http://git.codelutin.com/faxtomail.git commit 8730ee6a2c2baea3c4ebe15f430df7797cf6947f Author: Kevin Morin <morin@codelutin.com> Date: Tue May 5 18:26:31 2015 +0200 - fin de l'interface d'admin des marques par nom de domaine - ajout d'un bouton pour choisir parmi les clients détectés lors de la réception --- .../persistence/entities/BrandsForDomainImpl.java | 31 ++++++++------------- .../src/main/xmi/faxtomail.properties | 3 +- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 31130 -> 31055 bytes .../faxtomail/services/DecoratorServiceImpl.java | 2 ++ .../services/service/EmailServiceImpl.java | 1 + .../services/service/InitFaxToMailServiceImpl.java | 23 +++++++++------ ...s_for_domain_and_matching_clients_in_emails.sql | 5 +++- ...s_for_domain_and_matching_clients_in_emails.sql | 14 +++++++--- .../ui/swing/content/demande/DemandeUI.css | 5 ++++ .../ui/swing/content/demande/DemandeUI.jaxx | 25 ++++++++++------- .../ui/swing/content/demande/DemandeUIHandler.java | 25 ++++++++++++++--- .../ui/swing/content/demande/DemandeUIModel.java | 14 ++++++++-- .../src/main/resources/icons/action-warning.png | Bin 0 -> 666 bytes .../web/action/admin/ConfigurationAction.java | 1 - .../WEB-INF/content/admin/configuration-input.jsp | 4 +-- .../src/main/webapp/js/configuration.js | 14 +++++++--- 16 files changed, 109 insertions(+), 58 deletions(-) diff --git a/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/BrandsForDomainImpl.java b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/BrandsForDomainImpl.java index 03df49c..03d42b6 100644 --- a/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/BrandsForDomainImpl.java +++ b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/BrandsForDomainImpl.java @@ -1,41 +1,32 @@ package com.franciaflex.faxtomail.persistence.entities; -import com.google.gson.reflect.TypeToken; +import com.google.common.collect.Lists; +import org.apache.commons.lang3.StringUtils; -import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; /** * @author Kevin Morin (Code Lutin) - * @since x.x + * @since 1.2 */ public class BrandsForDomainImpl extends BrandsForDomainAbstract { - private static final Type LIST_STRING_GSON_TYPE = new TypeToken<List<String>>() {}.getType(); - @Override public void setBrands(List<String> brands) { - String json = AbstractFaxToMailTopiaDao.GSON_INSTANCE.toJson(brands); - setBrandsJson(json); + String brandsAsString = StringUtils.join(brands, ","); + setBrandsJson(brandsAsString); } @Override public List<String> getBrands() { String json = getBrandsJson(); - List<String> brands = AbstractFaxToMailTopiaDao.GSON_INSTANCE.fromJson(json, LIST_STRING_GSON_TYPE); - return brands; - } - - @Override - public void setBrands(String brands) { - List<String> brandList = new ArrayList<>(); - if (brands != null) { - String[] brandArray = brands.split(","); - for (String brand : brandArray) { - brandList.add(brand.trim()); - } + List<String> brands; + if (json == null) { + brands = new ArrayList<>(); + } else { + brands = Lists.newArrayList(json.split(",")); } - setBrands(brandList); + return brands; } } diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.properties b/faxtomail-persistence/src/main/xmi/faxtomail.properties index a3e6a5b..e3aa8ae 100644 --- a/faxtomail-persistence/src/main/xmi/faxtomail.properties +++ b/faxtomail-persistence/src/main/xmi/faxtomail.properties @@ -134,4 +134,5 @@ com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.tagvalu com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.tagvalue.unique=true # BrandsForDomain -com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domain.tagvalue.notNull=true \ No newline at end of file +com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domain.tagvalue.notNull=true +com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domain.stereotype=unique \ No newline at end of file diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.zargo b/faxtomail-persistence/src/main/xmi/faxtomail.zargo index 2026af5..6a304e1 100644 Binary files a/faxtomail-persistence/src/main/xmi/faxtomail.zargo and b/faxtomail-persistence/src/main/xmi/faxtomail.zargo differ diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java index b21ebb7..7492b13 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java @@ -26,6 +26,7 @@ package com.franciaflex.faxtomail.services; import com.franciaflex.faxtomail.persistence.entities.Attachment; import com.franciaflex.faxtomail.persistence.entities.AttachmentFile; +import com.franciaflex.faxtomail.persistence.entities.Client; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.HasLabel; import com.franciaflex.faxtomail.persistence.entities.Reply; @@ -138,6 +139,7 @@ public class DecoratorServiceImpl extends FaxToMailServiceSupport implements Dec }); registerMultiJXPathDecorator(Reply.class, "${sentDate}$s#${subject}$s", SEPARATOR, " - "); registerMultiJXPathDecorator(FaxToMailUser.class, "${lastName}$s#${firstName}$s#${trigraph}$s", SEPARATOR, " "); + registerMultiJXPathDecorator(Client.class, "${code}$s#${name}$s#${company}$s", SEPARATOR, " - "); } }; } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java index fc3275e..a440981 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java @@ -178,6 +178,7 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe Hibernate.initialize(rangeRow.getRange()); } } + Hibernate.initialize(email.getMatchingClients()); Hibernate.initialize(email.getReplies()); Hibernate.initialize(email.getAttachment()); Collection<History> histories = email.getHistory(); diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java index 4d39849..cab3a51 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java @@ -40,6 +40,8 @@ import com.franciaflex.faxtomail.persistence.entities.HistoryType; import com.franciaflex.faxtomail.persistence.entities.MailField; import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.OriginalEmail; +import com.franciaflex.faxtomail.persistence.entities.OriginalEmailTopiaDao; import com.franciaflex.faxtomail.persistence.entities.Priority; import com.franciaflex.faxtomail.persistence.entities.PriorityTopiaDao; import com.franciaflex.faxtomail.persistence.entities.Range; @@ -209,6 +211,7 @@ public class InitFaxToMailServiceImpl extends FaxToMailServiceSupport implements // fixme seed to be used in test Random random = new Random(1234); EmailTopiaDao emailDao = getPersistenceContext().getEmailDao(); + OriginalEmailTopiaDao originalEmailDao = getPersistenceContext().getOriginalEmailDao(); HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao(); RangeRowTopiaDao rangeRowDao = getPersistenceContext().getRangeRowDao(); @@ -309,12 +312,12 @@ public class InitFaxToMailServiceImpl extends FaxToMailServiceSupport implements if (fxClientsStream != null) { List<Client> clients = getReferentielService().importClients(fxClientsStream); - createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, cyrilFolder, cyril); - createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, claireFolder, claire); - createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, agatheFolder, agathe); - createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, marcFolder, marc); - createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, fredericFolder, frederic); - createEmails(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, jeanneFolder, jeanne); + createEmails(random, historyDao, rangeRowDao, emailDao, originalEmailDao, ranges, clients, types, priorities, cyrilFolder, cyril); + createEmails(random, historyDao, rangeRowDao, emailDao, originalEmailDao, ranges, clients, types, priorities, claireFolder, claire); + createEmails(random, historyDao, rangeRowDao, emailDao, originalEmailDao, ranges, clients, types, priorities, agatheFolder, agathe); + createEmails(random, historyDao, rangeRowDao, emailDao, originalEmailDao, ranges, clients, types, priorities, marcFolder, marc); + createEmails(random, historyDao, rangeRowDao, emailDao, originalEmailDao, ranges, clients, types, priorities, fredericFolder, frederic); + createEmails(random, historyDao, rangeRowDao, emailDao, originalEmailDao, ranges, clients, types, priorities, jeanneFolder, jeanne); } } catch(Exception e) { @@ -325,12 +328,13 @@ public class InitFaxToMailServiceImpl extends FaxToMailServiceSupport implements } } - protected void createEmails(Random random, HistoryTopiaDao historyDao, RangeRowTopiaDao rangeRowDao, EmailTopiaDao emailDao, + protected void createEmails(Random random, HistoryTopiaDao historyDao, RangeRowTopiaDao rangeRowDao, + EmailTopiaDao emailDao, OriginalEmailTopiaDao originalEmailDao, List<Range> ranges, List<Client> clients, List<DemandType> types, List<Priority> priorities, MailFolder folder, FaxToMailUser user) throws InvalidClientException { int r = random.nextInt(100) + 50; for (int i = 0 ; i < r ; i++) { - createEmail(random, historyDao, rangeRowDao, emailDao, ranges, clients, types, priorities, folder, user); + createEmail(random, historyDao, rangeRowDao, emailDao, originalEmailDao, ranges, clients, types, priorities, folder, user); } } @@ -338,6 +342,7 @@ public class InitFaxToMailServiceImpl extends FaxToMailServiceSupport implements HistoryTopiaDao historyDao, RangeRowTopiaDao rangeRowDao, EmailTopiaDao emailDao, + OriginalEmailTopiaDao originalEmailDao, List<Range> ranges, List<Client> clients, List<DemandType> types, @@ -389,7 +394,7 @@ public class InitFaxToMailServiceImpl extends FaxToMailServiceSupport implements Email.PROPERTY_MAIL_FOLDER, folder, Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED, Email.PROPERTY_HISTORY, Lists.newArrayList(history), - Email.PROPERTY_ORIGINAL_EMAIL, "Demo data"); + Email.PROPERTY_ORIGINAL_EMAIL, originalEmailDao.create(OriginalEmail.PROPERTY_CONTENT, "Demo data")); if (opened) { diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql b/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql index 3b83474..47155d7 100644 --- a/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql +++ b/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql @@ -4,7 +4,7 @@ CREATE TABLE BrandsForDomain ( topiaId VARCHAR(255) NOT NULL, topiaVersion BIGINT NOT NULL, topiaCreateDate TIMESTAMP, - domainName longvarchar NOT NULL, + domainName longvarchar NOT NULL UNIQUE, brandsJson longvarchar, PRIMARY KEY (topiaId) ); @@ -15,12 +15,15 @@ create table email_matchingClients ( email varchar(255) not null, matchingClients varchar(255) not null ); + alter table email_matchingClients add constraint FK_IICRYCV6TYE2EFQU4JTUM9CS1 foreign key (matchingClients) references client; + alter table email_matchingClients add constraint FK_CDHGKIXMOOF90L83HNWB83A35 foreign key (email) references email; + CREATE INDEX idx_Email_matchingClients ON email_matchingClients(email); \ No newline at end of file diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql similarity index 84% copy from faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql copy to faxtomail-service/src/main/resources/db/migration/sqlserver/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql index 3b83474..6efe734 100644 --- a/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql +++ b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql @@ -3,11 +3,12 @@ CREATE TABLE BrandsForDomain ( topiaId VARCHAR(255) NOT NULL, topiaVersion BIGINT NOT NULL, - topiaCreateDate TIMESTAMP, - domainName longvarchar NOT NULL, - brandsJson longvarchar, + topiaCreateDate datetime2, + domainName VARCHAR(MAX) NOT NULL UNIQUE, + brandsJson VARCHAR(MAX), PRIMARY KEY (topiaId) ); +GO -- add matching clients in email @@ -15,12 +16,17 @@ create table email_matchingClients ( email varchar(255) not null, matchingClients varchar(255) not null ); +GO + alter table email_matchingClients add constraint FK_IICRYCV6TYE2EFQU4JTUM9CS1 foreign key (matchingClients) references client; + alter table email_matchingClients add constraint FK_CDHGKIXMOOF90L83HNWB83A35 foreign key (email) references email; -CREATE INDEX idx_Email_matchingClients ON email_matchingClients(email); \ No newline at end of file + +CREATE INDEX idx_Email_matchingClients ON email_matchingClients(email); +GO \ No newline at end of file diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css index 7661cfd..9e482c5 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css @@ -87,6 +87,11 @@ JTextField, JXTable, BeanFilterableComboBox, #commentField, ButtonAttachment, Bu text: {model.getClientBrand()}; } +#warningClient { + actionIcon: warning; + visible: { model.getMatchingClients() != null && model.getMatchingClients().size() > 1 }; +} + #docTypeLabel { text: "faxtomail.demande.demandType.label"; } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx index 82b420c..85a81b1 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx @@ -78,6 +78,8 @@ <field name="comment" component="commentPane"/> </BeanValidator> + <JPopupMenu id="matchingClientsPopup"/> + <JToolBar id='topToolBar'> <ButtonDemandReplies id="demandRepliesButton" constructorParams="model"/> @@ -100,7 +102,7 @@ <cell> <JLabel id='receivedDateLabel'/> </cell> - <cell columns="3"> + <cell columns="4"> <JLabel id='receivedDateField'/> </cell> </row> @@ -108,7 +110,7 @@ <cell> <JLabel id='senderLabel'/> </cell> - <cell columns="3"> + <cell columns="4"> <JLabel id='senderField'/> </cell> </row> @@ -116,7 +118,7 @@ <cell> <JLabel id='objectLabel'/> </cell> - <cell weightx='1' columns="3"> + <cell weightx='1' columns="4"> <JTextField id='objectField' onKeyReleased='handler.setText(event, "object")'/> </cell> @@ -125,6 +127,9 @@ <cell> <JLabel id='clientLabel'/> </cell> + <cell> + <JButton id='warningClient' onActionPerformed="handler.showMatchingClientsPopup(event)"/> + </cell> <cell weightx='1'> <JTextField id='clientField' onKeyReleased='handler.setText(event, "clientCode")'/> @@ -142,7 +147,7 @@ <cell> <JLabel id='docTypeLabel'/> </cell> - <cell weightx='1' columns="3"> + <cell weightx='1' columns="4"> <BeanFilterableComboBox id='docTypeComboBox' constructorParams='this' genericType="DemandType"/> @@ -152,7 +157,7 @@ <cell> <JLabel id='priorityLabel'/> </cell> - <cell weightx='1' columns="3"> + <cell weightx='1' columns="4"> <BeanFilterableComboBox id='priorityComboBox' constructorParams='this' genericType="Priority"/> @@ -162,7 +167,7 @@ <cell> <JLabel id='projectReferenceLabel'/> </cell> - <cell weightx='1' columns="3"> + <cell weightx='1' columns="4"> <JTextField id='projectReferenceField' onKeyReleased='handler.setText(event, "projectReference")'/> </cell> @@ -171,7 +176,7 @@ <cell> <JLabel id='companyReferenceLabel'/> </cell> - <cell weightx='1' columns="3"> + <cell weightx='1' columns="4"> <JTextField id='companyReferenceField' onKeyReleased='handler.setText(event, "companyReference")'/> </cell> @@ -180,7 +185,7 @@ <cell> <JLabel id='waitingStateLabel'/> </cell> - <cell weightx='1' columns="3"> + <cell weightx='1' columns="4"> <BeanFilterableComboBox id='waitingStateComboBox' constructorParams='this' genericType="WaitingState"/> @@ -190,7 +195,7 @@ <cell> <JLabel id='statusLabel'/> </cell> - <cell weightx='1' columns="3"> + <cell weightx='1' columns="4"> <JPanel layout="{new BorderLayout()}"> <JLabel id='statusField' constraints='BorderLayout.NORTH'/> <BeanFilterableComboBox id='statusComboBox' @@ -204,7 +209,7 @@ <cell> <JLabel id="takenByLabel"/> </cell> - <cell weightx='1' columns="3"> + <cell weightx='1' columns="4"> <JLabel id="takenByField"/> </cell> </row> diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java index 2455bf7..d78fd1d 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java @@ -23,6 +23,7 @@ package com.franciaflex.faxtomail.ui.swing.content.demande; */ import com.franciaflex.faxtomail.persistence.entities.Attachment; +import com.franciaflex.faxtomail.persistence.entities.Client; import com.franciaflex.faxtomail.persistence.entities.DemandStatus; import com.franciaflex.faxtomail.persistence.entities.DemandType; import com.franciaflex.faxtomail.persistence.entities.Email; @@ -64,6 +65,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.TableCellEditor; import java.awt.*; +import java.awt.event.ActionEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.beans.PropertyChangeEvent; @@ -377,10 +379,10 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, } FaxToMailServiceContext serviceContext = getContext().newServiceContext(); Email email = serviceContext.getEmailService().addToHistory(topiaId, - HistoryType.ATTACHMENT_OPENING, - getContext().getCurrentUser(), - new Date(), - filename); + HistoryType.ATTACHMENT_OPENING, + getContext().getCurrentUser(), + new Date(), + filename); getModel().setHistory(email.getHistory()); } } @@ -418,6 +420,16 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, leftVerticalSplitPanel.setName("leftVerticalSplitPanel" + FaxToMailUIUtil.isRangePanelVisible(model.getDemandType())); getContext().getSwingSession().add(leftVerticalSplitPanel, true); + JPopupMenu menu = ui.getMatchingClientsPopup(); + for (final Client client : model.getMatchingClients()) { + menu.add(new JMenuItem(new AbstractAction(decorate(client)) { + @Override + public void actionPerformed(ActionEvent e) { + getModel().setClient(client); + } + })); + } + listModelIsModify(getModel()); } @@ -552,4 +564,9 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, } return result; } + + public void showMatchingClientsPopup(ActionEvent event) { + JButton button = (JButton) event.getSource(); + getUI().getMatchingClientsPopup().show(button, 0, button.getBounds().height); + } } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java index 1c0ffa9..bbc845f 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java @@ -382,8 +382,8 @@ public class DemandeUIModel extends AbstractFaxToMailBeanUIModel<Email, DemandeU Object oldValue = getClient(); editObject.setClient(client); if (client != null) { - this.clientCode = client.getCode(); - this.clientBrand = client.getBrand(); + setClientCode(client.getCode()); + setClientBrand(client.getBrand()); } firePropertyChanged(Email.PROPERTY_CLIENT, oldValue, client); } @@ -406,6 +406,16 @@ public class DemandeUIModel extends AbstractFaxToMailBeanUIModel<Email, DemandeU return clientBrand; } + public Collection<Client> getMatchingClients() { + return editObject.getMatchingClients(); + } + + public void setMatchingClients(Collection<Client> matchingClients) { + Object oldValue = getMatchingClients(); + editObject.setMatchingClients(matchingClients); + firePropertyChanged(Email.PROPERTY_MATCHING_CLIENTS, oldValue, matchingClients); + } + public void setWaitingState(WaitingState waitingState) { Object oldValue = getWaitingState(); editObject.setWaitingState(waitingState); diff --git a/faxtomail-ui-swing/src/main/resources/icons/action-warning.png b/faxtomail-ui-swing/src/main/resources/icons/action-warning.png new file mode 100644 index 0000000..628cf2d Binary files /dev/null and b/faxtomail-ui-swing/src/main/resources/icons/action-warning.png differ diff --git a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java index c690119..2f6ce52 100644 --- a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java +++ b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java @@ -219,7 +219,6 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa } public void setBrandsForDomainsJson(String json) { - System.out.println(json); Type type = new TypeToken<List<BrandsForDomain>>() {}.getType(); this.brandsForDomains = getGson().fromJson(json, type); } diff --git a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp index 145658c..f880720 100644 --- a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp +++ b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp @@ -1195,7 +1195,7 @@ <tbody> <tr ng-repeat="brandsForDomain in brandsForDomains"> <td>{{brandsForDomain.domainName}}</td> - <td>{{brandsForDomain.brands}}</td> + <td>{{brandsForDomain.brandsJson}}</td> <td> <a class="btn btn-danger btn-xs" ng-click="removeBrandsForDomain($index)"> <span class="glyphicon glyphicon-remove"></span> @@ -1219,7 +1219,7 @@ </div> <div class="form-group col-xs-5"> <label for="brandsForDomainBrands" class="control-label">Marques :</label> - <input id="brandsForDomainBrands" name="newBrandsForDomainBrands" type="text" class="form-control" ng-model="newBrandsForDomain.brands" ng-minlength="1" /> + <input id="brandsForDomainBrands" name="newBrandsForDomainBrands" type="text" class="form-control" ng-model="newBrandsForDomain.brands" ng-list ng-minlength="1" /> </div> <div class="form-group col-xs-2"> <br/> diff --git a/faxtomail-ui-web/src/main/webapp/js/configuration.js b/faxtomail-ui-web/src/main/webapp/js/configuration.js index fa4f193..5b5dc75 100644 --- a/faxtomail-ui-web/src/main/webapp/js/configuration.js +++ b/faxtomail-ui-web/src/main/webapp/js/configuration.js @@ -1230,10 +1230,16 @@ ConfigurationModule.controller('ConfigurationBrandsForDomainController', ['$scop // ajout d'un nouveau domaine $scope.addBrandsForDomain = function() { - console.log($scope.newBrandsForDomain); - $scope.brandsForDomains.push($scope.newBrandsForDomain); - $scope.newBrandsForDomain = {}; - $scope.addBrandsForDomainForm.$setPristine(); + if ($scope.brandsForDomains.indexOfBy('domainName', $scope.newBrandsForDomain) != -1) { + $window.alert("Ce nom de domaine est déjà configuré !"); + + } else { + var newBrandsForDomain = $scope.newBrandsForDomain; + newBrandsForDomain.brandsJson = newBrandsForDomain.brands.toString(); + $scope.brandsForDomains.push(newBrandsForDomain); + $scope.newBrandsForDomain = {}; + $scope.addBrandsForDomainForm.$setPristine(); + } }; // suppression d'un domaine -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See http://git.codelutin.com/faxtomail.git commit 67d677b38c60acd24d62126292c9fe8ea16bf264 Author: Kevin Morin <morin@codelutin.com> Date: Wed May 6 11:47:55 2015 +0200 fix migration scripts --- .../persistence/entities/BrandsForDomainImpl.java | 24 ++++++++++++++++++++++ .../src/main/resources/faxToMail.properties | 2 +- .../src/main/xmi/faxtomail.properties | 10 +++------ .../faxtomail/services/DecoratorServiceImpl.java | 2 +- .../services/service/InitFaxToMailServiceImpl.java | 2 +- ...s_for_domain_and_matching_clients_in_emails.sql | 4 ++-- ...s_for_domain_and_matching_clients_in_emails.sql | 4 ++-- .../src/main/webapp/js/configuration.js | 2 +- 8 files changed, 35 insertions(+), 15 deletions(-) diff --git a/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/BrandsForDomainImpl.java b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/BrandsForDomainImpl.java index 03d42b6..6d8eec9 100644 --- a/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/BrandsForDomainImpl.java +++ b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/BrandsForDomainImpl.java @@ -1,5 +1,29 @@ package com.franciaflex.faxtomail.persistence.entities; +/* + * #%L + * FaxToMail :: Persistence + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2014 - 2015 Mac-Groupe, Code Lutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import com.google.common.collect.Lists; import org.apache.commons.lang3.StringUtils; diff --git a/faxtomail-persistence/src/main/resources/faxToMail.properties b/faxtomail-persistence/src/main/resources/faxToMail.properties index 8c53b23..30dae76 100644 --- a/faxtomail-persistence/src/main/resources/faxToMail.properties +++ b/faxtomail-persistence/src/main/resources/faxToMail.properties @@ -31,7 +31,7 @@ hibernate.connection.password= #hibernate.dialect=org.hibernate.dialect.SQLServer2008Dialect #hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver -#hibernate.connection.url=jdbc:jtds:sqlserver://192.168.100.176:1433/faxtomail +#hibernate.connection.url=jdbc:jtds:sqlserver://192.168.100.247:1433/faxtomailtest #hibernate.connection.username=fx #hibernate.connection.password=FX2013! diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.properties b/faxtomail-persistence/src/main/xmi/faxtomail.properties index e3aa8ae..f101632 100644 --- a/faxtomail-persistence/src/main/xmi/faxtomail.properties +++ b/faxtomail-persistence/src/main/xmi/faxtomail.properties @@ -87,8 +87,7 @@ com.franciaflex.faxtomail.persistence.entities.MailFolder.attribute.folderTableC # MailFilter com.franciaflex.faxtomail.persistence.entities.MailFilter.attribute.expression.tagvalue.naturalId=true com.franciaflex.faxtomail.persistence.entities.MailFilter.attribute.mailFolder.tagvalue.notNull=true -#�TODO echatellier 20141003 : wrong property, fix it with stereotype=unique -com.franciaflex.faxtomail.persistence.entities.MailFilter.attribute.position.tagvalue.unique=true +com.franciaflex.faxtomail.persistence.entities.MailFilter.attribute.position.stereotype=unique # Email com.franciaflex.faxtomail.persistence.entities.Email.attribute.mailFolder.tagvalue.notNull=true @@ -116,7 +115,6 @@ com.franciaflex.faxtomail.persistence.entities.EmailGroup.attribute.email.stereo # History com.franciaflex.faxtomail.persistence.entities.History.attribute.type.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.History.attribute.fields.stereotype=unique # FaxToMailUser com.franciaflex.faxtomail.persistence.entities.FaxToMailUser.attribute.login.tagvalue.naturalId=true @@ -130,9 +128,7 @@ com.franciaflex.faxtomail.persistence.entities.GroupChef.attribute.userGroup.tag # MailLock com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockBy.tagvalue.notNull=true com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.tagvalue.notNull=true -#�TODO echatellier 20141003 : wrong property, fix it with stereotype=unique -com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.tagvalue.unique=true +com.franciaflex.faxtomail.persistence.entities.MailLock.attribute.lockOn.stereotype=unique # BrandsForDomain -com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domain.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domain.stereotype=unique \ No newline at end of file +com.franciaflex.faxtomail.persistence.entities.BrandsForDomain.attribute.domainName.tagvalue.notNull=true \ No newline at end of file diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java index 7492b13..18c6ceb 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorServiceImpl.java @@ -139,7 +139,7 @@ public class DecoratorServiceImpl extends FaxToMailServiceSupport implements Dec }); registerMultiJXPathDecorator(Reply.class, "${sentDate}$s#${subject}$s", SEPARATOR, " - "); registerMultiJXPathDecorator(FaxToMailUser.class, "${lastName}$s#${firstName}$s#${trigraph}$s", SEPARATOR, " "); - registerMultiJXPathDecorator(Client.class, "${code}$s#${name}$s#${company}$s", SEPARATOR, " - "); + registerMultiJXPathDecorator(Client.class, "${code}$s#${name}$s#${brand}$s", SEPARATOR, " - "); } }; } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java index cab3a51..540f52d 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java @@ -442,7 +442,7 @@ public class InitFaxToMailServiceImpl extends FaxToMailServiceSupport implements Email.PROPERTY_MAIL_FOLDER, folder, Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED, Email.PROPERTY_HISTORY, Lists.newArrayList(history), - Email.PROPERTY_ORIGINAL_EMAIL, "Demo data"); + Email.PROPERTY_ORIGINAL_EMAIL, originalEmailDao.create(OriginalEmail.PROPERTY_CONTENT, "Demo data")); if (opened) { diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql b/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql index 47155d7..7cda815 100644 --- a/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql +++ b/faxtomail-service/src/main/resources/db/migration/h2/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql @@ -1,10 +1,10 @@ -- add brands for domain -CREATE TABLE BrandsForDomain ( +CREATE TABLE brandsForDomain ( topiaId VARCHAR(255) NOT NULL, topiaVersion BIGINT NOT NULL, topiaCreateDate TIMESTAMP, - domainName longvarchar NOT NULL UNIQUE, + domainName longvarchar NOT NULL, brandsJson longvarchar, PRIMARY KEY (topiaId) ); diff --git a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql index 6efe734..d3028f0 100644 --- a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql +++ b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_2_0_761__add_brands_for_domain_and_matching_clients_in_emails.sql @@ -1,10 +1,10 @@ -- add brands for domain -CREATE TABLE BrandsForDomain ( +CREATE TABLE brandsForDomain ( topiaId VARCHAR(255) NOT NULL, topiaVersion BIGINT NOT NULL, topiaCreateDate datetime2, - domainName VARCHAR(MAX) NOT NULL UNIQUE, + domainName VARCHAR(255) NOT NULL, brandsJson VARCHAR(MAX), PRIMARY KEY (topiaId) ); diff --git a/faxtomail-ui-web/src/main/webapp/js/configuration.js b/faxtomail-ui-web/src/main/webapp/js/configuration.js index 5b5dc75..a51a010 100644 --- a/faxtomail-ui-web/src/main/webapp/js/configuration.js +++ b/faxtomail-ui-web/src/main/webapp/js/configuration.js @@ -1232,7 +1232,7 @@ ConfigurationModule.controller('ConfigurationBrandsForDomainController', ['$scop $scope.addBrandsForDomain = function() { if ($scope.brandsForDomains.indexOfBy('domainName', $scope.newBrandsForDomain) != -1) { $window.alert("Ce nom de domaine est déjà configuré !"); - + } else { var newBrandsForDomain = $scope.newBrandsForDomain; newBrandsForDomain.brandsJson = newBrandsForDomain.brands.toString(); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See http://git.codelutin.com/faxtomail.git commit 2aa851dd8ab318d8e65fc859ba0b0a183e8ecd88 Merge: 17a58d5 67d677b Author: Kevin Morin <morin@codelutin.com> Date: Wed May 6 11:48:44 2015 +0200 fixes #7060 Authentification des clients des éléments (noms de domaines par marque) .gitignore | 1 + .../persistence/entities/BrandsForDomainImpl.java | 35 +- .../src/main/resources/faxToMail.properties | 2 +- .../src/main/xmi/faxtomail.properties | 10 +- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 30153 -> 31055 bytes .../faxtomail/services/DecoratorServiceImpl.java | 2 + .../services/FaxToMailServiceSupport.java | 1 + .../faxtomail/services/service/ClientService.java | 4 +- .../services/service/ClientServiceImpl.java | 34 +- .../services/service/ConfigurationService.java | 8 +- .../services/service/ConfigurationServiceImpl.java | 48 +- .../services/service/EmailServiceImpl.java | 1 + .../services/service/InitFaxToMailServiceImpl.java | 25 +- ...s_for_domain_and_matching_clients_in_emails.sql | 29 + ...s_for_domain_and_matching_clients_in_emails.sql | 32 + .../services/service/ClientServiceTest.java | 37 +- .../ui/swing/content/demande/DemandeUI.css | 5 + .../ui/swing/content/demande/DemandeUI.jaxx | 25 +- .../ui/swing/content/demande/DemandeUIHandler.java | 25 +- .../ui/swing/content/demande/DemandeUIModel.java | 14 +- .../src/main/resources/icons/action-warning.png | Bin 0 -> 666 bytes .../web/action/admin/ConfigurationAction.java | 17 +- .../faxtomail/web/job/MailFilterJob.java | 17 +- .../WEB-INF/content/admin/configuration-input.jsp | 53 + .../src/main/webapp/js/configuration.js | 32 + pom.xml | 2 +- trunk/LICENSE.txt | 674 --------- trunk/README.txt | 0 trunk/faxtomail-persistence/LICENSE.txt | 674 --------- trunk/faxtomail-persistence/README.txt | 0 trunk/faxtomail-persistence/pom.xml | 165 --- .../src/license/THIRD-PARTY.properties | 53 - .../faxtomail/FaxToMailConfiguration.java | 426 ------ .../faxtomail/FaxToMailConfigurationOption.java | 385 ----- .../faxtomail/FaxToMailConfigurationProvider.java | 62 - .../faxtomail/persistence/ProgressionModel.java | 48 - .../persistence/RessourceClassLoader.java | 189 --- .../entities/AbstractFaxToMailTopiaDao.java | 61 - .../persistence/entities/AttachmentFileImpl.java | 115 -- .../faxtomail/persistence/entities/ClientImpl.java | 65 - .../persistence/entities/ClientTopiaDao.java | 58 - .../persistence/entities/DemandStatus.java | 62 - .../faxtomail/persistence/entities/EdiReturn.java | 38 - .../persistence/entities/EmailFilter.java | 303 ---- .../faxtomail/persistence/entities/EmailImpl.java | 201 --- .../persistence/entities/EmailProtocol.java | 44 - .../persistence/entities/EmailTopiaDao.java | 1027 ------------- .../entities/ExtensionCommandTopiaDao.java | 42 - .../persistence/entities/HistoryImpl.java | 52 - .../persistence/entities/HistoryType.java | 63 - .../faxtomail/persistence/entities/MailAction.java | 37 - .../faxtomail/persistence/entities/MailField.java | 100 -- .../persistence/entities/MailFilterTopiaDao.java | 50 - .../persistence/entities/MailFolderImpl.java | 66 - .../persistence/entities/MailFolderTopiaDao.java | 75 - .../faxtomail/persistence/entities/NewClient.java | 45 - .../persistence/entities/SearchFilter.java | 461 ------ .../persistence/entities/WaitingStateTopiaDao.java | 87 -- .../persistence/hibernate/EnumListUserType.java | 155 -- .../persistence/hibernate/EnumSetUserType.java | 161 -- .../hibernate/MailActionEnumSetUserType.java | 35 - .../hibernate/MailFieldEnumListUserType.java | 35 - .../hibernate/MailFieldEnumSetUserType.java | 35 - .../org.nuiton.config.ApplicationConfigProvider | 1 - .../src/main/resources/faxToMail.properties | 43 - .../i18n/faxtomail-persistence_fr_FR.properties | 46 - .../src/main/xmi/faxtomail.properties | 130 -- .../src/main/xmi/faxtomail.zargo | Bin 29652 -> 0 bytes trunk/faxtomail-service/LICENSE.txt | 674 --------- trunk/faxtomail-service/README.txt | 0 trunk/faxtomail-service/pom.xml | 234 --- .../src/license/THIRD-PARTY.properties | 37 - .../faxtomail/services/DecoratorService.java | 46 - .../faxtomail/services/DecoratorServiceImpl.java | 143 -- .../faxtomail/services/FaxToMailDecorator.java | 285 ---- .../faxtomail/services/FaxToMailService.java | 30 - .../services/FaxToMailServiceContext.java | 260 ---- .../services/FaxToMailServiceFactory.java | 36 - .../FaxToMailServiceInvocationHandler.java | 58 - .../services/FaxToMailServiceSupport.java | 85 -- .../faxtomail/services/FaxToMailServiceUtils.java | 77 - .../faxtomail/services/service/ClientService.java | 40 - .../services/service/ClientServiceImpl.java | 284 ---- .../services/service/ConfigurationService.java | 71 - .../services/service/ConfigurationServiceImpl.java | 606 -------- .../faxtomail/services/service/EmailService.java | 139 -- .../services/service/EmailServiceImpl.java | 1532 -------------------- .../services/service/InitFaxToMailService.java | 34 - .../services/service/InitFaxToMailServiceImpl.java | 465 ------ .../faxtomail/services/service/LdapService.java | 42 - .../services/service/LdapServiceImpl.java | 395 ----- .../services/service/MailFolderService.java | 65 - .../services/service/MailFolderServiceImpl.java | 328 ----- .../services/service/ReferentielService.java | 68 - .../services/service/ReferentielServiceImpl.java | 373 ----- .../faxtomail/services/service/UserService.java | 56 - .../services/service/UserServiceImpl.java | 95 -- .../services/service/ValidationService.java | 36 - .../services/service/ValidationServiceImpl.java | 48 - .../exceptions/AlreadyLockedMailException.java | 49 - .../exceptions/FolderNotReadableException.java | 44 - .../service/exceptions/InvalidClientException.java | 41 - .../service/imports/ArchiveImportBean.java | 73 - .../service/imports/ArchiveImportModel.java | 129 -- .../services/service/imports/ClientImportBean.java | 56 - .../service/imports/ClientImportModel.java | 92 -- .../service/imports/DemandTypeImportModel.java | 47 - .../service/imports/EmailAccountImportModel.java | 72 - .../service/imports/EmailFilterImportModel.java | 64 - .../service/imports/PriorityImportModel.java | 47 - .../services/service/imports/RangeImportModel.java | 47 - .../service/imports/WaitingStateImportModel.java | 47 - .../service/ldap/AuthenticationException.java | 36 - .../services/service/ldap/LdapServiceMock.java | 115 -- .../migration/FaxtomailFlywayMigrationService.java | 57 - .../validators/FaxToMailEmailValidator.java | 42 - .../entities/Email-error-validation.xml | 51 - ..._0_442__move_object_to_folder_configuration.sql | 60 - ..._0_448__add_mail_folder_level_configuration.sql | 6 - .../migration/h2/V1_0_0_454__add_ldap_config.sql | 6 - ...omailusergroup_loop_association_and_add_idx.sql | 39 - .../h2/V1_0_0_520__add_performance_indexes.sql | 18 - .../h2/V1_0_0_580__transform_enum_set_to_lists.sql | 25 - .../V1_0_0_583__readd_editranfer_on_demandtype.sql | 4 - .../h2/V1_0_0_597__mise_a_jour_performances.sql | 81 -- ...1_0_0_620__modification_newclient_edireturn.sql | 43 - .../h2/V1_0_0_662__add_company_in_mailfolder.sql | 5 - ..._0_442__move_object_to_folder_configuration.sql | 60 - ..._0_448__add_mail_folder_level_configuration.sql | 6 - .../postgres/V1_0_0_454__add_ldap_config.sql | 6 - ...omailusergroup_loop_association_and_add_idx.sql | 39 - .../V1_0_0_520__add_performance_indexes.sql | 18 - .../V1_0_0_580__transform_enum_set_to_lists.sql | 25 - .../V1_0_0_583__readd_editranfer_on_demandtype.sql | 4 - .../V1_0_0_597__mise_a_jour_performances.sql | 81 -- ...1_0_0_620__modification_newclient_edireturn.sql | 43 - .../V1_0_0_662__add_company_in_mailfolder.sql | 5 - ..._0_442__move_object_to_folder_configuration.sql | 66 - ..._0_448__add_mail_folder_level_configuration.sql | 7 - .../sqlserver/V1_0_0_454__add_ldap_config.sql | 7 - ...omailusergroup_loop_association_and_add_idx.sql | 47 - .../V1_0_0_520__add_performance_indexes.sql | 18 - .../V1_0_0_580__transform_enum_set_to_lists.sql | 33 - .../V1_0_0_583__readd_editranfer_on_demandtype.sql | 5 - .../V1_0_0_597__mise_a_jour_performances.sql | 90 -- ...1_0_0_620__modification_newclient_edireturn.sql | 50 - .../V1_0_0_662__add_company_in_mailfolder.sql | 6 - .../i18n/faxtomail-service_fr_FR.properties | 6 - .../src/main/resources/pdf/demande.mustache | 124 -- .../src/main/resources/validators.xml | 51 - .../service/AbstractFaxToMailServiceTest.java | 253 ---- .../services/service/ClientServiceTest.java | 123 -- .../services/service/EmailServiceTest.java | 217 --- .../faxtomail/services/service/InitTestData.java | 38 - .../services/service/InitTestDataImpl.java | 354 ----- .../services/service/MailFolderServiceTest.java | 82 -- .../faxtomail/services/service/MiscTest.java | 83 -- .../service/migration/FlywayMigrationTest.java | 117 -- .../src/test/resources/archives/archives.csv | 2 - .../src/test/resources/archives/att1.txt | 1 - .../src/test/resources/archives/att2.txt | 1 - .../src/test/resources/csv/clients.csv | 5 - .../src/test/resources/csv/demandtypes.csv | 4 - .../src/test/resources/csv/email_accounts.csv | 2 - .../src/test/resources/csv/email_filters.csv | 8 - .../src/test/resources/csv/etatattentes.csv | 6 - .../src/test/resources/csv/fx_clients.csv | 5 - .../src/test/resources/csv/priorities.csv | 5 - .../src/test/resources/csv/ranges.csv | 6 - .../src/test/resources/db/h2data-1_0_0_rc2.h2.db | Bin 509952 -> 0 bytes .../src/test/resources/log4j2.xml | 42 - trunk/faxtomail-ui-swing/LICENSE.txt | 674 --------- trunk/faxtomail-ui-swing/README.txt | 0 trunk/faxtomail-ui-swing/pom.xml | 764 ---------- .../src/license/THIRD-PARTY.properties | 69 - .../src/main/assembly/faxtomail-full-component.xml | 108 -- .../src/main/assembly/full-linux-i586.xml | 53 - .../src/main/assembly/full-linux-x64.xml | 53 - .../src/main/assembly/full-windows-i586.xml | 53 - .../src/main/assembly/full-windows-x64.xml | 52 - .../src/main/assembly/full/faxtomail.bat | 27 - .../src/main/assembly/full/faxtomail.sh | 51 - .../faxtomail-ui-swing/src/main/assembly/i18n.xml | 53 - .../src/main/assembly/min/README.txt | 0 .../src/main/assembly/min/launch.bat | 10 - .../src/main/assembly/min/launch.sh | 35 - .../src/main/assembly/standalone.xml | 74 - .../main/filtered-resources/faxToMail.properties | 25 - .../faxtomail/ui/swing/FaxToMailActionFactory.java | 58 - .../faxtomail/ui/swing/FaxToMailScreen.java | 37 - .../faxtomail/ui/swing/FaxToMailUIContext.java | 768 ---------- .../faxtomail/ui/swing/RunFaxToMail.java | 181 --- .../swing/actions/AbstractChangeScreenAction.java | 121 -- .../ui/swing/actions/AbstractFaxToMailAction.java | 80 - .../actions/AbstractMainUIFaxToMailAction.java | 38 - .../ui/swing/actions/AddAttachmentAction.java | 72 - .../swing/actions/AddAttachmentToReplyAction.java | 70 - .../faxtomail/ui/swing/actions/ArchiveAction.java | 106 -- .../ui/swing/actions/ArchiveFromListAction.java | 152 -- .../ui/swing/actions/CloseApplicationAction.java | 55 - .../actions/ComputeQuantitiesByRangeAction.java | 94 -- .../ui/swing/actions/EditAttachmentAction.java | 99 -- .../actions/GenerateAnnotatedAttachmentAction.java | 337 ----- .../ui/swing/actions/GoToPreviousScreenAction.java | 43 - .../faxtomail/ui/swing/actions/GroupAction.java | 94 -- .../ui/swing/actions/LoadFolderEmailsAction.java | 187 --- .../ui/swing/actions/OpenAttachmentAction.java | 61 - .../ui/swing/actions/OpenGroupedDemandAction.java | 176 --- .../OpenMailFolderChooserFromListAction.java | 109 -- .../swing/actions/PrintOnDefaultPrinterAction.java | 187 --- .../ui/swing/actions/ReloadFaxToMailAction.java | 49 - .../faxtomail/ui/swing/actions/ReplyAction.java | 92 -- .../SaveAndOpenChooseAttachmentToPrintAction.java | 68 - .../SaveAndOpenMailFolderChooserAction.java | 68 - .../swing/actions/SaveAndOpenModalFrameAction.java | 66 - .../swing/actions/SaveAndOpenReplyFormAction.java | 76 - .../actions/SaveAndOpenSearchToGroupAction.java | 59 - .../ui/swing/actions/SaveDemandeAction.java | 151 -- .../ui/swing/actions/SaveDemandeAndExitAction.java | 44 - .../swing/actions/SaveDemandeFromListAction.java | 72 - .../faxtomail/ui/swing/actions/SearchAction.java | 109 -- .../ui/swing/actions/SearchToGroupAction.java | 120 -- .../ui/swing/actions/ShowAboutAction.java | 91 -- .../ui/swing/actions/ShowDemandeAction.java | 170 --- .../ui/swing/actions/ShowDemandeListAction.java | 52 - .../ui/swing/actions/ShowRechercheAction.java | 47 - .../faxtomail/ui/swing/actions/TransmitAction.java | 140 -- .../faxtomail/ui/swing/content/Common.css | 26 - .../faxtomail/ui/swing/content/MainUI.css | 86 -- .../faxtomail/ui/swing/content/MainUI.jaxx | 68 - .../faxtomail/ui/swing/content/MainUIHandler.java | 391 ----- .../content/attachment/AttachmentCellEditor.java | 190 --- .../content/attachment/AttachmentCellRenderer.java | 120 -- .../content/attachment/AttachmentEditorUI.css | 59 - .../content/attachment/AttachmentEditorUI.jaxx | 72 - .../attachment/AttachmentEditorUIHandler.java | 262 ---- .../attachment/AttachmentEditorUIModel.java | 135 -- .../ui/swing/content/attachment/AttachmentItem.css | 61 - .../swing/content/attachment/AttachmentItem.jaxx | 51 - .../content/attachment/AttachmentModelAware.java | 49 - .../swing/content/attachment/ButtonAttachment.java | 112 -- .../content/demande/DemandeListTableFilter.java | 302 ---- .../ui/swing/content/demande/DemandeListUI.css | 156 -- .../ui/swing/content/demande/DemandeListUI.jaxx | 120 -- .../content/demande/DemandeListUIHandler.java | 636 -------- .../swing/content/demande/DemandeListUIModel.java | 290 ---- .../ui/swing/content/demande/DemandeUI.css | 342 ----- .../ui/swing/content/demande/DemandeUI.jaxx | 336 ----- .../ui/swing/content/demande/DemandeUIHandler.java | 535 ------- .../ui/swing/content/demande/DemandeUIModel.java | 969 ------------- .../ui/swing/content/demande/DemandesUI.css | 71 - .../ui/swing/content/demande/DemandesUI.jaxx | 66 - .../swing/content/demande/DemandesUIHandler.java | 346 ----- .../ui/swing/content/demande/DemandesUIModel.java | 176 --- .../swing/content/demande/QuantitiesByRangeUI.css | 30 - .../swing/content/demande/QuantitiesByRangeUI.jaxx | 53 - .../demande/QuantitiesByRangeUIHandler.java | 119 -- .../content/demande/QuantitiesByRangeUIModel.java | 66 - .../ui/swing/content/demande/RangeRowModel.java | 127 -- .../ui/swing/content/demande/RangeTableModel.java | 79 - .../demande/demandgroup/ButtonEmailGroup.java | 71 - .../demandgroup/DemandGroupCellRenderer.java | 106 -- .../demande/demandgroup/DemandGroupItem.css | 40 - .../demande/demandgroup/DemandGroupItem.jaxx | 50 - .../content/demande/demandgroup/DemandGroupUI.css | 34 - .../content/demande/demandgroup/DemandGroupUI.jaxx | 46 - .../demande/demandgroup/DemandGroupUIHandler.java | 181 --- .../content/demande/history/ButtonHistory.java | 86 -- .../swing/content/demande/history/HistoryItem.css | 63 - .../swing/content/demande/history/HistoryItem.jaxx | 60 - .../content/demande/history/HistoryItemModel.java | 103 -- .../content/demande/history/HistoryListUI.css | 30 - .../content/demande/history/HistoryListUI.jaxx | 44 - .../demande/history/HistoryListUIHandler.java | 233 --- .../demande/replies/ButtonDemandReplies.java | 102 -- .../content/demande/replies/DemandRepliesUI.css | 42 - .../content/demande/replies/DemandRepliesUI.jaxx | 49 - .../demande/replies/DemandRepliesUIHandler.java | 373 ----- .../content/demande/replies/DemandReplyItem.css | 51 - .../content/demande/replies/DemandReplyItem.jaxx | 58 - .../content/demande/replies/RepliesCellEditor.java | 133 -- .../demande/replies/RepliesCellRenderer.java | 108 -- .../swing/content/pdfeditor/PDFEditorCrossUI.css | 39 - .../swing/content/pdfeditor/PDFEditorCrossUI.jaxx | 63 - .../content/pdfeditor/PDFEditorHighlighterUI.css | 38 - .../content/pdfeditor/PDFEditorHighlighterUI.jaxx | 51 - .../ui/swing/content/pdfeditor/PDFEditorLineUI.css | 38 - .../swing/content/pdfeditor/PDFEditorLineUI.jaxx | 69 - .../ui/swing/content/pdfeditor/PDFEditorNoteUI.css | 56 - .../swing/content/pdfeditor/PDFEditorNoteUI.jaxx | 84 -- .../ui/swing/content/pdfeditor/PDFEditorUI.css | 128 -- .../ui/swing/content/pdfeditor/PDFEditorUI.jaxx | 104 -- .../content/pdfeditor/PDFEditorUIHandler.java | 584 -------- .../swing/content/pdfeditor/PDFEditorUIModel.java | 273 ---- .../content/print/AttachmentToPrintChooserUI.css | 40 - .../content/print/AttachmentToPrintChooserUI.jaxx | 62 - .../print/AttachmentToPrintChooserUIHandler.java | 177 --- .../print/AttachmentToPrintChooserUIModel.java | 76 - .../ui/swing/content/reply/AttachmentItem.css | 49 - .../ui/swing/content/reply/AttachmentItem.jaxx | 50 - .../swing/content/reply/ReplyAttachmentModel.java | 82 -- .../ui/swing/content/reply/ReplyFormUI.css | 150 -- .../ui/swing/content/reply/ReplyFormUI.jaxx | 171 --- .../ui/swing/content/reply/ReplyFormUIHandler.java | 440 ------ .../ui/swing/content/reply/ReplyFormUIModel.java | 357 ----- .../ui/swing/content/search/SearchToGroupUI.css | 333 ----- .../ui/swing/content/search/SearchToGroupUI.jaxx | 399 ----- .../content/search/SearchToGroupUIHandler.java | 383 ----- .../faxtomail/ui/swing/content/search/SearchUI.css | 332 ----- .../ui/swing/content/search/SearchUI.jaxx | 413 ------ .../ui/swing/content/search/SearchUIHandler.java | 354 ----- .../ui/swing/content/search/SearchUIModel.java | 471 ------ .../swing/content/transmit/MailFolderChooserUI.css | 47 - .../content/transmit/MailFolderChooserUI.jaxx | 54 - .../transmit/MailFolderChooserUIHandler.java | 144 -- .../content/transmit/MailFolderChooserUIModel.java | 68 - .../swing/util/AbstractFaxToMailBeanUIModel.java | 155 -- .../util/AbstractFaxToMailDemandListHandler.java | 349 ----- .../ui/swing/util/AbstractFaxToMailUIHandler.java | 489 ------- .../ui/swing/util/AbstractToolbarPopupButton.java | 116 -- .../ui/swing/util/AbstractToolbarPopupHandler.java | 150 -- .../ui/swing/util/AbstractToolbarPopupUI.css | 27 - .../ui/swing/util/AbstractToolbarPopupUI.jaxx | 56 - .../ui/swing/util/CheckBoxComboBoxModel.java | 81 -- .../ui/swing/util/CheckBoxListCellRenderer.java | 526 ------- .../faxtomail/ui/swing/util/DemandeTableModel.java | 199 --- .../ui/swing/util/FaxToMailExceptionHandler.java | 87 -- .../faxtomail/ui/swing/util/FaxToMailUI.java | 35 - .../faxtomail/ui/swing/util/FaxToMailUIUtil.java | 720 --------- .../faxtomail/ui/swing/util/FolderTreeNode.java | 67 - .../faxtomail/ui/swing/util/JImagePanel.java | 171 --- .../ui/swing/util/PaginationComboModel.java | 40 - .../util/RemoveablePropertyChangeListener.java | 33 - .../faxtomail/ui/swing/util/UIMessageNotifier.java | 33 - .../src/main/resources/PoetsenOne-Regular.ttf | Bin 172456 -> 0 bytes .../demande/DemandeUIModel-error-validation.xml | 111 -- .../reply/ReplyFormUIModel-error-validation.xml | 74 - .../i18n/faxtomail-ui-swing_fr_FR.properties | 332 ----- .../src/main/resources/icons/action-about.png | Bin 936 -> 0 bytes .../src/main/resources/icons/action-archive.png | Bin 766 -> 0 bytes .../src/main/resources/icons/action-attachment.png | Bin 391 -> 0 bytes .../src/main/resources/icons/action-cancel.png | Bin 587 -> 0 bytes .../src/main/resources/icons/action-collapse.png | Bin 372 -> 0 bytes .../src/main/resources/icons/action-compute.png | Bin 543 -> 0 bytes .../src/main/resources/icons/action-config.png | Bin 611 -> 0 bytes .../src/main/resources/icons/action-cross.png | Bin 626 -> 0 bytes .../src/main/resources/icons/action-delete.png | Bin 715 -> 0 bytes .../src/main/resources/icons/action-edit.png | Bin 450 -> 0 bytes .../main/resources/icons/action-email-group.png | Bin 821 -> 0 bytes .../src/main/resources/icons/action-email.png | Bin 783 -> 0 bytes .../src/main/resources/icons/action-exit.png | Bin 830 -> 0 bytes .../src/main/resources/icons/action-expand.png | Bin 371 -> 0 bytes .../main/resources/icons/action-folder_edit.png | Bin 733 -> 0 bytes .../src/main/resources/icons/action-group.png | Bin 343 -> 0 bytes .../main/resources/icons/action-highlighter.png | Bin 155 -> 0 bytes .../src/main/resources/icons/action-hline.png | Bin 344 -> 0 bytes .../src/main/resources/icons/action-import.png | Bin 532 -> 0 bytes .../src/main/resources/icons/action-left.png | Bin 345 -> 0 bytes .../src/main/resources/icons/action-line.png | Bin 344 -> 0 bytes .../src/main/resources/icons/action-list.png | Bin 675 -> 0 bytes .../src/main/resources/icons/action-new-demand.png | Bin 512 -> 0 bytes .../src/main/resources/icons/action-note.png | Bin 500 -> 0 bytes .../src/main/resources/icons/action-open-file.png | Bin 537 -> 0 bytes .../src/main/resources/icons/action-open.png | Bin 688 -> 0 bytes .../src/main/resources/icons/action-print.png | Bin 731 -> 0 bytes .../resources/icons/action-reload-application.png | Bin 525 -> 0 bytes .../resources/icons/action-reload-shortcut.png | Bin 570 -> 0 bytes .../src/main/resources/icons/action-reload-ui.png | Bin 795 -> 0 bytes .../src/main/resources/icons/action-reply.png | Bin 754 -> 0 bytes .../src/main/resources/icons/action-right.png | Bin 349 -> 0 bytes .../icons/action-rotate-anticlockwise.png | Bin 608 -> 0 bytes .../resources/icons/action-rotate-clockwise.png | Bin 602 -> 0 bytes .../src/main/resources/icons/action-save.png | Bin 620 -> 0 bytes .../src/main/resources/icons/action-search.png | Bin 692 -> 0 bytes .../src/main/resources/icons/action-transmit.png | Bin 694 -> 0 bytes .../src/main/resources/icons/action-user.png | Bin 741 -> 0 bytes .../src/main/resources/icons/action-validate.png | Bin 537 -> 0 bytes .../main/resources/icons/action-view-history.png | Bin 711 -> 0 bytes .../src/main/resources/icons/action-vline.png | Bin 370 -> 0 bytes .../src/main/resources/icons/action-zoom-in.png | Bin 680 -> 0 bytes .../src/main/resources/icons/action-zoom-out.png | Bin 657 -> 0 bytes .../src/main/resources/icons/add.png | Bin 733 -> 0 bytes .../src/main/resources/icons/application_home.png | Bin 685 -> 0 bytes .../src/main/resources/icons/cross_blue.png | Bin 2745 -> 0 bytes .../src/main/resources/icons/cross_red.png | Bin 1743 -> 0 bytes .../src/main/resources/icons/email.png | Bin 641 -> 0 bytes .../src/main/resources/icons/house.png | Bin 806 -> 0 bytes .../src/main/resources/log4j2.xml | 55 - .../src/main/resources/splashscreen.png | Bin 25809 -> 0 bytes trunk/faxtomail-ui-web/LICENSE.txt | 674 --------- trunk/faxtomail-ui-web/README.txt | 0 trunk/faxtomail-ui-web/pom.xml | 403 ----- .../src/license/THIRD-PARTY.properties | 70 - .../faxtomail/FaxToMailApplicationContext.java | 160 -- .../faxtomail/web/FaxToMailActionSupport.java | 170 --- .../web/FaxToMailApplicationListener.java | 163 --- .../faxtomail/web/FaxToMailInterceptor.java | 219 --- .../faxtomail/web/FaxToMailJsonAction.java | 52 - .../faxtomail/web/FaxToMailJsonResultSupport.java | 80 - .../faxtomail/web/FaxToMailLoginInterceptor.java | 66 - .../faxtomail/web/FaxToMailSession.java | 97 -- .../faxtomail/web/action/IndexAction.java | 44 - .../faxtomail/web/action/LoginAction.java | 76 - .../faxtomail/web/action/LogoutAction.java | 41 - .../web/action/admin/ConfigurationAction.java | 241 --- .../web/action/admin/ConfigurationJsonAction.java | 73 - .../faxtomail/web/action/admin/ImportAction.java | 149 -- .../web/action/admin/ImportArchiveAction.java | 137 -- .../faxtomail/web/action/admin/LdapAction.java | 109 -- .../faxtomail/web/action/admin/LockAction.java | 87 -- .../web/action/admin/UserFolderAction.java | 110 -- .../faxtomail/web/job/AbstractFaxToMailJob.java | 40 - .../faxtomail/web/job/ClientUpdateJob.java | 74 - .../faxtomail/web/job/EDIManagementJob.java | 79 - .../faxtomail/web/job/MailFilterJob.java | 846 ----------- .../web/json/HibernateProxyTypeAdapter.java | 82 -- .../faxtomail/web/json/TopiaEntityAdapter.java | 62 - .../i18n/faxtomail-ui-web_fr_FR.properties | 42 - .../faxtomail-ui-web/src/main/resources/log4j2.xml | 59 - .../src/main/resources/nuiton-js.properties | 34 - .../src/main/resources/quartz.properties | 28 - .../src/main/resources/struts.properties | 40 - .../faxtomail-ui-web/src/main/resources/struts.xml | 66 - .../src/main/resources/validators.xml | 74 - .../src/main/resources/xwork-conversion.properties | 25 - .../WEB-INF/content/admin/configuration-input.jsp | 1249 ---------------- .../WEB-INF/content/admin/import-archive-input.jsp | 66 - .../webapp/WEB-INF/content/admin/import-input.jsp | 91 -- .../webapp/WEB-INF/content/admin/ldap-input.jsp | 56 - .../webapp/WEB-INF/content/admin/ldap-wait.jsp | 44 - .../webapp/WEB-INF/content/admin/lock-input.jsp | 80 - .../WEB-INF/content/admin/user-folder-input.jsp | 93 -- .../src/main/webapp/WEB-INF/content/index.jsp | 51 - .../main/webapp/WEB-INF/content/login-input.jsp | 69 - .../src/main/webapp/WEB-INF/decorators.xml | 34 - .../src/main/webapp/WEB-INF/decorators/layout.jsp | 90 -- .../src/main/webapp/WEB-INF/web.xml | 70 - .../src/main/webapp/WEB-INF/wro.xml | 94 -- .../src/main/webapp/css/faxtomail.css | 94 -- .../src/main/webapp/js/configuration.js | 1330 ----------------- .../src/main/webapp/js/faxtomail.js | 94 -- .../faxtomail-ui-web/src/main/webapp/js/select2.js | 193 --- .../src/main/webapp/js/select2sortable.js | 254 ---- .../src/main/webapp/js/user-folder.js | 116 -- trunk/pom.xml | 875 ----------- trunk/src/site/resources/img/notepad.png | Bin 25930 -> 0 bytes trunk/src/site/resources/img/txt-to-csv.png | Bin 37447 -> 0 bytes trunk/src/site/rst/import.rst | 98 -- trunk/src/site/rst/index.rst | 29 - trunk/src/site/rst/install.rst | 98 -- trunk/src/site/rst/mssql.rst | 41 - trunk/src/site/site_fr.xml | 65 - 452 files changed, 384 insertions(+), 52128 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm