Compare commits

...

182 Commits

Author SHA1 Message Date
Francesco Mangiacrapa ff4e93ca23 Classes to migrate UCD data model 2024-02-02 09:42:12 +01:00
Francesco Mangiacrapa 6a0dc3c447 Added readContextSettings 2024-01-09 16:35:43 +01:00
Francesco Mangiacrapa 92da4837ee created script for updating GNA data model #26349 2024-01-09 12:14:26 +01:00
Francesco Mangiacrapa aeed289ca5 Updated changelog 2023-09-14 10:15:04 +02:00
Francesco Mangiacrapa 76909a2e68 removed -SNAPSHOT to be released 2023-09-11 14:20:07 +02:00
Francesco Mangiacrapa 474b870396 Merge pull request 'Read countByPhase from configuration [#25598]' (#10) from feature_25598 into master
Reviewed-on: #10
2023-09-11 14:19:20 +02:00
Francesco Mangiacrapa 704989f612 Read countByPhase from configuration [#25598] 2023-09-08 12:27:07 +02:00
Francesco Mangiacrapa 2a79c62038 removed -SNAPSHOT to be released 2023-09-05 15:24:07 +02:00
Francesco Mangiacrapa f819b0f10a Reduced/Optimized some LOGs, done [#25539] 2023-08-31 15:24:06 +02:00
Francesco Mangiacrapa 5def5c98fe removed -SNAPSHOT to be released 2023-06-09 11:08:21 +02:00
Francesco Mangiacrapa 93cf772a0c added -SNAPSHOT in the CHANGELOG 2023-06-09 11:00:53 +02:00
Francesco Mangiacrapa 759b2064f4 Passed to maven-parent 1.2.0 and SNAPSHOT version 2023-06-09 10:59:36 +02:00
Francesco Mangiacrapa 06923c3998 Removed -SNAPSHOT to be released 2023-06-09 10:34:31 +02:00
Francesco Mangiacrapa 3440ca8e8a Merge pull request 'feature_25074' (#9) from feature_25074 into master
Reviewed-on: #9
2023-06-05 14:30:06 +02:00
Francesco Mangiacrapa 11190e5605 Updated changelog 2023-06-05 14:28:53 +02:00
Francesco Mangiacrapa e003479415 added serializable 2023-05-25 09:20:18 +02:00
Francesco Mangiacrapa af82f20ca5 Read configuration and deserialization of
"GROUPED_CROSS_FILTERING_LAYERS"
2023-05-24 12:19:02 +02:00
Francesco Mangiacrapa 6a38ebc0c8 Renamed "grouped custom layers" to "grouped overlay layers" 2023-05-23 15:42:51 +02:00
Francesco Mangiacrapa f5785268ef - Integrated the grouped custom layers configuration [#25110] 2023-05-15 15:49:58 +02:00
Francesco Mangiacrapa 57d4ab211a Integrated the grouped custom layers configuration [#25110] 2023-05-15 15:49:36 +02:00
Francesco Mangiacrapa 472e5955d5 removed -SNAPSHOT to be released 2023-05-11 16:14:25 +02:00
Francesco Mangiacrapa 2747ffbb4d Added DELETE_RELATION into enum OPERATION_ON_ITEM 2023-05-11 16:13:56 +02:00
Francesco Mangiacrapa 702b24d3cc removed -SNAPSHOT. Moved to gcube-bom 2.3.0 2023-05-11 15:51:38 +02:00
Francesco Mangiacrapa 606fd1d218 Merge pull request 'task_24166' (#8) from task_24166 into master
Reviewed-on: #8
2023-05-11 15:49:16 +02:00
Francesco Mangiacrapa 2ba86a9f6f merged with branch task_24166 2023-05-11 15:49:06 +02:00
Francesco Mangiacrapa b1fcee1970 Added -SNAPSHOT for merging on master 2023-05-11 15:46:36 +02:00
Francesco Mangiacrapa 8d32c4e85b removed -SNAPSHOT to be released 2023-05-11 15:10:55 +02:00
Francesco Mangiacrapa 6b63090ec4 improved toSpatialReference method 2023-05-04 16:10:24 +02:00
Francesco Mangiacrapa 39f084b5c5 Updated list of operations 2023-05-03 10:53:21 +02:00
Francesco Mangiacrapa 0fd55e8a58 Integrated with the Geoportal_Resolver service [#25031] 2023-05-02 17:56:30 +02:00
Francesco Mangiacrapa f0508b4fd9 Updated "deleteFileset" added "ignoreErrors" parameter 2023-04-26 14:14:54 +02:00
Francesco Mangiacrapa 3db873b17e updated Test cases 2023-04-26 11:26:18 +02:00
Francesco Mangiacrapa f51896e28d updated 2023-04-18 09:38:46 +02:00
Francesco Mangiacrapa d58d933816 in progress on #24166 2023-04-17 16:02:18 +02:00
Francesco Mangiacrapa 9cbd162c40 Updated pom 2023-04-12 17:59:34 +02:00
Francesco Mangiacrapa b7f1e61b04 Pushed script for #24793 2023-04-12 17:49:43 +02:00
Francesco Mangiacrapa 9daa4bd3bc updated 2023-03-27 16:47:33 +02:00
Francesco Mangiacrapa 288756e686 Script completed for resynching Mongo -> PostGis -> Geoserver 2023-03-27 16:41:51 +02:00
Francesco Mangiacrapa 026fd35fd6 Added test classes 2023-03-17 16:41:33 +01:00
Francesco Mangiacrapa 6dd3cb4b79 Removed -SNAPSHOT to be released. Added gcube-bom 2.1.0 2023-03-07 11:05:40 +01:00
Francesco Mangiacrapa dc1a0146e5 Merge pull request 'task_24567' (#7) from task_24567 into master
Reviewed-on: #7
2023-03-07 11:04:06 +01:00
Francesco Mangiacrapa 4e19c5cdd0 Added gcube-bom 2.2.0-SNAPSHOT 2023-03-07 11:00:59 +01:00
Francesco Mangiacrapa 0e44b11c2a updated 2023-03-06 15:49:46 +01:00
Francesco Mangiacrapa acae9ffb77 - [#24569] Added the phase DRAFT in the enum (also required for #24571) 2023-02-09 12:37:29 +01:00
Francesco Mangiacrapa 62ce92b371 Casting to String, in order to avoid GWT serialization issue, see
#24537#note-9 and #24432
2023-02-07 11:47:39 +01:00
Francesco Mangiacrapa 955d670ce4 removed -SNAPSHOT to be released 2023-02-03 14:45:03 +01:00
Francesco Mangiacrapa 999d201737 Merge pull request 'task_24532' (#6) from task_24532 into master
Reviewed-on: #6
2023-02-03 14:43:30 +01:00
Francesco Mangiacrapa 2fb4767205 Added method get Access from the Document 2023-02-03 11:40:56 +01:00
Francesco Mangiacrapa 2ef9a4fa8c Reverted serialization from Sting to Object values returning the
Document as Map
2023-02-02 16:56:21 +01:00
Francesco Mangiacrapa ebdf9714c9 removed -SNAPSHOT to be released 2023-01-19 14:49:28 +01:00
Francesco Mangiacrapa a96899dbf7 Just for building the SNAPSHOT version 2023-01-19 14:48:58 +01:00
Francesco Mangiacrapa 178ba1bb44 Added WORKFLOW_PHASE [#24458] 2023-01-19 14:45:30 +01:00
Francesco Mangiacrapa d954dafa90 [#24432] Added a trim for returning value to solve a space as suffix
into returned date (fixing the data displayed in the Timeline Widget)
2023-01-19 11:31:48 +01:00
Francesco Mangiacrapa 9910e79e4e Removed -SNAPSHOT to be released 2023-01-17 16:59:51 +01:00
Francesco Mangiacrapa 0fb3faecff To build SNAPSHOT version 2023-01-17 16:59:11 +01:00
Francesco Mangiacrapa c88d71c9d2 Fixing issue: #24432 Using LinkedHashMap<String, String> instead of
LinkedHashMap<String, Object>
2023-01-17 16:51:01 +01:00
Francesco Mangiacrapa 9f38eac98e fixed bean 2023-01-12 16:45:47 +01:00
Francesco Mangiacrapa 5476833a7e Removed -SNAPSHOT to be released 2023-01-12 11:52:55 +01:00
Francesco Mangiacrapa 9450bf2ddc Building -SNAPSHOT version 2023-01-12 11:52:01 +01:00
Francesco Mangiacrapa 0eca260675 commented JUnit Tests 2023-01-12 11:47:15 +01:00
Francesco Mangiacrapa 6d7f5b9338 Added new method accessPolicyFromSessionLogin 2023-01-11 16:46:14 +01:00
Francesco Mangiacrapa 408780c6b1 Removed -SNAPSHOT to be released 2022-12-21 11:16:14 +01:00
Francesco Mangiacrapa a54747c5ac Fixing JSON library v20090211 (see #24263#note-1). New version is
2.0.1-SNAPSHOT
2022-12-13 14:23:04 +01:00
Francesco Mangiacrapa 265dfaec22 fixing setStorageID method 2022-11-29 11:26:45 +01:00
Francesco Mangiacrapa ca578b5249 one log moved to DEBUG 2022-11-28 15:28:12 +01:00
Francesco Mangiacrapa 4b06b9e0a1 removed -SNAPSHOT 2022-11-28 09:48:47 +01:00
Francesco Mangiacrapa cb35bf57d4 Added -SNAPSHOT to deploy it 2022-11-28 09:48:19 +01:00
Francesco Mangiacrapa 7656bc01ed updated some log levels 2022-11-25 14:35:59 +01:00
Francesco Mangiacrapa df334c45a8 removed -SNAPSHOT to be released 2022-11-17 12:26:00 +01:00
Francesco Mangiacrapa 0154a49842 json dependency at compile 2022-11-17 10:05:33 +01:00
Francesco Mangiacrapa b1c0137000 #24136 Integrated the temporal reference on the front-end side 2022-11-16 16:40:27 +01:00
Francesco Mangiacrapa d99480a442 Updated README 2022-11-15 11:10:49 +01:00
Francesco Mangiacrapa 9e00a79f3f Merge branch 'master' into feature_22684 2022-11-15 10:54:39 +01:00
Francesco Mangiacrapa 773ca756ff revisited parsing of the "Geoportal-DataViewer-Configs" GR 2022-11-14 16:59:00 +01:00
Francesco Mangiacrapa 657fded79c BBOX fixed 2022-11-11 16:19:44 +01:00
Francesco Mangiacrapa ce9a5160ae improved the method 2022-11-11 16:03:16 +01:00
Francesco Mangiacrapa 8f911c2ab2 updated constructor 2022-11-11 15:55:01 +01:00
Francesco Mangiacrapa 1098365d62 add hasSpatialLayers() 2022-11-11 15:16:32 +01:00
Francesco Mangiacrapa c4af58c1e1 revisited BBOXDV 2022-11-11 15:08:49 +01:00
Francesco Mangiacrapa a5e597c941 Only added new serialVersionUIDs 2022-11-11 11:03:05 +01:00
Francesco Mangiacrapa 6ca16f8907 Remoed old model "Concessioni" 2022-11-09 15:06:26 +01:00
Francesco Mangiacrapa 80553eaef2 Added the new "geoportal_timeline_json_template" to
GEOPORTAL_DATA_HANDLER
2022-11-08 16:30:21 +01:00
Francesco Mangiacrapa 7a7b39418f Updated Tests 2022-11-08 10:53:02 +01:00
Francesco Mangiacrapa 44b87e9aff added Boolean deep to getRelationshipChain 2022-11-04 17:21:34 +01:00
Francesco Mangiacrapa 8891ec4fb2 Added spatialReference to ResultDocumentDV 2022-10-27 15:08:02 +02:00
Francesco Mangiacrapa abc5466f71 Added new handler. Added GeoJSON object 2022-10-26 16:26:44 +02:00
Francesco Mangiacrapa c95d026ecb fixing bug 2022-10-25 16:59:14 +02:00
Francesco Mangiacrapa eaa089d378 removed printstacktrace 2022-10-25 11:34:24 +02:00
Francesco Mangiacrapa dfbd083b4a added properties centroidLong, centroidLat; 2022-10-24 14:48:28 +02:00
Francesco Mangiacrapa 3deb2ec6e8 Added addSectionView 2022-10-21 16:44:25 +02:00
Francesco Mangiacrapa b37a7446c3 refactored 2022-10-21 16:33:17 +02:00
Francesco Mangiacrapa 5d51e3f740 Updated Centroid coordinate as Double 2022-10-21 16:26:13 +02:00
Francesco Mangiacrapa 192c0098e2 refactor 2022-10-18 15:39:11 +02:00
Francesco Mangiacrapa 42baf0633c Added WMS Link 2022-10-18 14:58:12 +02:00
Francesco Mangiacrapa f722449403 Added the profileName property 2022-10-17 16:50:48 +02:00
Francesco Mangiacrapa c1cc4f391a revisited due to GWT buggy 2022-10-14 17:18:35 +02:00
Francesco Mangiacrapa ae92ea0c3d Deserialization of layers done 2022-10-14 15:22:54 +02:00
Francesco Mangiacrapa 805a3171e2 refactoring 2022-10-13 17:36:44 +02:00
Francesco Mangiacrapa c89277aef8 removed class 2022-10-13 17:19:37 +02:00
Francesco Mangiacrapa f007654210 merged with beans contained in the branch cms-projects-support 2022-10-13 17:18:04 +02:00
Francesco Mangiacrapa c5a3d8faee refactor 2022-10-13 12:36:32 +02:00
Francesco Mangiacrapa 40eb373fa7 Added projectId to DocumentDV 2022-10-12 15:23:01 +02:00
Francesco Mangiacrapa e8a52bcf7e Added getRelationshipChain 2022-10-11 15:55:24 +02:00
Francesco Mangiacrapa 2a6e51b238 refactor 2022-10-11 10:43:02 +02:00
Francesco Mangiacrapa a8b4ae48bc Added PayloadDV 2022-10-11 10:35:35 +02:00
Francesco Mangiacrapa 07ffe5ec37 Updated 2022-10-11 09:47:12 +02:00
Francesco Mangiacrapa 06ef7cb118 Updated ProjectView 2022-10-11 09:15:15 +02:00
Francesco Mangiacrapa d15fdacb08 #23941 Added beans 2022-10-07 18:38:31 +02:00
Francesco Mangiacrapa e487edcce0 Starting trasformation from JSON document to displayable sections 2022-10-06 17:29:47 +02:00
Francesco Mangiacrapa b49c1c1e21 #23834 Integrated with the create/view/delete Relationship facility 2022-10-05 14:43:16 +02:00
Francesco Mangiacrapa fa2e46af79 Fixing relationships 2022-10-03 17:51:29 +02:00
Francesco Mangiacrapa 27b90a6640 #23927 Integrated with Relationship definition in UCD 2022-10-03 16:49:05 +02:00
Francesco Mangiacrapa c5fecafe64 Removed the jaxb-api dependency 2022-09-28 14:13:11 +02:00
Francesco Mangiacrapa fdde2f9467 moved jaxb-api at compile 2022-09-27 17:22:21 +02:00
Francesco Mangiacrapa 88fcc4d707 fixing instantToDateFormatString 2022-09-27 16:59:59 +02:00
Francesco Mangiacrapa f5cc79ec1f unmarshalling via jaxb 2022-09-27 11:15:11 +02:00
Francesco Mangiacrapa f63a1becd6 jackson-dataformat-xml to provided 2022-09-27 10:46:38 +02:00
Francesco Mangiacrapa 8a6b30872b - [#23913] Done 2022-09-26 16:16:26 +02:00
Francesco Mangiacrapa a84dca5230 Added 'jaxb-api' dependency (at provided) required for compiling in
JDK_11
2022-09-23 09:34:35 +02:00
Francesco Mangiacrapa 2fdb2f0c4a formatting the pom 2022-09-22 15:57:58 +02:00
Francesco Mangiacrapa 9946933742 Added lombok v.1.18.4 required for JDK_11 on jenkins 2022-09-22 15:55:27 +02:00
Francesco Mangiacrapa e4d1ae1a28 Fixing date formatting 2022-09-22 15:49:47 +02:00
Francesco Mangiacrapa 8d64e2972c Added operation 'VIEW_RELATIONSHIPS' 2022-09-21 17:16:15 +02:00
Francesco Mangiacrapa 2f263dae44 Added createRelation method 2022-09-21 10:52:31 +02:00
Francesco Mangiacrapa 5c644e8c1e Added getFirstEntryOfMap 2022-09-19 18:16:23 +02:00
Francesco Mangiacrapa d8610c1f54 Added "Create Relation" Operation 2022-09-16 17:42:42 +02:00
Francesco Mangiacrapa e08454e991 Removed unused import 2022-09-15 17:38:42 +02:00
Francesco Mangiacrapa 770d9a0c05 fixed Tests 2022-09-15 16:59:32 +02:00
Francesco Mangiacrapa 564afb38e8 Integrated roles into ActionDefinition by reading from the Handler
"LifecycleManagement"
2022-09-15 16:59:09 +02:00
Francesco Mangiacrapa c998a39f11 Removed unused import 2022-09-14 16:55:37 +02:00
Francesco Mangiacrapa 1593755ee2 Added new Data_Handler and UCD test cases 2022-09-14 16:50:59 +02:00
Francesco Mangiacrapa ab11f34bee Fixing performSteps call 2022-09-14 11:27:27 +02:00
Francesco Mangiacrapa 6901b7573d Fixed JUnit Tests 2022-09-13 16:21:53 +02:00
Francesco Mangiacrapa 1b11e3fba2 Added method `performStep` 2022-09-13 16:17:50 +02:00
Francesco Mangiacrapa 637028d9c8 ACTION_ON_ITEM renamed to OPERATION_ON_ITEM 2022-09-13 13:51:58 +02:00
Francesco Mangiacrapa b4bade9951 #23835 implementing WORKFLOW_ACTION_LIST_GUI configuration 2022-09-12 15:03:33 +02:00
Francesco Mangiacrapa b629928f36 Migrated the deleteProject. Updated the LifecycleInformationDV 2022-09-01 16:41:01 +02:00
Francesco Mangiacrapa 8c302a4110 Integrated with #23784 functionalities 2022-08-31 17:22:15 +02:00
Francesco Mangiacrapa e5a10134bd New test case added 2022-08-31 12:44:29 +02:00
Francesco Mangiacrapa 310817e425 migration in progress 2022-08-31 12:43:41 +02:00
Francesco Mangiacrapa 5c8c2a342d added new data view models 2022-08-10 17:07:28 +02:00
Francesco Mangiacrapa 0d2fddce07 Refactored. Added getListPhases, getConfiguration, getTotalDocument 2022-08-10 12:29:03 +02:00
Francesco Mangiacrapa 83f6fb915c Improved queryOnMongo and JUnit tests 2022-08-09 16:36:49 +02:00
Francesco Mangiacrapa 41e3dc28d9 Improved data converter and data model 2022-08-08 12:18:38 +02:00
Francesco Mangiacrapa 8dec1aa19d Added getProjectByID 2022-08-05 13:11:01 +02:00
Francesco Mangiacrapa 12ec651000 moved to geoportal-client (>= 1.1.0-SNAPSHOT) 2022-08-02 17:05:39 +02:00
Francesco Mangiacrapa ff7387299e Remove -SNAPSHOT to be released 2022-07-27 12:13:47 +02:00
Francesco Mangiacrapa b08b9a6915 #23704 New maven version range required for (the old) geoportal-client 2022-07-26 17:53:32 +02:00
Francesco Mangiacrapa a9cb4e409c Moved to gcube-bom v 2.1.0-SNAPSHOT, Merged with Clone and
Publish/UnPublish
2022-06-21 17:13:39 +02:00
Francesco Mangiacrapa 882b58c19d Removed -SNAPSHOT to be released 2022-06-08 11:38:02 +02:00
Francesco Mangiacrapa f5b4f4e974 Merge pull request 'feature_23390' (#4) from feature_23390 into master
Reviewed-on: #4
2022-06-08 11:36:21 +02:00
Francesco Mangiacrapa 092d7a089e #23457 Added action "Publish/UnPublish" Project 2022-06-01 17:44:29 +02:00
Francesco Mangiacrapa 6e84b5ab68 geoportal-client range [1.0.0, 1.0.7] 2022-06-01 12:19:21 +02:00
Francesco Mangiacrapa 44eb0bbdbf Updated geoportal-common range to [1.0.0,1.0.9-SNAPSHOT) 2022-05-27 17:37:38 +02:00
Francesco Mangiacrapa 91edd1ad94 geoportal-client range [1.0.0, 1.0.8-SNAPSHOT) 2022-05-26 16:00:12 +02:00
Francesco Mangiacrapa f03f211140 #23392 implementing the "Clone Project" facility. Moved to
1.4.0-SNAPSHOT
2022-05-24 17:59:52 +02:00
Francesco Mangiacrapa f812ac31d6 updated 2022-05-20 15:43:35 +02:00
Francesco Mangiacrapa 5e876f32df in progress 2022-05-20 12:31:39 +02:00
Francesco Mangiacrapa eb99899fa4 Added method getProfileID 2022-03-21 10:45:43 +01:00
Francesco Mangiacrapa 1fd3cae333 Fixed test case 2022-03-17 16:46:50 +01:00
Francesco Mangiacrapa 9f3bd01da0 in progress on migration to UCD 2022-03-17 16:03:32 +01:00
Francesco Mangiacrapa f1cec8071a in progress on migration 2022-03-16 18:10:17 +01:00
Francesco Mangiacrapa 608039a4d5 Moving to Project ad UCD models.. 2022-03-11 12:01:27 +01:00
Francesco Mangiacrapa e27a95cab2 added setParentName 2022-03-07 12:01:28 +01:00
Francesco Mangiacrapa dc7bff999c Added getParentName 2022-03-07 11:52:43 +01:00
Francesco Mangiacrapa 8afcf0e7a3 refactored classes 2022-03-04 14:39:44 +01:00
Francesco Mangiacrapa 4c889bc3a3 ignoring geoportal-config.json 2022-03-03 15:42:40 +01:00
Francesco Mangiacrapa da8ab06772 #22883 starting.. 2022-03-01 12:19:37 +01:00
Francesco Mangiacrapa 29609dc7e0 REMOVED -SNAPSHOT to be released 2022-01-13 17:00:16 +01:00
Francesco Mangiacrapa 274be83613 Merge pull request 'feature_22506' (#3) from feature_22506 into master
Reviewed-on: #3
2022-01-13 16:51:29 +01:00
Francesco Mangiacrapa 672b74e238 updated README 2022-01-13 16:50:18 +01:00
Francesco Mangiacrapa bd116cbf46 Renamed GRs to: Geoportal-DataEntry-Configs and
Geoportal-DataViewer-Configs
2021-12-22 12:10:43 +01:00
Francesco Mangiacrapa 486c40668e improved code 2021-12-21 15:54:43 +01:00
Francesco Mangiacrapa 26e801767d improved logs 2021-12-21 12:06:15 +01:00
Francesco Mangiacrapa 69a4f34e88 refactored and created new class to read configurations from IS 2021-12-21 11:55:58 +01:00
Francesco Mangiacrapa 07bf557525 Added WhereClause into SearchingFilter 2021-12-15 15:42:39 +01:00
Francesco Mangiacrapa cca77a169f fixed the OR clause 2021-12-10 15:04:45 +01:00
Francesco Mangiacrapa c9586c8594 fixed mapping of ItemFields 2021-12-07 10:00:38 +01:00
Francesco Mangiacrapa fa201fb35b fixed mapping 2021-12-06 17:12:03 +01:00
Francesco Mangiacrapa 749e6424fd commented test cases 2021-12-06 17:06:39 +01:00
Francesco Mangiacrapa 5d0b45649a refactored 2021-12-06 17:03:01 +01:00
Francesco Mangiacrapa ae1cc32387 Added classes to read configurations and common classes to GNA DataEntry
and Viewer
2021-12-06 16:07:03 +01:00
121 changed files with 13033 additions and 3235 deletions

View File

@ -1,11 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.7"/>
<installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.8"/>
</faceted-project>

View File

@ -4,6 +4,68 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.3.0]
- Read countByPhase from configuration [#25598]
- Reduced/Optimized some LOGs [#25539]
## [v2.2.0]
- Integrated the cross-filtering configuration [#25074]
- Integrated the overlay layers configuration [#25110]
## [v2.1.0] - 2023-05-11
- Integrated the deleteFileset method [#24977]
- Integrated with the Geoportal_Resolver service [#25031]
## [v2.0.3] - 2023-02-09
#### Enhancements
- [#24569] Added the phase DRAFT in the enum (also required for #24571)
## [v2.0.2] - 2022-02-03
#### Enhancements
- [#24432] Reverted serialization from Sting to Object values returning the Document as Map
- [#24475] Propagated the Access Policy in the fileset
## [v2.0.1] - 2022-01-19
#### Bug fixes
- [#24263] Fixing JSON library v20090211
- [#24432] Fixing serialization issue using LinkedHashMap<String, String> instead of LinkedHashMap<String, Object>.
- [#24432] Added a trim for returning value to solve a space as suffix into returned date (fixing the data displayed in the Timeline Widget)
## [v2.0.0] - 2022-11-17
#### Enhancements
- [#22883] Integrated the configurations exposed by (the new) geoportal-client (>= 1.1.0-SNAPSHOT)
- Passed to UCD/Projects geoportal client/service
- [#23835] Integrated with WORKFLOW_ACTION_LIST_GUI configuration
- [#23909] Declared lombok required for JDK_11
- [#23913] Integrated with GUI presentation configurations read from IS
- [#23927] Integrated with Relationship definition in UCD
- [#23834] Integrated with the create/view/delete Relationship facility
- [#24136] Integrated the temporal dimension on the front-end side
- [#24458] Published projects cannot be edited/updated
## [v1.4.0] - 2022-06-08
#### Enhancements
- [#23392] Implemented the "Clone Project" facility
- [#23457] Implemented the "Publish/UnPublish Project" facility
## [v1.3.0] - 2021-12-03
#### Enhancements
- [#22506] Added classes to read configurations and common classes from the GNA components: DataEntry and DataViewer
## [v1.2.0] - 2021-09-29

View File

@ -1,6 +1,6 @@
# GeoPortal Data Common
GeoPortal Data Common is a common library used by GUI components developed for GeoNA
GeoPortal Data Common is a common library used by GUI components developed for the Geoportal
## Built With

40
pom.xml
View File

@ -5,12 +5,12 @@
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId>
<version>1.2.0</version>
<version>2.3.0</version>
<description>GeoPortal Data Common is common library used by GUI components developed for GeoNA</description>
<scm>
@ -32,7 +32,7 @@
</developers>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
@ -41,7 +41,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>2.0.1</version>
<version>2.3.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -68,7 +68,7 @@
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-client</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@ -80,15 +80,36 @@
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-url-shortener</artifactId>
<artifactId>uri-resolver-manager</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
<scope>compile</scope>
</dependency>
<!-- REQUIRED FOR JDK_11 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<!-- LOGGER -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
<!-- JUNIT -->
@ -99,6 +120,13 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1212</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,71 @@
package org.gcube.application.geoportalcommon;
import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.access.AccessPolicy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
/**
* The Class ConvertToDataServiceModel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Feb 3, 2023
*/
public class ConvertToDataServiceModel {
private static Logger LOG = LoggerFactory.getLogger(ConvertToDataServiceModel.class);
/**
* Gets the access from document section.
*
* @param theJSONDocument the the JSON document
* @param sectionJSONPath the section JSON path
* @return the access from document section
*/
public static Access getAccessFromDocumentSection(String theJSONDocument, String sectionJSONPath) {
String accessPolicyPath = String.format("%s.%s", sectionJSONPath, ConvertToDataValueObjectModel.POLICY);
AccessPolicy accessPolicy = null;
com.jayway.jsonpath.Configuration config = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build();
// Reading policy fields
try {
JsonPath theSectionPolycJsonPath = JsonPath.compile(accessPolicyPath);
String policy = theSectionPolycJsonPath.read(theJSONDocument, config).toString();
LOG.debug("Read " + ConvertToDataValueObjectModel.POLICY + ": " + policy + ", from section: "
+ accessPolicyPath);
if (policy != null) {
accessPolicy = AccessPolicy.valueOf(policy.toUpperCase());
}
} catch (Exception e) {
LOG.info("No " + ConvertToDataValueObjectModel.POLICY + " found in the path: " + accessPolicyPath);
}
// Reading policy fields
String licenseIDPath = String.format("%s.%s", sectionJSONPath, ConvertToDataValueObjectModel.LICENSE_ID);
String licenseID = null;
try {
JsonPath theSectionLicenseJsonPath = JsonPath.compile(licenseIDPath);
licenseID = theSectionLicenseJsonPath.read(theJSONDocument, config).toString();
LOG.debug("Read " + ConvertToDataValueObjectModel.LICENSE_ID + ": " + licenseID + ", from section: "
+ licenseIDPath);
} catch (Exception e) {
LOG.info("No " + ConvertToDataValueObjectModel.LICENSE_ID + " found in the path: " + licenseIDPath);
}
Access access = new Access();
if (accessPolicy != null)
access.setPolicy(accessPolicy);
if (licenseID != null)
access.setLicense(licenseID);
LOG.info("Access is: " + access.getPolicy() + " / " + access.getLicense());
return access;
}
}

View File

@ -1,36 +1,10 @@
package org.gcube.application.geoportalcommon;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import org.gcube.application.geoportal.common.model.legacy.AbstractRelazione;
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
import org.gcube.application.geoportal.common.model.legacy.BBOX;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
import org.gcube.application.geoportal.common.model.legacy.OtherContent;
import org.gcube.application.geoportal.common.model.legacy.PersistedContent;
import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent;
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.content.OtherContentDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV.ValidationStatus;
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
import org.gcube.application.geoportalcommon.util.DateUtils;
import org.gcube.application.geoportalcommon.util.URLParserUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -48,257 +22,12 @@ public class ConvertToDataViewModel {
/** The Constant LOG. */
private static final Logger LOG = LoggerFactory.getLogger(ConvertToDataViewModel.class);
public static final String DATE_FORMAT = "dd-MM-yyyy";
public static final String DATE_FORMAT = "yyyy-MM-dd";
public static final String HOURS_MINUTES_SEPARATOR = ":";
public static final String TIME_FORMAT = "HH" + HOURS_MINUTES_SEPARATOR + "mm";
/**
* To concessione.
*
* @param concessione the concessione
* @return the concessione
* @throws Exception the exception
*/
public static ConcessioneDV toConcessione(Concessione concessione) throws Exception {
LOG.debug("toConcessione called");
if (concessione == null)
return null;
LOG.debug("toConcessione called for concessione with mongoId: " + concessione.getMongo_id());
if (LOG.isTraceEnabled())
LOG.trace("Source concessione is: " + concessione);
try {
ConcessioneDV theConcessione = new ConcessioneDV();
theConcessione.setPolicy(toPolicy(concessione.getPolicy()));
theConcessione.setAuthors(concessione.getAuthors());
theConcessione.setCentroidLat(concessione.getCentroidLat());
theConcessione.setCentroidLong(concessione.getCentroidLong());
theConcessione.setContributore(concessione.getContributore());
theConcessione.setCreationTime(DateUtils.asDate(concessione.getCreationTime()));
theConcessione.setCreationUser(toUser(concessione.getCreationUser()));
theConcessione.setDataInizioProgetto(DateUtils.asDate(concessione.getDataInizioProgetto()));
theConcessione.setDataFineProgetto(DateUtils.asDate(concessione.getDataFineProgetto()));
theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto());
theConcessione.setEditore(concessione.getEditore());
theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento());
theConcessione.setItemId(concessione.getMongo_id());
theConcessione.setNome(concessione.getNome());
theConcessione.setIntroduzione(concessione.getIntroduzione());
theConcessione.setLastUpdateTime(DateUtils.asDate(concessione.getLastUpdateTime()));
theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser()));
theConcessione.setLicenzaID(concessione.getLicenzaID());
theConcessione.setParoleChiaveICCD(concessione.getParoleChiaveICCD());
theConcessione.setParoleChiaveLibere(concessione.getParoleChiaveLibere());
theConcessione.setResponsabile(concessione.getResponsabile());
theConcessione.setRisorseCorrelate(concessione.getRisorseCorrelate());
theConcessione.setSoggetto(concessione.getSoggetto());
theConcessione.setTitolariCopyright(concessione.getTitolareCopyright());
theConcessione.setTitolariLicenza(concessione.getTitolareLicenza());
theConcessione.setTitolari(concessione.getTitolari());
theConcessione.setVersion(concessione.getVersion());
theConcessione.setRecordType(concessione.getRecordType().name());
theConcessione.setAbstractRelazioneScavo(toAbstractRelazioneScavo(concessione.getAbstractRelazione()));
theConcessione.setRelazioneScavo(toRelazioneScavo(concessione.getRelazioneScavo()));
if (concessione.getImmaginiRappresentative() != null) {
List<UploadedImageDV> uploadedImagesDV = new ArrayList<UploadedImageDV>(
concessione.getImmaginiRappresentative().size());
for (UploadedImage ui : concessione.getImmaginiRappresentative()) {
uploadedImagesDV.add(toUploadedImage(ui));
}
theConcessione.setImmaginiRappresentative(uploadedImagesDV);
}
if (concessione.getGenericContent() != null) {
List<OtherContentDV> otherContentsDV = new ArrayList<OtherContentDV>(
concessione.getGenericContent().size());
for (OtherContent gc : concessione.getGenericContent()) {
otherContentsDV.add(toOtherContentDV(gc));
}
theConcessione.setGenericContent(otherContentsDV);
}
if (concessione.getPianteFineScavo() != null) {
List<LayerConcessioneDV> piantaScavoDV = new ArrayList<LayerConcessioneDV>(
concessione.getPianteFineScavo().size());
for (LayerConcessione lc : concessione.getPianteFineScavo()) {
// TODO CHECK WHY I HAVE TO PASS theConcessione = null IN ORDER TO AVOID GWT
// serialization error
piantaScavoDV.add(toLayerConcessione(lc, null));
}
theConcessione.setPianteFineScavo(piantaScavoDV);
}
if (concessione.getPosizionamentoScavo() != null) {
// TODO CHECK WHY I HAVE TO PASS theConcessione = null IN ORDER TO AVOID GWT
// serialization error
LayerConcessioneDV thePosizScavo = toLayerConcessione(concessione.getPosizionamentoScavo(), null);
theConcessione.setPosizionamentoScavo(thePosizScavo);
}
LOG.debug("Returning concessioneDV with id: " + theConcessione.getItemId());
if (LOG.isTraceEnabled())
LOG.trace("Returning: " + theConcessione);
return theConcessione;
} catch (Exception e) {
LOG.error("Error on converting concessione: " + concessione, e);
return null;
}
}
/**
* To metadata concessione.
*
* @param concessione the concessione
* @param includeValidationReport the include validation report
* @return the concessione DV
* @throws Exception the exception
*/
public static ConcessioneDV toMetadataConcessione(Concessione concessione, boolean includeValidationReport)
throws Exception {
LOG.debug("toMetadataConcessione called");
if (concessione == null)
return null;
LOG.debug("toMetadataConcessione called for concessione with [mongoId: " + concessione.getMongo_id()
+ ", includeValidationReport: " + includeValidationReport + "]");
if (LOG.isTraceEnabled())
LOG.trace("Source concessione is: " + concessione);
try {
ConcessioneDV theConcessione = new ConcessioneDV();
theConcessione.setPolicy(toPolicy(concessione.getPolicy()));
theConcessione.setCentroidLat(concessione.getCentroidLat());
theConcessione.setCentroidLong(concessione.getCentroidLong());
theConcessione.setContributore(concessione.getContributore());
theConcessione.setCreationTime(DateUtils.asDate(concessione.getCreationTime()));
theConcessione.setCreationUser(toUser(concessione.getCreationUser()));
theConcessione.setDataInizioProgetto(DateUtils.asDate(concessione.getDataInizioProgetto()));
theConcessione.setDataFineProgetto(DateUtils.asDate(concessione.getDataFineProgetto()));
theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto());
theConcessione.setEditore(concessione.getEditore());
theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento());
theConcessione.setItemId(concessione.getMongo_id());
theConcessione.setNome(concessione.getNome());
theConcessione.setAuthors(concessione.getAuthors());
theConcessione.setCreationTime(DateUtils.asDate(concessione.getCreationTime()));
theConcessione.setIntroduzione(concessione.getIntroduzione());
theConcessione.setLastUpdateTime(DateUtils.asDate(concessione.getLastUpdateTime()));
theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser()));
theConcessione.setLicenzaID(concessione.getLicenzaID());
theConcessione.setParoleChiaveICCD(concessione.getParoleChiaveICCD());
theConcessione.setParoleChiaveLibere(concessione.getParoleChiaveLibere());
theConcessione.setResponsabile(concessione.getResponsabile());
theConcessione.setTitolariCopyright(concessione.getTitolareCopyright());
theConcessione.setTitolariLicenza(concessione.getTitolareLicenza());
theConcessione.setTitolari(concessione.getTitolari());
if (includeValidationReport) {
theConcessione.setValidationReport(toValidationReport(concessione.getReport()));
if (theConcessione.getValidationReport() != null)
theConcessione.setValidationStatus(theConcessione.getValidationReport().getStatus());
}
LOG.info("Returning concessioneDV with id: " + theConcessione.getItemId());
if (LOG.isTraceEnabled())
LOG.trace("Returning: " + theConcessione);
return theConcessione;
} catch (Exception e) {
LOG.error("Error on converting concessione: " + concessione, e);
return null;
}
}
/**
* To validation report.
*
* @param validationReport the validation report
* @return the validation report DV
* @throws Exception the exception
*/
public static ValidationReportDV toValidationReport(ValidationReport validationReport) throws Exception {
LOG.debug("toValidationReport called");
if (validationReport == null)
return null;
LOG.debug("toValidationReport called for: "+validationReport);
ValidationReportDV theVR = new ValidationReportDV();
theVR.setErrorMessages(validationReport.getErrorMessages());
theVR.setObjectName(validationReport.getObjectName());
theVR.setStatus(ValidationStatus.valueOf(validationReport.getStatus().name()));
theVR.setWarningMessages(validationReport.getWarningMessages());
theVR.setAsJSONString(toJSON(validationReport));
LOG.debug("Returning: "+theVR);
return theVR;
}
/**
* To base concessione.
*
* @param concessione the concessione
* @return the concessione DV
* @throws Exception the exception
*/
public static BaseConcessioneDV toBaseConcessione(Concessione concessione) throws Exception {
LOG.debug("toBaseConcessione called");
if (concessione == null)
return null;
LOG.debug("toBaseConcessione called for concessione with mongoId: " + concessione.getMongo_id());
if (LOG.isTraceEnabled())
LOG.trace("Source concessione is: " + concessione);
try {
BaseConcessioneDV theConcessione = new BaseConcessioneDV();
theConcessione.setPolicy(toPolicy(concessione.getPolicy()));
theConcessione.setCreationTime(DateUtils.asDate(concessione.getCreationTime()));
theConcessione.setCreationUser(toUser(concessione.getCreationUser()));
theConcessione.setItemId(concessione.getMongo_id());
theConcessione.setNome(concessione.getNome());
theConcessione.setAuthors(concessione.getAuthors());
theConcessione.setCreationTime(DateUtils.asDate(concessione.getCreationTime()));
theConcessione.setIntroduzione(concessione.getIntroduzione());
theConcessione.setLastUpdateTime(DateUtils.asDate(concessione.getLastUpdateTime()));
theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser()));
theConcessione.setLicenzaID(concessione.getLicenzaID());
LOG.debug("Returning BaseConcessioneDV with id: " + theConcessione.getItemId());
if (LOG.isTraceEnabled())
LOG.trace("Returning: " + theConcessione);
return theConcessione;
} catch (Exception e) {
LOG.error("Error on converting concessione: " + concessione, e);
return null;
}
}
/**
* To user.
*
@ -329,292 +58,6 @@ public class ConvertToDataViewModel {
}
/**
* To date format string.
*
* @param dateTime the date time
* @return the string
*/
public static String toDateFormatString(LocalDateTime dateTime) {
if (dateTime == null)
return null;
String time = dateTime.toString();
DateTimeFormatter formatter = null;
try {
if (!time.endsWith(NO_TIME)) {
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT + " " + TIME_FORMAT);
} else {
time = time.replace(NO_TIME, "");
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT);
}
} catch (Exception e) {
LOG.warn("Parsing error: ", e);
}
try {
if (formatter != null)
return dateTime.format(formatter);
} catch (Exception e) {
LOG.warn("Date format error: ", e);
}
return dateTime.toString();
}
/**
* To abstract relazione scavo.
*
* @param abstractRelazione the abstract relazione
* @return the abstract relazione scavo DV
*/
public static AbstractRelazioneScavoDV toAbstractRelazioneScavo(AbstractRelazione abstractRelazione) {
LOG.debug("toAbstractRelazioneScavo called");
if (abstractRelazione == null)
return null;
AbstractRelazioneScavoDV theARelDiScavo = new AbstractRelazioneScavoDV();
theARelDiScavo.setAbstractSectionIta(abstractRelazione.getAbstractIta());
theARelDiScavo.setAbstractSectionEng(abstractRelazione.getAbstractEng());
theARelDiScavo.setCreationTime(DateUtils.asDate(abstractRelazione.getCreationTime()));
theARelDiScavo.setId(abstractRelazione.getId());
theARelDiScavo.setLicenseID(abstractRelazione.getLicenseID());
theARelDiScavo.setPolicy(toPolicy(abstractRelazione.getPolicy()));
theARelDiScavo.setTitolo(abstractRelazione.getTitolo());
List<PersistedContent> actContent = abstractRelazione.getActualContent();
if (actContent != null && actContent.size() > 0) {
List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
for (PersistedContent content : actContent) {
if (content != null && content instanceof WorkspaceContent) {
listWsContent.add(toWorkspaceContent((WorkspaceContent) content));
}
}
theARelDiScavo.setListWsContent(listWsContent);
}
LOG.debug("Returning: " + theARelDiScavo);
return theARelDiScavo;
}
/**
* To relazione scavo.
*
* @param relazioneScavo the relazione scavo
* @return the relazione scavo data view
*/
public static RelazioneScavoDV toRelazioneScavo(RelazioneScavo relazioneScavo) {
LOG.debug("toRelazioneScavo called");
if (relazioneScavo == null)
return null;
RelazioneScavoDV theRelDiScavo = new RelazioneScavoDV();
theRelDiScavo.setCreationTime(DateUtils.asDate(relazioneScavo.getCreationTime()));
theRelDiScavo.setId(relazioneScavo.getId());
theRelDiScavo.setLicenseID(relazioneScavo.getLicenseID());
theRelDiScavo.setPolicy(toPolicy(relazioneScavo.getPolicy()));
// theRelazioneDiScavo.setRecord(recordDV);
theRelDiScavo.setResponsabili(relazioneScavo.getResponsabili());
theRelDiScavo.setSoggetto(relazioneScavo.getSoggetto());
theRelDiScavo.setTitolo(relazioneScavo.getTitolo());
List<PersistedContent> actContent = relazioneScavo.getActualContent();
if (actContent != null && actContent.size() > 0) {
List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
for (PersistedContent content : actContent) {
if (content != null && content instanceof WorkspaceContent) {
listWsContent.add(toWorkspaceContent((WorkspaceContent) content));
}
}
theRelDiScavo.setListWsContent(listWsContent);
}
LOG.debug("Returning: " + theRelDiScavo);
return theRelDiScavo;
}
/**
* To uploaded image.
*
* @param uploadedImage the uploaded image
* @return the uploaded image data-view
*/
public static UploadedImageDV toUploadedImage(UploadedImage uploadedImage) {
LOG.debug("toUploadedImage called");
if (uploadedImage == null)
return null;
UploadedImageDV theUploadedImageDV = new UploadedImageDV();
theUploadedImageDV.setCreationTime(DateUtils.asDate(uploadedImage.getCreationTime()));
theUploadedImageDV.setDidascalia(uploadedImage.getDidascalia());
theUploadedImageDV.setFormat(uploadedImage.getFormat());
theUploadedImageDV.setId(uploadedImage.getId());
theUploadedImageDV.setLicenseID(uploadedImage.getLicenseID());
theUploadedImageDV.setPolicy(toPolicy(uploadedImage.getPolicy()));
// theUploadedImageDV.setRecord(recordDV);
theUploadedImageDV.setResponsabili(uploadedImage.getResponsabili());
theUploadedImageDV.setSoggetto(uploadedImage.getSoggetto());
theUploadedImageDV.setTitolo(uploadedImage.getTitolo());
List<PersistedContent> actContent = uploadedImage.getActualContent();
if (actContent != null && actContent.size() > 0) {
List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
for (PersistedContent content : actContent) {
if (content != null && content instanceof WorkspaceContent) {
listWsContent.add(toWorkspaceContent((WorkspaceContent) content));
}
}
theUploadedImageDV.setListWsContent(listWsContent);
}
LOG.debug("Returning: " + theUploadedImageDV);
return theUploadedImageDV;
}
/**
* To workspace content.
*
* @param wContent the w content
* @return the workspace content DV
*/
public static WorkspaceContentDV toWorkspaceContent(WorkspaceContent wContent) {
LOG.debug("toWorkspaceContent called");
if (wContent == null)
return null;
WorkspaceContentDV theWSDV = new WorkspaceContentDV();
theWSDV.setLink(wContent.getLink());
theWSDV.setMimetype(wContent.getMimetype());
theWSDV.setStorageID(wContent.getStorageID());
theWSDV.setId(wContent.getId());
theWSDV.setName(wContent.getName());
return theWSDV;
}
/**
* To layer concessione.
*
* @param layerConcessione the layer concessione
* @param refersToBaseConcessione the refers to base concessione
* @return the layer concessione data view
*/
public static LayerConcessioneDV toLayerConcessione(LayerConcessione layerConcessione,
BaseConcessioneDV refersToBaseConcessione) {
if (layerConcessione == null)
return null;
LOG.debug("Converting: " + layerConcessione);
LayerConcessioneDV theLayerConessione = new LayerConcessioneDV();
theLayerConessione.setAbstractSection(layerConcessione.getAbstractSection());
String wmsLink = layerConcessione.getWmsLink();
String layerName = null;
BoundsMap bounds = null;
// reading layer name from wmsLink
// string bbox
if (wmsLink != null) {
layerName = URLParserUtil.extractValueOfParameterFromURL("layers", wmsLink);
String bbox = URLParserUtil.extractValueOfParameterFromURL("bbox", wmsLink);
String wmsVersion = URLParserUtil.extractValueOfParameterFromURL("version", wmsLink);
bounds = toBoundMap(wmsVersion, bbox, ",");
LOG.debug("Built bounds from wmsLInk: " + bounds);
}
if (layerName != null)
theLayerConessione.setLayerName(layerName);
else
theLayerConessione.setLayerName(layerConcessione.getLayerName());
theLayerConessione.setWmsLink(wmsLink);
theLayerConessione.setLayerID(layerConcessione.getLayerID());
theLayerConessione.setLayerUUID(layerConcessione.getLayerUUID());
theLayerConessione.setAuthors(layerConcessione.getAuthors());
if (bounds == null)
bounds = toBoundMap(layerConcessione.getBbox());
theLayerConessione.setBbox(bounds);
theLayerConessione.setCreationTime(DateUtils.asDate(layerConcessione.getCreationTime()));
theLayerConessione.setId(layerConcessione.getId());
theLayerConessione.setLicenseID(layerConcessione.getLicenseID());
theLayerConessione.setMetodoRaccoltaDati(layerConcessione.getMetodoRaccoltaDati());
theLayerConessione.setPolicy(toPolicy(layerConcessione.getPolicy()));
// theLayerConessione.setRecord(recordDV);
theLayerConessione.setScalaAcquisizione(layerConcessione.getScalaAcquisizione());
theLayerConessione.setSubTopic(layerConcessione.getSubTopic());
theLayerConessione.setTitolo(layerConcessione.getTitolo());
theLayerConessione.setTopicCategory(layerConcessione.getTopicCategory());
theLayerConessione.setValutazioneQualita(layerConcessione.getValutazioneQualita());
theLayerConessione.setRefersTo(refersToBaseConcessione);
List<PersistedContent> actContent = layerConcessione.getActualContent();
if (actContent != null && actContent.size() > 0) {
List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
for (PersistedContent content : actContent) {
if (content != null && content instanceof WorkspaceContent) {
listWsContent.add(toWorkspaceContent((WorkspaceContent) content));
}
}
theLayerConessione.setListWsContent(listWsContent);
}
LOG.debug("Returning: " + theLayerConessione);
return theLayerConessione;
}
/**
* To other content DV.
*
* @param otherContent the other content
* @return the other content DV
*/
public static OtherContentDV toOtherContentDV(OtherContent otherContent) {
if (otherContent == null)
return null;
OtherContentDV theOtherContent = new OtherContentDV();
theOtherContent.setCreationTime(DateUtils.asDate(otherContent.getCreationTime()));
theOtherContent.setId(otherContent.getId());
theOtherContent.setLicenseID(otherContent.getLicenseID());
theOtherContent.setPolicy(toPolicy(otherContent.getPolicy()));
// theOtherContent.setRecord(recordDV);
theOtherContent.setTitolo(otherContent.getTitolo());
return theOtherContent;
}
public static FileSetPathsDV getFileSetPaths() {
LOG.info("readFileSetPaths called");
FileSetPathsDV fsp = new FileSetPathsDV();
List<String> fileSetPaths = new ArrayList<String>();
fileSetPaths.add(Concessione.Paths.ABSTRACT_RELAZIONE);
fileSetPaths.add(Concessione.Paths.RELAZIONE);
fileSetPaths.add(Concessione.Paths.IMMAGINI);
fileSetPaths.add(Concessione.Paths.POSIZIONAMENTO);
fileSetPaths.add(Concessione.Paths.PIANTE);
fsp.setFileSetPaths(fileSetPaths);
return fsp;
}
/**
* To bound map.
*

View File

@ -0,0 +1,134 @@
package org.gcube.application.geoportalcommon;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import org.gcube.application.geoportalcommon.config.CSVFile;
import org.gcube.application.geoportalcommon.config.CSVReader;
import org.gcube.application.geoportalcommon.config.CSVRow;
import org.gcube.application.geoportalcommon.config.FileUtil;
import org.gcube.application.geoportalcommon.shared.exception.GNAConfigException;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class GNAConfigsConverter.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 21, 2021
*/
public class GNAConfigsConverter {
private static final Logger LOG = LoggerFactory.getLogger(GNAConfigsConverter.class);
public GNAConfigsConverter() {
}
/**
* Read list items config.
*
* @param contentValue the content value
* @return the list
* @throws GNAConfigException the GNA user rights config exception
*/
public List<ItemFieldDV> readListItemsConfig(String contentValue) throws GNAConfigException {
LOG.debug("readListItemsConfig called");
File configurationFile = null;
List<ItemFieldDV> listItemFields = new ArrayList<ItemFieldDV>();
try {
configurationFile = FileUtil.inputStreamToTempFile(contentValue, "GNA_ListItems_Configs"+new Random().nextInt());
CSVReader reader = new CSVReader(configurationFile);
CSVFile csvFile = reader.getCsvFile();
if(LOG.isTraceEnabled()) {
LOG.trace("CSV Header Row: "+csvFile.getHeaderRow());
}
List<CSVRow> rows = csvFile.getValueRows();
LOG.debug("CSV Value Row are: "+rows);
// Starting from index 1 (means the second row in the CSV)
for (int i = 0; i < rows.size(); i++) {
LOG.trace(i + " row");
ItemFieldDV itemField = new ItemFieldDV();
CSVRow row = rows.get(i);
// mapping to ItemFiel
List<String> rowValues = row.getListValues();
LOG.debug("rowValues: " + rowValues);
itemField.setDisplayName(rowValues.get(0));
// Reading JSON Fields
String[] jsonFields = rowValues.get(1).split(";");
List<String> theJsonFields = new ArrayList<String>(jsonFields.length);
for (String jsonField : jsonFields) {
theJsonFields.add(jsonField.trim());
}
itemField.setJsonFields(theJsonFields);
// Display as result
if (checkYesNoValue(rowValues.get(2))) {
itemField.setDisplayAsResult(true);
}
// Sortable
if (checkYesNoValue(rowValues.get(3))) {
itemField.setSortable(true);
}
// Searchable
if (checkYesNoValue(rowValues.get(4))) {
itemField.setSearchable(true);
}
listItemFields.add(itemField);
}
LOG.info("Returning item fields config: " + listItemFields);
return listItemFields;
} catch (Exception e) {
LOG.error("An error occurred on reading the GNA config from: " + contentValue, e);
throw new GNAConfigException("Error on reading the GNA config from: " + contentValue);
} finally {
if (configurationFile != null) {
try {
configurationFile.delete();
} catch (Exception e) {
// silent
}
}
}
}
/**
* Check yes no value.
*
* @param value the value
* @return true, if successful
*/
public static boolean checkYesNoValue(String value) {
if (value == null || value.isEmpty())
return false;
String lowerValue = value.toLowerCase();
if (lowerValue.equals("yes") || lowerValue.equals("true")) {
return true;
}
return false;
}
}

View File

@ -0,0 +1,326 @@
package org.gcube.application.geoportalcommon;
import static org.gcube.resources.discovery.icclient.ICFactory.client;
import java.io.File;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.gcube.application.geoportalcommon.config.CSVFile;
import org.gcube.application.geoportalcommon.config.CSVReader;
import org.gcube.application.geoportalcommon.config.CSVRow;
import org.gcube.application.geoportalcommon.config.FileUtil;
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
import org.gcube.application.geoportalcommon.shared.config.OPERATION_ON_ITEM;
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE;
import org.gcube.application.geoportalcommon.shared.exception.ApplicationProfileNotFoundException;
import org.gcube.application.geoportalcommon.shared.exception.GNAConfigException;
import org.gcube.application.geoportalcommon.shared.guipresentation.BodyWelcome;
import org.gcube.application.geoportalcommon.shared.guipresentation.DataEntryGUIPresentationConfig;
import org.gcube.application.geoportalcommon.shared.guipresentation.Header;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.Query;
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
/**
* The Class GNADataEntryConfigProfileReader.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 21, 2021
*/
public class GNADataEntryConfigProfileReader {
private static final String RESOURCE_PROFILE_BODY = "/Resource/Profile/Body";
public static final String SECONDARY_TYPE = "ApplicationProfile";
public static final String GENERIC_RESOURCE_NAME = "Geoportal-DataEntry-Configs";
private static final String PATH_TO_PERMISSIONS_PATH = RESOURCE_PROFILE_BODY + "/permssions_for_role";
// private static final String PATH_TO_ITEM_FIELDS_CONFIG = RESOURCE_PROFILE_BODY + "/item_fields_config";
private static final String PATH_TO_HEADER_GUI_PRESENTATION = RESOURCE_PROFILE_BODY + "/gui_presentation/data_entry_facility/header";
private static final String PATH_TO_BODY_WELCOME_GUI_PRESENTATION = RESOURCE_PROFILE_BODY + "/gui_presentation/data_entry_facility/body_welcome";
private String scope;
private static final Logger LOG = LoggerFactory.getLogger(GNADataEntryConfigProfileReader.class);
/**
* Instantiates a new application profile reader.
*/
public GNADataEntryConfigProfileReader() {
}
/**
* Read profile from infrastrucure.
*
* @return the map
* @throws Exception the exception
*/
public GNADataEntryConfigProfile readProfileFromInfrastrucure() throws Exception {
LOG.info("called readProfileFromInfrastrucure");
String queryString = getGcubeGenericQueryString(SECONDARY_TYPE, GENERIC_RESOURCE_NAME);
this.scope = ScopeProvider.instance.get();
LOG.info("Scope " + scope + ", trying to perform query: " + queryString);
if (scope == null)
throw new Exception("Scope is null, set scope into ScopeProvider");
GNADataEntryConfigProfile gnDEC = new GNADataEntryConfigProfile();
String permissions_for_role = "";
String item_fields = "";
try {
LOG.info("Trying to fetch GR named: " + GENERIC_RESOURCE_NAME + ", in the scope: " + scope
+ ", SecondaryType: " + SECONDARY_TYPE);
Query q = new QueryBox(queryString);
DiscoveryClient<String> client = client();
List<String> appProfile = client.submit(q);
if (appProfile == null || appProfile.size() == 0)
throw new ApplicationProfileNotFoundException("GR with SecondaryType: " + SECONDARY_TYPE
+ ", and name: " + GENERIC_RESOURCE_NAME + " is not registered in the scope: " + scope);
else {
String elem = appProfile.get(0);
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = docBuilder.parse(new InputSource(new StringReader(elem)));
XPathHelper helper = new XPathHelper(doc.getDocumentElement());
List<String> currValue = null;
String xPathExp = PATH_TO_PERMISSIONS_PATH + "/text()";
currValue = helper.evaluate(xPathExp);
if (currValue != null && currValue.size() > 0) {
permissions_for_role = currValue.get(0);
} else
throw new Exception("I'm not able to read the path: " + xPathExp);
// replacing \n with new_line string
LOG.debug("read " + PATH_TO_PERMISSIONS_PATH + ": " + permissions_for_role);
String value_with_new_lines = permissions_for_role.replaceAll("\\\\n", System.lineSeparator());
LOG.debug(PATH_TO_PERMISSIONS_PATH + " with new lines: " + value_with_new_lines);
List<RoleRights> listRoleRights = readRoleRightsConfig(value_with_new_lines);
gnDEC.setPermissionsForRole(listRoleRights);
//GUI PRESENTATION CONFIGS
DataEntryGUIPresentationConfig deGUIP = new DataEntryGUIPresentationConfig();
xPathExp = PATH_TO_HEADER_GUI_PRESENTATION;
currValue = helper.evaluate(xPathExp);
LOG.debug("read " + PATH_TO_HEADER_GUI_PRESENTATION + ": " + currValue);
if (currValue != null && currValue.size() > 0) {
String headerGUI = currValue.get(0);
Header headerClass = SerializerUtil.unmarshalXML(headerGUI, Header.class);
LOG.debug("serialized " + Header.class + ": " + headerClass);
deGUIP.setHeader(headerClass);
} else
throw new Exception("I'm not able to read the path: " + xPathExp);
xPathExp = PATH_TO_BODY_WELCOME_GUI_PRESENTATION;
currValue = helper.evaluate(xPathExp);
LOG.debug("read " + PATH_TO_BODY_WELCOME_GUI_PRESENTATION + ": " + currValue);
if (currValue != null && currValue.size() > 0) {
String bodyWelcome = currValue.get(0);
BodyWelcome bodyWelcomeClass = SerializerUtil.unmarshalXML(bodyWelcome, BodyWelcome.class);
LOG.debug("serialized " + BodyWelcome.class + ": " + bodyWelcomeClass);
deGUIP.setBodyWelcome(bodyWelcomeClass);
} else
throw new Exception("I'm not able to read the path: " + xPathExp);
gnDEC.setDataEntryGUIPresentation(deGUIP);
LOG.info("returning: " + gnDEC);
return gnDEC;
}
} catch (Exception e) {
LOG.error("Error while trying to read the " + SECONDARY_TYPE + " with SecondaryType "
+ GENERIC_RESOURCE_NAME + " from scope " + scope, e);
return null;
} finally {
}
}
/**
* To gcube user role.
*
* @param name the name
* @return the gcube user role
*/
protected static GcubeUserRole toGcubeUserRole(String name) {
for (GcubeUserRole gCubeUserRole : GcubeUserRole.values()) {
if (gCubeUserRole.getName().equalsIgnoreCase(name))
return gCubeUserRole;
}
return null;
}
/**
* Read user rights config.
*
* @param permissions_for_role the permissions for role
* @return the list
* @throws GNAConfigException the GNA user rights config not found
* exception
*/
public List<RoleRights> readRoleRightsConfig(String permissions_for_role) throws GNAConfigException {
LOG.debug("readRoleRightsConfig called");
File configurationFile = null;
List<RoleRights> listUserRights = new ArrayList<RoleRights>();
try {
configurationFile = FileUtil.inputStreamToTempFile(permissions_for_role, "GNA_RoleRights_Configurations"+new Random().nextInt());
CSVReader reader = new CSVReader(configurationFile);
CSVFile csvFile = reader.getCsvFile();
List<String> headerKeys = csvFile.getHeaderRow().getListValues();
List<CSVRow> rows = csvFile.getValueRows();
// MAPPING OPERATION TYPE AS READ, WRITE, etc.
Map<String, OPERATION_TYPE> mapOperationTypes = new HashMap<String, RoleRights.OPERATION_TYPE>();
CSVRow operationTypeRow = rows.get(0);
List<String> rowValues = operationTypeRow.getListValues();
for (int j = 1; j < rowValues.size(); j++) {
String operationType = rowValues.get(j);
RoleRights.OPERATION_TYPE ot = RoleRights.OPERATION_TYPE.UNKNOWN;
if (operationType.equalsIgnoreCase("R")) {
ot = RoleRights.OPERATION_TYPE.READ;
} else if (operationType.equalsIgnoreCase("RW")) {
ot = RoleRights.OPERATION_TYPE.READ_WRITE;
} else if (operationType.equalsIgnoreCase("W")) {
ot = RoleRights.OPERATION_TYPE.WRITE;
}
mapOperationTypes.put(headerKeys.get(j), ot);
}
LOG.debug("Map of operation types: " + mapOperationTypes);
// Starting from index 1 (means the second row in the CSV)
for (int i = 1; i < rows.size(); i++) {
LOG.trace(i + " row");
RoleRights useRights = new RoleRights();
CSVRow row = rows.get(i);
// to map properties
rowValues = row.getListValues();
LOG.debug("rowValues: " + rowValues);
Map<String, String> mapUserRolePermissions = new HashMap<String, String>();
GcubeUserRole gCubeUserRole = toGcubeUserRole(rowValues.get(0));
if (gCubeUserRole == null) {
LOG.warn("The Role " + rowValues.get(0) + " not found into roleName of: " + GcubeUserRole.values());
continue;
}
useRights.setUserRole(gCubeUserRole);
for (int j = 1; j < rowValues.size(); j++) {
mapUserRolePermissions.put(headerKeys.get(j), rowValues.get(j));
}
LOG.debug("Role: " + useRights.getUserRole());
LOG.debug("Permissions read: " + mapUserRolePermissions);
Map<OPERATION_ON_ITEM, OPERATION_TYPE> listPermessions = new HashMap<OPERATION_ON_ITEM, OPERATION_TYPE>();
for (OPERATION_ON_ITEM value : OPERATION_ON_ITEM.values()) {
String yesno = mapUserRolePermissions.get(value.name());
if (GNAConfigsConverter.checkYesNoValue(yesno)) {
listPermessions.put(value, mapOperationTypes.get(value.name()));
}
}
useRights.setListPermessions(listPermessions);
// String writeOwn = mapUserRolePermissions.get(WRITE_OWN_CONFIG);
// if (writeOwn != null && writeOwn.equalsIgnoreCase("yes")) {
// useRights.setWriteOwn(true);
// }
//
// String writeAny = mapUserRolePermissions.get(WRITE_ANY_CONFIG);
// if (writeAny != null && writeAny.equalsIgnoreCase("yes")) {
// useRights.setWriteAny(true);
// }
listUserRights.add(useRights);
}
LOG.info("Returning user rights config: " + listUserRights);
return listUserRights;
} catch (Exception e) {
LOG.error("An error occurred on reading the GNA DataEntry config from: " + permissions_for_role, e);
throw new GNAConfigException("Error on reading the GNA DataEntry from: " + permissions_for_role);
} finally {
if (configurationFile != null) {
try {
configurationFile.delete();
} catch (Exception e) {
// silent
}
}
}
}
/**
* Gets the gcube generic query string.
*
* @param secondaryType the secondary type
* @param genericResourceName the generic resource name
* @return the gcube generic query string
*/
public static String getGcubeGenericQueryString(String secondaryType, String genericResourceName) {
return "for $profile in collection('/db/Profiles/GenericResource')//Resource "
+ "where $profile/Profile/SecondaryType/string() eq '" + secondaryType
+ "' and $profile/Profile/Name/string() " + " eq '" + genericResourceName + "'" + "return $profile";
}
/**
* Gets the secondary type.
*
* @return the secondary type
*/
public String getSecondaryType() {
return SECONDARY_TYPE;
}
/**
* Gets the scope.
*
* @return the scope
*/
public String getScope() {
return scope;
}
}

View File

@ -3,19 +3,12 @@ package org.gcube.application.geoportalcommon;
import static org.gcube.resources.discovery.icclient.ICFactory.client;
import java.io.StringReader;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
import org.gcube.application.geoportalcommon.shared.LayerItem;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.exception.ApplicationProfileNotFoundException;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.gcube.common.scope.api.ScopeProvider;
@ -25,28 +18,25 @@ import org.gcube.resources.discovery.client.queries.impl.QueryBox;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/**
* The Class GeoNaViewerProfileReader.
* The Class GNADataViewerConfigProfileReader.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 12, 2020
* Dec 21, 2021
*/
public class GeoNaDataViewerProfileReader {
public class GNADataViewerConfigProfileReader {
private static final String RESOURCE_PROFILE_BODY = "/Resource/Profile/Body";
/**
*
*/
public static final String SECONDARY_TYPE = "ApplicationProfile";
public static final String WORKSPACE_EXPLORER_APP_NAME = "GeoNa-Viewer-Profile";
public static final String GENERIC_RESOURCE_NAME = "Geoportal-DataViewer-Configs";
private Logger logger = LoggerFactory.getLogger(GeoNaDataViewerProfileReader.class);
private static Logger LOG = LoggerFactory.getLogger(GNADataViewerConfigProfileReader.class);
private String secondaryType;
private String scope;
private String appID;
@ -56,7 +46,7 @@ public class GeoNaDataViewerProfileReader {
*
* @param appID the app id
*/
public GeoNaDataViewerProfileReader(String appID) {
public GNADataViewerConfigProfileReader(String appID) {
this.appID = appID;
this.secondaryType = SECONDARY_TYPE;
@ -67,25 +57,27 @@ public class GeoNaDataViewerProfileReader {
* Read profile from infrastrucure.
*
* @return the map
* @throws Exception the exception
*/
public GeoNaDataViewerProfile readProfileFromInfrastrucure() throws Exception {
protected GNADataViewerConfigProfile readProfileFromInfrastructure() throws Exception {
String queryString = getGcubeGenericQueryString(secondaryType, appID);
logger.info("Scope " + scope + ", trying to perform query: " + queryString);
LOG.info("Scope " + scope + ", trying to perform query: " + queryString);
try {
if (scope == null)
throw new Exception("Scope is null, set scope into ScopeProvider");
GeoNaDataViewerProfile profile = new GeoNaDataViewerProfile();
GNADataViewerConfigProfile profile = new GNADataViewerConfigProfile();
logger.info("Trying to fetch ApplicationProfile in the scope: " + scope + ", SecondaryType: "
LOG.info("Trying to fetch ApplicationProfile in the scope: " + scope + ", SecondaryType: "
+ secondaryType + ", AppId: " + appID);
Query q = new QueryBox(queryString);
DiscoveryClient<String> client = client();
List<String> appProfile = client.submit(q);
// String item_fields = "";
if (appProfile == null || appProfile.size() == 0)
throw new ApplicationProfileNotFoundException("ApplicationProfile with SecondaryType: " + secondaryType
+ ", AppId: " + appID + " is not registered in the scope: " + scope);
@ -111,33 +103,13 @@ public class GeoNaDataViewerProfileReader {
} else
throw new Exception("I'm not able to read the path: " + xPathExp);
XPath xPath = XPathFactory.newInstance().newXPath();
NodeList nodeList = (NodeList) xPath.compile("/Resource/Profile/Body/AvailableLayers/Layer")
.evaluate(doc, XPathConstants.NODESET);
Map<String, LayerItem> mapLayers = new HashMap<String, LayerItem>(nodeList.getLength());
for (int i = 0; i < nodeList.getLength(); i++) {
Node layerNode = nodeList.item(i);
if (layerNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) layerNode;
String layerType = eElement.getElementsByTagName("Type").item(0).getTextContent();
String wmsLink = eElement.getElementsByTagName("WMSLink").item(0).getTextContent();
String decodedURL = URLDecoder.decode(wmsLink, "UTF-8");
LayerItem layer = new LayerItem();
layer.setWmsLink(decodedURL);
mapLayers.put(layerType.toLowerCase(), layer);
}
}
profile.setMapLayers(mapLayers);
logger.info("returning: " + profile);
LOG.info("returning: " + profile);
return profile;
}
} catch (Exception e) {
logger.error("Error while trying to read the " + SECONDARY_TYPE + " with SecondaryType "
+ WORKSPACE_EXPLORER_APP_NAME + " from scope " + scope, e);
LOG.error("Error while trying to read the " + SECONDARY_TYPE + " with SecondaryType "
+ GENERIC_RESOURCE_NAME + " from scope " + scope, e);
return null;
} finally {
@ -179,22 +151,17 @@ public class GeoNaDataViewerProfileReader {
@Override
public String toString() {
return "GeoNaViewerProfileReader [secondaryType=" + secondaryType + ", scope=" + scope + ", appID=" + appID
+ "]";
StringBuilder builder = new StringBuilder();
builder.append("GNADataViewerConfigProfileReader [LOG=");
builder.append(LOG);
builder.append(", secondaryType=");
builder.append(secondaryType);
builder.append(", scope=");
builder.append(scope);
builder.append(", appID=");
builder.append(appID);
builder.append("]");
return builder.toString();
}
/*
* public static void main(String[] args) throws Exception {
* ScopeProvider.instance.set("/gcube/devNext/NextNext");
* GeoNaDataViewerProfileReader gdvp = new
* GeoNaDataViewerProfileReader("geoportal-data-viewer-app");
* GeoNaDataViewerProfile profile = gdvp.readProfileFromInfrastrucure();
* System.out.println(profile.getRestrictedPortletURL());
* System.out.println(profile.getOpenPortletURL());
*
* if(profile.getMapLayers()!=null) { for (String type :
* profile.getMapLayers().keySet()) {
* System.out.println("key: "+type+", value: "+profile.getMapLayers().get(type))
* ; } } }
*/
}

View File

@ -3,53 +3,48 @@ package org.gcube.application.geoportalcommon;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.PublicLink;
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder;
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder.RESOLVE_AS;
import org.gcube.portlets.user.urlshortener.UrlShortener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class GeoportalCommon.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 5, 2021
* May 2, 2023
*/
public class GeoportalCommon {
/** The Constant LOG. */
private static final Logger LOG = LoggerFactory.getLogger(GeoportalCommon.class);
private GeoNaDataViewerProfile geonaDataProfile;
/**
* Instantiates a new geoportal common.
*/
public GeoportalCommon() {
}
/**
* Instantiates a new geoportal common.
*
* @param geonaDataProfile the geona data profile
*/
public GeoportalCommon(GeoNaDataViewerProfile geonaDataProfile) {
this.geonaDataProfile = geonaDataProfile;
}
/**
* Gets the public links for.
*
* @param item the item
* @param gcubeScope the gcube scope
* @param item the item
* @param createShortURL creates and returns the short URL also.
* @return the public links for
* @throws Exception the exception
*/
public GeoNaItemRef getPublicLinksFor(GeoNaItemRef item, boolean createShortURL) throws Exception {
public GeoportalItemReferences getPublicLinksFor(String gcubeScope, GeoportalItemReferences item,
boolean createShortURL) throws Exception {
LOG.info("getPublicLinksFor called for: " + item);
try {
@ -57,37 +52,39 @@ public class GeoportalCommon {
if (item == null)
throw new Exception("Bad request, the item is null");
if (item.getItemId() == null)
throw new Exception("Bad request, the item id is null");
if (item.getProjectID() == null)
throw new Exception("Bad request, the ProjectID is null");
if (item.getItemType() == null)
throw new Exception("Bad request, the item type is null");
if (item.getProfileID() == null)
throw new Exception("Bad request, the ProfileID is null");
if(this.geonaDataProfile==null)
this.geonaDataProfile = getGeoNaDataViewProfile(GeoportalCommonConstants.GEOPORTAL_DATA_VIEWER_APP);
// Restricted Link
String link = String.format("%s?%s=%s&%s=%s", geonaDataProfile.getRestrictedPortletURL(),
GeoportalCommonConstants.GET_GEONA_ITEM_ID, item.getItemId(),
GeoportalCommonConstants.GET_GEONA_ITEM_TYPE, item.getItemType());
UriResolverManager resolver = new UriResolverManager("GEO");
// PRIVATE LINK
GeoportalResolverQueryStringBuilder builder = new GeoportalResolverQueryStringBuilder(item.getProfileID(),
item.getProjectID());
builder.scope(gcubeScope);
builder.resolverAs(RESOLVE_AS.PRIVATE);
// builder.resolverAs(RESOLVE_AS.PRIVATE);
Map<String, String> params = builder.buildQueryParameters();
String link = resolver.getLink(params, false);
String shortUrl = link;
try {
if(createShortURL)
if (createShortURL)
shortUrl = getShortUrl(link);
} catch (Exception e) {
LOG.warn("Error on shortening the URL: ", e);
}
item.setRestrictedLink(new PublicLink(link, shortUrl));
// Open Link
link = String.format("%s?%s=%s&%s=%s", geonaDataProfile.getOpenPortletURL(),
GeoportalCommonConstants.GET_GEONA_ITEM_ID, item.getItemId(),
GeoportalCommonConstants.GET_GEONA_ITEM_TYPE, item.getItemType());
// PUBLIC LINK
builder.resolverAs(RESOLVE_AS.PUBLIC);
params = builder.buildQueryParameters();
link = resolver.getLink(params, false);
shortUrl = link;
try {
shortUrl = getShortUrl(link);
if (createShortURL)
shortUrl = getShortUrl(link);
} catch (Exception e) {
LOG.warn("Error on shortening the URL: ", e);
}
@ -103,27 +100,6 @@ public class GeoportalCommon {
}
}
/**
* Gets the GeoNaData Viewer Profile.
*
* @param appID if null or empty uses the default appID that is
* {@link GeoportalCommonConstants#GEOPORTAL_DATA_VIEWER_APP}
* @return the GeoNaData Viewer Profile
* @throws Exception the exception
*/
public GeoNaDataViewerProfile getGeoNaDataViewProfile(String appID) throws Exception {
LOG.info("getGeoNaDataViewProfile called for: " + appID);
if (appID == null || appID.isEmpty())
appID = GeoportalCommonConstants.GEOPORTAL_DATA_VIEWER_APP;
LOG.info("using AppId: " + appID);
GeoNaDataViewerProfileReader gdvp = new GeoNaDataViewerProfileReader(appID);
GeoNaDataViewerProfile profile = gdvp.readProfileFromInfrastrucure();
LOG.info("Returning profile: " + profile);
return profile;
}
/**
* Gets the short url.
*
@ -169,12 +145,39 @@ public class GeoportalCommon {
}
/**
* Gets the geona data profile.
* Read GNA data viewer config.
*
* @return the geona data profile
* @param appID the app ID. If null uses the default
* {@link GeoportalCommonConstants#GEOPORTAL_DATA_VIEWER_APP}
* @return the GNA data viewer config profile
* @throws Exception the exception
*/
public GeoNaDataViewerProfile getGeonaDataProfile() {
return geonaDataProfile;
public GNADataViewerConfigProfile readGNADataViewerConfig(String appID) throws Exception {
LOG.info("getGeoNaDataViewProfile called for AppID: " + appID);
if (appID == null || appID.isEmpty()) {
appID = GeoportalCommonConstants.GEOPORTAL_DATA_VIEWER_APP;
LOG.info("AppID is null, so using DEFAULT: " + appID);
}
GNADataViewerConfigProfileReader gdvp = new GNADataViewerConfigProfileReader(appID);
GNADataViewerConfigProfile profile = gdvp.readProfileFromInfrastructure();
LOG.info("Returning profile: " + profile);
return profile;
}
/**
* Gets the GNA data config read from ApplicationProfile stored into IS.
*
* @return the GNA data config
* @throws Exception the exception
*/
public GNADataEntryConfigProfile readGNADataEntryConfig() throws Exception {
LOG.info("readGNADataEntryConfig called");
GNADataEntryConfigProfileReader gnaConfigReader = new GNADataEntryConfigProfileReader();
GNADataEntryConfigProfile config = gnaConfigReader.readProfileFromInfrastrucure();
return config;
}
}

View File

@ -14,5 +14,4 @@ public class GeoportalCommonConstants {
public static final String GEOPORTAL_DATA_VIEWER_APP = "geoportal-data-viewer-app";
}

View File

@ -0,0 +1,102 @@
package org.gcube.application.geoportalcommon;
import java.util.List;
/**
* The Class ProjectDVBuilder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 10, 2022
*/
public class ProjectDVBuilder {
private boolean lifecycleInformation;
private boolean spatialReference = true; //default
private boolean temporalReference;
private boolean relationships;
private List<String> listDocumentKeys;
private boolean fullDocumentMap;
private ProjectDVBuilder() {
}
public static ProjectDVBuilder newBuilder() {
return new ProjectDVBuilder();
}
public boolean isIncludeLifecycleInformation() {
return lifecycleInformation;
}
public boolean isIncludeSpatialReference() {
return spatialReference;
}
public boolean isIncludeTemporalReference() {
return temporalReference;
}
public boolean isIncludeRelationships() {
return relationships;
}
public List<String> getListDocumentKeys() {
return listDocumentKeys;
}
public boolean isIncludeFullDocumentMap() {
return fullDocumentMap;
}
public ProjectDVBuilder lifecycleInformation(boolean lifecycleInformation) {
this.lifecycleInformation = lifecycleInformation;
return this;
}
public ProjectDVBuilder spatialReference(boolean includeSpatialReference) {
this.spatialReference = includeSpatialReference;
return this;
}
public ProjectDVBuilder temporalReference(boolean includeTemporalReference) {
this.temporalReference = includeTemporalReference;
return this;
}
public ProjectDVBuilder relationships(boolean includeRelationships) {
this.relationships = includeRelationships;
return this;
}
public ProjectDVBuilder listDocumentKeys(List<String> listDocumentKeys) {
this.listDocumentKeys = listDocumentKeys;
return this;
}
public ProjectDVBuilder fullDocumentMap(boolean includeFullDocumentMap) {
this.fullDocumentMap = includeFullDocumentMap;
return this;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ProjectDVBuilder [lifecycleInformation=");
builder.append(lifecycleInformation);
builder.append(", spatialReference=");
builder.append(spatialReference);
builder.append(", temporalReference=");
builder.append(temporalReference);
builder.append(", relationships=");
builder.append(relationships);
builder.append(", listDocumentKeys=");
builder.append(listDocumentKeys);
builder.append(", fullDocumentMap=");
builder.append(fullDocumentMap);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,108 @@
package org.gcube.application.geoportalcommon;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GeoServerPlatformInfoDV;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
/**
* The Class SerializerUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 26, 2022
*/
public class SerializerUtil {
private static Logger LOG = LoggerFactory.getLogger(SerializerUtil.class);
private static ObjectMapper mapper;
private static ObjectMapper mapperXML;
static {
mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
mapper.configure(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
mapper.registerModule(new JavaTimeModule());
SimpleModule s = new SimpleModule();
mapper.registerModule(s);
}
/**
* Read JSON.
*
* @param <T> the generic type
* @param string the string
* @param clazz the clazz
* @return the t
* @throws JsonProcessingException the json processing exception
* @throws IOException Signals that an I/O exception has occurred.
*/
public static <T> T readJSON(String string, Class<T> clazz) throws JsonProcessingException, IOException {
return mapper.readerFor(clazz).readValue(string);
}
/**
* Unmarshal XML.
*
* @param <T> the generic type
* @param string the string
* @param theClass the the class
* @return the class
* @throws Exception the exception
*/
public static <T> T unmarshalXML(String string, Class<T> theClass) throws Exception {
LOG.debug("unmarshalXML: " + string.trim() + " as class: " + theClass);
try {
JAXBContext jaxbContext = JAXBContext.newInstance(theClass);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
if (string == null || string.length() == 0)
throw new Exception("Input string is null or empty");
InputStream stream = new ByteArrayInputStream(string.getBytes());
T umarshalledObject = (T) jaxbUnmarshaller.unmarshal(stream);
LOG.debug("returning: " + umarshalledObject);
return umarshalledObject;
} catch (Exception e) {
LOG.error("An error occurred on unmarshalling " + string + "as " + theClass, e);
return null;
}
}
public static class GeoserverPlaformInfoJsonDeserializer extends JsonDeserializer<GeoServerPlatformInfoDV[]> {
@Override
public GeoServerPlatformInfoDV[] deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
LOG.info("deserialize: " +jp.getValueAsString());
return jp.readValueAs(GeoServerPlatformInfoDV[].class);
//return jp.readValueAs(GeoServerPlatformInfoDV[].class);
//List<GeoServerPlatformInfoDV> listPlatform = jp.readValueAs(new TypeReference<List<GeoServerPlatformInfoDV>>() {});
}
}
}

View File

@ -0,0 +1,152 @@
/**
*
*/
package org.gcube.application.geoportalcommon.config;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* The Class CSVFile.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* Jan 29, 2019
*/
public class CSVFile implements Serializable{
/**
*
*/
private static final long serialVersionUID = 6408321963787244600L;
private CSVRow headerRow;
private List<CSVRow> valueRows;
private String fileName;
/**
* Instantiates a new CSV file.
*/
public CSVFile(){
}
/**
* Instantiates a new csv file.
*
* @param fileName the file name
* @param headerRow the header row
* @param valueRows the value rows
*/
public CSVFile(String fileName, CSVRow headerRow, List<CSVRow> valueRows) {
this.fileName = fileName;
this.headerRow = headerRow;
this.valueRows = valueRows;
}
/**
* Gets the header row.
*
* @return the headerRow
*/
public CSVRow getHeaderRow() {
return headerRow;
}
/**
* Adds the value row.
*
* @param row the row
*/
public void addValueRow(CSVRow row) {
if(valueRows==null)
valueRows = new ArrayList<CSVRow>();
valueRows.add(row);
}
/**
* Sets the value rows.
*
* @param valueRows the new value rows
*/
public void setValueRows(List<CSVRow> valueRows) {
this.valueRows = valueRows;
}
/**
* Gets the value rows.
*
* @return the valueRows
*/
public List<CSVRow> getValueRows() {
return valueRows;
}
/**
* Sets the header row.
*
* @param headerRow the headerRow to set
*/
public void setHeaderRow(CSVRow headerRow) {
this.headerRow = headerRow;
}
/**
* Gets the file name.
*
* @return the fileName
*/
public String getFileName() {
return fileName;
}
/**
* Sets the file name.
*
* @param fileName the fileName to set
*/
public void setFileName(String fileName) {
this.fileName = fileName;
}
/**
* To string.
*
* @return the string
*/
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CSVFile [headerRow=");
builder.append(headerRow);
builder.append(", valueRows=");
builder.append(valueRows);
builder.append(", fileName=");
builder.append(fileName);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,192 @@
/**
*
*/
package org.gcube.application.geoportalcommon.config;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* The Class CSVReader.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* Jan 29, 2019
*/
public class CSVReader {
public static final char DEFAULT_SEPARATOR = ',';
public static final char DEFAULT_QUOTE = '"';
private File file;
private CSVFile csvFile;
/**
* Instantiates a new CSV reader.
*
* @param file the file
* @throws FileNotFoundException the file not found exception
*/
public CSVReader(File file) throws FileNotFoundException {
this.file = file;
this.csvFile = new CSVFile();
readCSV(file);
}
/**
* Read csv.
*
* @param file the file
* @throws FileNotFoundException the file not found exception
*/
private void readCSV(File file) throws FileNotFoundException {
Scanner scanner = new Scanner(file);
csvFile.setFileName(file.getName());
int i = 0;
while (scanner.hasNext()) {
CSVRow csvRow = new CSVRow();
List<String> line = parseLine(scanner.nextLine());
csvRow.setListValues(line);
if(i==0){
csvFile.setHeaderRow(csvRow);
}else{
csvFile.addValueRow(csvRow);
}
i++;
}
scanner.close();
}
/**
* Parses the line.
*
* @param cvsLine the cvs line
* @return the list
*/
public static List<String> parseLine(String cvsLine) {
return parseLine(cvsLine, DEFAULT_SEPARATOR, DEFAULT_QUOTE);
}
/**
* Parses the line.
*
* @param cvsLine the cvs line
* @param separators the separators
* @return the list
*/
public static List<String> parseLine(String cvsLine, char separators) {
return parseLine(cvsLine, separators, DEFAULT_QUOTE);
}
/**
* Parses the line.
*
* @param cvsLine the cvs line
* @param separators the separators
* @param customQuote the custom quote
* @return the list
*/
private static List<String> parseLine(String cvsLine, char separators, char customQuote) {
List<String> result = new ArrayList<>();
// if empty, return!
if (cvsLine == null || cvsLine.isEmpty()) {
return result;
}
if (customQuote == ' ') {
customQuote = DEFAULT_QUOTE;
}
if (separators == ' ') {
separators = DEFAULT_SEPARATOR;
}
StringBuffer curVal = new StringBuffer();
boolean inQuotes = false;
boolean startCollectChar = false;
boolean doubleQuotesInColumn = false;
char[] chars = cvsLine.toCharArray();
for (char ch : chars) {
if (inQuotes) {
startCollectChar = true;
if (ch == customQuote) {
inQuotes = false;
doubleQuotesInColumn = false;
}
else {
// Fixed : allow "" in custom quote enclosed
if (ch == '\"') {
if (!doubleQuotesInColumn) {
curVal.append(ch);
doubleQuotesInColumn = true;
}
}
else {
curVal.append(ch);
}
}
}
else {
if (ch == customQuote) {
inQuotes = true;
// Fixed : allow "" in empty quote enclosed
if (chars[0] != '"' && customQuote == '\"') {
curVal.append('"');
}
// double quotes in column will hit this!
if (startCollectChar) {
curVal.append('"');
}
}
else if (ch == separators) {
result.add(curVal.toString());
curVal = new StringBuffer();
startCollectChar = false;
}
else if (ch == '\r') {
// ignore LF characters
continue;
}
else if (ch == '\n') {
// the end, break!
break;
}
else {
curVal.append(ch);
}
}
}
result.add(curVal.toString());
return result;
}
/**
* Gets the csv file.
*
* @return the csvFile
*/
public CSVFile getCsvFile() {
return csvFile;
}
/**
* Gets the file.
*
* @return the file
*/
public File getFile() {
return file;
}
}

View File

@ -0,0 +1,81 @@
/**
*
*/
package org.gcube.application.geoportalcommon.config;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* The Class CSVRow.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* Jan 29, 2019
*/
public class CSVRow implements Serializable{
/**
*
*/
private static final long serialVersionUID = 6254861811998867626L;
private List<String> listValues;
/**
* Instantiates a new CSV row.
*/
public CSVRow(){
}
/**
* Gets the list values.
*
* @return the listValues
*/
public List<String> getListValues() {
return listValues;
}
/**
* @param listValues the listValues to set
*/
public void setListValues(List<String> listValues) {
this.listValues = listValues;
}
/**
* Adds the value.
*
* @param value the value
*/
public void addValue(String value) {
if(listValues==null)
listValues = new ArrayList<String>();
listValues.add(value);
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CSVRow [listValues=");
builder.append(listValues);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,100 @@
package org.gcube.application.geoportalcommon.config;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
/**
* The Class FileUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 2, 2021
*/
public class FileUtil {
/**
* Input stream to temp file.
*
* @param inputStream the input stream
* @param fileName the file name
* @return the file
* @throws IOException Signals that an I/O exception has occurred.
*/
// InputStream -> Temp File
public static File inputStreamToTempFile(InputStream inputStream, String fileName) throws IOException {
File tempFile = File.createTempFile(fileName, ".tmp");
// File tempFile = File.createTempFile("MyAppName-", ".tmp");
try (FileOutputStream outputStream = new FileOutputStream(tempFile)) {
int read;
byte[] bytes = new byte[1024];
while ((read = inputStream.read(bytes)) != -1) {
outputStream.write(bytes, 0, read);
}
return tempFile;
} finally {
tempFile.deleteOnExit();
}
}
/**
* Input stream to temp file.
*
* @param copyString the copy string
* @return
* @throws IOException Signals that an I/O exception has occurred.
*/
public static File inputStreamToTempFile(String copyString, String prefixFile) throws IOException {
File targetFile = null;
try {
InputStream initialStream = new ByteArrayInputStream(copyString.getBytes());
targetFile = File.createTempFile(prefixFile, ".tmp");
java.nio.file.Files.copy(initialStream, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
try {
if (initialStream != null) {
initialStream.close();
}
} catch (IOException ioe) {
// ignore
}
return targetFile;
} finally {
try {
if (targetFile != null)
targetFile.deleteOnExit();
} catch (Exception e) {
}
}
}
/**
* Copy input stream to file.
*
* @param is the is
* @param to the to
* @return the file
* @throws IOException Signals that an I/O exception has occurred.
*/
public static File copyInputStreamToFile(InputStream is, String to) throws IOException {
Path dest = Paths.get(to);
Files.copy(is, dest);
return new File(to);
}
}

View File

@ -0,0 +1,33 @@
package org.gcube.application.geoportalcommon.geoportal;
/**
* The Class GeoportalClientCaller
*
* Wrapping the geoportal Clients
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 11, 2022
*/
public class GeoportalClientCaller {
/**
* Use case descriptor client.
*
* @return the use case descriptor caller
*/
public static UseCaseDescriptorCaller useCaseDescriptors() {
return new UseCaseDescriptorCaller();
}
/**
* Projects client
*
* @return the projects caller
*/
public static ProjectsCaller projects() {
return new ProjectsCaller();
}
}

View File

@ -0,0 +1,80 @@
package org.gcube.application.geoportalcommon.geoportal;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
/**
* The Class GeoportalConfigUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 15, 2022
*/
public class GeoportalConfigUtil {
private static Logger LOG = LoggerFactory.getLogger(GeoportalConfigUtil.class);
/**
* Read roles for STEP id.
*
* @param handler the handler
* @param stepID the step ID
* @return the list
* @throws Exception the exception
*/
public static List<String> readRolesForSTEPId(HandlerDeclaration handler, String stepID) throws Exception {
LOG.debug("readRolesForSTEPId called for stepID {}, handler {}", stepID, handler);
List<String> roles = new ArrayList<String>();
try {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build();
String toJSON = handler.getConfiguration().toJson();
LOG.debug("Handler to JSON: " + toJSON);
JSONObject jObject = new JSONObject(toJSON);
JsonPath jsonPath = JsonPath.compile("$.step_access[?(@.STEP == '" + stepID + "' )].roles");
LOG.trace("jsonPath: " + jsonPath.getPath());
// $..book[?(@.price <= $['expensive'])]
JSONArray data = jsonPath.read(jObject, configuration);
LOG.debug("jsonPath matching data lenght: " + data.length());
HashSet<String> listdata = new HashSet<String>(data.length());
if(data.length()>0) {
LOG.debug("stepID found");
try {
JSONArray arrayRoles = new JSONArray(data.get(0).toString());
for (int i = 0; i < arrayRoles.length(); i++) {
String role = arrayRoles.get(i).toString();
LOG.debug("for STEP_ID {} read role {}", stepID, role);
listdata.add(role);
}
}catch (Exception e) {
LOG.warn("Error on reading array roles for STEP_ID: "+stepID, e);
}
}
roles = listdata.stream().collect(Collectors.toList());
LOG.info("for STEP_ID {} returning Roles {} ", stepID, roles);
} catch (Exception e) {
LOG.warn("Error occurred on reading roles into handler {} returning no role", handler);
}
return roles;
}
}

View File

@ -0,0 +1,670 @@
package org.gcube.application.geoportalcommon.geoportal;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
import java.io.File;
import java.io.FileNotFoundException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.bson.Document;
import org.gcube.application.geoportal.common.faults.InvalidRequestException;
import org.gcube.application.geoportal.common.model.configuration.Archive;
import org.gcube.application.geoportal.common.model.configuration.Configuration;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.relationships.RelationshipNavigationObject;
import org.gcube.application.geoportal.common.model.rest.CreateRelationshipRequest;
import org.gcube.application.geoportal.common.model.rest.DeleteRelationshipRequest;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest;
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest.Direction;
import org.gcube.application.geoportal.common.model.rest.QueryRequest.PagedRequest;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest;
import org.gcube.application.geoportal.common.rest.Projects;
import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
import org.gcube.application.geoportalcommon.shared.WhereClause;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.PhaseDV;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.BasicDBObjectBuilder;
/**
* The Class ProjectsCaller.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 17, 2022
*/
public class ProjectsCaller {
public static final String DOCUMENT_STORE_COLLECTION = "DOCUMENT-STORE-COLLECTION";
private static Logger LOG = LoggerFactory.getLogger(GeoportalClientCaller.class);
/**
* Gets the client.
*
* @param profileID the profile ID
* @return the client
*/
public Projects<Project> getClient(String profileID) {
LOG.info("getClient called for profileID={}", profileID);
return projects(profileID).build();
}
/**
* Creates the new.
*
* @param profileID the profile ID
* @param jsonDocument the json document
* @return the project
* @throws RemoteException the remote exception
*/
public Project createNew(String profileID, String jsonDocument) throws RemoteException {
LOG.info("createNew called on profileID={}", profileID);
Document myDocument = Document.parse(jsonDocument);
Projects<Project> client = getClient(profileID);
Project project = client.createNew(myDocument);
return project;
}
/**
* Register file set.
*
* @param profileID the profile ID
* @param project the project
* @param theFile the the file
* @param parentPath the parent path
* @param fieldName the field name
* @param fieldDefinition the field definition
* @return the project
* @throws RemoteException the remote exception
* @throws FileNotFoundException the file not found exception
* @throws JsonProcessingException the json processing exception
* @throws InvalidRequestException the invalid request exception
*/
public Project registerFileSet(String profileID, Project project, File theFile, String parentPath, String fieldName,
String fieldDefinition)
throws RemoteException, FileNotFoundException, JsonProcessingException, InvalidRequestException {
LOG.info(
"registerFileSet called with [profileID={}, projectID={}, theFile={}, parentPath={}, fieldName={}, fieldDefinition={}",
parentPath, project.getId(), theFile, parentPath, fieldName, fieldDefinition);
Projects<Project> client = getClient(profileID);
// Prepare request
RegisterFileSetRequest fsRequest = FileSets.prepareRequest(new StorageUtils(), parentPath, fieldName,
fieldDefinition, theFile);
project = client.registerFileSet(project.getId(), fsRequest);
LOG.trace("Resulting Project : " + project);
return project;
}
/**
* Gets the list for profile ID.
*
* @param profileID the profile ID
* @return the list for profile ID
* @throws Exception the exception
*/
public List<Project> getListForProfileID(String profileID) throws Exception {
LOG.info("getListForProfileID called for profileID: {}", profileID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
List<Project> listProjects = new ArrayList<Project>();
Iterator<Project> projects = client.query(new QueryRequest());
for (Iterator<Project> iterator = projects; projects.hasNext();) {
Project prg = (Project) iterator.next();
listProjects.add(prg);
}
LOG.info("returning {} project/s", listProjects.size(), Project.class.getName());
return listProjects;
}
/**
* Gets the project by ID.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the project by ID
* @throws Exception the exception
*/
public Project getProjectByID(String profileID, String projectID) throws Exception {
LOG.info("getProjectByID called for profileID: {}, projectID: {}", profileID, projectID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Project project = client.getById(projectID);
LOG.info("returning project {}", project != null ? project.getId() : null);
return project;
}
/**
* Gets the relationship chain.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param relationID the relation ID
* @param deep the deep
* @return the relationship chain
* @throws Exception the exception
*/
public Iterator<RelationshipNavigationObject> getRelationshipChain(String profileID, String projectID,
String relationID, Boolean deep) throws Exception {
LOG.info("getRelationshipChain called for projectID: {}, relationID: {}", projectID, projectID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
return client.getRelationshipChain(projectID, relationID, deep);
}
/**
* Gets the configuration.
*
* @param profileID the profile ID
* @return the configuration
* @throws Exception the exception
*/
public Configuration getConfiguration(String profileID) throws Exception {
LOG.info("getConfiguration called for profileID: {} ", profileID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Configuration config = client.getConfiguration();
LOG.debug("returning: {} ", config);
return config;
}
/**
* Gets the total document.
*
* @param profileID the profile ID
* @return the total document
* @throws Exception the exception
*/
public Integer getTotalDocument(String profileID) throws Exception {
LOG.info("getTotalDocument called for profileID: {}", profileID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Configuration config = client.getConfiguration();
List<Archive> listArchives = config.getArchives();
for (Archive archive : listArchives) {
String theType = archive.getString("_type");
if (theType.equalsIgnoreCase(DOCUMENT_STORE_COLLECTION)) {
String totalDocumentAre = archive.get("count").toString();
int total = Integer.parseInt(totalDocumentAre);
LOG.info("total docs for profileID: {}, are: {}", profileID, total);
return total;
}
}
return null;
}
/**
* Gets the total document.
*
* @param profileID the profile ID
* @return the total document
* @throws Exception the exception
*/
public List<String> getIDsPhases(String profileID) throws Exception {
LOG.info("getIDsPhases called for profileID: {}", profileID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Configuration config = client.getConfiguration();
List<Archive> listArchives = config.getArchives();
for (Archive archive : listArchives) {
String theType = archive.getString("_type");
if (theType.equalsIgnoreCase(DOCUMENT_STORE_COLLECTION)) {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build();
String toJSON = archive.toJson();
JSONObject jObject = new JSONObject(toJSON);
JsonPath jsonPath = JsonPath.compile("$.countByPhase[*]._id.phase");
JSONArray phases = jsonPath.read(jObject, configuration);
HashSet<String> listdata = new HashSet<String>(phases.length());
for (int i = 0; i < phases.length(); i++) {
listdata.add(phases.get(i).toString());
}
List<String> idsPhases = listdata.stream().collect(Collectors.toList());
LOG.info("getIDsPhases returning: {}", idsPhases);
return idsPhases;
}
}
LOG.info("getIDsPhases returning null");
return null;
}
public Integer getCountByPhaseFor(String profileID, String phase, String status) throws Exception {
LOG.info("getCountByPhaseFor called for profileID: {}, phase: {}, status: {}", profileID, phase, status);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Configuration config = client.getConfiguration();
List<Archive> listArchives = config.getArchives();
Integer count = null;
for (Archive archive : listArchives) {
String theType = archive.getString("_type");
if (theType.equalsIgnoreCase(DOCUMENT_STORE_COLLECTION)) {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build();
String toJSON = archive.toJson();
JSONObject jObject = new JSONObject(toJSON);
String query = String.format("$.countByPhase[*][?(@._id.phase == '%s' && @._id.status == '%s')].count",
phase, status);
LOG.debug("Performing query: " + query);
JsonPath jsonPath = JsonPath.compile(query);
JSONArray counts = jsonPath.read(jObject, configuration);
try {
count = counts.getInt(0);
} catch (Exception e) {
LOG.warn("getCountByPhaseFor error: " + e.getLocalizedMessage());
}
}
}
LOG.info("getCountByPhaseFor returning: " + count);
return count;
}
/**
* Gets the phases into document store collection.
*
* @param profileID the profile ID
* @return the phases into document store collection
* @throws Exception the exception
*/
public PhaseDV[] getPhasesIntoDocumentStoreCollection(String profileID) throws Exception {
LOG.info("getPhases called for profileID: {}", profileID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
Configuration config = client.getConfiguration();
List<Archive> listArchives = config.getArchives();
for (Archive archive : listArchives) {
String theType = archive.getString("_type");
if (theType.equalsIgnoreCase(DOCUMENT_STORE_COLLECTION)) {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build();
String toJSON = archive.toJson();
JSONObject jObject = new JSONObject(toJSON);
JsonPath jsonPath = JsonPath.compile("$.countByPhase[*]");
JSONArray phases = jsonPath.read(jObject, configuration);
final ObjectMapper objectMapper = new ObjectMapper();
PhaseDV[] phasesArr = objectMapper.readValue(phases.toString(), PhaseDV[].class);
LOG.info("getPhases returning {} PhaseDVs", phasesArr.length);
return phasesArr;
}
}
LOG.info("getPhases returning null");
return null;
}
/**
* Perform step.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param stepID the step ID
* @param options the options
* @return the project
* @throws Exception the exception
*/
public Project performStep(String profileID, String projectID, String stepID, Document options) throws Exception {
LOG.info("performStep called for profileID: {}, projectID: {}", profileID, projectID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
StepExecutionRequest request = new StepExecutionRequest(stepID, options);
Project project = client.performStep(projectID, request);
LOG.info("performStep returning project ID: " + project.getId());
return project;
}
/**
* Delete project.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param force the force
* @throws RemoteException the remote exception
*/
public void deleteProject(String profileID, String projectID, boolean force) throws RemoteException {
LOG.info("deleteProject called for projectID {}", projectID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
if (force)
client.deleteById(projectID, force);
else
client.deleteById(projectID);
return;
}
/**
* Update project.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param updatedDocument the updated document
* @return the project
* @throws RemoteException the remote exception
*/
public Project updateProject(String profileID, String projectID, Document updatedDocument) throws RemoteException {
LOG.info("updateProject called for projectID {}", projectID);
Projects<Project> client = (Projects<Project>) getClient(profileID);
return client.updateDocument(projectID, updatedDocument);
}
/**
* Creates the relationship.
*
* @param fromProfileID the from profile ID
* @param fromProjectID the from project ID
* @param relationshipId the relationship id
* @param toProfileID the to profile ID
* @param toProjectID the to project ID
* @throws RemoteException the remote exception
*/
public void createRelationship(String fromProfileID, String fromProjectID, String relationshipId,
String toProfileID, String toProjectID) throws RemoteException {
LOG.info("createRelationship called for fromProfileID {} and fromProjectID {}", fromProfileID, fromProjectID);
LOG.info("create relationshipName {}", relationshipId);
LOG.info("to toProfileID {} and toProjectID {}", toProfileID, toProjectID);
Projects<Project> client = (Projects<Project>) getClient(fromProfileID);
CreateRelationshipRequest request = new CreateRelationshipRequest(fromProjectID, relationshipId, toProjectID,
toProfileID);
client.setRelation(request);
return;
}
/**
* Delete relationship.
*
* @param fromProfileID the from profile ID
* @param fromProjectID the from project ID
* @param relationshipId the relationship id
* @param toProfileID the to profile ID
* @param toProjectID the to project ID
* @throws RemoteException the remote exception
*/
public void deleteRelationship(String fromProfileID, String fromProjectID, String relationshipId,
String toProfileID, String toProjectID) throws RemoteException {
LOG.info("deleteRelationship called for fromProfileID {} and fromProjectID {}", fromProfileID, fromProjectID);
LOG.info("deleteRelationship relationshipName {}", relationshipId);
LOG.info("to toProfileID {} and toProjectID {}", toProfileID, toProjectID);
Projects<Project> client = (Projects<Project>) getClient(fromProfileID);
DeleteRelationshipRequest request = new DeleteRelationshipRequest(fromProjectID, relationshipId, toProjectID,
toProfileID);
client.deleteRelation(request);
}
/**
* Delete fileset.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param jsonPathToFileset the json path to fileset
* @param force the force
* @param ignoreErrors the ignore errors
* @return the project
* @throws RemoteException the remote exception
*/
public Project deleteFileset(String profileID, String projectID, String jsonPathToFileset, Boolean force,
Boolean ignoreErrors) throws RemoteException {
LOG.info("deleteFileset called for profileID {} and projectID {}, fileset path: {}", profileID, projectID,
jsonPathToFileset);
Projects<Project> client = (Projects<Project>) getClient(profileID);
ignoreErrors = ignoreErrors == null ? false : ignoreErrors;
Project project = client.deleteFileSet(projectID, jsonPathToFileset, force, ignoreErrors);
LOG.info("fileset {} deleted", jsonPathToFileset);
LOG.debug("returning new project: {} ", project.getTheDocument());
return project;
}
/**
* Simple query.
*
* @param profileID the profile ID
* @param filter the filter
* @return the iterator
* @throws Exception the exception
*/
public Iterator<Project> simpleQuery(String profileID, Document filter) throws Exception {
LOG.info("simpleQuery called for profileID {} and filter {}", profileID, filter);
try {
Projects<Project> geoportalClient = getClient(profileID);
QueryRequest request = new QueryRequest();
request.setFilter(filter);
return geoportalClient.query(request);
} catch (Exception e) {
LOG.error("Error on performing query: " + filter, e);
throw new Exception("Error occurred on performing query " + filter + ". Error: " + e.getMessage());
}
}
/**
* Query on mongo.
*
* @param profileID the profile ID
* @param totalItems the total items
* @param offset the offset
* @param limit the limit
* @param filter the filter
* @return the iterator
* @throws Exception the exception
*/
public Iterator<Project> queryOnMongo(String profileID, Integer totalItems, Integer offset, Integer limit,
SearchingFilter filter) throws Exception {
LOG.debug("queryOnMongo called");
try {
Projects<Project> geoportalClient = getClient(profileID);
if (totalItems == null || totalItems < 0) {
// TODO MUST BE REPLACED BY COUNT
List<Project> listOfProjects = getListForProfileID(profileID);
int listConcessioniSize = listOfProjects.size();
totalItems = listConcessioniSize;
}
Integer offsetIndex = offset;
Integer limitIndex = limit;
if (offset == null || offset < 0) {
offsetIndex = 0;
}
if (limit == null || limit < 0) {
limitIndex = totalItems;
}
Direction sDirection = null;
List<String> orderingFields = new ArrayList<String>();
if (filter == null) {
LOG.info("No filter found, creating empty filter");
filter = new SearchingFilter();
}
ORDER order = filter.getOrder();
if (order == null) {
order = ORDER.ASC;
LOG.info("No direction/order found, using default: " + order);
}
switch (order) {
case ASC:
sDirection = Direction.ASCENDING;
break;
case DESC:
sDirection = Direction.DESCENDING;
break;
}
List<ItemFieldDV> orderByFields = filter.getOrderByFields();
if (orderByFields == null) {
orderByFields = new ArrayList<ItemFieldDV>();
}
// if (orderByFields.isEmpty()) {
// ItemFieldDV orderD = new ItemFieldDV("", Arrays.asList("name"), null, false, false, false);
// LOG.info("Order by is null, adding default: " + orderD);
// orderByFields.add(orderD);
// }
for (ItemFieldDV itemField : orderByFields) {
if (itemField.getJsonFields() != null) {
for (String jsonFieldPath : itemField.getJsonFields()) {
// String fieldFullPath = String.format("%s.%s", itemField.getProjection(),
// field);
orderingFields.add(jsonFieldPath);
}
}
}
Map<String, Object> projection = filter.getProjection();
Document projectionDocument = null;
if (projection != null && !projection.isEmpty()) {
projectionDocument = new Document(projection);
}
QueryRequest request = new QueryRequest();
PagedRequest paging = new PagedRequest();
paging.setOffset(offsetIndex);
paging.setLimit(limitIndex);
request.setPaging(paging);
OrderedRequest ordering = new OrderedRequest();
ordering.setDirection(sDirection);
ordering.setFields(orderingFields);
request.setOrdering(ordering);
Document query = new Document();
if (filter.getConditions() != null) {
for (WhereClause whereClause : filter.getConditions()) {
LOGICAL_OP searchWithOperator = whereClause.getOperator();
if (searchWithOperator == null) {
searchWithOperator = LOGICAL_OP.OR;
}
if (whereClause.getSearchInto() != null && !whereClause.getSearchInto().isEmpty()) {
Map<String, Object> searchFields = whereClause.getSearchInto();
BasicDBObjectBuilder builder = BasicDBObjectBuilder.start();
for (String key : searchFields.keySet()) {
// using regex and case-insensitive
BasicDBObject bs = new BasicDBObject();
bs.append("$regex", searchFields.get(key));
bs.append("$options", "i");
builder.append(key, bs);
}
// Building list of Document in OR clause
BasicDBList list = new BasicDBList();
Map map = builder.get().toMap();
for (Object key : map.keySet()) {
BasicDBObject value = (BasicDBObject) map.get(key);
Document doc = new Document((String) key, value);
list.add(doc);
}
// query = new Document();
query.put(searchWithOperator.getOperator(), list);
// BasicDBObject bs = new BasicDBObject();
// bs.append("$eq", "PASSED");
// query.put("report.status", bs);
}
}
}
if (projectionDocument != null) {
request.setProjection(projectionDocument);
// THE first field specified in the projection must be not null
BasicDBObject bsNotEqualEmpty = new BasicDBObject();
bsNotEqualEmpty.append("$ne", null);
Optional<String> firstKey = projection.keySet().stream().findFirst();
if (firstKey.isPresent()) {
String firstFieldPath = firstKey.get();
query.append(firstFieldPath, bsNotEqualEmpty);
}
}
// REMOVING DIRTY DOCUMENTS
/*
* BasicDBObject bsValid_Document = new BasicDBObject();
* bsValid_Document.append("$exists", true); bsValid_Document.append("$ne",
* null); query.append("_theDocument", bsValid_Document);
*
* BasicDBObject bsValidLfc = new BasicDBObject(); bsValidLfc.append("$ne",
* null); query.append("_lifecycleInformation._phase", bsValidLfc);
*/
// BasicDBObject bsDocumentExists = new BasicDBObject();
// bsDocumentExists.append("$exists", false);
// query.append("theDocument", bsDocumentExists);
// BasicDBObject bsNotEqualEmpty = new BasicDBObject();
// bsNotEqualEmpty.append("$ne", null);
// query.append("_theDocument.nome", bsNotEqualEmpty);
request.setFilter(query);
LOG.info("Paging offset: " + offsetIndex + ", limit: " + limitIndex);
LOG.info("Direction: " + sDirection);
LOG.info("Projection: " + projectionDocument);
LOG.info("Order by Fields: " + ordering);
LOG.info("Search for conditions: " + filter.getConditions());
if (query != null) {
LOG.info("Search query to JSON: " + query.toJson());
}
return geoportalClient.query(request);
} catch (Exception e) {
LOG.error("Error on loading paginated and filtered list of Project: ", e);
throw new Exception("Error occurred on loading list of Project. Error: " + e.getMessage());
}
}
}

View File

@ -0,0 +1,229 @@
package org.gcube.application.geoportalcommon.geoportal;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import org.bson.Document;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.RelationshipDefinition;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.rest.UseCaseDescriptorsI;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
/**
* The Class UseCaseDescriptorCaller.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 14, 2022
*/
public class UseCaseDescriptorCaller {
private static Logger LOG = LoggerFactory.getLogger(UseCaseDescriptorCaller.class);
public static final String TIMELINE_CONFIG_TJT_DOCUMENT = "tjt_document";
/**
* Use case descriptors client.
*
* @return the use case descriptors I
*/
public UseCaseDescriptorsI useCaseDescriptorsClient() {
LOG.info("useCaseDescriptorsClient called");
return useCaseDescriptors().build();
}
/**
* Gets the list.
*
* @return the list
* @throws Exception the exception
*/
public List<UseCaseDescriptor> getList() throws Exception {
LOG.info("getList called");
UseCaseDescriptorsI client = useCaseDescriptorsClient();
List<UseCaseDescriptor> listUCD = new ArrayList<UseCaseDescriptor>();
Iterator<UseCaseDescriptor> useCaseDescrs = client.query(new QueryRequest());
for (Iterator<UseCaseDescriptor> iterator = useCaseDescrs; useCaseDescrs.hasNext();) {
UseCaseDescriptor prg = (UseCaseDescriptor) iterator.next();
listUCD.add(prg);
}
LOG.info("returning {} {}", listUCD.size(), UseCaseDescriptor.class.getName());
return listUCD;
}
/**
* Gets the list for handler ids.
*
* @param listHandlersIds the list handlers ids
* @return the list for handler ids
* @throws Exception the exception
*/
public List<UseCaseDescriptor> getListForHandlerIds(List<String> listHandlersIds) throws Exception {
LOG.info("getListForHandlerIds called");
return getListForJSONPath("_handlers._id", listHandlersIds);
}
/**
* Gets the list for JSON path.
*
* @param jsonPath the json path
* @param listValues the list values
* @return the list for JSON path
* @throws Exception the exception
*/
public List<UseCaseDescriptor> getListForJSONPath(String jsonPath, List<String> listValues) throws Exception {
LOG.info("getListForJSONPath called for jsonPath: {}, with listValues: {}", jsonPath, listValues);
UseCaseDescriptorsI client = useCaseDescriptorsClient();
List<UseCaseDescriptor> listUCD = new ArrayList<UseCaseDescriptor>();
// BasicDBObjectBuilder builder = BasicDBObjectBuilder.start();
// for (String key : listHandlersIds) {
// // using regex and case-insensitive
// BasicDBObject bs = new BasicDBObject();
// bs.append(jsonPath, key);
// builder.append(key, bs);
//
// }
// Building list of Document in OR clause
BasicDBList list = new BasicDBList();
for (String value : listValues) {
Document doc = new Document(jsonPath, value);
list.add(doc);
}
QueryRequest queryRequest = new QueryRequest();
Document queryDoc = new Document();
queryDoc.put("$and", list);
LOG.debug("Performing query: {}", queryDoc.toJson());
queryRequest.setFilter(queryDoc);
// QueryRequest queryRequest = new QueryRequest();
// Document queryDoc = new Document();
// BasicDBObject bs = new BasicDBObject();
// bs.append("$eq", hasValue);
// queryDoc.put(jsonPath, bs);
// LOG.debug("Performing query: {}", queryDoc.toJson());
// queryRequest.setFilter(queryDoc);
Iterator<UseCaseDescriptor> useCaseDescrsIt = client.query(queryRequest);
if (useCaseDescrsIt != null) {
while (useCaseDescrsIt.hasNext()) {
UseCaseDescriptor prg = (UseCaseDescriptor) useCaseDescrsIt.next();
listUCD.add(prg);
}
}
LOG.info("getListForJSONPath returning {} {}", listUCD.size(), UseCaseDescriptor.class.getName());
return listUCD;
}
/**
* Gets the UCD for id.
*
* @param profileID the profile ID
* @return the UCD for id
* @throws Exception the exception
*/
public UseCaseDescriptor getUCDForId(String profileID) throws Exception {
LOG.info("getUCDForId called for profileID: {}", profileID);
UseCaseDescriptorsI client = useCaseDescriptorsClient();
QueryRequest queryRequest = new QueryRequest();
Document queryDoc = new Document();
BasicDBObject bs = new BasicDBObject();
bs.append("$eq", profileID);
queryDoc.put("_id", bs);
LOG.debug("Performing query: {}", queryDoc.toJson());
queryRequest.setFilter(queryDoc);
Iterator<UseCaseDescriptor> useCaseDescrs = client.query(queryRequest);
UseCaseDescriptor ucd = null;
if (useCaseDescrs.hasNext()) {
ucd = useCaseDescrs.next();
}
LOG.info("for profileID: {}, returning: {}", profileID, ucd);
return ucd;
}
/**
* Gets the handlers by type.
*
* @param profileID the profile ID
* @param theHandlerType the the handler type
* @return the handlers by type
* @throws Exception the exception
*/
public List<HandlerDeclaration> getHandlersByType(String profileID, String theHandlerType) throws Exception {
LOG.info("getHandlersByType called for profileID: {}", profileID);
UseCaseDescriptorsI client = useCaseDescriptorsClient();
UseCaseDescriptor ucd = client.getById(profileID);
return ucd.getHandlersByType(theHandlerType);
}
/**
* Gets the relationship definitions.
*
* @param profileID the profile ID
* @return the relationship definitions
* @throws Exception the exception
*/
public List<RelationshipDefinition> getRelationshipDefinitions(String profileID) throws Exception {
LOG.info("getRelationshipNames called for profileID: {}", profileID);
UseCaseDescriptorsI client = useCaseDescriptorsClient();
UseCaseDescriptor ucd = client.getById(profileID);
return ucd.getRelationshipDefinitions();
}
/**
* Read temporal dimension template.
*
* @param profileID the profile ID
* @return the document
* @throws Exception the exception
*/
public Document readTemporalDimensionTemplate(String profileID) throws Exception {
UseCaseDescriptorsI client = useCaseDescriptorsClient();
UseCaseDescriptor ucd = client.getById(profileID);
List<HandlerDeclaration> timelineHandlers = ucd
.getHandlersByType(GEOPORTAL_DATA_HANDLER.geoportal_timeline_json_template.getType());
if (timelineHandlers != null && timelineHandlers.size() > 0) {
HandlerDeclaration handler = timelineHandlers.get(0); // only one expected
Document config = handler.getConfiguration();
try {
LinkedHashMap<String, Object> tjtDoc = (LinkedHashMap<String, Object>) config
.get(TIMELINE_CONFIG_TJT_DOCUMENT);
return new Document(tjtDoc);
} catch (Exception e) {
LOG.warn("Error on reading the handler type "
+ GEOPORTAL_DATA_HANDLER.geoportal_timeline_json_template.getType() + " in the profileID: "
+ profileID, e);
return null;
}
}
return null;
}
}

View File

@ -0,0 +1,111 @@
package org.gcube.application.geoportalcommon.geoportal.access;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class GeportalCheckAccessPolicy.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 7, 2022
*/
public class GeportalCheckAccessPolicy {
private static final Logger LOG = LoggerFactory.getLogger(GeportalCheckAccessPolicy.class);
/**
* The Enum ACCESS_POLICY.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Sep 8, 2021
*/
public static enum ACCESS_POLICY {
OPEN, RESTICTED
}
/**
* Checks if is open access.
*
* @param policy the policy
* @return true, if is open access
*/
private static boolean isOpenAccess(String policy) {
if (policy == null || policy.equalsIgnoreCase(ACCESS_POLICY.OPEN.name())) {
return true;
}
return false;
}
/**
* Checks if is restricted access.
*
* @param policy the policy
* @return true, if is restricted access
*/
private static boolean isRestrictedAccess(String policy) {
if (policy == null || policy.equalsIgnoreCase(ACCESS_POLICY.RESTICTED.name())) {
return true;
}
return false;
}
/**
* Checks if is accessible according to access policies.
*
* @param policy the policy
* @param myLogin the my login
* @return true, if is accessible
*/
public static boolean isAccessible(String policy, String myLogin) {
boolean bool = isOpenAccess(policy);
if (bool) {
// is open access
return true;
}
// From here managing is NOT OPEN access
if (myLogin == null || myLogin.isEmpty()) {
// here is not open and the user is not authenticated
return false;
}
// Here the login is not null, so checking if the access to item is RESTICTED
bool = isRestrictedAccess(policy);
if (bool) {
// is restricted access
return true;
}
// Here the user is authenticated, but the policy is not managed, so returning
// true
return true;
}
/**
* Access policy from session login.
*
* @param mySessionLogin the my session login
* @return the access policy
*/
public static ACCESS_POLICY accessPolicyFromSessionLogin(String mySessionLogin) {
if (mySessionLogin == null || mySessionLogin.isEmpty()) {
// here is not open and the user is not authenticated
return ACCESS_POLICY.OPEN;
}
return ACCESS_POLICY.RESTICTED;
}
}

View File

@ -0,0 +1,34 @@
package org.gcube.application.geoportalcommon.geoportal.config;
import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Data
@XmlRootElement(name = "actionsDefinition")
@Slf4j
public class ActionDefinition {
@JsonProperty
private String id;
@JsonProperty
private String title;
@JsonProperty
private String[] call_STEPS;
@JsonProperty
private String description;
@JsonProperty
private String[] display_on_phase;
@JsonProperty
private boolean searchable;
private String configID;
public ActionDefinition() {
}
}

View File

@ -0,0 +1,25 @@
package org.gcube.application.geoportalcommon.geoportal.config;
import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Data
@XmlRootElement(name = "filePaths")
@Slf4j
public class FilePath {
@JsonProperty
String gcubeProfileFieldName;
@JsonProperty
String fieldDefinition;
@JsonProperty
String fieldName;
public FilePath() {
}
}

View File

@ -0,0 +1,58 @@
package org.gcube.application.geoportalcommon.geoportal.config;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Data
@XmlRootElement(name = "gcubeProfiles")
@Slf4j
public class GcubeProfile {
private static final String FILE_PATHS = "filePaths";
public static final int MIN_MAX_NOT_SPECIFIED = -1;
@JsonProperty
private String gcubeSecondaryType;
@JsonProperty
private String gcubeName;
@JsonProperty
private String parentName;
@JsonProperty
private String sectionName;
@JsonProperty
private String sectionTitle;
/**
* 0: Not specified means Not Mandatory. The Gcube Profile is not mandatory and means that all its fields must be optional in the gCube Meta Profile.
* N: is the MIN number of Occurrences
* Default is 1 occurrence
*/
@JsonProperty
private int minOccurs = 1;
/**
* 0: Not specified means max number of Occurrences is arbitrary.
* N: is the MAX number of Occurrences
*/
@JsonProperty
private int maxOccurs = 1;
@JsonProperty(FILE_PATHS)
private List<FilePath> filePaths;
public GcubeProfile() {}
}

View File

@ -0,0 +1,33 @@
package org.gcube.application.geoportalcommon.geoportal.config;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@Data
@XmlRootElement(name = "itemFields")
@Slf4j
public class ItemField {
@JsonProperty
private String label;
@JsonProperty
private List<String> paths;
@JsonProperty
private String operator;
@JsonProperty
private boolean searchable;
@JsonProperty
private boolean sortable;
@JsonProperty
private boolean asResult;
public ItemField() {
}
}

View File

@ -0,0 +1,83 @@
package org.gcube.application.geoportalcommon.geoportal.serdes;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.extern.slf4j.Slf4j;
@XmlRootElement(name = "_payloads")
@Slf4j
public class Payload implements Serializable {
/**
*
*/
private static final long serialVersionUID = -3975356671779455705L;
@JsonProperty("_mimetype")
private String mimetype;
@JsonProperty("_storageID")
private String storageID;
@JsonProperty("_link")
private String link;
@JsonProperty("_name")
private String name;
public Payload() {
}
public String getMimetype() {
return mimetype;
}
public String getStorageID() {
return storageID;
}
public String getLink() {
return link;
}
public String getName() {
return name;
}
public void setMimetype(String mimetype) {
this.mimetype = mimetype;
}
public void setStorageID(String storageID) {
this.storageID = storageID;
}
public void setLink(String link) {
this.link = link;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Payload [mimetype=");
builder.append(mimetype);
builder.append(", storageID=");
builder.append(storageID);
builder.append(", link=");
builder.append(link);
builder.append(", name=");
builder.append(name);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,26 @@
package org.gcube.application.geoportalcommon.geoportal.util;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
import org.json.JSONArray;
public class GisUtil {
public static BBOXDV fromJSONArray(JSONArray outerArray) {
try {
if (outerArray == null)
return new BBOXDV();
double[] coords = new double[outerArray.length()];
for (int i = 0; i < outerArray.length(); i++) {
coords[i] = outerArray.getDouble(i);
}
return BBOXDV.fromGeoJSON(coords);
} catch (Exception e) {
return new BBOXDV();
}
}
}

View File

@ -0,0 +1,84 @@
package org.gcube.application.geoportalcommon.shared;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
import org.gcube.application.geoportalcommon.shared.guipresentation.DataEntryGUIPresentationConfig;
/**
* The Class GNADataEntryConfigProfile.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 21, 2021
*/
public class GNADataEntryConfigProfile implements Serializable {
private static final long serialVersionUID = 5152380669677928785L;
private List<RoleRights> permissionsForRole;
private DataEntryGUIPresentationConfig dataEntryGUIPresentation;
/**
* Instantiates a new GNA data entry config profile.
*/
public GNADataEntryConfigProfile() {
}
public GNADataEntryConfigProfile(List<RoleRights> permissionsForRole,
DataEntryGUIPresentationConfig dataEntryGUIPresentation) {
this.permissionsForRole = permissionsForRole;
this.dataEntryGUIPresentation = dataEntryGUIPresentation;
}
/**
* Gets the data entry GUI presentation.
*
* @return the data entry GUI presentation
*/
public DataEntryGUIPresentationConfig getDataEntryGUIPresentation() {
return dataEntryGUIPresentation;
}
/**
* Sets the data entry GUI presentation.
*
* @param dataEntryGUIPresentation the new data entry GUI presentation
*/
public void setDataEntryGUIPresentation(DataEntryGUIPresentationConfig dataEntryGUIPresentation) {
this.dataEntryGUIPresentation = dataEntryGUIPresentation;
}
/**
* Gets the permissions for role.
*
* @return the permissions for role
*/
public List<RoleRights> getPermissionsForRole() {
return permissionsForRole;
}
/**
* Sets the permissions for role.
*
* @param permissionsForRole the new permissions for role
*/
public void setPermissionsForRole(List<RoleRights> permissionsForRole) {
this.permissionsForRole = permissionsForRole;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GNADataEntryConfigProfile [permissionsForRole=");
builder.append(permissionsForRole);
builder.append(", dataEntryGUIPresentation=");
builder.append(dataEntryGUIPresentation);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,17 +1,15 @@
package org.gcube.application.geoportalcommon.shared;
import java.io.Serializable;
import java.util.Map;
/**
* The Class GeoNaDataViewerProfile.
* The Class GNADataViewerConfigProfile.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 13, 2020
* Dec 21, 2021
*/
public class GeoNaDataViewerProfile implements Serializable{
public class GNADataViewerConfigProfile implements Serializable {
/**
*
@ -19,13 +17,11 @@ public class GeoNaDataViewerProfile implements Serializable{
private static final long serialVersionUID = 2968334957258327191L;
private String restrictedPortletURL;
private String openPortletURL;
//the key is the layer type
private Map<String, LayerItem> mapLayers;
/**
* Instantiates a new geo na data viewer profile.
*/
public GeoNaDataViewerProfile() {
public GNADataViewerConfigProfile() {
}
@ -65,41 +61,15 @@ public class GeoNaDataViewerProfile implements Serializable{
this.openPortletURL = openPortletURL;
}
/**
* Gets the map layers.
*
* @return the map layers
*/
public Map<String, LayerItem> getMapLayers() {
return mapLayers;
}
/**
* Sets the map layers.
*
* @param mapLayers the map layers
*/
public void setMapLayers(Map<String, LayerItem> mapLayers) {
this.mapLayers = mapLayers;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GeoNaDataViewerProfile [restrictedPortletURL=");
builder.append("GNADataViewerConfigProfile [restrictedPortletURL=");
builder.append(restrictedPortletURL);
builder.append(", openPortletURL=");
builder.append(openPortletURL);
builder.append(", mapLayers=");
builder.append(mapLayers);
builder.append("]");
return builder.toString();
}
}

View File

@ -2,15 +2,14 @@ package org.gcube.application.geoportalcommon.shared;
import java.io.Serializable;
/**
* The Class GeoNaItemRef.
* The Class GeoportalItemReferences.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jul 30, 2021
* Oct 18, 2022
*/
public class GeoNaItemRef implements Serializable {
public class GeoportalItemReferences implements Serializable {
/**
*
@ -18,66 +17,73 @@ public class GeoNaItemRef implements Serializable {
private static final long serialVersionUID = -7021431511279022193L;
// this is the mongoID
private String itemId;
private String itemType;
private String projectID;
private String profileID; // this is the profileID - UCD
private String itemName;
private PublicLink restrictedLink;
private PublicLink openLink;
private String layerObjectType;
/**
* Instantiates a new geo na object.
*/
public GeoNaItemRef() {
public GeoportalItemReferences() {
}
/**
* Instantiates a new geo na object.
* Instantiates a new geo na item ref.
*
* @param itemId the item id
* @param itemType the item type
* @param projectID the project ID
* @param profileID the profile ID
*/
public GeoNaItemRef(String itemId, String itemType) {
public GeoportalItemReferences(String projectID, String profileID) {
super();
this.itemId = itemId;
this.itemType = itemType;
this.projectID = projectID;
this.profileID = profileID;
}
/**
* Gets the item id.
* Instantiates a new geo na item ref.
*
* @return the item id
* @param projectID the project ID
* @param profileID the profile ID
* @param layerObjectType the layer object type
*/
public String getItemId() {
return itemId;
public GeoportalItemReferences(String projectID, String profileID, String layerObjectType) {
super();
this.projectID = projectID;
this.profileID = profileID;
this.layerObjectType = layerObjectType;
}
/**
* Sets the item id.
* Gets the profile ID.
*
* @param itemId the new item id
* @return the profile ID
*/
public void setItemId(String itemId) {
this.itemId = itemId;
public String getProfileID() {
return profileID;
}
/**
* Gets the item type.
* Gets the project ID.
*
* @return the item type
* @return the project ID
*/
public String getItemType() {
return itemType;
public String getProjectID() {
return projectID;
}
/**
* Sets the item type.
* Gets the layer object type.
*
* @param itemType the new item type
* @return the layer object type
*/
public void setItemType(String itemType) {
this.itemType = itemType;
public String getLayerObjectType() {
return layerObjectType;
}
/**
@ -142,16 +148,18 @@ public class GeoNaItemRef implements Serializable {
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GeoNaItemRef [itemId=");
builder.append(itemId);
builder.append(", itemType=");
builder.append(itemType);
builder.append("GeoportalItemReferences [projectID=");
builder.append(projectID);
builder.append(", profileID=");
builder.append(profileID);
builder.append(", itemName=");
builder.append(itemName);
builder.append(", restrictedLink=");
builder.append(restrictedLink);
builder.append(", openLink=");
builder.append(openLink);
builder.append(", layerObjectType=");
builder.append(layerObjectType);
builder.append("]");
return builder.toString();
}

View File

@ -0,0 +1,185 @@
/**
*
*/
package org.gcube.application.geoportalcommon.shared;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
/**
* The Class ResultSetPaginatedData.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 6, 2021
*/
public class ResultSetPaginatedData implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6800997954077785719L;
private List<? extends DocumentDV> data;
private int offset = 0;
private int limit;
private boolean isServerSearchFinished = false;
private long totalItems;
/**
* Instantiates a new searched folder.
*/
public ResultSetPaginatedData() {
}
/**
* Instantiates a new result set paginated data.
*
* @param offset the offset
* @param limit the limit
* @param isServerSearchFinished the is server search finished
*/
public ResultSetPaginatedData(int offset, int limit, boolean isServerSearchFinished) {
this.offset = offset;
this.limit = limit;
this.isServerSearchFinished = isServerSearchFinished;
}
/**
* Gets the data.
*
* @return the data
*/
public List<? extends DocumentDV> getData() {
return data;
}
/**
* Gets the client start index.
*
* @return the client start index
*/
public int getClientStartIndex() {
return offset;
}
/**
* Gets the limit.
*
* @return the limit
*/
public int getLimit() {
return limit;
}
/**
* Checks if is server search finished.
*
* @return true, if is server search finished
*/
public boolean isServerSearchFinished() {
return isServerSearchFinished;
}
/**
* Sets the data.
*
* @param data the new data
*/
public void setData(List<ResultDocumentDV> data) {
this.data = data;
}
/**
* Sets the client start index.
*
* @param clientStartIndex the new client start index
*/
public void setClientStartIndex(int clientStartIndex) {
this.offset = clientStartIndex;
}
/**
* Sets the limit.
*
* @param limit the new limit
*/
public void setLimit(int limit) {
this.limit = limit;
}
/**
* Sets the server search finished.
*
* @param isServerSearchFinished the new server search finished
*/
public void setServerSearchFinished(boolean isServerSearchFinished) {
this.isServerSearchFinished = isServerSearchFinished;
}
/**
* Gets the total items.
*
* @return the total items
*/
public long getTotalItems() {
return totalItems;
}
/**
* Sets the total items.
*
* @param totalItems the new total items
*/
public void setTotalItems(long totalItems) {
this.totalItems = totalItems;
}
/**
* Gets the serialversionuid.
*
* @return the serialversionuid
*/
public static long getSerialversionuid() {
return serialVersionUID;
}
/**
* Gets the offset.
*
* @return the offset
*/
public int getOffset() {
return offset;
}
/**
* Sets the offset.
*
* @param offset the new offset
*/
public void setOffset(int offset) {
this.offset = offset;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ResultSetPaginatedData [data=");
builder.append(data);
builder.append(", offset=");
builder.append(offset);
builder.append(", limit=");
builder.append(limit);
builder.append(", isServerSearchFinished=");
builder.append(isServerSearchFinished);
builder.append(", totalItems=");
builder.append(totalItems);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,207 @@
package org.gcube.application.geoportalcommon.shared;
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
/**
* The Class SearchingFilter.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 30, 2021
*/
public class SearchingFilter implements Serializable {
/**
* The Enum ORDER.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 30, 2021
*/
public static enum ORDER {
ASC("ASCENDING"), DESC("DESCENDING");
String label;
/**
* Instantiates a new order.
*
* @param label the label
*/
ORDER(String label) {
this.label = label;
}
/**
* Gets the label.
*
* @return the label
*/
public String getLabel() {
return label;
}
}
/**
* The Enum LOGICAL_OP.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 15, 2021
*/
public static enum LOGICAL_OP {
AND("$and"), OR("$or");
String operator;
/**
* Instantiates a new order.
*
* @param operator the operator
*/
LOGICAL_OP(String operator) {
this.operator = operator;
}
/**
* Gets the operator.
*
* @return the operator
*/
public String getOperator() {
return operator;
}
}
/**
*
*/
private static final long serialVersionUID = -4004094263090373626L;
private List<ItemFieldDV> orderByFields;
private ORDER order = ORDER.ASC;
private List<WhereClause> conditions;
private LinkedHashMap<String, Object> projection;
/**
* Instantiates a new sort filter.
*/
public SearchingFilter() {
}
private void addProjectionBaseInfo() {
if (projection != null) {
projection.put("_profileID", 1);
projection.put("_profileVersion", 1);
projection.put("_version", 1);
projection.put("_lifecycleInformation", 1);
projection.put("_info", 1);
projection.put("_relationships", 1);
}
}
/**
* Instantiates a new sort filter.
*
* @param orderByFields the order by fields
* @param order the order
*/
public SearchingFilter(List<ItemFieldDV> orderByFields, ORDER order) {
this.orderByFields = orderByFields;
this.order = order;
if (this.order == null)
order = ORDER.ASC;
}
/**
* Instantiates a new sort filter.
*
* @param orderByFields the order by fields
* @param order the order
* @param searchInto the search into
*/
public SearchingFilter(List<ItemFieldDV> orderByFields, ORDER order, List<WhereClause> conditions) {
this.orderByFields = orderByFields;
this.order = order;
this.conditions = conditions;
}
public List<WhereClause> getConditions() {
return conditions;
}
public void setConditions(List<WhereClause> conditions) {
this.conditions = conditions;
}
public void setProjection(LinkedHashMap<String, Object> projection) {
this.projection = projection;
addProjectionBaseInfo();
}
public LinkedHashMap<String, Object> getProjection() {
return projection;
}
/**
* Gets the order by fields.
*
* @return the order by fields
*/
public List<ItemFieldDV> getOrderByFields() {
return orderByFields;
}
/**
* Gets the order.
*
* @return the order
*/
public ORDER getOrder() {
return order;
}
/**
* Sets the order by fields.
*
* @param orderByFields the new order by fields
*/
public void setOrderByFields(List<ItemFieldDV> orderByFields) {
this.orderByFields = orderByFields;
}
/**
* Sets the order.
*
* @param order the new order
*/
public void setOrder(ORDER order) {
this.order = order;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SearchingFilter [orderByFields=");
builder.append(orderByFields);
builder.append(", order=");
builder.append(order);
builder.append(", conditions=");
builder.append(conditions);
builder.append(", projection=");
builder.append(projection);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,97 @@
package org.gcube.application.geoportalcommon.shared;
import java.io.Serializable;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
/**
* The Class WhereClause.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 15, 2021
*/
public class WhereClause implements Serializable {
/**
*
*/
private static final long serialVersionUID = -8577885822669878296L;
private LOGICAL_OP operator = LOGICAL_OP.OR;
private Map<String, Object> searchInto;
/**
* Instantiates a new where clause.
*/
public WhereClause() {
}
/**
* Instantiates a new where clause.
*
* @param operator the operator
* @param searchInto the search into
*/
public WhereClause(LOGICAL_OP operator, Map<String, Object> searchInto) {
super();
this.operator = operator;
this.searchInto = searchInto;
}
/**
* Gets the operator.
*
* @return the operator
*/
public LOGICAL_OP getOperator() {
return operator;
}
/**
* Gets the search into.
*
* @return the search into
*/
public Map<String, Object> getSearchInto() {
return searchInto;
}
/**
* Sets the operator.
*
* @param operator the new operator
*/
public void setOperator(LOGICAL_OP operator) {
this.operator = operator;
}
/**
* Sets the search into.
*
* @param searchInto the search into
*/
public void setSearchInto(Map<String, Object> searchInto) {
this.searchInto = searchInto;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("WhereClause [operator=");
builder.append(operator);
builder.append(", searchInto=");
builder.append(searchInto);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,55 @@
package org.gcube.application.geoportalcommon.shared.config;
/**
* The Enum GcubeUserRole.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 25, 2021
*/
public enum GcubeUserRole {
DATA_MEMBER("Data-Member", false, false),
DATA_EDITOR("Data-Editor", true, false),
DATA_MANAGER("Data-Manager", true, true);
private String name;
private boolean writeOwn;
private boolean writeAny;
/**
* Instantiates a new gcube user role.
*
* @param name the name
*/
private GcubeUserRole(String name, boolean writeOwn, boolean writeAny) {
this.name = name;
this.writeOwn = writeOwn;
this.writeAny = writeAny;
}
public String getName() {
return name;
}
public boolean isWriteOwn() {
return writeOwn;
}
public boolean isWriteAny() {
return writeAny;
}
public void setName(String name) {
this.name = name;
}
public void setWriteOwn(boolean writeOwn) {
this.writeOwn = writeOwn;
}
public void setWriteAny(boolean writeAny) {
this.writeAny = writeAny;
}
}

View File

@ -0,0 +1,46 @@
package org.gcube.application.geoportalcommon.shared.config;
/**
* The Enum OPERATION_ON_ITEM.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 13, 2022
*/
public enum OPERATION_ON_ITEM {
CREATE_NEW_PROJECT("Create New Project"),
VIEW_PROJECT_AS_DOCUMENT("View Project as Document"),
VIEW_PROJECT_AS_JSON("View Projet as JSON"),
VIEW_ON_MAP("View on Map"),
VIEW_REPORT("View the Report"),
EDIT_PROJECT("Edit the Project"),
CLONE_PROJECT("Clone the Project"),
PUBLISH_UNPUBLISH_PROJECT("Publish/UnPublish the Project"),
DELETE_PROJECT("Delete the Project"),
CREATE_RELATION("Create Relation between two Projects"),
DELETE_RELATION("Delete Relation between two Projects"),
VIEW_RELATIONSHIPS("View the relationship/s created for the Project");
String label;
/**
* Instantiates a new operation on item.
*
* @param label the label
*/
OPERATION_ON_ITEM(String label){
this.label = label;
}
/**
* Gets the label.
*
* @return the label
*/
public String getLabel() {
return label;
}
}

View File

@ -0,0 +1,100 @@
package org.gcube.application.geoportalcommon.shared.config;
import java.io.Serializable;
import java.util.Map;
/**
* The Class RoleRights.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 26, 2021
*/
public class RoleRights implements Serializable {
/**
*
*/
private static final long serialVersionUID = -304157165851633221L;
/**
* The Enum OPERATION_TYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 26, 2021
*/
public static enum OPERATION_TYPE {
READ, WRITE, READ_WRITE, UNKNOWN
}
private Map<OPERATION_ON_ITEM, OPERATION_TYPE> listPermessions;
private GcubeUserRole userRole;
/**
* Instantiates a new user rights.
*/
public RoleRights() {
super();
}
/**
* Instantiates a new role rights.
*
* @param myUsername the my username
* @param listPermessions the list permessions
* @param userRole the user role
*/
public RoleRights(Map<OPERATION_ON_ITEM, OPERATION_TYPE> listPermessions, GcubeUserRole userRole) {
this.listPermessions = listPermessions;
this.userRole = userRole;
}
/**
* Gets the list permessions.
*
* @return the list permessions
*/
public Map<OPERATION_ON_ITEM, OPERATION_TYPE> getListPermessions() {
return listPermessions;
}
/**
* Gets the user role.
*
* @return the user role
*/
public GcubeUserRole getUserRole() {
return userRole;
}
/**
* Sets the list permessions.
*
* @param listPermessions the list permessions
*/
public void setListPermessions(Map<OPERATION_ON_ITEM, OPERATION_TYPE> listPermessions) {
this.listPermessions = listPermessions;
}
/**
* Sets the user role.
*
* @param userRole the new user role
*/
public void setUserRole(GcubeUserRole userRole) {
this.userRole = userRole;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RoleRights [listPermessions=");
builder.append(listPermessions);
builder.append(", userRole=");
builder.append(userRole);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.application.geoportalcommon.shared.exception;
@SuppressWarnings("serial")
public class GNAConfigException extends Exception {
public GNAConfigException(String message) {
super(message);
}
}

View File

@ -0,0 +1,55 @@
package org.gcube.application.geoportalcommon.shared.geoportal;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GeoportalConfigurationID;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_CONFIGURATION_TYPE;
public class ConfigurationDV<T extends List<? extends GeoportalConfigurationID>> implements Serializable {
/**
*
*/
private static final long serialVersionUID = 4836713840177636940L;
private T configuration;
private GEOPORTAL_CONFIGURATION_TYPE configurationType;
public ConfigurationDV() {
}
public ConfigurationDV(T configuration) {
this.configuration = configuration;
}
public GEOPORTAL_CONFIGURATION_TYPE getConfigurationType() {
return configurationType;
}
public void setConfigurationType(GEOPORTAL_CONFIGURATION_TYPE configurationType) {
this.configurationType = configurationType;
}
public T getConfiguration() {
return configuration;
}
public void setConfiguration(T config) {
this.configuration = config;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ConfigurationDV [configuration=");
builder.append(configuration);
builder.append(", configurationType=");
builder.append(configurationType);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,77 @@
package org.gcube.application.geoportalcommon.shared.geoportal;
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
public class DocumentDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 4978517506036855883L;
protected LinkedHashMap<String, Object> documentAsMap;
private String documentAsJSON;
private ConfigurationDV<?> configuration;
private String projectID;
public DocumentDV() {
}
public LinkedHashMap<String, Object> getDocumentAsMap() {
return documentAsMap;
}
public Entry<String, Object> getFirstEntryOfMap() {
if (documentAsMap != null && documentAsMap.size() >= 1) {
return documentAsMap.entrySet().iterator().next();
}
return null;
}
public String getProjectID() {
return projectID;
}
public void setProjectID(String projectID) {
this.projectID = projectID;
}
public String getDocumentAsJSON() {
return documentAsJSON;
}
public void setDocumentAsMap(LinkedHashMap<String, Object> documentAsMap) {
this.documentAsMap = documentAsMap;
}
public void setDocumentAsJSON(String documentAsJSON) {
this.documentAsJSON = documentAsJSON;
}
public ConfigurationDV<?> getConfiguration() {
return configuration;
}
public void setConfiguration(ConfigurationDV<?> configuration) {
this.configuration = configuration;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DocumentDV [documentAsMap=");
builder.append(documentAsMap);
builder.append(", documentAsJSON=");
builder.append(documentAsJSON);
builder.append(", configuration=");
builder.append(configuration);
builder.append(", projectID=");
builder.append(projectID);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,117 @@
package org.gcube.application.geoportalcommon.shared.geoportal;
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.project.BasicLifecycleInformationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.PublicationInfoDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
public class ResultDocumentDV extends DocumentDV implements Serializable {
private String id;
private String profileID;
private BasicLifecycleInformationDV lifecycleInfo;
private PublicationInfoDV publicationInfoDV;
private List<RelationshipDV> listRelationshipDV;
private GeoJSON spatialReference;
private WORKFLOW_PHASE worflowPhase; //never used. Just for serialization in GWT
/**
*
*/
private static final long serialVersionUID = -7209592503036632772L;
public ResultDocumentDV() {
}
public String getId() {
return id;
}
public String getProfileID() {
return profileID;
}
public void setId(String id) {
this.id = id;
}
public void setProfileID(String profileID) {
this.profileID = profileID;
}
public void addItemToMap(String property, Object value) {
if (documentAsMap == null)
documentAsMap = new LinkedHashMap<String, Object>();
documentAsMap.put(property, value);
}
public BasicLifecycleInformationDV getLifecycleInfo() {
return lifecycleInfo;
}
public void setLifecycleInfo(BasicLifecycleInformationDV lifecycleInfo) {
this.lifecycleInfo = lifecycleInfo;
}
public void setListRelationship(List<RelationshipDV> listRelationshipDV) {
this.listRelationshipDV = listRelationshipDV;
}
public void setPublicationInfoDV(PublicationInfoDV publicationInfoDV) {
this.publicationInfoDV = publicationInfoDV;
}
public void setListRelationshipDV(List<RelationshipDV> listRelationshipDV) {
this.listRelationshipDV = listRelationshipDV;
}
public List<RelationshipDV> getListRelationshipDV() {
return listRelationshipDV;
}
public void setPublicationInfo(PublicationInfoDV publicationInfoDV) {
this.publicationInfoDV = publicationInfoDV;
}
public PublicationInfoDV getPublicationInfoDV() {
return publicationInfoDV;
}
public GeoJSON getSpatialReference() {
return spatialReference;
}
public void setSpatialReference(GeoJSON spatialReference) {
this.spatialReference = spatialReference;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ResultDocumentDV [id=");
builder.append(id);
builder.append(", profileID=");
builder.append(profileID);
builder.append(", lifecycleInfo=");
builder.append(lifecycleInfo);
builder.append(", publicationInfoDV=");
builder.append(publicationInfoDV);
builder.append(", listRelationshipDV=");
builder.append(listRelationshipDV);
builder.append(", spatialReference=");
builder.append(spatialReference);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,35 @@
package org.gcube.application.geoportalcommon.shared.geoportal;
/**
* The Enum WORKFLOW_PHASE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 19, 2023
*/
public enum WORKFLOW_PHASE {
PUBLISHED("Published"), //Should be always the last one
DRAFT("Draft");
private String label;
/**
* Instantiates a new workflow phase.
*
* @param label the label
*/
WORKFLOW_PHASE(String label) {
this.label = label;
}
/**
* Gets the label.
*
* @return the label
*/
public String getLabel() {
return label;
}
}

View File

@ -0,0 +1,117 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class ActionDefinitionDV implements GeoportalConfigurationID, Serializable {
/**
*
*/
private static final long serialVersionUID = 6071900142588642601L;
private String id;
private String title;
private String[] callSteps;
private String description;
private String[] displayOnPhase;
private String configID;
public Set<String> roles = new HashSet<String>(); //No role/s defined means enable the action by default
public ActionDefinitionDV() {
}
@Override
public String getID() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setID(String configID) {
// TODO Auto-generated method stub
}
public String getId() {
return id;
}
public String getTitle() {
return title;
}
public String[] getCallSteps() {
return callSteps;
}
public String getDescription() {
return description;
}
public String[] getDisplayOnPhase() {
return displayOnPhase;
}
public String getConfigID() {
return configID;
}
public void setId(String id) {
this.id = id;
}
public void setTitle(String title) {
this.title = title;
}
public void setCallSteps(String[] callSteps) {
this.callSteps = callSteps;
}
public void setDescription(String description) {
this.description = description;
}
public void setDisplayOnPhase(String[] displayOnPhase) {
this.displayOnPhase = displayOnPhase;
}
public void setConfigID(String configID) {
this.configID = configID;
}
public Set<String> getRoles() {
return roles;
}
public void setRoles(Set<String> roles) {
this.roles = roles;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ActionDefinitionDV [id=");
builder.append(id);
builder.append(", title=");
builder.append(title);
builder.append(", callSteps=");
builder.append(Arrays.toString(callSteps));
builder.append(", description=");
builder.append(description);
builder.append(", displayOnPhase=");
builder.append(Arrays.toString(displayOnPhase));
builder.append(", configID=");
builder.append(configID);
builder.append(", roles=");
builder.append(roles);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,56 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config;
import java.io.Serializable;
public class FilePathDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -9186437393759442989L;
private String gcubeProfileFieldName;
private String fieldName;
private String fieldDefinition;
public FilePathDV() {
}
public String getGcubeProfileFieldName() {
return gcubeProfileFieldName;
}
public void setGcubeProfileFieldName(String gcubeProfileFieldName) {
this.gcubeProfileFieldName = gcubeProfileFieldName;
}
public String getFieldName() {
return fieldName;
}
public String getFieldDefinition() {
return fieldDefinition;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public void setFieldDefinition(String fieldDefinition) {
this.fieldDefinition = fieldDefinition;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("FilePathDV [gcubeProfileFieldName=");
builder.append(gcubeProfileFieldName);
builder.append(", fieldName=");
builder.append(fieldName);
builder.append(", fieldDefinition=");
builder.append(fieldDefinition);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,240 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config;
import java.io.Serializable;
import java.util.List;
/**
* The Class GcubeProfileDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 7, 2022
*/
public class GcubeProfileDV implements GeoportalConfigurationID, Serializable {
/**
*
*/
private static final long serialVersionUID = -6177379075015880565L;
public static final int MIN_MAX_NOT_SPECIFIED = -1;
private String configID;
private String gcubeSecondaryType;
private String gcubeName;
private String sectionName;
private String sectionTitle;
private String parentName;
/**
* 0: Not specified means Not Mandatory. The Gcube Profile is not mandatory and
* means that all its fields must be optional in the gCube Meta Profile. N: is
* the MIN number of Occurrences Default is 1 occurrence
*/
private int minOccurs = 1;
/**
* 0: Not specified means max number of Occurrences is arbitrary. N: is the MAX
* number of Occurrences
*/
private int maxOccurs = 1;
private List<FilePathDV> filePaths;
/**
* Instantiates a new gcube profile DV.
*/
public GcubeProfileDV() {
}
@Override
public String getID() {
return configID;
}
@Override
public void setID(String configID) {
this.configID = configID;
}
/**
* Gets the gcube secondary type.
*
* @return the gcube secondary type
*/
public String getGcubeSecondaryType() {
return gcubeSecondaryType;
}
/**
* Gets the gcube name.
*
* @return the gcube name
*/
public String getGcubeName() {
return gcubeName;
}
/**
* Gets the section name.
*
* @return the section name
*/
public String getSectionName() {
return sectionName;
}
/**
* Gets the section title.
*
* @return the section title
*/
public String getSectionTitle() {
return sectionTitle;
}
/**
* Gets the parent name. If is null or empty return the "" /(empty string) as
* default.
*
* @return the parent name
*/
public String getParentName() {
if (parentName == null)
return "";
return parentName;
}
/**
* Gets the min occurs.
*
* @return the min occurs
*/
public int getMinOccurs() {
return minOccurs;
}
/**
* Gets the max occurs.
*
* @return the max occurs
*/
public int getMaxOccurs() {
return maxOccurs;
}
/**
* Gets the file paths.
*
* @return the file paths
*/
public List<FilePathDV> getFilePaths() {
return filePaths;
}
/**
* Sets the gcube secondary type.
*
* @param gcubeSecondaryType the new gcube secondary type
*/
public void setGcubeSecondaryType(String gcubeSecondaryType) {
this.gcubeSecondaryType = gcubeSecondaryType;
}
/**
* Sets the gcube name.
*
* @param gcubeName the new gcube name
*/
public void setGcubeName(String gcubeName) {
this.gcubeName = gcubeName;
}
/**
* Sets the section name.
*
* @param sectionName the new section name
*/
public void setSectionName(String sectionName) {
this.sectionName = sectionName;
}
/**
* Sets the section title.
*
* @param sectionTitle the new section title
*/
public void setSectionTitle(String sectionTitle) {
this.sectionTitle = sectionTitle;
}
/**
* Sets the parent name.
*
* @param parentName the new parent name
*/
public void setParentName(String parentName) {
this.parentName = parentName;
}
/**
* Sets the min occurs.
*
* @param minOccurs the new min occurs
*/
public void setMinOccurs(int minOccurs) {
this.minOccurs = minOccurs;
}
/**
* Sets the max occurs.
*
* @param maxOccurs the new max occurs
*/
public void setMaxOccurs(int maxOccurs) {
this.maxOccurs = maxOccurs;
}
/**
* Sets the file paths.
*
* @param filePaths the new file paths
*/
public void setFilePaths(List<FilePathDV> filePaths) {
this.filePaths = filePaths;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GcubeProfileDV [gcubeSecondaryType=");
builder.append(gcubeSecondaryType);
builder.append(", gcubeName=");
builder.append(gcubeName);
builder.append(", sectionName=");
builder.append(sectionName);
builder.append(", sectionTitle=");
builder.append(sectionTitle);
builder.append(", parentName=");
builder.append(parentName);
builder.append(", minOccurs=");
builder.append(minOccurs);
builder.append(", maxOccurs=");
builder.append(maxOccurs);
builder.append(", filePaths=");
builder.append(filePaths);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,9 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config;
public interface GeoportalConfigurationID {
String getID();
void setID(String configID);
}

View File

@ -0,0 +1,82 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The Class GroupedLayersDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 12, 2023
*/
public class GroupedLayersDV<T extends LayerIDV> implements Serializable, GeoportalConfigurationID {
/**
*
*/
private static final long serialVersionUID = -2021774489849084231L;
private String name;
private String description;
@JsonProperty(value = "layers")
private List<T> listCustomLayers;
@Override
public String getID() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setID(String configID) {
// TODO Auto-generated method stub
}
public GroupedLayersDV() {
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public List<T> getListCustomLayers() {
return listCustomLayers;
}
public void setName(String name) {
this.name = name;
}
public void setDescription(String description) {
this.description = description;
}
public void setListCustomLayers(List<T> listCustomLayers) {
this.listCustomLayers = listCustomLayers;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GroupedLayersDV [name=");
builder.append(name);
builder.append(", description=");
builder.append(description);
builder.append(", listCustomLayers=");
builder.append(listCustomLayers);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,196 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config;
import java.io.Serializable;
import java.util.List;
/**
* The Class ItemFieldDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 16, 2022
*/
public class ItemFieldDV implements GeoportalConfigurationID, Serializable {
/**
*
*/
private static final long serialVersionUID = -1489912649531434470L;
private String displayName;
private List<String> jsonFields;
private String operator;
private boolean displayAsResult;
private boolean sortable;
private boolean searchable;
private String configID;
/**
* Instantiates a new item field.
*/
public ItemFieldDV() {
}
/**
* Instantiates a new item field DV.
*
* @param displayName the display name
* @param jsonFields the json fields
* @param operator the operator
* @param displayAsResult the display as result
* @param sortable the sortable
* @param searchable the searchable
*/
public ItemFieldDV(String displayName, List<String> jsonFields, String operator, boolean displayAsResult,
boolean sortable, boolean searchable) {
super();
this.displayName = displayName;
this.jsonFields = jsonFields;
this.operator = operator;
this.displayAsResult = displayAsResult;
this.sortable = sortable;
this.searchable = searchable;
}
@Override
public String getID() {
return configID;
}
@Override
public void setID(String configID) {
this.configID = configID;
}
/**
* Gets the display name.
*
* @return the display name
*/
public String getDisplayName() {
return displayName;
}
/**
* Gets the json fields.
*
* @return the json fields
*/
public List<String> getJsonFields() {
return jsonFields;
}
/**
* Gets the operator.
*
* @return the operator
*/
public String getOperator() {
return operator;
}
/**
* Checks if is display as result.
*
* @return true, if is display as result
*/
public boolean isDisplayAsResult() {
return displayAsResult;
}
/**
* Checks if is sortable.
*
* @return true, if is sortable
*/
public boolean isSortable() {
return sortable;
}
/**
* Checks if is searchable.
*
* @return true, if is searchable
*/
public boolean isSearchable() {
return searchable;
}
/**
* Sets the display name.
*
* @param displayName the new display name
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
/**
* Sets the json fields.
*
* @param jsonFields the new json fields
*/
public void setJsonFields(List<String> jsonFields) {
this.jsonFields = jsonFields;
}
/**
* Sets the operator.
*
* @param operator the new operator
*/
public void setOperator(String operator) {
this.operator = operator;
}
/**
* Sets the display as result.
*
* @param displayAsResult the new display as result
*/
public void setDisplayAsResult(boolean displayAsResult) {
this.displayAsResult = displayAsResult;
}
/**
* Sets the sortable.
*
* @param sortable the new sortable
*/
public void setSortable(boolean sortable) {
this.sortable = sortable;
}
/**
* Sets the searchable.
*
* @param searchable the new searchable
*/
public void setSearchable(boolean searchable) {
this.searchable = searchable;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ItemFieldDV [displayName=");
builder.append(displayName);
builder.append(", jsonFields=");
builder.append(jsonFields);
builder.append(", operator=");
builder.append(operator);
builder.append(", displayAsResult=");
builder.append(displayAsResult);
builder.append(", sortable=");
builder.append(sortable);
builder.append(", searchable=");
builder.append(searchable);
builder.append(", configID=");
builder.append(configID);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,98 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config.layers;
import java.io.Serializable;
/**
* The Class ConfiguredLayerDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 12, 2023
*/
public class ConfiguredLayerDV implements LayerIDV, Serializable{
/**
*
*/
private static final long serialVersionUID = 6910607957385140987L;
private String title;
private String description;
private String name;
private String wms_url;
private String wfs_url;
boolean display = false;
public ConfiguredLayerDV() {
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public String getName() {
return name;
}
public String getWMS_URL() {
return wms_url;
}
public String getWFS_URL() {
return wfs_url;
}
public boolean isDisplay() {
return display;
}
public void setTitle(String title) {
this.title = title;
}
public void setDescription(String description) {
this.description = description;
}
public void setName(String name) {
this.name = name;
}
public void setWms_url(String wms_url) {
this.wms_url = wms_url;
}
public void setWfs_url(String wfs_url) {
this.wfs_url = wfs_url;
}
public void setDisplay(boolean display) {
this.display = display;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ConfiguredLayerDV [title=");
builder.append(title);
builder.append(", description=");
builder.append(description);
builder.append(", name=");
builder.append(name);
builder.append(", wms_url=");
builder.append(wms_url);
builder.append(", wfs_url=");
builder.append(wfs_url);
builder.append(", display=");
builder.append(display);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,78 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config.layers;
import java.util.List;
public class CrossFilteringLayerDV extends ConfiguredLayerDV {
/**
*
*/
private static final long serialVersionUID = 1130075528037312939L;
String table_show_field;
String table_key_field;
String table_parent_key_field;
String table_geometry_name;
List<CrossFilteringLayerDV> related_to;
public CrossFilteringLayerDV() {
}
public String getTable_show_field() {
return table_show_field;
}
public String getTable_key_field() {
return table_key_field;
}
public String getTable_parent_key_field() {
return table_parent_key_field;
}
public String getTable_geometry_name() {
return table_geometry_name;
}
public List<CrossFilteringLayerDV> getRelated_to() {
return related_to;
}
public void setTable_show_field(String table_show_field) {
this.table_show_field = table_show_field;
}
public void setTable_key_field(String table_key_field) {
this.table_key_field = table_key_field;
}
public void setTable_parent_key_field(String table_parent_key_field) {
this.table_parent_key_field = table_parent_key_field;
}
public void setTable_geometry_name(String table_geometry_name) {
this.table_geometry_name = table_geometry_name;
}
public void setRelated_to(List<CrossFilteringLayerDV> related_to) {
this.related_to = related_to;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CrossFilteringLayerDV [table_show_field=");
builder.append(table_show_field);
builder.append(", table_key_field=");
builder.append(table_key_field);
builder.append(", table_parent_key_field=");
builder.append(table_parent_key_field);
builder.append(", table_geometry_name=");
builder.append(table_geometry_name);
builder.append(", related_to=");
builder.append(related_to);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,10 @@
package org.gcube.application.geoportalcommon.shared.geoportal.config.layers;
public interface LayerIDV {
String getName();
String getTitle();
String getWMS_URL();
String getWFS_URL();
}

View File

@ -0,0 +1,67 @@
package org.gcube.application.geoportalcommon.shared.geoportal.geojson;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Crs implements Serializable {
/**
*
*/
private static final long serialVersionUID = -8848168371106854638L;
public Crs(){
}
@JsonProperty
private String type;
@JsonProperty
private Map<String, Object> properties = new HashMap<String, Object>();
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public Map<String, Object> getProperties() {
return properties;
}
public void setProperties(Map<String, Object> properties) {
this.properties = properties;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Crs)) {
return false;
}
Crs crs = (Crs) o;
if (properties != null ? !properties.equals(crs.properties) : crs.properties != null) {
return false;
}
return !(type != null ? !type.equals(crs.type) : crs.type != null);
}
@Override
public int hashCode() {
int result = type != null ? type.hashCode() : 0;
result = 31 * result + (properties != null ? properties.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "Crs{" + "type='" + type + '\'' + ", properties=" + properties + '}';
}
}

View File

@ -0,0 +1,74 @@
package org.gcube.application.geoportalcommon.shared.geoportal.geojson;
import java.io.Serializable;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
public class GeoJSON implements Serializable {
public static final String TYPE = "type";
public static final String BBOX = "bbox";
public static final String CRS = "crs";
public static final String COORDINATES = "coordinates";
/**
*
*/
private static final long serialVersionUID = -7798331554142534921L;
private String type;
private Crs crs;
private BBOXDV bbox;
private String geoJSON;
public GeoJSON() {
}
public String getType() {
return type;
}
public Crs getCrs() {
return crs;
}
public BBOXDV getBbox() {
return bbox;
}
public String getGeoJSON() {
return geoJSON;
}
public void setType(String type) {
this.type = type;
}
public void setCrs(Crs crs) {
this.crs = crs;
}
public void setBbox(BBOXDV bbox) {
this.bbox = bbox;
}
public void setGeoJSON(String geoJSON) {
this.geoJSON = geoJSON;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GeoJSON [type=");
builder.append(type);
builder.append(", crs=");
builder.append(crs);
builder.append(", bbox=");
builder.append(bbox);
builder.append(", geoJSON=");
builder.append(geoJSON);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,80 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
import com.fasterxml.jackson.annotation.JsonProperty;
public class GCubeSDILayer implements Serializable {
// TODO manage heterogeneus collection
/**
*
*/
private static final long serialVersionUID = 5317964084778336268L;
@JsonProperty(value = "_type")
private String type;
@JsonProperty(value = "_platformInfo")
private List<GeoServerPlatformInfoDV> platformInfos;
@JsonProperty(value = "_bbox")
private BBOXDV bbox;
@JsonProperty(value = "_ogcLinks")
private HashMap<String, String> ogcLinks;
public GCubeSDILayer() {
}
public String getType() {
return type;
}
public List<GeoServerPlatformInfoDV> getPlatformInfos() {
return platformInfos;
}
public BBOXDV getBbox() {
return bbox;
}
public HashMap<String, String> getOgcLinks() {
return ogcLinks;
}
public void setType(String type) {
this.type = type;
}
public void setPlatformInfos(List<GeoServerPlatformInfoDV> platformInfos) {
this.platformInfos = platformInfos;
}
public void setBbox(BBOXDV bbox) {
this.bbox = bbox;
}
public void setOgcLinks(HashMap<String, String> ogcLinks) {
this.ogcLinks = ogcLinks;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GCubeSDILayer [type=");
builder.append(type);
builder.append(", platformInfos=");
builder.append(platformInfos);
builder.append(", bbox=");
builder.append(bbox);
builder.append(", ogcLinks=");
builder.append(ogcLinks);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,78 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization;
import java.io.Serializable;
import java.util.HashMap;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
public class GCubeSDIViewerLayerDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6620710416056942397L;
private String type;
private BBOXDV bbox;
private HashMap<String, String> ogcLinks;
private String layerName;
public GCubeSDIViewerLayerDV() {
}
public String getType() {
return type;
}
public BBOXDV getBbox() {
return bbox;
}
public HashMap<String, String> getOgcLinks() {
return ogcLinks;
}
public String getWMSLink() {
if (ogcLinks != null) {
return ogcLinks.get("wms");
}
return null;
}
public void setType(String type) {
this.type = type;
}
public void setBbox(BBOXDV bbox) {
this.bbox = bbox;
}
public void setOgcLinks(HashMap<String, String> ogcLinks) {
this.ogcLinks = ogcLinks;
}
public void setLayerName(String layerName) {
this.layerName = layerName;
}
public String getLayerName() {
return layerName;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GCubeSDIViewerLayerDV [type=");
builder.append(type);
builder.append(", bbox=");
builder.append(bbox);
builder.append(", ogcLinks=");
builder.append(ogcLinks);
builder.append(", layerName=");
builder.append(layerName);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,85 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization;
import java.io.Serializable;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
public class GeoServerPlatformInfoDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -2630467451758269625L;
@JsonProperty(value = "_type")
private String type;
private String workspace;
private String storeName;
@JsonProperty(value = "_host")
private String host;
private Map<String, String> ogcLinks;
public GeoServerPlatformInfoDV() {
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getWorkspace() {
return workspace;
}
public void setWorkspace(String workspace) {
this.workspace = workspace;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public Map<String, String> getOgcLinks() {
return ogcLinks;
}
public void setOgcLinks(Map<String, String> ogcLinks) {
this.ogcLinks = ogcLinks;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GeoServerPlatformInfoDV [type=");
builder.append(type);
builder.append(", workspace=");
builder.append(workspace);
builder.append(", storeName=");
builder.append(storeName);
builder.append(", host=");
builder.append(host);
builder.append(", ogcLinks=");
builder.append(ogcLinks);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,83 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonProperty;
public class IndexLayerDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 5352754312327975329L;
@JsonProperty(value = "_type")
private String type;
private GCubeSDILayer layer;
private String indexName;
private int records;
private String flag;
public IndexLayerDV() {
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public GCubeSDILayer getLayer() {
return layer;
}
public void setLayer(GCubeSDILayer layer) {
this.layer = layer;
}
public String getIndexName() {
return indexName;
}
public void setIndexName(String indexName) {
this.indexName = indexName;
}
public int getRecords() {
return records;
}
public void setRecords(int records) {
this.records = records;
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("IndexLayerDV [type=");
builder.append(type);
builder.append(", layer=");
builder.append(layer);
builder.append(", indexName=");
builder.append(indexName);
builder.append(", records=");
builder.append(records);
builder.append(", flag=");
builder.append(flag);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,186 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject;
import java.io.Serializable;
import java.util.HashMap;
public class BBOXDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -4438327945612263171L;
public static final String MAX_X = "_maxX";
public static final String MAX_Y = "_maxY";
public static final String MAX_Z = "_maxZ";
public static final String MIN_X = "_minX";
public static final String MIN_Y = "_minY";
public static final String MIN_Z = "_minZ";
public static final BBOXDV WORLD = new BBOXDV(180d, -180d, 90d, -90d);
public static final BBOXDV WORLD_3D = new BBOXDV(180d, -180d, 90d, -90d);
private HashMap<String, Double> bbox = new HashMap<String, Double>();
public BBOXDV() {
}
public BBOXDV(Double maxX, Double minX, Double maxY, Double minY) {
setMaxX(maxX);
setMinX(minX);
setMaxY(maxY);
setMinY(minY);
}
public BBOXDV(Double maxX, Double minX, Double maxY, Double minY, Double maxZ, Double minZ) {
this(maxX, minX, maxY, minY);
setMaxZ(maxZ);
setMinZ(minZ);
}
public BBOXDV(HashMap<String, Object> hash) {
setMaxX(toDouble(hash.get(MAX_X)));
setMaxY(toDouble(hash.get(MAX_Y)));
setMinX(toDouble(hash.get(MIN_X)));
setMinY(toDouble(hash.get(MIN_Y)));
setMinZ(toDouble(hash.get(MIN_Z)));
setMaxZ(toDouble(hash.get(MAX_Z)));
}
private Double toDouble(Object toDouble) {
try {
return new Double((double) toDouble);
} catch (Exception e) {
// System.out.println(toDouble + " is not castable to " +
// Double.class.getSimpleName());
}
return null;
}
public static final BBOXDV fromGeoJSON(double[] coords) {
BBOXDV toReturn = new BBOXDV();
toReturn.setMaxX(coords[0]);
toReturn.setMinY(coords[1]);
if (coords.length == 6) {
// 3D
toReturn.setMinZ(coords[2]);
toReturn.setMinX(coords[3]);
toReturn.setMaxY(coords[4]);
toReturn.setMaxZ(coords[5]);
} else {
toReturn.setMinX(coords[2]);
toReturn.setMaxY(coords[3]);
}
return toReturn;
}
public BBOXDV setMaxX(Double d) {
this.bbox.put(MAX_X, d);
return this;
}
public BBOXDV setMaxY(Double d) {
this.bbox.put(MAX_Y, d);
return this;
}
public BBOXDV setMaxZ(Double d) {
this.bbox.put(MAX_Z, d);
return this;
}
public BBOXDV setMinX(Double d) {
this.bbox.put(MIN_X, d);
return this;
}
public BBOXDV setMinY(Double d) {
this.bbox.put(MIN_Y, d);
return this;
}
public BBOXDV setMinZ(Double d) {
this.bbox.put(MIN_Z, d);
return this;
}
public Double getMinY() {
try {
return this.bbox.get(MIN_Y);
} catch (Exception e) {
}
return new Double(-90d);
}
public Double getMaxY() {
try {
return this.bbox.get(MAX_Y);
} catch (Exception e) {
}
return new Double(90d);
}
public Double getMinX() {
try {
return this.bbox.get(MIN_X);
} catch (Exception e) {
}
return new Double(-180d);
}
public Double getMaxX() {
try {
return this.bbox.get(MAX_X);
} catch (Exception e) {
}
return new Double(180d);
}
public Double getMinZ() {
return (Double) this.bbox.getOrDefault(MIN_Z, null);
}
public Double getMaxZ() {
return (Double) this.bbox.getOrDefault(MAX_Z, null);
}
public Boolean is3d() {
return getMinZ() != null && getMaxZ() != null;
}
public final String asGeoJSONBBox() {
StringBuilder builder = new StringBuilder("[");
builder.append(getMaxX() + ","); // W
builder.append(getMinY() + ","); // S
if (is3d())
builder.append(getMinZ() + ","); // Z
builder.append(getMinX() + ","); // E
builder.append(getMaxY() + ","); // N
if (is3d())
builder.append(getMaxZ() + ","); // Z
builder.deleteCharAt(builder.length());
builder.append("]");
return builder.toString();
}
public double[] asGeoJSONArray() {
if (is3d()) {
return new double[] { getMaxX(), getMinY(), getMinZ(), getMinX(), getMaxY(), getMaxZ() };
} else
return new double[] { getMaxX(), getMinY(), getMinX(), getMaxY() };
}
}

View File

@ -0,0 +1,65 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class FilesetDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -3108729581669778828L;
private String gcubeProfileFieldName; // It is the gcubeProfileFieldName in the UCD filePaths
private String filesetFieldName; // It is the fieldName in the UCD filePaths
private List<PayloadDV> listPayloads = new ArrayList<PayloadDV>();
public FilesetDV() {
}
public String getFilesetFieldName() {
return filesetFieldName;
}
public void setFilesetFieldName(String filesetFieldName) {
this.filesetFieldName = filesetFieldName;
}
public String getGcubeProfileFieldName() {
return gcubeProfileFieldName;
}
public void setGcubeProfileFieldName(String name) {
this.gcubeProfileFieldName = name;
}
public List<PayloadDV> getListPayload() {
return listPayloads;
}
public void addPayloadDV(PayloadDV payloadDV) {
listPayloads.add(payloadDV);
}
public void addListPayloadsDV(List<PayloadDV> listPayloadsDV) {
listPayloads.addAll(listPayloadsDV);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("FilesetDV [gcubeProfileFieldName=");
builder.append(gcubeProfileFieldName);
builder.append(", filesetFieldName=");
builder.append(filesetFieldName);
builder.append(", listPayloads=");
builder.append(listPayloads);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,72 @@
package org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject;
import java.io.Serializable;
public class PayloadDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -1638565659484691126L;
private String mimetype;
private String storageID;
private String link;
private String name;
public PayloadDV() {
}
public String getMimetype() {
return mimetype;
}
public String getStorageID() {
return storageID;
}
public String getLink() {
return link;
}
public String getName() {
return name;
}
public void setMimetype(String mimetype) {
this.mimetype = mimetype;
}
public void setStorageID(String storageID) {
this.storageID = storageID;
}
public void setLink(String link) {
this.link = link;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Payload [mimetype=");
builder.append(mimetype);
builder.append(", storageID=");
builder.append(storageID);
builder.append(", link=");
builder.append(link);
builder.append(", name=");
builder.append(name);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,83 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
/**
* The Class AccessDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 10, 2022
*/
public class AccessDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -8017931037814730958L;
private String policy;
private String license;
/**
* Instantiates a new access DV.
*/
public AccessDV() {
}
/**
* Gets the policy.
*
* @return the policy
*/
public String getPolicy() {
return policy;
}
/**
* Gets the license.
*
* @return the license
*/
public String getLicense() {
return license;
}
/**
* Sets the policy.
*
* @param policy the new policy
*/
public void setPolicy(String policy) {
this.policy = policy;
}
/**
* Sets the license.
*
* @param license the new license
*/
public void setLicense(String license) {
this.license = license;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AccessDV [policy=");
builder.append(policy);
builder.append(", license=");
builder.append(license);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,108 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
import java.util.Set;
/**
* The Class AccountingInfoDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 10, 2022
*/
public class AccountingInfoDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -5676731760855130687L;
private String username;
private Set<String> roles;
private String context;
private String localDate;
/**
* Instantiates a new accounting info DV.
*/
public AccountingInfoDV() {
}
/**
* Gets the username.
*
* @return the username
*/
public String getUsername() {
return username;
}
/**
* Gets the roles.
*
* @return the roles
*/
public Set<String> getRoles() {
return roles;
}
/**
* Gets the context.
*
* @return the context
*/
public String getContext() {
return context;
}
/**
* Sets the username.
*
* @param username the new username
*/
public void setUsername(String username) {
this.username = username;
}
/**
* Sets the roles.
*
* @param roles the new roles
*/
public void setRoles(Set<String> roles) {
this.roles = roles;
}
/**
* Sets the context.
*
* @param context the new context
*/
public void setContext(String context) {
this.context = context;
}
public String getLocalDate() {
return localDate;
}
public void setLocalDate(String localDate) {
this.localDate = localDate;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AccountingInfoDV [username=");
builder.append(username);
builder.append(", roles=");
builder.append(roles);
builder.append(", context=");
builder.append(context);
builder.append(", localDate=");
builder.append(localDate);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,112 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
/**
* The Class BasicLifecycleInformationDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 10, 2022
*/
public class BasicLifecycleInformationDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2301238401365921132L;
/**
* The Enum Status.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 21, 2022
*/
public static enum Status {
OK("Success"), ERROR("Error"), WARNING("Warning"), NOT_SPECIFIED("Not specified");
private String label;
/**
* Instantiates a new status.
*
* @param label the label
*/
private Status(String label) {
this.label = label;
}
/**
* Gets the label.
*
* @return the label
*/
public String getLabel() {
return label;
}
}
protected String phase;
protected Status lastOperationStatus;
/**
* Instantiates a new basic lifecycle information DV.
*/
public BasicLifecycleInformationDV() {
}
/**
* Gets the phase.
*
* @return the phase
*/
public String getPhase() {
return phase;
}
/**
* Gets the last operation status.
*
* @return the last operation status
*/
public Status getLastOperationStatus() {
return lastOperationStatus;
}
/**
* Sets the phase.
*
* @param phase the new phase
*/
public void setPhase(String phase) {
this.phase = phase;
}
/**
* Sets the last operation status.
*
* @param lastOperationStatus the new last operation status
*/
public void setLastOperationStatus(Status lastOperationStatus) {
this.lastOperationStatus = lastOperationStatus;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("BasicLifecycleInformationDV [phase=");
builder.append(phase);
builder.append(", lastOperationStatus=");
builder.append(lastOperationStatus);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,46 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
public class IdentificationReferenceDV extends DocumentDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -4038859146891291745L;
private String type;
public IdentificationReferenceDV() {
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public IdentificationReferencesTYPE asIdentificationReferencesTYPE() {
try {
return IdentificationReferencesTYPE.valueOf(type);
} catch (Exception e) {
}
return null;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("IdentificationReferenceDV [type=");
builder.append(type);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,35 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
/**
* The Enum IdentificationReferencesTYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 26, 2022
*/
public enum IdentificationReferencesTYPE {
SPATIAL_REFERENCE("SPATIAL REFERENCE");
String type;
/**
* Instantiates a new identification references TYPE.
*
* @param type the type
*/
IdentificationReferencesTYPE(String type) {
this.type = type;
}
/**
* Gets the type.
*
* @return the type
*/
public String getType() {
return type;
}
}

View File

@ -0,0 +1,200 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.util.List;
/**
* The Class LifecycleInformationDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 21, 2022
*/
public class LifecycleInformationDV extends BasicLifecycleInformationDV {
/**
*
*/
private static final long serialVersionUID = 3042285563158430778L;
private String lastInvokedStep;
private List<String> errorMessages;
private List<String> warningMessages;
private String asJSONString;
private String lastEvent;
/**
* Instantiates a new lifecycle information DV.
*/
public LifecycleInformationDV() {
}
/**
* Instantiates a new lifecycle information DV.
*
* @param lastInvokedStep the last invoked step
* @param errorMessages the error messages
* @param warningMessages the warning messages
* @param asJSONString the as JSON string
* @param lastEvent the last event
*/
public LifecycleInformationDV(String lastInvokedStep, List<String> errorMessages, List<String> warningMessages,
String asJSONString, String lastEvent) {
super();
this.lastInvokedStep = lastInvokedStep;
this.errorMessages = errorMessages;
this.warningMessages = warningMessages;
this.asJSONString = asJSONString;
this.lastEvent = lastEvent;
}
/**
* Gets the phase.
*
* @return the phase
*/
public String getPhase() {
return phase;
}
/**
* Gets the last invoked step.
*
* @return the last invoked step
*/
public String getLastInvokedStep() {
return lastInvokedStep;
}
/**
* Gets the last operation status.
*
* @return the last operation status
*/
public Status getLastOperationStatus() {
return lastOperationStatus;
}
/**
* Gets the error messages.
*
* @return the error messages
*/
public List<String> getErrorMessages() {
return errorMessages;
}
/**
* Gets the warning messages.
*
* @return the warning messages
*/
public List<String> getWarningMessages() {
return warningMessages;
}
/**
* Sets the phase.
*
* @param phase the new phase
*/
public void setPhase(String phase) {
this.phase = phase;
}
/**
* Sets the last invoked step.
*
* @param lastInvokedStep the new last invoked step
*/
public void setLastInvokedStep(String lastInvokedStep) {
this.lastInvokedStep = lastInvokedStep;
}
/**
* Sets the last operation status.
*
* @param lastOperationStatus the new last operation status
*/
public void setLastOperationStatus(Status lastOperationStatus) {
this.lastOperationStatus = lastOperationStatus;
}
/**
* Sets the error messages.
*
* @param errorMessages the new error messages
*/
public void setErrorMessages(List<String> errorMessages) {
this.errorMessages = errorMessages;
}
/**
* Sets the warning messages.
*
* @param warningMessages the new warning messages
*/
public void setWarningMessages(List<String> warningMessages) {
this.warningMessages = warningMessages;
}
/**
* Sets the as JSON string.
*
* @param json the new as JSON string
*/
public void setAsJSONString(String json) {
this.asJSONString = json;
}
/**
* Sets the last event.
*
* @param lastEvent the new last event
*/
public void setLastEvent(String lastEvent) {
this.lastEvent = lastEvent;
}
/**
* Gets the last event.
*
* @return the last event
*/
public String getLastEvent() {
return lastEvent;
}
/**
* Gets the as JSON string.
*
* @return the as JSON string
*/
public String getAsJSONString() {
return asJSONString;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("LifecycleInformationDV [lastInvokedStep=");
builder.append(lastInvokedStep);
builder.append(", errorMessages=");
builder.append(errorMessages);
builder.append(", warningMessages=");
builder.append(warningMessages);
builder.append(", asJSONString=");
builder.append(asJSONString);
builder.append(", lastEvent=");
builder.append(lastEvent);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,35 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class PhaseDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -1894531938705738017L;
private Integer count;
private Phase_Id _id;
public PhaseDV() {
}
@Data
@AllArgsConstructor
class Phase_Id {
String phase;
String status;
public Phase_Id() {
}
}
}

View File

@ -0,0 +1,154 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
public class ProjectDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6296612945369540613L;
private String id;
private String version;
// private PublicationInfo info;
private String profileID; // the profile == UCD
private String profileVersion; // the profile == UCD
private String profileName;
private List<RelationshipDV> relationships;
private DocumentDV theDocument;
// the key is the IdentificationReferenceDV.getType()
private Map<String, IdentificationReferenceDV> mapIdentReferenceDV;
private LifecycleInformationDV lifecycleInformationDV;
// Shortcut to "SPATIAL REFERENCE" containted into IdentificationReferenceDV
private GeoJSON spatialReference;
private TemporalReferenceDV temporalReference;
public ProjectDV() {
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
public String getId() {
return id;
}
public String getVersion() {
return version;
}
public String getProfileID() {
return profileID;
}
public String getProfileVersion() {
return profileVersion;
}
public List<RelationshipDV> getRelationships() {
return relationships;
}
public DocumentDV getTheDocument() {
return theDocument;
}
public void setId(String id) {
this.id = id;
}
public void setVersion(String version) {
this.version = version;
}
public void setProfileID(String profileID) {
this.profileID = profileID;
}
public void setProfileVersion(String profileVersion) {
this.profileVersion = profileVersion;
}
public void setRelationships(List<RelationshipDV> relationships) {
this.relationships = relationships;
}
public void setTheDocument(DocumentDV theDocument) {
this.theDocument = theDocument;
}
public LifecycleInformationDV getLifecycleInformationDV() {
return lifecycleInformationDV;
}
public Map<String, IdentificationReferenceDV> getMapIdentReferenceDV() {
return mapIdentReferenceDV;
}
public void setMapIdentReferenceDV(Map<String, IdentificationReferenceDV> mapIdentReferenceDV) {
this.mapIdentReferenceDV = mapIdentReferenceDV;
}
public void setLifecycleInformationDV(LifecycleInformationDV lifecycleInformationDV) {
this.lifecycleInformationDV = lifecycleInformationDV;
}
public GeoJSON getSpatialReference() {
return spatialReference;
}
public void setSpatialReference(GeoJSON spatialReference) {
this.spatialReference = spatialReference;
}
public TemporalReferenceDV getTemporalReference() {
return temporalReference;
}
public void setTemporalReference(TemporalReferenceDV temporalReference) {
this.temporalReference = temporalReference;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ProjectDV [id=");
builder.append(id);
builder.append(", version=");
builder.append(version);
builder.append(", profileID=");
builder.append(profileID);
builder.append(", profileVersion=");
builder.append(profileVersion);
builder.append(", profileName=");
builder.append(profileName);
builder.append(", relationships=");
builder.append(relationships);
builder.append(", theDocument=");
builder.append(theDocument);
builder.append(", mapIdentReferenceDV=");
builder.append(mapIdentReferenceDV);
builder.append(", lifecycleInformationDV=");
builder.append(lifecycleInformationDV);
builder.append(", spatialReference=");
builder.append(spatialReference);
builder.append(", temporalReference=");
builder.append(temporalReference);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,56 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
public class PublicationInfoDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -6381578837148417563L;
private AccountingInfoDV creationInfo;
private AccountingInfoDV lastEditInfo;
private AccessDV access;
public PublicationInfoDV() {
}
public AccountingInfoDV getCreationInfo() {
return creationInfo;
}
public AccountingInfoDV getLastEditInfo() {
return lastEditInfo;
}
public AccessDV getAccess() {
return access;
}
public void setCreationInfo(AccountingInfoDV creationInfo) {
this.creationInfo = creationInfo;
}
public void setLastEditInfo(AccountingInfoDV lastEditInfo) {
this.lastEditInfo = lastEditInfo;
}
public void setAccess(AccessDV access) {
this.access = access;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("PublicationInfoDV [creationInfo=");
builder.append(creationInfo);
builder.append(", lastEditInfo=");
builder.append(lastEditInfo);
builder.append(", access=");
builder.append(access);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,75 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.io.Serializable;
public class RelationshipDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 8295671124305773593L;
private String relationshipName;
private String targetID;
private String asJSON;
private String targetUCD;
public RelationshipDV() {
}
public RelationshipDV(String relationshipName, String targetID, String targetUCD, String asJSON) {
super();
this.relationshipName = relationshipName;
this.targetID = targetID;
this.targetUCD = targetUCD;
this.asJSON = asJSON;
}
public String getTargetUCD() {
return targetUCD;
}
public void setTargetUCD(String targetUCD) {
this.targetUCD = targetUCD;
}
public String getTargetID() {
return targetID;
}
public void setTargetID(String targetID) {
this.targetID = targetID;
}
public String getRelationshipName() {
return relationshipName;
}
public void setRelationshipName(String relationshipName) {
this.relationshipName = relationshipName;
}
public String getAsJSON() {
return asJSON;
}
public void setAsJSON(String asJSON) {
this.asJSON = asJSON;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RelationshipDV [relationshipName=");
builder.append(relationshipName);
builder.append(", targetID=");
builder.append(targetID);
builder.append(", asJSON=");
builder.append(asJSON);
builder.append(", targetUCD=");
builder.append(targetUCD);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,93 @@
package org.gcube.application.geoportalcommon.shared.geoportal.project;
import java.util.Date;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
/**
* The Class TemporalReferenceDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 10, 2022
* @param <T>
*/
public class TemporalReferenceDV extends DocumentDV {
/**
*
*/
private static final long serialVersionUID = -7990905553022863653L;
private String profileID;
private String projectID;
private String jsonTimelineObject;
private Date start;
private Date end;
/**
* Instantiates a new temporal reference DV.
*/
public TemporalReferenceDV() {
}
public String getJsonTimelineObject() {
return jsonTimelineObject;
}
public void setJsonTimelineObject(String jsonTimelineObject) {
this.jsonTimelineObject = jsonTimelineObject;
}
public String getProfileID() {
return profileID;
}
public String getProjectID() {
return projectID;
}
public Date getStart() {
return start;
}
public Date getEnd() {
return end;
}
public void setProfileID(String profileID) {
this.profileID = profileID;
}
public void setProjectID(String projectID) {
this.projectID = projectID;
}
public void setStart(Date start) {
this.start = start;
}
public void setEnd(Date end) {
this.end = end;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("TemporalReferenceDV [profileID=");
builder.append(profileID);
builder.append(", projectID=");
builder.append(projectID);
builder.append(", jsonTimelineObject=");
builder.append(jsonTimelineObject);
builder.append(", start=");
builder.append(start);
builder.append(", end=");
builder.append(end);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,40 @@
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
public enum GEOPORTAL_CONFIGURATION_TYPE {
item_fields("itemFields"),
gcube_profiles("gcubeProfiles"),
actions_definition("actionsDefinition"),
grouped_overlay_layers("grouped_overlay_layers"),
grouped_cross_filtering_layers("grouped_cross_filtering_layers");
String id;
/**
* Instantiates a new gna config managed.
*
* @param id the id
*/
GEOPORTAL_CONFIGURATION_TYPE(String id) {
this.id = id;
}
/**
* Gets the id.
*
* @return the id
*/
public String getId() {
return id;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
return id;
}
}

View File

@ -0,0 +1,29 @@
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
public enum GEOPORTAL_DATA_HANDLER {
geoportal_data_list("org.gcube.portlets.user.geoportal-data-list", "DATA_LIST_GUI"),
geoportal_basic_data_list("org.gcube.portlets.user.geoportal-basic-data-list", "BASIC_DATA_LIST_GUI"),
geoportal_data_entry("org.gcube.portlets.user.geoportal-data-entry-app", "DATA_ENTRY_GUI"),
geoportal_workflow_action_list("org.gcube.portlets.user.geoportal-workflow-action-list","WORKFLOW_ACTION_LIST_GUI"),
geoportal_timeline_json_template("org.gcube.portlets.user.geoportal-timeline-json-template","TIMELINE_JSON_TEMPLATE"),
geoportal_grouped_cross_filtering("org.gcube.portlets.user.grouped_cross_filtering_layers","GROUPED_CROSS_FILTERING_LAYERS"),
geoportal_grouped_overlay_layers("org.gcube.portlets.user.grouped_overlay_layers","GROUPED_OVERLAY_LAYERS"),
gna_concessioni_lc("GNA-CONCESSIONI-LC", "LifecycleManagement");
String id;
String type;
GEOPORTAL_DATA_HANDLER(String id, String type) {
this.id = id;
this.type = type;
}
public String getId() {
return id;
}
public String getType() {
return type;
}
}

View File

@ -0,0 +1,167 @@
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
import java.io.Serializable;
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
/**
* The Class HandlerDeclarationDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Mar 17, 2022
*/
public class HandlerDeclarationDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 3664650151266716354L;
private String id;
private String type;
private String itemType; // This is the use case (e.g. Concessioni)
private ConfigurationDV<?> configuration;
private GEOPORTAL_DATA_HANDLER dataHandlerType;
/**
* Instantiates a new handler declaration DV.
*/
public HandlerDeclarationDV() {
}
/**
* Instantiates a new handler declaration DV.
*
* @param id the id
* @param type the type
* @param itemType the item type
* @param configuration the configuration
* @param dataHandlerType the data handler type
*/
public HandlerDeclarationDV(String id, String type, String itemType,
ConfigurationDV<?> configuration,
GEOPORTAL_DATA_HANDLER dataHandlerType) {
super();
this.id = id;
this.type = type;
this.itemType = itemType;
this.configuration = configuration;
this.dataHandlerType = dataHandlerType;
}
/**
* Gets the id.
*
* @return the id
*/
public String getId() {
return id;
}
/**
* Gets the type.
*
* @return the type
*/
public String getType() {
return type;
}
/**
* Gets the item type.
*
* @return the item type
*/
public String getItemType() {
return itemType;
}
/**
* Gets the configuration.
*
* @return the configuration
*/
public ConfigurationDV<?> getConfiguration() {
return configuration;
}
/**
* Gets the data handler type.
*
* @return the data handler type
*/
public GEOPORTAL_DATA_HANDLER getDataHandlerType() {
return dataHandlerType;
}
/**
* Sets the id.
*
* @param id the new id
*/
public void setId(String id) {
this.id = id;
}
/**
* Sets the type.
*
* @param type the new type
*/
public void setType(String type) {
this.type = type;
}
/**
* Sets the item type.
*
* @param itemType the new item type
*/
public void setItemType(String itemType) {
this.itemType = itemType;
}
/**
* Sets the configuration.
*
* @param configuration the new configuration
*/
public void setConfiguration(ConfigurationDV<?> configuration) {
this.configuration = configuration;
}
/**
* Sets the data handler type.
*
* @param dataHandlerType the new data handler type
*/
public void setDataHandlerType(GEOPORTAL_DATA_HANDLER dataHandlerType) {
this.dataHandlerType = dataHandlerType;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("HandlerDeclarationDV [id=");
builder.append(id);
builder.append(", type=");
builder.append(type);
builder.append(", itemType=");
builder.append(itemType);
builder.append(", configuration=");
builder.append(configuration);
builder.append(", dataHandlerType=");
builder.append(dataHandlerType);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,63 @@
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
import java.io.Serializable;
public class RelationshipDefinitionDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -8542669180440066726L;
private String id;
private String label;
private String reverseRelationId;
public RelationshipDefinitionDV() {
}
public RelationshipDefinitionDV(String id, String label, String reverseRelationId) {
super();
this.id = id;
this.label = label;
this.reverseRelationId = reverseRelationId;
}
public String getId() {
return id;
}
public String getLabel() {
return label;
}
public String getReverseRelationId() {
return reverseRelationId;
}
public void setId(String id) {
this.id = id;
}
public void setLabel(String label) {
this.label = label;
}
public void setReverseRelationId(String reverseRelationId) {
this.reverseRelationId = reverseRelationId;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RelationshipDefinitionDV [id=");
builder.append(id);
builder.append(", label=");
builder.append(label);
builder.append(", reverseRelationId=");
builder.append(reverseRelationId);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,91 @@
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
import java.io.Serializable;
import java.util.List;
public class UseCaseDescriptorDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -2864888245002804887L;
private String id; // this is the ProfileID
private String version;
private String name;
private String description;
private List<HandlerDeclarationDV> handlers;
public UseCaseDescriptorDV() {
}
public UseCaseDescriptorDV(String id, String version, String name, String description) {
super();
this.id = id;
this.version = version;
this.name = name;
this.description = description;
}
public String getId() {
return id;
}
public String getProfileID() {
return id;
}
public String getVersion() {
return version;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public List<HandlerDeclarationDV> getHandlers() {
return handlers;
}
public void setId(String id) {
this.id = id;
}
public void setVersion(String version) {
this.version = version;
}
public void setName(String name) {
this.name = name;
}
public void setDescription(String description) {
this.description = description;
}
public void setHandlers(List<HandlerDeclarationDV> handlers) {
this.handlers = handlers;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("UseCaseDescriptorDV [id=");
builder.append(id);
builder.append(", version=");
builder.append(version);
builder.append(", name=");
builder.append(name);
builder.append(", description=");
builder.append(description);
builder.append(", handlers=");
builder.append(handlers);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,7 @@
package org.gcube.application.geoportalcommon.shared.geoportal.view;
public interface CheckEmpty {
public Boolean isEmpty();
}

View File

@ -0,0 +1,54 @@
package org.gcube.application.geoportalcommon.shared.geoportal.view;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
public class ProjectView implements Serializable {
/**
*
*/
private static final long serialVersionUID = -1681876085329564419L;
private ProjectDV theProjectDV;
// The DocumentDV (contained in the ProjectDV) is listed in SectionView
private List<SectionView> listSections = new ArrayList<SectionView>();
public ProjectView() {
}
public void addSectionView(SectionView sectionView) {
listSections.add(sectionView);
}
public ProjectDV getTheProjectDV() {
return theProjectDV;
}
public List<SectionView> getListSections() {
return listSections;
}
public void setTheProjectDV(ProjectDV theProjectDV) {
this.theProjectDV = theProjectDV;
}
public void setListSections(List<SectionView> listSections) {
this.listSections = listSections;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ProjectView [theProjectDV=");
builder.append(theProjectDV);
builder.append(", listSections=");
builder.append(listSections);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,129 @@
package org.gcube.application.geoportalcommon.shared.geoportal.view;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* The Class SectionView.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 11, 2022
*/
public class SectionView implements Serializable, CheckEmpty {
/**
*
*/
private static final long serialVersionUID = -5360469987059239067L;
private String sectionTitle;
private List<SubDocumentView> listSubDocuments;
/**
* Instantiates a new section view.
*/
public SectionView() {
}
/**
* Checks if is empty.
*
* @return true, if is empty
*/
@Override
public Boolean isEmpty() {
if (listSubDocuments == null)
return true;
for (SubDocumentView subDocumentView : listSubDocuments) {
boolean isEmpty = subDocumentView.isEmpty();
if (isEmpty)
return true;
}
return false;
}
/**
* Checks for spatial layers.
*
* @return true, if successful
*/
public Boolean hasSpatialLayers() {
if (listSubDocuments == null)
return false;
for (SubDocumentView subDocumentView : listSubDocuments) {
boolean hasLayers = subDocumentView.getListLayers() != null && subDocumentView.getListLayers().size() > 0;
if (hasLayers)
return true;
}
return false;
}
/**
* Gets the section title.
*
* @return the section title
*/
public String getSectionTitle() {
return sectionTitle;
}
/**
* Adds the sub document.
*
* @param subDocumentView the sub document view
*/
public void addSubDocument(SubDocumentView subDocumentView) {
if (listSubDocuments == null)
listSubDocuments = new ArrayList<SubDocumentView>();
listSubDocuments.add(subDocumentView);
}
/**
* Gets the list sub documents.
*
* @return the list sub documents
*/
public List<SubDocumentView> getListSubDocuments() {
if (listSubDocuments == null)
listSubDocuments = new ArrayList<SubDocumentView>();
return listSubDocuments;
}
/**
* Sets the section title.
*
* @param sectionTitle the new section title
*/
public void setSectionTitle(String sectionTitle) {
this.sectionTitle = sectionTitle;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SectionView [sectionTitle=");
builder.append(sectionTitle);
builder.append(", listSubDocuments=");
builder.append(listSubDocuments);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,91 @@
package org.gcube.application.geoportalcommon.shared.geoportal.view;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
public class SubDocumentView implements Serializable, CheckEmpty {
/**
*
*/
private static final long serialVersionUID = 3563782450418275140L;
private String metadataAsJSON;
private List<FilesetDV> listFiles;
private List<FilesetDV> listImages;
private List<GCubeSDIViewerLayerDV> listLayers;
public SubDocumentView() {
}
@Override
public Boolean isEmpty() {
if (metadataAsJSON != null && !metadataAsJSON.isEmpty())
return false;
if (listFiles != null && !listFiles.isEmpty())
return false;
if (listImages != null && !listImages.isEmpty())
return false;
if (listLayers != null && !listLayers.isEmpty())
return false;
return true;
}
public String getMetadataAsJSON() {
return metadataAsJSON;
}
public List<FilesetDV> getListFiles() {
return listFiles;
}
public List<FilesetDV> getListImages() {
return listImages;
}
public List<GCubeSDIViewerLayerDV> getListLayers() {
return listLayers;
}
public void setMetadataAsJSON(String metadataAsJSON) {
this.metadataAsJSON = metadataAsJSON;
}
public void setListFiles(List<FilesetDV> listFiles) {
this.listFiles = listFiles;
}
public void setListImages(List<FilesetDV> listImages) {
this.listImages = listImages;
}
public void setListLayers(List<GCubeSDIViewerLayerDV> listLayers) {
this.listLayers = listLayers;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SubDocumentView [metadataAsJSON=");
builder.append(metadataAsJSON);
builder.append(", listFiles=");
builder.append(listFiles);
builder.append(", listImages=");
builder.append(listImages);
builder.append(", listLayers=");
builder.append(listLayers);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,53 @@
package org.gcube.application.geoportalcommon.shared.guipresentation;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "body_welcome")
@XmlAccessorType(XmlAccessType.FIELD)
public class BodyWelcome implements Serializable {
private static final long serialVersionUID = 801731912505360534L;
@XmlElement
private String title;
@XmlElement
private String description;
public BodyWelcome() {
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public void setTitle(String title) {
this.title = title;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("BodyWelcome [title=");
builder.append(title);
builder.append(", description=");
builder.append(description);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,55 @@
package org.gcube.application.geoportalcommon.shared.guipresentation;
import java.io.Serializable;
/**
* The Class DataEntryGUIPresentationConfig.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 26, 2022
*/
public class DataEntryGUIPresentationConfig implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6007504380531152501L;
private Header header;
private BodyWelcome bodyWelcome;
/**
* Instantiates a new data entry GUI presentation config.
*/
public DataEntryGUIPresentationConfig() {
}
public Header getHeader() {
return header;
}
public BodyWelcome getBodyWelcome() {
return bodyWelcome;
}
public void setHeader(Header header) {
this.header = header;
}
public void setBodyWelcome(BodyWelcome bodyWelcome) {
this.bodyWelcome = bodyWelcome;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DataEntryGUIPresentationConfig [header=");
builder.append(header);
builder.append(", bodyWelcome=");
builder.append(bodyWelcome);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,83 @@
package org.gcube.application.geoportalcommon.shared.guipresentation;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* The Class Header.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 26, 2022
*/
@XmlRootElement(name = "header")
@XmlAccessorType(XmlAccessType.FIELD)
public class Header implements Serializable {
private static final long serialVersionUID = 1914492109448706008L;
@XmlElement
private String title;
@XmlElement
private String subtitle;
/**
* Instantiates a new header.
*/
public Header() {
}
/**
* Gets the title.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* Gets the subtitle.
*
* @return the subtitle
*/
public String getSubtitle() {
return subtitle;
}
/**
* Sets the title.
*
* @param title the new title
*/
public void setTitle(String title) {
this.title = title;
}
/**
* Sets the subtitle.
*
* @param subtitle the new subtitle
*/
public void setSubtitle(String subtitle) {
this.subtitle = subtitle;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Header [title=");
builder.append(title);
builder.append(", subtitle=");
builder.append(subtitle);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,84 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
/**
* The Class BaseConcessioneDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 9, 2021
*/
public class BaseConcessioneDV extends RecordDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -2291409985743665842L;
/** The introduzione. */
private String introduzione;
/** The authors. */
private List<String> authors;
/**
* Instantiates a new base concessione DV.
*/
public BaseConcessioneDV() {
}
/**
* Instantiates a new base concessione DV.
*
* @param introduzione the introduzione
* @param authors the authors
*/
public BaseConcessioneDV(String introduzione, List<String> authors) {
this.introduzione = introduzione;
this.authors = authors;
}
/**
* Gets the introduzione.
*
* @return the introduzione
*/
public String getIntroduzione() {
return introduzione;
}
/**
* Gets the authors.
*
* @return the authors
*/
public List<String> getAuthors() {
return authors;
}
/**
* Sets the introduzione.
*
* @param introduzione the new introduzione
*/
public void setIntroduzione(String introduzione) {
this.introduzione = introduzione;
}
/**
* Sets the authors.
*
* @param authors the new authors
*/
public void setAuthors(List<String> authors) {
this.authors = authors;
}
}

View File

@ -1,587 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.content.OtherContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV.ValidationStatus;
/**
* The Class ConcessioneDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 4, 2020
*/
public class ConcessioneDV extends BaseConcessioneDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1387327199157005059L;
/** The descrizione contenuto. */
private String descrizioneContenuto;
/** The contributore. */
private String contributore;
/** The titolari. */
private List<String> titolari;
/** The responsabile. */
private String responsabile;
/** The editore. */
private String editore;
/** The fonti finanziamento. */
private List<String> fontiFinanziamento;
/** The soggetto. */
private List<String> soggetto;
/** The risorse correlate. */
private List<String> risorseCorrelate;
/** The data inizio progetto. */
private Date dataInizioProgetto;
/** The data fine progetto. */
private Date dataFineProgetto;
/** The titolare licenza. */
private List<String> titolariLicenza;
/** The titolare copyright. */
private List<String> titolariCopyright;
/** The parole chiave libere. */
private List<String> paroleChiaveLibere;
/** The parole chiave ICCD. */
private List<String> paroleChiaveICCD;
/** The centroid lat. */
private Double centroidLat;
/** The centroid long. */
private Double centroidLong;
/** The relazione scavo. */
private AbstractRelazioneScavoDV abstractRelazioneScavo;
/** The relazione scavo. */
private RelazioneScavoDV relazioneScavo;
/** The immagini rappresentative. */
private List<UploadedImageDV> immaginiRappresentative = new ArrayList<UploadedImageDV>();
/** The posizionamento scavo. */
private LayerConcessioneDV posizionamentoScavo;
/** The piante fine scavo. */
private List<LayerConcessioneDV> pianteFineScavo = new ArrayList<LayerConcessioneDV>();
/** The generic content. */
private List<OtherContentDV> genericContent = new ArrayList<OtherContentDV>();
private ValidationReportDV validationReport = null;
// Redundancy required by GUI.
//It is the value of ValidationReportDV::ValidationStatus.
private ValidationStatus validationStatus = null;
/**
* Instantiates a new concessione.
*/
public ConcessioneDV() {
}
/**
* Gets the descrizione contenuto.
*
* @return the descrizione contenuto
*/
public String getDescrizioneContenuto() {
return descrizioneContenuto;
}
/**
* Sets the descrizione contenuto.
*
* @param descrizioneContenuto the new descrizione contenuto
*/
public void setDescrizioneContenuto(String descrizioneContenuto) {
this.descrizioneContenuto = descrizioneContenuto;
}
/**
* Gets the contributore.
*
* @return the contributore
*/
public String getContributore() {
return contributore;
}
/**
* Sets the contributore.
*
* @param contributore the new contributore
*/
public void setContributore(String contributore) {
this.contributore = contributore;
}
/**
* Gets the titolari.
*
* @return the titolari
*/
public List<String> getTitolari() {
return titolari;
}
/**
* Sets the titolari.
*
* @param titolari the new titolari
*/
public void setTitolari(List<String> titolari) {
this.titolari = titolari;
}
/**
* Gets the responsabile.
*
* @return the responsabile
*/
public String getResponsabile() {
return responsabile;
}
/**
* Sets the responsabile.
*
* @param responsabile the new responsabile
*/
public void setResponsabile(String responsabile) {
this.responsabile = responsabile;
}
/**
* Gets the editore.
*
* @return the editore
*/
public String getEditore() {
return editore;
}
/**
* Sets the editore.
*
* @param editore the new editore
*/
public void setEditore(String editore) {
this.editore = editore;
}
/**
* Gets the fonti finanziamento.
*
* @return the fonti finanziamento
*/
public List<String> getFontiFinanziamento() {
return fontiFinanziamento;
}
/**
* Sets the fonti finanziamento.
*
* @param fontiFinanziamento the new fonti finanziamento
*/
public void setFontiFinanziamento(List<String> fontiFinanziamento) {
this.fontiFinanziamento = fontiFinanziamento;
}
/**
* Gets the soggetto.
*
* @return the soggetto
*/
public List<String> getSoggetto() {
return soggetto;
}
/**
* Sets the soggetto.
*
* @param soggetto the new soggetto
*/
public void setSoggetto(List<String> soggetto) {
this.soggetto = soggetto;
}
/**
* Gets the risorse correlate.
*
* @return the risorse correlate
*/
public List<String> getRisorseCorrelate() {
return risorseCorrelate;
}
/**
* Sets the risorse correlate.
*
* @param risorseCorrelate the new risorse correlate
*/
public void setRisorseCorrelate(List<String> risorseCorrelate) {
this.risorseCorrelate = risorseCorrelate;
}
/**
* Gets the data inizio progetto.
*
* @return the data inizio progetto
*/
public Date getDataInizioProgetto() {
return dataInizioProgetto;
}
/**
* Sets the data inizio progetto.
*
* @param dataInizioProgetto the new data inizio progetto
*/
public void setDataInizioProgetto(Date dataInizioProgetto) {
this.dataInizioProgetto = dataInizioProgetto;
}
/**
* Gets the data fine progetto.
*
* @return the data fine progetto
*/
public Date getDataFineProgetto() {
return dataFineProgetto;
}
/**
* Sets the data fine progetto.
*
* @param date the new data fine progetto
*/
public void setDataFineProgetto(Date date) {
this.dataFineProgetto = date;
}
/**
* Gets the titolari licenza.
*
* @return the titolari licenza
*/
public List<String> getTitolariLicenza() {
return titolariLicenza;
}
/**
* Sets the titolari licenza.
*
* @param titolariLicenza the new titolari licenza
*/
public void setTitolariLicenza(List<String> titolariLicenza) {
this.titolariLicenza = titolariLicenza;
}
/**
* Gets the titolari copyright.
*
* @return the titolari copyright
*/
public List<String> getTitolariCopyright() {
return titolariCopyright;
}
/**
* Sets the titolari copyright.
*
* @param titolariCopyright the new titolari copyright
*/
public void setTitolariCopyright(List<String> titolariCopyright) {
this.titolariCopyright = titolariCopyright;
}
/**
* Gets the parole chiave libere.
*
* @return the parole chiave libere
*/
public List<String> getParoleChiaveLibere() {
return paroleChiaveLibere;
}
/**
* Sets the parole chiave libere.
*
* @param paroleChiaveLibere the new parole chiave libere
*/
public void setParoleChiaveLibere(List<String> paroleChiaveLibere) {
this.paroleChiaveLibere = paroleChiaveLibere;
}
/**
* Gets the parole chiave ICCD.
*
* @return the parole chiave ICCD
*/
public List<String> getParoleChiaveICCD() {
return paroleChiaveICCD;
}
/**
* Sets the parole chiave ICCD.
*
* @param paroleChiaveICCD the new parole chiave ICCD
*/
public void setParoleChiaveICCD(List<String> paroleChiaveICCD) {
this.paroleChiaveICCD = paroleChiaveICCD;
}
/**
* Gets the centroid lat.
*
* @return the centroid lat
*/
public Double getCentroidLat() {
return centroidLat;
}
/**
* Sets the centroid lat.
*
* @param centroidLat the new centroid lat
*/
public void setCentroidLat(Double centroidLat) {
this.centroidLat = centroidLat;
}
/**
* Gets the centroid long.
*
* @return the centroid long
*/
public Double getCentroidLong() {
return centroidLong;
}
/**
* Sets the centroid long.
*
* @param centroidLong the new centroid long
*/
public void setCentroidLong(Double centroidLong) {
this.centroidLong = centroidLong;
}
/**
* Gets the relazione scavo.
*
* @return the relazione scavo
*/
public RelazioneScavoDV getRelazioneScavo() {
return relazioneScavo;
}
/**
* Sets the relazione scavo.
*
* @param relazioneScavo the new relazione scavo
*/
public void setRelazioneScavo(RelazioneScavoDV relazioneScavo) {
this.relazioneScavo = relazioneScavo;
}
/**
* Gets the immagini rappresentative.
*
* @return the immagini rappresentative
*/
public List<UploadedImageDV> getImmaginiRappresentative() {
return immaginiRappresentative;
}
/**
* Sets the immagini rappresentative.
*
* @param immaginiRappresentative the new immagini rappresentative
*/
public void setImmaginiRappresentative(List<UploadedImageDV> immaginiRappresentative) {
this.immaginiRappresentative = immaginiRappresentative;
}
/**
* Gets the posizionamento scavo.
*
* @return the posizionamento scavo
*/
public LayerConcessioneDV getPosizionamentoScavo() {
return posizionamentoScavo;
}
/**
* Sets the posizionamento scavo.
*
* @param posizionamentoScavo the new posizionamento scavo
*/
public void setPosizionamentoScavo(LayerConcessioneDV posizionamentoScavo) {
this.posizionamentoScavo = posizionamentoScavo;
}
/**
* Gets the piante fine scavo.
*
* @return the piante fine scavo
*/
public List<LayerConcessioneDV> getPianteFineScavo() {
return pianteFineScavo;
}
/**
* Sets the piante fine scavo.
*
* @param pianteFineScavo the new piante fine scavo
*/
public void setPianteFineScavo(List<LayerConcessioneDV> pianteFineScavo) {
this.pianteFineScavo = pianteFineScavo;
}
/**
* Gets the generic content.
*
* @return the generic content
*/
public List<OtherContentDV> getGenericContent() {
return genericContent;
}
/**
* Sets the generic content.
*
* @param genericContent the new generic content
*/
public void setGenericContent(List<OtherContentDV> genericContent) {
this.genericContent = genericContent;
}
/**
* Gets the abstract relazione scavo.
*
* @return the abstract relazione scavo
*/
public AbstractRelazioneScavoDV getAbstractRelazioneScavo() {
return abstractRelazioneScavo;
}
/**
* Sets the abstract relazione scavo.
*
* @param abstractRelazioneScavo the new abstract relazione scavo
*/
public void setAbstractRelazioneScavo(AbstractRelazioneScavoDV abstractRelazioneScavo) {
this.abstractRelazioneScavo = abstractRelazioneScavo;
}
/**
* Gets the validation report.
*
* @return the validation report
*/
public ValidationReportDV getValidationReport() {
return validationReport;
}
/**
* Sets the validation report.
*
* @param validationReport the new validation report
*/
public void setValidationReport(ValidationReportDV validationReport) {
this.validationReport = validationReport;
}
public ValidationStatus getValidationStatus() {
return validationStatus;
}
public void setValidationStatus(ValidationStatus validationStatus) {
this.validationStatus = validationStatus;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ConcessioneDV [descrizioneContenuto=");
builder.append(descrizioneContenuto);
builder.append(", contributore=");
builder.append(contributore);
builder.append(", titolari=");
builder.append(titolari);
builder.append(", responsabile=");
builder.append(responsabile);
builder.append(", editore=");
builder.append(editore);
builder.append(", fontiFinanziamento=");
builder.append(fontiFinanziamento);
builder.append(", soggetto=");
builder.append(soggetto);
builder.append(", risorseCorrelate=");
builder.append(risorseCorrelate);
builder.append(", dataInizioProgetto=");
builder.append(dataInizioProgetto);
builder.append(", dataFineProgetto=");
builder.append(dataFineProgetto);
builder.append(", titolariLicenza=");
builder.append(titolariLicenza);
builder.append(", titolariCopyright=");
builder.append(titolariCopyright);
builder.append(", paroleChiaveLibere=");
builder.append(paroleChiaveLibere);
builder.append(", paroleChiaveICCD=");
builder.append(paroleChiaveICCD);
builder.append(", centroidLat=");
builder.append(centroidLat);
builder.append(", centroidLong=");
builder.append(centroidLong);
builder.append(", abstractRelazioneScavo=");
builder.append(abstractRelazioneScavo);
builder.append(", relazioneScavo=");
builder.append(relazioneScavo);
builder.append(", immaginiRappresentative=");
builder.append(immaginiRappresentative);
builder.append(", posizionamentoScavo=");
builder.append(posizionamentoScavo);
builder.append(", pianteFineScavo=");
builder.append(pianteFineScavo);
builder.append(", genericContent=");
builder.append(genericContent);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,201 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products.content;
import java.io.Serializable;
import java.util.Date;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
/**
* The Class AssociatedContent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 2, 2020
*/
public abstract class AssociatedContentDV implements Serializable{
/**
*
*/
private static final long serialVersionUID = -3666420861504055117L;
/** The id. */
private long id;
/** The policy. */
private String policy;
/** The license ID. */
private String licenseID;
/** The titolo. */
private String titolo;
/** The creation time. */
private Date creationTime;
/** The record. */
private RecordDV record;
/**
* Instantiates a new associated content.
*/
public AssociatedContentDV() {
}
/**
* Instantiates a new associated content.
*
* @param id the id
* @param policy the policy
* @param licenseID the license ID
* @param titolo the titolo
* @param creationTime the creation time
* @param record the record
*/
public AssociatedContentDV(long id, String policy, String licenseID, String titolo, Date creationTime,
RecordDV record) {
super();
this.id = id;
this.policy = policy;
this.licenseID = licenseID;
this.titolo = titolo;
this.creationTime = creationTime;
this.record = record;
}
/**
* Gets the id.
*
* @return the id
*/
public long getId() {
return id;
}
/**
* Sets the id.
*
* @param id the new id
*/
public void setId(long id) {
this.id = id;
}
/**
* Gets the policy.
*
* @return the policy
*/
public String getPolicy() {
return policy;
}
/**
* Sets the policy.
*
* @param policy the new policy
*/
public void setPolicy(String policy) {
this.policy = policy;
}
/**
* Gets the license ID.
*
* @return the license ID
*/
public String getLicenseID() {
return licenseID;
}
/**
* Sets the license ID.
*
* @param licenseID the new license ID
*/
public void setLicenseID(String licenseID) {
this.licenseID = licenseID;
}
/**
* Gets the titolo.
*
* @return the titolo
*/
public String getTitolo() {
return titolo;
}
/**
* Sets the titolo.
*
* @param titolo the new titolo
*/
public void setTitolo(String titolo) {
this.titolo = titolo;
}
/**
* Gets the creation time.
*
* @return the creation time
*/
public Date getCreationTime() {
return creationTime;
}
/**
* Sets the creation time.
*
* @param creationTime the new creation time
*/
public void setCreationTime(Date creationTime) {
this.creationTime = creationTime;
}
/**
* Gets the record.
*
* @return the record
*/
public RecordDV getRecord() {
return record;
}
/**
* Sets the record.
*
* @param record the new record
*/
public void setRecord(RecordDV record) {
this.record = record;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AssociatedContent [id=");
builder.append(id);
builder.append(", policy=");
builder.append(policy);
builder.append(", licenseID=");
builder.append(licenseID);
builder.append(", titolo=");
builder.append(titolo);
builder.append(", creationTime=");
builder.append(creationTime);
builder.append(", record=");
builder.append(record);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,41 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products.content;
import java.io.Serializable;
/**
* The Class OtherContent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 2, 2020
*/
public class OtherContentDV extends AssociatedContentDV implements Serializable{
/**
*
*/
private static final long serialVersionUID = -2550361768550673836L;
/**
* Instantiates a new other content.
*/
public OtherContentDV() {
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("OtherContent [toString()=");
builder.append(super.toString());
builder.append("]");
return builder.toString();
}
}

View File

@ -1,172 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products.content;
import java.io.Serializable;
/**
* The Class WorkspaceContentDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 5, 2020
*/
public class WorkspaceContentDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -3919923007831416696L;
/** The mimetype. */
private String mimetype;
/** The storage ID. */
private String storageID;
/** The link. */
private String link;
private Long id;
private String name;
// this field is used by GUI
private Integer cliendId;
/**
* Instantiates a new workspace content DV.
*/
public WorkspaceContentDV() {
}
/**
* Gets the id.
*
* @return the id
*/
public Long getId() {
return id;
}
/**
* Sets the id.
*
* @param id the new id
*/
public void setId(Long id) {
this.id = id;
}
/**
* Gets the mimetype.
*
* @return the mimetype
*/
public String getMimetype() {
return mimetype;
}
/**
* Sets the mimetype.
*
* @param mimetype the new mimetype
*/
public void setMimetype(String mimetype) {
this.mimetype = mimetype;
}
/**
* Gets the storage ID.
*
* @return the storage ID
*/
public String getStorageID() {
return storageID;
}
/**
* Sets the storage ID.
*
* @param storageID the new storage ID
*/
public void setStorageID(String storageID) {
this.storageID = storageID;
}
/**
* Gets the link.
*
* @return the link
*/
public String getLink() {
return link;
}
/**
* Sets the link.
*
* @param link the new link
*/
public void setLink(String link) {
this.link = link;
}
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Sets the name.
*
* @param name the new name
*/
public void setName(String name) {
this.name = name;
}
/**
* Gets the cliend id.
*
* @return the cliend id
*/
public Integer getCliendId() {
return cliendId;
}
/**
* Sets the cliend id.
*
* @param cliendId the new cliend id
*/
public void setCliendId(Integer cliendId) {
this.cliendId = cliendId;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("WorkspaceContentDV [mimetype=");
builder.append(mimetype);
builder.append(", storageID=");
builder.append(storageID);
builder.append(", link=");
builder.append(link);
builder.append(", id=");
builder.append(id);
builder.append(", name=");
builder.append(name);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,121 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.content.AssociatedContentDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
/**
* The Class AbstractRelazioneScavoDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 24, 2021
*/
public class AbstractRelazioneScavoDV extends AssociatedContentDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 8768745863185590509L;
/** The abstract section. */
private String abstractSectionIta;
private String abstractSectionEng;
private List<WorkspaceContentDV> listWsContent;
/**
* Instantiates a new abstract relazione scavo.
*/
public AbstractRelazioneScavoDV() {
}
/**
* Instantiates a new abstract relazione scavo DV.
*
* @param abstractSectionIta the abstract section ita
* @param abstractSectionEng the abstract section eng
*/
public AbstractRelazioneScavoDV(String abstractSectionIta, String abstractSectionEng) {
super();
this.abstractSectionIta = abstractSectionIta;
this.abstractSectionEng = abstractSectionEng;
}
/**
* Gets the abstract section ita.
*
* @return the abstract section ita
*/
public String getAbstractSectionIta() {
return abstractSectionIta;
}
/**
* Sets the abstract section ita.
*
* @param abstractSectionIta the new abstract section ita
*/
public void setAbstractSectionIta(String abstractSectionIta) {
this.abstractSectionIta = abstractSectionIta;
}
/**
* Gets the abstract section eng.
*
* @return the abstract section eng
*/
public String getAbstractSectionEng() {
return abstractSectionEng;
}
/**
* Sets the abstract section eng.
*
* @param abstractSectionEng the new abstract section eng
*/
public void setAbstractSectionEng(String abstractSectionEng) {
this.abstractSectionEng = abstractSectionEng;
}
/**
* Gets the list ws content.
*
* @return the list ws content
*/
public List<WorkspaceContentDV> getListWsContent() {
return listWsContent;
}
/**
* Sets the list ws content.
*
* @param listWsContent the new list ws content
*/
public void setListWsContent(List<WorkspaceContentDV> listWsContent) {
this.listWsContent = listWsContent;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AbstractRelazioneScavoDV [abstractSectionIta=");
builder.append(abstractSectionIta);
builder.append(", abstractSectionEng=");
builder.append(abstractSectionEng);
builder.append(", listWsContent=");
builder.append(listWsContent);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,271 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
/**
* The Class LayerConcessioneDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 9, 2021
*/
public class LayerConcessioneDV extends SDILayerDescriptorDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2633250621043744245L;
// 1.Identificazione
private String abstractSection;
// 2.Classificazione
private String topicCategory;
// 3.Keyword
private String subTopic;
// 4. Delimitazione geographica
private BoundsMap bbox;
// 5. Temporal
// 6. Quality
private String valutazioneQualita;
private String metodoRaccoltaDati;
private String scalaAcquisizione;
private List<String> authors;
private BaseConcessioneDV refersTo;
private List<WorkspaceContentDV> listWsContent;
/**
* Instantiates a new layer concessione DV.
*/
public LayerConcessioneDV() {
}
/**
* Gets the abstract section.
*
* @return the abstract section
*/
public String getAbstractSection() {
return abstractSection;
}
/**
* Sets the abstract section.
*
* @param abstractSection the new abstract section
*/
public void setAbstractSection(String abstractSection) {
this.abstractSection = abstractSection;
}
/**
* Gets the topic category.
*
* @return the topic category
*/
public String getTopicCategory() {
return topicCategory;
}
/**
* Sets the topic category.
*
* @param topicCategory the new topic category
*/
public void setTopicCategory(String topicCategory) {
this.topicCategory = topicCategory;
}
/**
* Gets the sub topic.
*
* @return the sub topic
*/
public String getSubTopic() {
return subTopic;
}
/**
* Sets the sub topic.
*
* @param subTopic the new sub topic
*/
public void setSubTopic(String subTopic) {
this.subTopic = subTopic;
}
/**
* Gets the bbox.
*
* @return the bbox
*/
public BoundsMap getBbox() {
return bbox;
}
/**
* Sets the bbox.
*
* @param bbox the new bbox
*/
public void setBbox(BoundsMap bbox) {
this.bbox = bbox;
}
/**
* Gets the valutazione qualita.
*
* @return the valutazione qualita
*/
public String getValutazioneQualita() {
return valutazioneQualita;
}
/**
* Sets the valutazione qualita.
*
* @param valutazioneQualita the new valutazione qualita
*/
public void setValutazioneQualita(String valutazioneQualita) {
this.valutazioneQualita = valutazioneQualita;
}
/**
* Gets the metodo raccolta dati.
*
* @return the metodo raccolta dati
*/
public String getMetodoRaccoltaDati() {
return metodoRaccoltaDati;
}
/**
* Sets the metodo raccolta dati.
*
* @param metodoRaccoltaDati the new metodo raccolta dati
*/
public void setMetodoRaccoltaDati(String metodoRaccoltaDati) {
this.metodoRaccoltaDati = metodoRaccoltaDati;
}
/**
* Gets the scala acquisizione.
*
* @return the scala acquisizione
*/
public String getScalaAcquisizione() {
return scalaAcquisizione;
}
/**
* Sets the scala acquisizione.
*
* @param scalaAcquisizione the new scala acquisizione
*/
public void setScalaAcquisizione(String scalaAcquisizione) {
this.scalaAcquisizione = scalaAcquisizione;
}
/**
* Gets the authors.
*
* @return the authors
*/
public List<String> getAuthors() {
return authors;
}
/**
* Sets the authors.
*
* @param authors the new authors
*/
public void setAuthors(List<String> authors) {
this.authors = authors;
}
/**
* Gets the refers to.
*
* @return the refers to
*/
public BaseConcessioneDV getRefersTo() {
return refersTo;
}
/**
* Sets the refers to.
*
* @param refersTo the new refers to
*/
public void setRefersTo(BaseConcessioneDV refersTo) {
this.refersTo = refersTo;
}
/**
* Sets the list ws content.
*
* @param listWsContent the new list ws content
*/
public void setListWsContent(List<WorkspaceContentDV> listWsContent) {
this.listWsContent = listWsContent;
}
/**
* Gets the list ws content.
*
* @return the list ws content
*/
public List<WorkspaceContentDV> getListWsContent() {
return listWsContent;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("LayerConcessioneDV [abstractSection=");
builder.append(abstractSection);
builder.append(", topicCategory=");
builder.append(topicCategory);
builder.append(", subTopic=");
builder.append(subTopic);
builder.append(", bbox=");
builder.append(bbox);
builder.append(", valutazioneQualita=");
builder.append(valutazioneQualita);
builder.append(", metodoRaccoltaDati=");
builder.append(metodoRaccoltaDati);
builder.append(", scalaAcquisizione=");
builder.append(scalaAcquisizione);
builder.append(", authors=");
builder.append(authors);
builder.append(", refersTo=");
builder.append(refersTo);
builder.append(", listWsContent=");
builder.append(listWsContent);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,297 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import java.util.Date;
/**
* The Class RecordDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 2, 2021
*/
public abstract class RecordDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2913726613820175679L;
/** The id. */
// this is the mongoID
private String itemId;
/** The record type. */
private String recordType;
/** The version. */
private String version = "1.0.0";
/** The licenza ID. */
private String licenzaID;
private String policy;
/** The nome. */
// Nome del progetto
private String nome;
/** The folder id. */
// Storage Info
private String folderId;
/** The last update time. */
// Accounting
private Date lastUpdateTime;
/** The last update user. */
private String lastUpdateUser;
/** The creation time. */
private Date creationTime;
/** The creation user. */
private String creationUser;
/**
* Instantiates a new record.
*/
public RecordDV() {
}
/**
* Gets the item id.
*
* @return the item id
*/
public String getItemId() {
return itemId;
}
/**
* Sets the item id.
*
* @param itemId the new item id
*/
public void setItemId(String itemId) {
this.itemId = itemId;
}
/**
* Gets the record type.
*
* @return the record type
*/
public String getRecordType() {
return recordType;
}
/**
* Sets the record type.
*
* @param recordType the new record type
*/
public void setRecordType(String recordType) {
this.recordType = recordType;
}
/**
* Gets the version.
*
* @return the version
*/
public String getVersion() {
return version;
}
/**
* Sets the version.
*
* @param version the new version
*/
public void setVersion(String version) {
this.version = version;
}
/**
* Gets the licenza ID.
*
* @return the licenza ID
*/
public String getLicenzaID() {
return licenzaID;
}
/**
* Sets the licenza ID.
*
* @param licenzaID the new licenza ID
*/
public void setLicenzaID(String licenzaID) {
this.licenzaID = licenzaID;
}
/**
* Gets the accesso.
*
* @return the accesso
*/
public String getPolicy() {
return policy;
}
/**
* Sets the accesso.
*
* @param policy the new policy
*/
public void setPolicy(String policy) {
this.policy = policy;
}
/**
* Gets the nome.
*
* @return the nome
*/
public String getNome() {
return nome;
}
/**
* Sets the nome.
*
* @param nome the new nome
*/
public void setNome(String nome) {
this.nome = nome;
}
/**
* Gets the folder id.
*
* @return the folder id
*/
public String getFolderId() {
return folderId;
}
/**
* Sets the folder id.
*
* @param folderId the new folder id
*/
public void setFolderId(String folderId) {
this.folderId = folderId;
}
/**
* Gets the last update time.
*
* @return the last update time
*/
public Date getLastUpdateTime() {
return lastUpdateTime;
}
/**
* Sets the last update time.
*
* @param date the new last update time
*/
public void setLastUpdateTime(Date date) {
this.lastUpdateTime = date;
}
/**
* Gets the last update user.
*
* @return the last update user
*/
public String getLastUpdateUser() {
return lastUpdateUser;
}
/**
* Sets the last update user.
*
* @param lastUpdateUser the new last update user
*/
public void setLastUpdateUser(String lastUpdateUser) {
this.lastUpdateUser = lastUpdateUser;
}
/**
* Gets the creation time.
*
* @return the creation time
*/
public Date getCreationTime() {
return creationTime;
}
/**
* Sets the creation time.
*
* @param creationTime the new creation time
*/
public void setCreationTime(Date creationTime) {
this.creationTime = creationTime;
}
/**
* Gets the creation user.
*
* @return the creation user
*/
public String getCreationUser() {
return creationUser;
}
/**
* Sets the creation user.
*
* @param creationUser the new creation user
*/
public void setCreationUser(String creationUser) {
this.creationUser = creationUser;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RecordDV [itemId=");
builder.append(itemId);
builder.append(", recordType=");
builder.append(recordType);
builder.append(", version=");
builder.append(version);
builder.append(", licenzaID=");
builder.append(licenzaID);
builder.append(", policy=");
builder.append(policy);
builder.append(", nome=");
builder.append(nome);
builder.append(", folderId=");
builder.append(folderId);
builder.append(", lastUpdateTime=");
builder.append(lastUpdateTime);
builder.append(", lastUpdateUser=");
builder.append(lastUpdateUser);
builder.append(", creationTime=");
builder.append(creationTime);
builder.append(", creationUser=");
builder.append(creationUser);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,125 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.content.AssociatedContentDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
/**
* The Class RelazioneScavoDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Dec 21, 2020
*/
public class RelazioneScavoDV extends AssociatedContentDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2456950567302197554L;
/** The responsabili. */
private List<String> responsabili;
/** The soggetto. */
private List<String> soggetto;
private List<WorkspaceContentDV> listWsContent;
/**
* Instantiates a new relazione scavo DV.
*/
public RelazioneScavoDV() {
}
/**
* Instantiates a new relazione scavo DV.
*
* @param responsabili the responsabili
* @param soggetto the soggetto
*/
public RelazioneScavoDV(List<String> responsabili, List<String> soggetto) {
super();
this.responsabili = responsabili;
this.soggetto = soggetto;
}
/**
* Gets the responsabili.
*
* @return the responsabili
*/
public List<String> getResponsabili() {
return responsabili;
}
/**
* Sets the responsabili.
*
* @param responsabili the new responsabili
*/
public void setResponsabili(List<String> responsabili) {
this.responsabili = responsabili;
}
/**
* Gets the soggetto.
*
* @return the soggetto
*/
public List<String> getSoggetto() {
return soggetto;
}
/**
* Sets the soggetto.
*
* @param soggetto the new soggetto
*/
public void setSoggetto(List<String> soggetto) {
this.soggetto = soggetto;
}
/**
* Gets the list ws content.
*
* @return the list ws content
*/
public List<WorkspaceContentDV> getListWsContent() {
return listWsContent;
}
/**
* Sets the list ws content.
*
* @param listWsContent the new list ws content
*/
public void setListWsContent(List<WorkspaceContentDV> listWsContent) {
this.listWsContent = listWsContent;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RelazioneScavoDV [responsabili=");
builder.append(responsabili);
builder.append(", soggetto=");
builder.append(soggetto);
builder.append(", listWsContent=");
builder.append(listWsContent);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,141 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import org.gcube.application.geoportalcommon.shared.products.content.AssociatedContentDV;
/**
* The Class SDILayerDescriptorDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 4, 2020
*/
public class SDILayerDescriptorDV extends AssociatedContentDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6137246723753812015L;
// meta
private String layerUUID;
private Long layerID;
// layer
private String layerName;
private String wmsLink;
/**
* Instantiates a new SDI layer descriptor DV.
*/
public SDILayerDescriptorDV() {
}
/**
* Instantiates a new SDI layer descriptor DV.
*
* @param layerUUID the layer UUID
* @param layerID the layer ID
* @param layerName the layer name
* @param wmsLink the wms link
*/
public SDILayerDescriptorDV(String layerUUID, Long layerID, String layerName, String wmsLink) {
super();
this.layerUUID = layerUUID;
this.layerID = layerID;
this.layerName = layerName;
this.wmsLink = wmsLink;
}
/**
* Gets the layer UUID.
*
* @return the layer UUID
*/
public String getLayerUUID() {
return layerUUID;
}
/**
* Sets the layer UUID.
*
* @param layerUUID the new layer UUID
*/
public void setLayerUUID(String layerUUID) {
this.layerUUID = layerUUID;
}
/**
* Gets the layer ID.
*
* @return the layer ID
*/
public Long getLayerID() {
return layerID;
}
/**
* Sets the layer ID.
*
* @param layerID the new layer ID
*/
public void setLayerID(Long layerID) {
this.layerID = layerID;
}
/**
* Gets the layer name.
*
* @return the layer name
*/
public String getLayerName() {
return layerName;
}
/**
* Sets the layer name.
*
* @param layerName the new layer name
*/
public void setLayerName(String layerName) {
this.layerName = layerName;
}
/**
* Gets the wms link.
*
* @return the wms link
*/
public String getWmsLink() {
return wmsLink;
}
/**
* Sets the wms link.
*
* @param wmsLink the new wms link
*/
public void setWmsLink(String wmsLink) {
this.wmsLink = wmsLink;
}
/* (non-Javadoc)
* @see org.gcube.portlets.user.geoportaldataviewer.shared.products.content.AssociatedContentDV#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SDILayerDescriptor [layerUUID=");
builder.append(layerUUID);
builder.append(", layerID=");
builder.append(layerID);
builder.append(", layerName=");
builder.append(layerName);
builder.append(", wmsLink=");
builder.append(wmsLink);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,139 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.content.AssociatedContentDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
/**
* The Class UploadedImage.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 2, 2020
*/
public class UploadedImageDV extends AssociatedContentDV implements Serializable {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 809167060189883015L;
/** The didascalia. */
private String didascalia;
/** The format. */
private String format;
/** The responsabili. */
private List<String> responsabili;
/** The soggetto. */
private List<String> soggetto;
private List<WorkspaceContentDV> listWsContent;
/**
* Instantiates a new uploaded image.
*/
public UploadedImageDV() {
}
/**
* Gets the didascalia.
*
* @return the didascalia
*/
public String getDidascalia() {
return didascalia;
}
/**
* Sets the didascalia.
*
* @param didascalia the new didascalia
*/
public void setDidascalia(String didascalia) {
this.didascalia = didascalia;
}
/**
* Gets the format.
*
* @return the format
*/
public String getFormat() {
return format;
}
/**
* Sets the format.
*
* @param format the new format
*/
public void setFormat(String format) {
this.format = format;
}
/**
* Gets the responsabili.
*
* @return the responsabili
*/
public List<String> getResponsabili() {
return responsabili;
}
/**
* Sets the responsabili.
*
* @param responsabili the new responsabili
*/
public void setResponsabili(List<String> responsabili) {
this.responsabili = responsabili;
}
/**
* Gets the soggetto.
*
* @return the soggetto
*/
public List<String> getSoggetto() {
return soggetto;
}
/**
* Sets the soggetto.
*
* @param soggetto the new soggetto
*/
public void setSoggetto(List<String> soggetto) {
this.soggetto = soggetto;
}
public List<WorkspaceContentDV> getListWsContent() {
return listWsContent;
}
public void setListWsContent(List<WorkspaceContentDV> listWsContent) {
this.listWsContent = listWsContent;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("UploadedImageDV [didascalia=");
builder.append(didascalia);
builder.append(", format=");
builder.append(format);
builder.append(", responsabili=");
builder.append(responsabili);
builder.append(", soggetto=");
builder.append(soggetto);
builder.append(", listWsContent=");
builder.append(listWsContent);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,186 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* The Class ValidationReportDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 13, 2021
*/
public class ValidationReportDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = -4579856308279187824L;
/**
* The Enum ValidationStatus.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 13, 2021
*/
public static enum ValidationStatus {
PASSED("Success"), ERROR("Error"), WARNING("Warning");
private String label;
private ValidationStatus(String label) {
this.label = label;
}
public String getLabel() {
return label;
}
}
private String objectName;
private ValidationStatus status;
private List<String> errorMessages = new ArrayList<String>();
private List<String> warningMessages = new ArrayList<String>();
private String asJSONString;
/**
* Instantiates a new validation report DV.
*/
public ValidationReportDV() {
}
/**
* Instantiates a new validation report DV.
*
* @param objectName the object name
* @param status the status
* @param errorMessages the error messages
* @param warningMessages the warning messages
* @param asJSONString the as JSON string
*/
public ValidationReportDV(String objectName, ValidationStatus status, List<String> errorMessages,
List<String> warningMessages, String asJSONString) {
super();
this.objectName = objectName;
this.status = status;
this.errorMessages = errorMessages;
this.warningMessages = warningMessages;
this.asJSONString = asJSONString;
}
/**
* Gets the object name.
*
* @return the object name
*/
public String getObjectName() {
return objectName;
}
/**
* Gets the status.
*
* @return the status
*/
public ValidationStatus getStatus() {
return status;
}
/**
* Gets the error messages.
*
* @return the error messages
*/
public List<String> getErrorMessages() {
return errorMessages;
}
/**
* Gets the warning messages.
*
* @return the warning messages
*/
public List<String> getWarningMessages() {
return warningMessages;
}
/**
* Gets the as JSON string.
*
* @return the as JSON string
*/
public String getAsJSONString() {
return asJSONString;
}
/**
* Sets the object name.
*
* @param objectName the new object name
*/
public void setObjectName(String objectName) {
this.objectName = objectName;
}
/**
* Sets the status.
*
* @param status the new status
*/
public void setStatus(ValidationStatus status) {
this.status = status;
}
/**
* Sets the error messages.
*
* @param errorMessages the new error messages
*/
public void setErrorMessages(List<String> errorMessages) {
this.errorMessages = errorMessages;
}
/**
* Sets the warning messages.
*
* @param warningMessages the new warning messages
*/
public void setWarningMessages(List<String> warningMessages) {
this.warningMessages = warningMessages;
}
/**
* Sets the as JSON string.
*
* @param asJSONString the new as JSON string
*/
public void setAsJSONString(String asJSONString) {
this.asJSONString = asJSONString;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ValidationReportDV [objectName=");
builder.append(objectName);
builder.append(", status=");
builder.append(status);
builder.append(", errorMessages=");
builder.append(errorMessages);
builder.append(", warningMessages=");
builder.append(warningMessages);
builder.append(", asJSONString=");
builder.append(asJSONString);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,66 +0,0 @@
package org.gcube.application.geoportalcommon.shared.products.paths;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* The Class FileSetPathsDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 29, 2021
*/
public class FileSetPathsDV implements Serializable {
/**
*
*/
private static final long serialVersionUID = 7494678009053802818L;
List<String> fileSetPaths = new ArrayList<String>();
/**
* Instantiates a new file set paths DV.
*/
public FileSetPathsDV() {
}
/**
* Instantiates a new file set paths DV.
*
* @param fileSetPaths the file set paths
*/
public FileSetPathsDV(List<String> fileSetPaths) {
super();
this.fileSetPaths = fileSetPaths;
}
/**
* Gets the file set paths.
*
* @return the file set paths
*/
public List<String> getFileSetPaths() {
return fileSetPaths;
}
/**
* Sets the file set paths.
*
* @param fileSetPaths the new file set paths
*/
public void setFileSetPaths(List<String> fileSetPaths) {
this.fileSetPaths = fileSetPaths;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("FileSetPathsDV [fileSetPaths=");
builder.append(fileSetPaths);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,5 +1,6 @@
package org.gcube.application.geoportalcommon.util;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
@ -11,7 +12,7 @@ import java.util.Date;
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 4, 2021
* Aug 4, 2021
*/
public class DateUtils {
@ -62,4 +63,32 @@ public class DateUtils {
return null;
return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDateTime();
}
public static Date toDate(String date) {
if (date == null || date.isEmpty())
return null;
try {
LocalDate localDate = LocalDate.parse(date);
return asDate(localDate);
} catch (Exception e) {
// TODO: handle exception
}
try {
LocalDateTime dateTime = LocalDateTime.parse(date);
return asDate(dateTime);
} catch (Exception e) {
// TODO: handle exception
}
try {
return new SimpleDateFormat("yyy-MM-dd").parse(date);
} catch (Exception e) {
// TODO: handle exception
}
return null;
}
}

View File

@ -0,0 +1,27 @@
package org.gcube.application.geoportalcommon.util;
/**
* The Class StringUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 31, 2023
*/
public class StringUtil {
/**
* Ellipsize.
*
* @param input the input
* @param maxLength the max length
* @return the string
*/
public static String ellipsize(String input, int maxLength) {
String ellip = "...";
if (input == null || input.length() <= maxLength || input.length() < ellip.length()) {
return input;
}
return input.substring(0, maxLength - ellip.length()).concat(ellip);
}
}

Some files were not shown because too many files have changed in this diff Show More