diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/mapper/publicapi/DmpToPublicApiDmpMapper.java b/dmp-backend/core/src/main/java/eu/eudat/model/mapper/publicapi/DmpToPublicApiDmpMapper.java new file mode 100644 index 000000000..f7e3e7cd8 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/model/mapper/publicapi/DmpToPublicApiDmpMapper.java @@ -0,0 +1,7 @@ +package eu.eudat.model.mapper.publicapi; + +public class DmpToPublicApiDmpMapper { + + + +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/DataModel.java b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/DataModel.java new file mode 100644 index 000000000..359fb8852 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/DataModel.java @@ -0,0 +1,12 @@ +package eu.eudat.model.publicapi; + + +import eu.eudat.data.old.queryableentity.DataEntity; + +public interface DataModel, M extends DataModel> { + M fromDataModel(T entity); + + T toDataModel() throws Exception; + + String getHint(); +} diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/HintedModelFactory.java b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/HintedModelFactory.java new file mode 100644 index 000000000..5a5ffcf86 --- /dev/null +++ b/dmp-backend/core/src/main/java/eu/eudat/model/publicapi/HintedModelFactory.java @@ -0,0 +1,22 @@ +package eu.eudat.model.publicapi; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.reflect.InvocationTargetException; + +public class HintedModelFactory { + private static final Logger logger = LoggerFactory.getLogger(HintedModelFactory.class); + + public static > String getHint(Class clazz) { + try { + return clazz.getDeclaredConstructor().newInstance().getHint(); + } catch (InstantiationException | IllegalAccessException e) { + logger.error(e.getMessage(), e); + return null; + } catch (InvocationTargetException | NoSuchMethodException e) { + throw new RuntimeException(e); + } + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicApiStaticHelpers.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicApiStaticHelpers.java new file mode 100644 index 000000000..9d16a55b3 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicApiStaticHelpers.java @@ -0,0 +1,424 @@ +package eu.eudat.controllers.publicapi; + +public final class PublicApiStaticHelpers { + + public static final class Dmp { + + public static final String getPagedNotes = "The json response is of type **ResponseItem>** containing the following properties:\n" + + "
    " + + "
  1. message: string, message indicating error, null if everything went well
  2. " + + "
  3. statusCode: integer, status code indicating if something unexpected happened, otherwise 0
  4. " + + "
  5. responseType: integer, 0 for json, 1 for file
  6. " + + "
  7. payload: DataTableData, containing the number of values of actual data returned and the data of type DataManagementPlanPublicListingModel
  8. " + + "
      " + + "
    1. id: string, id of dmp returned
    2. " + + "
    3. label: string, label of dmp
    4. " + + "
    5. grant: string, grant of dmp
    6. " + + "
    7. createdAt: date, creation time of dmp
    8. " + + "
    9. modifiedAt: date, modification time of dmp
    10. " + + "
    11. version: integer, version of dmp
    12. " + + "
    13. groupId: uuid, group id in which dmp belongs
    14. " + + "
    15. users: list of UserInfoPublicModel, user who collaborated on the dmp
    16. " + + "
    17. researchers: list of ResearcherPublicModel, researchers involved in the dmp
    18. " + + "
    19. finalizedAt: date, finalization date
    20. " + + "
    21. publishedAt: date, publication date
    22. " + + "
    " + + "
"; + + public static final String getPagedResponseExample = "{\n" + + " \"statusCode\": 0,\n" + + " \"responseType\": 0,\n" + + " \"message\": null,\n" + + " \"payload\": {\n" + + " \"totalCount\": 2,\n" + + " \"data\": [\n" + + " {\n" + + " \"id\": \"e9a73d77-adfa-4546-974f-4a4a623b53a8\",\n" + + " \"label\": \"Giorgos's DMP\",\n" + + " \"grant\": \"Novel EOSC services for Emerging Atmosphere, Underwater and Space Challenges\",\n" + + " \"createdAt\": 1579077317000,\n" + + " \"modifiedAt\": 1586444334000,\n" + + " \"version\": 0,\n" + + " \"groupId\": \"d949592d-f862-4b31-a43a-f5f70596df5e\",\n" + + " \"users\": [],\n" + + " \"finalizedAt\": 1586444334000,\n" + + " \"publishedAt\": 1586444334000,\n" + + " \"hint\": \"dataManagementPlanListingModel\"\n" + + " },\n" + + " {\n" + + " \"id\": \"e27789f1-de35-4b4a-9587-a46d131c366e\",\n" + + " \"label\": \"TestH2020Clone3\",\n" + + " \"grant\": \"Evaluation of the Benefits of innovative Concepts of laminar nacelle and HTP installed on a business jet configuration\",\n" + + " \"createdAt\": 1600774437000,\n" + + " \"modifiedAt\": 1600879107000,\n" + + " \"version\": 0,\n" + + " \"groupId\": \"7b793c17-cb69-41d2-a97d-e8d1b03ddbed\",\n" + + " \"users\": [],\n" + + " \"finalizedAt\": 1600879107000,\n" + + " \"publishedAt\": 1600879107000,\n" + + " \"hint\": \"dataManagementPlanListingModel\"\n" + + " }\n" + + " ]\n" + + " }\n" + + "}"; + + public static final String getPagedRequestBodyDescription = "The dmpTableRequest is a DataManagementPlanPublicTableRequest object with the following fields:\n" + + "
    " + + "
  • length: how many dmps should be fetched (required)
  • " + + "
  • offset: offset of the returned dmps, first time should be 0, then offset += length
  • " + + "
  • orderings: array of strings specifying the order, format:= +string or -string or asc or desc.
  • " + + "+ means ascending order. - means descending order.
        Available strings are: 1) status, 2) label, 3) publishedAt, 4) created.
    " + + "    asc equivalent to +label.
        desc equivalent to -label.
    " + + "
  • criteria: this is DataManagementPlanPublicCriteria object which applies filters for the dmp returned. More specifically:
  • " + + "
      " + + "
    1. periodStart: date, dmps created date greater than periodStart
    2. " + + "
    3. periodEnd: date, dmps created date less than periodEnd
    4. " + + "
    5. grants: list of uuids, dmps with the corresponding grants
    6. " + + "
    7. grantsLike: list of strings, dmps fetched having their grant matching any of the strings provided
    8. " + + "
    9. funders: list of uuids, dmps with the corresponding funders
    10. " + + "
    11. fundersLike: list of strings, dmps fetched having their funders matching any of the strings provided
    12. " + + "
    13. datasetTemplates: list of uuids, dataset templates which are described in the dmps
    14. " + + "
    15. dmpOrganisations: list of strings, dmps belonging to these organisations
    16. " + + "
    17. collaborators: list of uuids, user who collaborated on the creation/modification of dmps
    18. " + + "
    19. collaboratorsLike: list of strings, dmps fetched having their collaborators matching any of the strings provided
    20. " + + "
    21. allVersions: boolean, if dmps should be fetched with all their versions
    22. " + + "
    23. groupIds: list of uuids, in which groups the dmps are
    24. " + + "
    25. like: string, dmps fetched have this string matched in their label or description
    26. " + + "
    " + + "
      "; + + public static final String getPagedRequestParamDescription = "The fieldsGroup is a string which indicates if the returned objects would have all their properties\n" + + "There are two available values: 1) listing and 2) autocomplete\n" + + "
        " + + "
      • listing: returns objects with all their properties completed
      • " + + "
      • autocomplete: returns objects with only id, label, groupId and creationTime assigned
      • " + + "
          "; + + public static final String getOverviewSinglePublicNotes = "The json response is of type **ResponseItem< DataManagementPlanPublicModel >** containing the following properties:\n" + + "
            " + + "
          1. message: string, message indicating error, null if everything went well
          2. " + + "
          3. statusCode: integer, status code indicating if something unexpected happened, otherwise 0
          4. " + + "
          5. responseType: integer, 0 for json, 1 for file
          6. " + + "
          7. payload: DataManagementPlanPublicModel, dmp returned
          8. " + + "
              " + + "
            1. id: string, id of dmp returned
            2. " + + "
            3. label: string, label of dmp
            4. " + + "
            5. profile: string, profile of dmp
            6. " + + "
            7. grant: GrantPublicOverviewModel, grant of dmp
            8. " + + "
            9. createdAt: date, creation time of dmp
            10. " + + "
            11. modifiedAt: date, modification time of dmp
            12. " + + "
            13. finalizedAt: date, finalization date of dmp
            14. " + + "
            15. organisations: list of OrganizationPublicModel, organizations in which dmp belongs
            16. " + + "
            17. version: integer, version of dmp
            18. " + + "
            19. groupId: uuid, group id in which dmp belongs
            20. " + + "
            21. datasets: list of DatasetPublicModel, contained datasets
            22. " + + "
            23. associatedProfiles: list of AssociatedProfilePublicModel, associated profiles of dmp
            24. " + + "
            25. researchers: list of ResearcherPublicModel, researchers involved in dmp
            26. " + + "
            27. users: list of UserInfoPublicModel, user who collaborated on the dmp
            28. " + + "
            29. description: string, description of dmp
            30. " + + "
            31. publishedAt: date, publication date
            32. " + + "
            33. doi: string, if dmp has been published to zenodo so it has doi
            34. " + + "
            " + + "
          "; + + public static final String getOverviewSinglePublicResponseExample = "{\n" + + " \"statusCode\": 0,\n" + + " \"responseType\": 0,\n" + + " \"message\": null,\n" + + " \"payload\": {\n" + + " \"id\": \"e9a73d77-adfa-4546-974f-4a4a623b53a8\",\n" + + " \"label\": \"Giorgos's DMP\",\n" + + " \"profile\": null,\n" + + " \"grant\": {\n" + + " \"id\": \"c8309ae5-4e56-43eb-aa5a-9950c24051fe\",\n" + + " \"label\": \"Novel EOSC services for Emerging Atmosphere, Underwater and Space Challenges\",\n" + + " \"abbreviation\": null,\n" + + " \"description\": null,\n" + + " \"startDate\": null,\n" + + " \"endDate\": null,\n" + + " \"uri\": null,\n" + + " \"funder\": {\n" + + " \"id\": \"25e76828-3539-4c66-9870-0ecea7a4d16e\",\n" + + " \"label\": \"European Commission||EC\",\n" + + " \"hint\": null\n" + + " },\n" + + " \"hint\": null\n" + + " },\n" + + " \"createdAt\": 1579077317000,\n" + + " \"modifiedAt\": 1586444334000,\n" + + " \"finalizedAt\": 1586444334000,\n" + + " \"organisations\": [],\n" + + " \"version\": 0,\n" + + " \"groupId\": \"d949592d-f862-4b31-a43a-f5f70596df5e\",\n" + + " \"datasets\": [\n" + + " {\n" + + " \"id\": \"853a24c3-def4-4978-985f-92e7fa57ef22\",\n" + + " \"label\": \"Giorgos's Dataset Desc\",\n" + + " \"reference\": null,\n" + + " \"uri\": null,\n" + + " \"description\": null,\n" + + " \"status\": 1,\n" + + " \"createdAt\": 1579077532000,\n" + + " \"dmp\": {\n" + + " \"id\": \"e9a73d77-adfa-4546-974f-4a4a623b53a8\",\n" + + " \"label\": \"Giorgos's DMP\",\n" + + " \"grant\": \"Novel EOSC services for Emerging Atmosphere, Underwater and Space Challenges\",\n" + + " \"createdAt\": 1579077317000,\n" + + " \"modifiedAt\": 1586444334000,\n" + + " \"version\": 0,\n" + + " \"groupId\": \"d949592d-f862-4b31-a43a-f5f70596df5e\",\n" + + " \"users\": [\n" + + " {\n" + + " \"id\": \"00476b4d-0491-44ca-b2fd-92e695062a48\",\n" + + " \"name\": \"OpenDMP OpenDMP\",\n" + + " \"role\": 0,\n" + + " \"email\": \"opendmpeu@gmail.com\",\n" + + " \"hint\": \"UserInfoListingModel\"\n" + + " }\n" + + " ],\n" + + " \"finalizedAt\": 1586444334000,\n" + + " \"publishedAt\": 1586444334000,\n" + + " \"hint\": \"dataManagementPlanListingModel\"\n" + + " },\n" + + " \"datasetProfileDefinition\": {\n" + + " \"pages\": [...],\n" + + " \"rules\": [...],\n" + + " \"status\": 0\n" + + " },\n" + + " \"registries\": [],\n" + + " \"services\": [],\n" + + " \"dataRepositories\": [],\n" + + " \"tags\": null,\n" + + " \"externalDatasets\": [],\n" + + " \"profile\": {\n" + + " \"id\": \"2a6e0835-349e-412c-9fcc-8e1298ce8a5a\",\n" + + " \"label\": \"Horizon 2020\",\n" + + " \"hint\": null\n" + + " },\n" + + " \"modifiedAt\": 1579077898000,\n" + + " \"hint\": \"datasetOverviewModel\"\n" + + " }\n" + + " ],\n" + + " \"associatedProfiles\": [\n" + + " {\n" + + " \"id\": \"f41bd794-761d-4fe8-ab67-3a989d982c53\",\n" + + " \"label\": \"Swedish Research Council\"\n" + + " },\n" + + " {\n" + + " \"id\": \"2a6e0835-349e-412c-9fcc-8e1298ce8a5a\",\n" + + " \"label\": \"Horizon 2020\"\n" + + " }\n" + + " ],\n" + + " \"researchers\": [],\n" + + " \"users\": [\n" + + " {\n" + + " \"id\": \"00476b4d-0491-44ca-b2fd-92e695062a48\",\n" + + " \"name\": \"OpenDMP OpenDMP\",\n" + + " \"role\": 0,\n" + + " \"email\": \"opendmpeu@gmail.com\",\n" + + " \"hint\": \"UserInfoListingModel\"\n" + + " }\n" + + " ],\n" + + " \"description\": null,\n" + + " \"publishedAt\": 1586444334000,\n" + + " \"doi\": \"10.5072/zenodo.522151\",\n" + + " \"hint\": \"dataManagementPlanOverviewModel\"\n" + + " }\n" + + "}"; + + } + + public static final class Description { + + public static final String getPagedNotes = "The json response is of type **ResponseItem>** containing the following properties:\n" + + "
            " + + "
          1. message: string, message indicating error, null if everything went well
          2. " + + "
          3. statusCode: integer, status code indicating if something unexpected happened, otherwise 0
          4. " + + "
          5. responseType: integer, 0 for json, 1 for file
          6. " + + "
          7. payload: DataTableData, containing the number of values of actual data returned and the data of type DatasetPublicListingModel
          8. " + + "
              " + + "
            1. id: string, id of dataset returned
            2. " + + "
            3. label: string, label of dataset
            4. " + + "
            5. grant: string, grant of dataset
            6. " + + "
            7. dmp: string, dmp description
            8. " + + "
            9. dmpId: string, dmp's id
            10. " + + "
            11. profile: DatasetProfilePublicModel, dataset's profile
            12. " + + "
            13. createdAt: date, creation date
            14. " + + "
            15. modifiedAt: date, modification date
            16. " + + "
            17. description: string, dataset's description
            18. " + + "
            19. finalizedAt: date, finalization date
            20. " + + "
            21. dmpPublishedAt: date, dmp's publication date
            22. " + + "
            23. version: integer, dataset's version
            24. " + + "
            25. users: list of UserInfoPublicModel, user who collaborated on the dataset
            26. " + + "
            " + + "
          "; + public static final String getPagedResponseExample = "{\n" + + " \"statusCode\": 0,\n" + + " \"responseType\": 0,\n" + + " \"message\": null,\n" + + " \"payload\": {\n" + + " \"totalCount\": 2,\n" + + " \"data\": [\n" + + " {\n" + + " \"id\": \"ef7dfbdc-c5c1-46a7-a37b-c8d8692f1c0e\",\n" + + " \"label\": \"BARKAMOL RIVOJLANGAN SHAXSNI TARBIYALASHDA HARAKATLI O`YINLARNING O`RNI\",\n" + + " \"grant\": \"A next generation nano media tailored to capture and recycle hazardous micropollutants in contaminated industrial wastewater.\",\n" + + " \"dmp\": \"test for demo\",\n" + + " \"dmpId\": \"9dee6e72-7a4c-4fbd-b8a4-1f8cda38eb5e\",\n" + + " \"profile\": {\n" + + " \"id\": \"771283d7-a5be-4a93-bd3c-8b1883fe837c\",\n" + + " \"label\": \"Horizon Europe\",\n" + + " \"hint\": null\n" + + " },\n" + + " \"createdAt\": 1662711279000,\n" + + " \"modifiedAt\": 1662712928000,\n" + + " \"description\": \"

               Annotatsiya  Maqolada  bolalarni  o`yin  mavjud  bo`lgan  shakllarda  mavjud 
          \\nhayot  bilan  kengroq  tanishtirishga  imkon  beradi.  O`yin  bolalarning  turli  xil 
          \\nfaoliyati,o`yin  ko`nikmalarini  shakllantirishga  yordam  beradi.Ularni  fikrlash,  his-
          \\ntuyg`ular, tajribalar, o`yin muammosini hal qilishning faol usullarini izlash, ularning 
          \\no`yin sharoitlari va sharoitlariga bo`ysunishi, o`yindagi bolalarning munosabatlari, 
          \\no`yin orqali bola organik rivojlanadi,  inson madaniyatining muhim qatlami kattalar 
          \\no`rtasidagi  munosabatlar  -  oilada,  ularning  kasbiy  faoliyati  va  boshqalar.  O`yin 
          \\no`qituvchilar barcha ta’lim vazifalarini, shu jumladan o`rganishni hal qiladigan eng 
          \\nmuhim faoliyat sifatida foydalaniladi. 

          \",\n" + + " \"finalizedAt\": 1662712928000,\n" + + " \"dmpPublishedAt\": 1662713226000,\n" + + " \"version\": 0,\n" + + " \"users\": [\n" + + " {\n" + + " \"id\": \"33024e48-d528-45a5-8035-ea48641bd2f2\",\n" + + " \"name\": \"DMP author\",\n" + + " \"role\": 0,\n" + + " \"email\": \"kanavou.p@gmail.com\",\n" + + " \"hint\": \"UserInfoListingModel\"\n" + + " }\n" + + " ],\n" + + " \"hint\": \"datasetListingModel\"\n" + + " },\n" + + " {\n" + + " \"id\": \"0f253ab2-18cb-4798-adc1-135b81cfad0c\",\n" + + " \"label\": \"A \\\"zoom-elit\\\" és a kamionosok küzdelme, avagy a meritokrácia és a populizmus összecsapása\",\n" + + " \"grant\": \"Discovery Projects - Grant ID: DP140100157\",\n" + + " \"dmp\": \"TEST UPDATE 2.8.2022\",\n" + + " \"dmpId\": \"1f4daa8f-4e2f-4dc9-a60b-f6b75d313400\",\n" + + " \"profile\": {\n" + + " \"id\": \"3d43ba45-25fa-4815-81b4-9bf22ecd8316\",\n" + + " \"label\": \"HE_Final\",\n" + + " \"hint\": null\n" + + " },\n" + + " \"createdAt\": 1659392761000,\n" + + " \"modifiedAt\": 1659393655000,\n" + + " \"description\": \"

          A kanadai kamionosok „szabadságmenete” kapcsán a New York Times hasábjain Ross Donthat publicista egy régi könyvre hívja fel a figyelmet, amely sok évtizeddel ezelőtt megjósolta az elit elleni hasonló lázadásokat.

          \",\n" + + " \"finalizedAt\": 1659393654000,\n" + + " \"dmpPublishedAt\": 1659393698000,\n" + + " \"version\": 0,\n" + + " \"users\": [\n" + + " {\n" + + " \"id\": \"33024e48-d528-45a5-8035-ea48641bd2f2\",\n" + + " \"name\": \"DMP author\",\n" + + " \"role\": 0,\n" + + " \"email\": \"kanavou.p@gmail.com\",\n" + + " \"hint\": \"UserInfoListingModel\"\n" + + " }\n" + + " ],\n" + + " \"hint\": \"datasetListingModel\"\n" + + " }\n" + + " ]\n" + + " }\n" + + "}"; + public static final String getPagedRequestBodyDescription = "The datasetTableRequest is a DatasetPublicTableRequest object with the following fields:\n" + + "
            " + + "
          • length: how many datasets should be fetched (required)
          • " + + "
          • offset: offset of the returned datasets, first time should be 0, then offset += length
          • " + + "
          • orderings: array of strings specifying the order, format:= +string or -string or asc or desc.
          • " + + "+ means ascending order. - means descending order.
                Available strings are: 1) status, 2) label, 3) created.
            " + + "    asc equivalent to +label.
                desc equivalent to -label.
            " + + "
          • criteria: this is DatasetPublicCriteria object which applies filters for the datasets returned. More specifically:
          • " + + "
              " + + "
            1. periodStart: date, datasets created date greater than periodStart
            2. " + + "
            3. periodEnd: date, datasets created date less than periodEnd
            4. " + + "
            5. grants: list of uuids, dmps(datasets) with the corresponding grants
            6. " + + "
            7. collaborators: list of uuids, user who collaborated on the creation/modification of datasets
            8. " + + "
            9. datasetTemplates: list of uuids, dataset templates uuids to be included
            10. " + + "
            11. dmpOrganisations: list of strings, datasets involved in dmps which belong to these organisations
            12. " + + "
            13. tags: list of Tag objects, tags involved in datasets
            14. " + + "
            15. dmpIds: list of uuids, dmps with the specific ids
            16. " + + "
            17. groupIds: list of uuids, in which groups the datasets are
            18. " + + "
            19. allVersions: boolean, if datasets should be fetched with all their versions
            20. " + + "
            21. like: string, datasets fetched have this string matched in their label or description
            22. " + + "
            " + + "
          "; + + public static final String getOverviewSinglePublicNotes = "The json response is of type **ResponseItem< DatasetPublicModel >** containing the following properties:\n" + + "
            " + + "
          1. message: string, message indicating error, null if everything went well
          2. " + + "
          3. statusCode: integer, status code indicating if something unexpected happened, otherwise 0
          4. " + + "
          5. responseType: integer, 0 for json, 1 for file
          6. " + + "
          7. payload: DatasetPublicModel, dmp returned
          8. " + + "
              " + + "
            1. id: uuid, id of dataset returned
            2. " + + "
            3. label: string, label of dataset
            4. " + + "
            5. reference: string, reference of dataset
            6. " + + "
            7. uri: string, uri of dataset
            8. " + + "
            9. description: string, dataset's description
            10. " + + "
            11. status: string, dataset's status
            12. " + + "
            13. createdAt: date, creation time of dataset
            14. " + + "
            15. dmp: DataManagementPlanPublicListingModel, dmp to which dataset belongs
            16. " + + "
            17. datasetProfileDefinition: PagedDatasetProfile, dataset's paged description
            18. " + + "
            19. registries: list of RegistryPublicModel, dataset's registries
            20. " + + "
            21. services: list of ServicePublicModel, dataset's services
            22. " + + "
            23. dataRepositories: list of DataRepositoryPublicModel, dataset's data repositories
            24. " + + "
            25. tags: list of Tag, dataset's tags
            26. " + + "
            27. externalDatasets: list of ExternalDatasetPublicListingModel, dataset's external datasets
            28. " + + "
            29. profile: DatasetProfilePublicModel, dataset's profile
            30. " + + "
            31. modifiedAt: date, modification time of dataset
            32. " + + "
            " + + "
          "; + public static final String getOverviewSinglePublicResponseExample = "{\n" + + " \"statusCode\": 0,\n" + + " \"responseType\": 0,\n" + + " \"message\": null,\n" + + " \"payload\": {\n" + + " \"id\": \"ef7dfbdc-c5c1-46a7-a37b-c8d8692f1c0e\",\n" + + " \"label\": \"BARKAMOL RIVOJLANGAN SHAXSNI TARBIYALASHDA HARAKATLI O`YINLARNING O`RNI\",\n" + + " \"reference\": null,\n" + + " \"uri\": null,\n" + + " \"description\": \"

               Annotatsiya  Maqolada  bolalarni  o`yin  mavjud  bo`lgan  shakllarda  mavjud 
          \\nhayot  bilan  kengroq  tanishtirishga  imkon  beradi.  O`yin  bolalarning  turli  xil 
          \\nfaoliyati,o`yin  ko`nikmalarini  shakllantirishga  yordam  beradi.Ularni  fikrlash,  his-
          \\ntuyg`ular, tajribalar, o`yin muammosini hal qilishning faol usullarini izlash, ularning 
          \\no`yin sharoitlari va sharoitlariga bo`ysunishi, o`yindagi bolalarning munosabatlari, 
          \\no`yin orqali bola organik rivojlanadi,  inson madaniyatining muhim qatlami kattalar 
          \\no`rtasidagi  munosabatlar  -  oilada,  ularning  kasbiy  faoliyati  va  boshqalar.  O`yin 
          \\no`qituvchilar barcha ta’lim vazifalarini, shu jumladan o`rganishni hal qiladigan eng 
          \\nmuhim faoliyat sifatida foydalaniladi. 

          \",\n" + + " \"status\": 1,\n" + + " \"createdAt\": 1662711279000,\n" + + " \"dmp\": {\n" + + " \"id\": \"9dee6e72-7a4c-4fbd-b8a4-1f8cda38eb5e\",\n" + + " \"label\": \"test for demo\",\n" + + " \"grant\": \"A next generation nano media tailored to capture and recycle hazardous micropollutants in contaminated industrial wastewater.\",\n" + + " \"createdAt\": 1662710691000,\n" + + " \"modifiedAt\": 1662713226000,\n" + + " \"version\": 0,\n" + + " \"groupId\": \"adaa4e17-7375-45b8-b052-09edaeb6da86\",\n" + + " \"users\": [\n" + + " {\n" + + " \"id\": \"33024e48-d528-45a5-8035-ea48641bd2f2\",\n" + + " \"name\": \"DMP author\",\n" + + " \"role\": 0,\n" + + " \"email\": \"kanavou.p@gmail.com\",\n" + + " \"hint\": \"UserInfoListingModel\"\n" + + " }\n" + + " ],\n" + + " \"finalizedAt\": 1662713226000,\n" + + " \"publishedAt\": 1662713226000,\n" + + " \"hint\": \"dataManagementPlanListingModel\"\n" + + " },\n" + + " \"datasetProfileDefinition\": {\n" + + " \"pages\": [...],\n" + + " \"rules\": [...],\n" + + " \"status\": 0\n" + + " },\n" + + " \"registries\": [],\n" + + " \"services\": [],\n" + + " \"dataRepositories\": [],\n" + + " \"tags\": null,\n" + + " \"externalDatasets\": [],\n" + + " \"profile\": {\n" + + " \"id\": \"771283d7-a5be-4a93-bd3c-8b1883fe837c\",\n" + + " \"label\": \"Horizon Europe\",\n" + + " \"hint\": null\n" + + " },\n" + + " \"modifiedAt\": 1662712928000,\n" + + " \"hint\": \"datasetOverviewModel\"\n" + + " }\n" + + "}"; + + } + +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java new file mode 100644 index 000000000..6cfb0c34a --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java @@ -0,0 +1,73 @@ +package eu.eudat.controllers.publicapi; + +import eu.eudat.controllers.BaseController; +import eu.eudat.controllers.publicapi.managers.DatasetPublicManager; +import eu.eudat.controllers.publicapi.models.listingmodels.DatasetPublicListingModel; +import eu.eudat.controllers.publicapi.response.DataTableData; +import eu.eudat.logic.services.ApiContext; +import eu.eudat.models.data.helpers.responses.ResponseItem; +import eu.eudat.controllers.publicapi.models.overviewmodels.DatasetPublicModel; +import eu.eudat.controllers.publicapi.request.dataset.DatasetPublicTableRequest; +import eu.eudat.types.ApiMessageCode; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; + +@Tag(name = "Datasets Description", description = "Provides Dataset description public API's.") +@RestController +@CrossOrigin +@RequestMapping(value = {"/api/public/datasets/"}) +public class PublicDatasetsDescriptionDocumentation extends BaseController { + + private static final Logger logger = LoggerFactory.getLogger(PublicDatasetsDescriptionDocumentation.class); + + private DatasetPublicManager datasetManager; + + @Autowired + public PublicDatasetsDescriptionDocumentation(ApiContext apiContext, DatasetPublicManager datasetManager) { + super(apiContext); + this.datasetManager = datasetManager; + } + + @Operation(summary = "This method is used to get a listing of public datasets.", description = PublicApiStaticHelpers.Description.getPagedNotes) + @io.swagger.v3.oas.annotations.responses.ApiResponses(value = {@io.swagger.v3.oas.annotations.responses.ApiResponse( + responseCode = "200", + description = "The following example is generated using body: *{\"criteria\": {},\"length\": 2,\"offset\": 0,\"orderings\": {\"fields\": []} }*", + content = @Content(mediaType = APPLICATION_JSON_VALUE, examples = {@ExampleObject( + value = PublicApiStaticHelpers.Description.getPagedResponseExample + )}) + )}) + @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json") + public @ResponseBody + ResponseEntity>> getPaged(@Valid @RequestBody @io.swagger.v3.oas.annotations.parameters.RequestBody(description = PublicApiStaticHelpers.Description.getPagedRequestBodyDescription) DatasetPublicTableRequest datasetTableRequest) throws Exception { + DataTableData dataTable = this.datasetManager.getPublicPaged(datasetTableRequest); + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable)); + } + + @Operation(summary = "This method is used to get the overview of a public dataset.", description = PublicApiStaticHelpers.Description.getOverviewSinglePublicNotes) + @io.swagger.v3.oas.annotations.responses.ApiResponses(value = {@ApiResponse( + responseCode = "200", + description = "The following example is generated using id: *ef7dfbdc-c5c1-46a7-a37b-c8d8692f1c0e*", + content = @Content(mediaType = APPLICATION_JSON_VALUE, examples = {@ExampleObject( + value = PublicApiStaticHelpers.Description.getOverviewSinglePublicResponseExample + )}) + )}) + @RequestMapping(method = RequestMethod.GET, value = {"/{id}"}, produces = "application/json") + public @ResponseBody + ResponseEntity> getOverviewSinglePublic(@PathVariable @Parameter(description = "fetch the dataset with the given id", example = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") String id) throws Exception { + DatasetPublicModel dataset = this.datasetManager.getOverviewSinglePublic(id); + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(dataset)); + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDmpsDocumentation.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDmpsDocumentation.java new file mode 100644 index 000000000..882ed3087 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/PublicDmpsDocumentation.java @@ -0,0 +1,74 @@ +package eu.eudat.controllers.publicapi; + +import eu.eudat.controllers.BaseController; +import eu.eudat.controllers.publicapi.managers.DataManagementPlanPublicManager; +import eu.eudat.controllers.publicapi.models.listingmodels.DataManagementPlanPublicListingModel; +import eu.eudat.controllers.publicapi.models.overviewmodels.DataManagementPlanPublicModel; +import eu.eudat.controllers.publicapi.request.dmp.DataManagmentPlanPublicTableRequest; +import eu.eudat.controllers.publicapi.response.DataTableData; +import eu.eudat.logic.services.ApiContext; +import eu.eudat.models.data.helpers.responses.ResponseItem; +import eu.eudat.types.ApiMessageCode; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; + +@Tag(name = "DMPs", description = "Provides DMP public API's.") +@RestController +@CrossOrigin +@RequestMapping(value = {"/api/public/dmps"}) +public class PublicDmpsDocumentation extends BaseController { + + private static final Logger logger = LoggerFactory.getLogger(PublicDmpsDocumentation.class); + + @Autowired + public PublicDmpsDocumentation(ApiContext apiContext) { + super(apiContext); + } + + @Operation(summary = "This method is used to get a listing of public dmps.", description = PublicApiStaticHelpers.Dmp.getPagedNotes) + @io.swagger.v3.oas.annotations.responses.ApiResponses(value = {@ApiResponse( + responseCode = "200", + description = """ + The following example is generated using: + a) body: *{"criteria": {},"length": 2,"offset": 0,"orderings": {"fields": []} }* + b) fieldsGroup: listing""", + content = @Content(mediaType = APPLICATION_JSON_VALUE, examples = {@ExampleObject( + value = PublicApiStaticHelpers.Dmp.getPagedResponseExample + )}) + )}) + @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json") + public @ResponseBody + ResponseEntity>> getPaged(@Valid @RequestBody @io.swagger.v3.oas.annotations.parameters.RequestBody(description = PublicApiStaticHelpers.Dmp.getPagedRequestBodyDescription) DataManagmentPlanPublicTableRequest dmpTableRequest, + @RequestParam @Parameter(description = PublicApiStaticHelpers.Dmp.getPagedRequestParamDescription, example = "listing") String fieldsGroup) throws Exception { +// DataTableData dataTable = this.dataManagementPlanManager.getPublicPaged(dmpTableRequest, fieldsGroup); //TODO + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(null)); + } + + @Operation(summary = "This method is used to get the overview of a public dmp.", description = PublicApiStaticHelpers.Dmp.getOverviewSinglePublicNotes) + @io.swagger.v3.oas.annotations.responses.ApiResponses(value = {@ApiResponse( + responseCode = "200", + description = "The following example is generated using id: *e9a73d77-adfa-4546-974f-4a4a623b53a8*", + content = @Content(mediaType = APPLICATION_JSON_VALUE, examples = {@ExampleObject( + value = PublicApiStaticHelpers.Dmp.getOverviewSinglePublicResponseExample + )}) + )}) + @RequestMapping(method = RequestMethod.GET, value = {"/{id}"}, produces = "application/json") + public @ResponseBody ResponseEntity> getOverviewSinglePublic(@PathVariable @Parameter(description = "fetch the dmp with the given id", example = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") String id) throws Exception { +// DataManagementPlanPublicModel dataManagementPlan = this.dataManagementPlanManager.getOverviewSinglePublic(id); //TODO + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(null)); + } + +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/criteria/dataset/DatasetPublicCriteria.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/criteria/dataset/DatasetPublicCriteria.java similarity index 98% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/criteria/dataset/DatasetPublicCriteria.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/criteria/dataset/DatasetPublicCriteria.java index abe7a1f42..76e58a9ec 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/criteria/dataset/DatasetPublicCriteria.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/criteria/dataset/DatasetPublicCriteria.java @@ -1,4 +1,4 @@ -package eu.eudat.publicapi.criteria.dataset; +package eu.eudat.controllers.publicapi.criteria.dataset; import eu.eudat.data.dao.criteria.Criteria; import eu.eudat.data.DescriptionEntity; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/criteria/dmp/DataManagementPlanPublicCriteria.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/criteria/dmp/DataManagementPlanPublicCriteria.java similarity index 98% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/criteria/dmp/DataManagementPlanPublicCriteria.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/criteria/dmp/DataManagementPlanPublicCriteria.java index c9a4e3a26..0f9c27c7a 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/criteria/dmp/DataManagementPlanPublicCriteria.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/criteria/dmp/DataManagementPlanPublicCriteria.java @@ -1,4 +1,4 @@ -package eu.eudat.publicapi.criteria.dmp; +package eu.eudat.controllers.publicapi.criteria.dmp; import eu.eudat.data.DmpEntity; import eu.eudat.data.dao.criteria.Criteria; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/managers/DataManagementPlanPublicManager.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/managers/DataManagementPlanPublicManager.java similarity index 86% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/managers/DataManagementPlanPublicManager.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/managers/DataManagementPlanPublicManager.java index bee4a9bbc..381ff5b49 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/managers/DataManagementPlanPublicManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/managers/DataManagementPlanPublicManager.java @@ -1,17 +1,17 @@ -package eu.eudat.publicapi.managers; +package eu.eudat.controllers.publicapi.managers; import eu.eudat.commons.enums.DmpAccessType; import eu.eudat.commons.enums.IsActive; +import eu.eudat.controllers.publicapi.models.listingmodels.DataManagementPlanPublicListingModel; +import eu.eudat.controllers.publicapi.response.DataTableData; import eu.eudat.data.DmpEntity; import eu.eudat.exceptions.security.ForbiddenException; import eu.eudat.logic.managers.PaginationManager; import eu.eudat.logic.services.ApiContext; import eu.eudat.logic.services.operations.DatabaseRepository; import eu.eudat.models.HintedModelFactory; -import eu.eudat.models.data.helpers.common.DataTableData; -import eu.eudat.publicapi.models.listingmodels.DataManagementPlanPublicListingModel; -import eu.eudat.publicapi.models.overviewmodels.DataManagementPlanPublicModel; -import eu.eudat.publicapi.request.dmp.DataManagmentPlanPublicTableRequest; +import eu.eudat.controllers.publicapi.models.overviewmodels.DataManagementPlanPublicModel; +import eu.eudat.controllers.publicapi.request.dmp.DataManagmentPlanPublicTableRequest; import eu.eudat.queryable.QueryableList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,7 +33,7 @@ public class DataManagementPlanPublicManager { } public DataTableData getPublicPaged(DataManagmentPlanPublicTableRequest dmpTableRequest, String fieldsGroup) throws Exception { - dmpTableRequest.setQuery(databaseRepository.getDmpDao().asQueryable().withHint(HintedModelFactory.getHint(DataManagementPlanPublicListingModel.class))); + dmpTableRequest.setQuery(databaseRepository.getDmpDao().asQueryable().withHint(DataManagementPlanPublicListingModel.getHint())); QueryableList items = dmpTableRequest.applyCriteria(); QueryableList pagedItems = PaginationManager.applyPaging(items, dmpTableRequest); @@ -41,7 +41,7 @@ public class DataManagementPlanPublicManager { CompletableFuture itemsFuture; if (fieldsGroup.equals("listing")) { - itemsFuture = pagedItems.withHint(HintedModelFactory.getHint(DataManagementPlanPublicListingModel.class)) + itemsFuture = pagedItems.withHint(DataManagementPlanPublicListingModel.getHint()) .selectAsync(item -> { // item.setDataset( // item.getDataset().stream() diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/managers/DatasetPublicManager.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/managers/DatasetPublicManager.java new file mode 100644 index 000000000..b64c91f48 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/managers/DatasetPublicManager.java @@ -0,0 +1,113 @@ +package eu.eudat.controllers.publicapi.managers; + +import eu.eudat.commons.enums.DescriptionStatus; +import eu.eudat.commons.enums.IsActive; +import eu.eudat.commons.types.descriptiontemplate.DefinitionEntity; +import eu.eudat.controllers.publicapi.models.listingmodels.DatasetPublicListingModel; +import eu.eudat.controllers.publicapi.request.dataset.DatasetPublicTableRequest; +import eu.eudat.controllers.publicapi.response.DataTableData; +import eu.eudat.data.DescriptionEntity; +import eu.eudat.data.DescriptionTemplateEntity; +import eu.eudat.data.query.definition.helpers.ColumnOrderings; +import eu.eudat.logic.managers.PaginationManager; +import eu.eudat.logic.services.ApiContext; +import eu.eudat.logic.services.operations.DatabaseRepository; +import eu.eudat.commons.types.xml.XmlBuilder; +import eu.eudat.models.HintedModelFactory; +import eu.eudat.models.data.user.composite.PagedDatasetProfile; +import eu.eudat.controllers.publicapi.models.overviewmodels.DatasetPublicModel; +import eu.eudat.queryable.QueryableList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import jakarta.transaction.Transactional; +import java.util.*; +import java.util.stream.Collectors; + +@Component +public class DatasetPublicManager { + private static final Logger logger = LoggerFactory.getLogger(DatasetPublicManager.class); + + private DatabaseRepository databaseRepository; + + @Autowired + public DatasetPublicManager(ApiContext apiContext){ + this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository(); + } + + public DataTableData getPublicPaged(DatasetPublicTableRequest datasetTableRequest) throws Exception { + Long count = 0L; + + datasetTableRequest.setQuery(databaseRepository.getDatasetDao().asQueryable().withHint(DatasetPublicListingModel.getHint())); + QueryableList items; + + items = datasetTableRequest.applyCriteria(); + + List strings = new ArrayList<>(); + strings.add("-dmp:publishedAt|join|"); + if(datasetTableRequest.getOrderings() != null) { + datasetTableRequest.getOrderings().setFields(strings); + } + else{ + datasetTableRequest.setOrderings(new ColumnOrderings()); + datasetTableRequest.getOrderings().setFields(strings); + } + count = items.count(); + QueryableList pagedItems = PaginationManager.applyPaging(items, datasetTableRequest); + DataTableData dataTable = new DataTableData<>(); + + List datasetLists = pagedItems. + select(this::mapPublicModel); + + dataTable.setData(datasetLists.stream().filter(Objects::nonNull).collect(Collectors.toList())); + dataTable.setTotalCount(count); + return dataTable; + } + + public DatasetPublicModel getOverviewSinglePublic(String id) throws Exception { + DescriptionEntity descriptionEntityEntity = databaseRepository.getDatasetDao().find(UUID.fromString(id)); + if (descriptionEntityEntity.getIsActive() == IsActive.Inactive) { + throw new Exception("Dataset is deleted."); + } + DatasetPublicModel dataset = new DatasetPublicModel(); + dataset.setDatasetProfileDefinition(this.getPagedProfile(dataset.getStatus(), descriptionEntityEntity)); + dataset.fromDataModel(descriptionEntityEntity); + + return dataset; + } + + @Transactional + private DatasetPublicListingModel mapPublicModel(DescriptionEntity item) { + DatasetPublicListingModel listingPublicModel = new DatasetPublicListingModel().fromDataModel(item); + return listingPublicModel; + } + + private PagedDatasetProfile getPagedProfile(DescriptionStatus status, DescriptionEntity descriptionEntityEntity){ + //TODO +// eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = this.generateDatasetProfileModel(descriptionEntityEntity.getProfile()); +// datasetprofile.setStatus(status.getValue()); +// if (descriptionEntityEntity.getProperties() != null) { +// JSONObject jObject = new JSONObject(descriptionEntityEntity.getProperties()); +// Map properties = jObject.toMap(); +// datasetprofile.fromJsonObject(properties); +// } + PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile(); +// pagedDatasetProfile.buildPagedDatasetProfile(datasetprofile); + return pagedDatasetProfile; + } + + private eu.eudat.models.data.user.composite.DatasetProfile generateDatasetProfileModel(DescriptionTemplateEntity profile) { + Document viewStyleDoc = XmlBuilder.fromXml(profile.getDefinition()); + Element root = (Element) viewStyleDoc.getDocumentElement(); + DefinitionEntity viewstyle = new DefinitionEntity().fromXml(root); + + eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = new eu.eudat.models.data.user.composite.DatasetProfile(); + datasetprofile.buildProfile(viewstyle); + + return datasetprofile; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/associatedprofile/AssociatedProfilePublicModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/associatedprofile/AssociatedProfilePublicModel.java similarity index 96% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/associatedprofile/AssociatedProfilePublicModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/associatedprofile/AssociatedProfilePublicModel.java index e62d8410a..b8c348cfe 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/associatedprofile/AssociatedProfilePublicModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/associatedprofile/AssociatedProfilePublicModel.java @@ -1,4 +1,4 @@ -package eu.eudat.publicapi.models.associatedprofile; +package eu.eudat.controllers.publicapi.models.associatedprofile; import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.commons.types.xml.XmlSerializable; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetprofile/DatasetProfilePublicModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetprofile/DatasetProfilePublicModel.java similarity index 94% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetprofile/DatasetProfilePublicModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetprofile/DatasetProfilePublicModel.java index 6936eac5b..c843fb3ee 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetprofile/DatasetProfilePublicModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetprofile/DatasetProfilePublicModel.java @@ -1,4 +1,4 @@ -package eu.eudat.publicapi.models.datasetprofile; +package eu.eudat.controllers.publicapi.models.datasetprofile; import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.models.DataModel; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetwizard/DataRepositoryPublicModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetwizard/DataRepositoryPublicModel.java similarity index 98% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetwizard/DataRepositoryPublicModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetwizard/DataRepositoryPublicModel.java index d922c7447..7b483e49d 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetwizard/DataRepositoryPublicModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetwizard/DataRepositoryPublicModel.java @@ -1,4 +1,4 @@ -package eu.eudat.publicapi.models.datasetwizard; +package eu.eudat.controllers.publicapi.models.datasetwizard; import eu.eudat.data.old.DataRepository; import eu.eudat.logic.utilities.helpers.LabelGenerator; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetwizard/ExternalDatasetPublicListingModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetwizard/ExternalDatasetPublicListingModel.java similarity index 98% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetwizard/ExternalDatasetPublicListingModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetwizard/ExternalDatasetPublicListingModel.java index 13e8f2239..183f2c32d 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetwizard/ExternalDatasetPublicListingModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetwizard/ExternalDatasetPublicListingModel.java @@ -1,4 +1,4 @@ -package eu.eudat.publicapi.models.datasetwizard; +package eu.eudat.controllers.publicapi.models.datasetwizard; import eu.eudat.data.old.ExternalDataset; import eu.eudat.models.DataModel; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetwizard/RegistryPublicModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetwizard/RegistryPublicModel.java similarity index 98% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetwizard/RegistryPublicModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetwizard/RegistryPublicModel.java index 9e6a5a34f..85cb749ae 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetwizard/RegistryPublicModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetwizard/RegistryPublicModel.java @@ -1,4 +1,4 @@ -package eu.eudat.publicapi.models.datasetwizard; +package eu.eudat.controllers.publicapi.models.datasetwizard; import eu.eudat.data.old.Registry; import eu.eudat.logic.utilities.helpers.LabelGenerator; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetwizard/ServicePublicModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetwizard/ServicePublicModel.java similarity index 98% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetwizard/ServicePublicModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetwizard/ServicePublicModel.java index 6e9359da5..79f085088 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/datasetwizard/ServicePublicModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/datasetwizard/ServicePublicModel.java @@ -1,4 +1,4 @@ -package eu.eudat.publicapi.models.datasetwizard; +package eu.eudat.controllers.publicapi.models.datasetwizard; import eu.eudat.data.old.Service; import eu.eudat.logic.utilities.helpers.LabelGenerator; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/doi/DoiPublicModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/doi/DoiPublicModel.java similarity index 94% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/doi/DoiPublicModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/doi/DoiPublicModel.java index cafb4d86d..d4918bede 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/doi/DoiPublicModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/doi/DoiPublicModel.java @@ -1,8 +1,7 @@ -package eu.eudat.publicapi.models.doi; +package eu.eudat.controllers.publicapi.models.doi; import eu.eudat.data.EntityDoiEntity; import eu.eudat.logic.utilities.helpers.LabelGenerator; -import eu.eudat.models.DataModel; import java.util.UUID; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/funder/FunderPublicOverviewModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/funder/FunderPublicOverviewModel.java similarity index 93% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/funder/FunderPublicOverviewModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/funder/FunderPublicOverviewModel.java index c64eac892..1f9bef460 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/funder/FunderPublicOverviewModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/funder/FunderPublicOverviewModel.java @@ -1,4 +1,4 @@ -package eu.eudat.publicapi.models.funder; +package eu.eudat.controllers.publicapi.models.funder; import eu.eudat.data.old.Funder; import eu.eudat.models.DataModel; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/grant/GrantPublicOverviewModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/grant/GrantPublicOverviewModel.java similarity index 94% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/grant/GrantPublicOverviewModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/grant/GrantPublicOverviewModel.java index 04fb519cf..6015e7896 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/grant/GrantPublicOverviewModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/grant/GrantPublicOverviewModel.java @@ -1,8 +1,8 @@ -package eu.eudat.publicapi.models.grant; +package eu.eudat.controllers.publicapi.models.grant; +import eu.eudat.controllers.publicapi.models.funder.FunderPublicOverviewModel; import eu.eudat.data.old.Grant; import eu.eudat.models.DataModel; -import eu.eudat.publicapi.models.funder.FunderPublicOverviewModel; import java.util.Date; import java.util.UUID; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/listingmodels/DataManagementPlanPublicListingModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/listingmodels/DataManagementPlanPublicListingModel.java similarity index 62% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/listingmodels/DataManagementPlanPublicListingModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/listingmodels/DataManagementPlanPublicListingModel.java index f0aeb65ed..3c977f730 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/listingmodels/DataManagementPlanPublicListingModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/listingmodels/DataManagementPlanPublicListingModel.java @@ -1,15 +1,12 @@ -package eu.eudat.publicapi.models.listingmodels; +package eu.eudat.controllers.publicapi.models.listingmodels; import eu.eudat.data.DmpEntity; -import eu.eudat.data.old.Grant; import eu.eudat.model.DmpUser; -import eu.eudat.models.DataModel; -import eu.eudat.publicapi.models.researcher.ResearcherPublicModel; +import eu.eudat.controllers.publicapi.models.researcher.ResearcherPublicModel; import java.util.*; -import java.util.stream.Collectors; -public class DataManagementPlanPublicListingModel implements DataModel { +public class DataManagementPlanPublicListingModel { private String id; private String label; private String grant; @@ -99,7 +96,6 @@ public class DataManagementPlanPublicListingModel implements DataModel new UserInfoPublicModel().fromDataModel(x)).collect(Collectors.toList()) : new ArrayList<>(); -// this.researchers = entity.getResearchers() != null ? entity.getResearchers().stream().map(x -> new ResearcherPublicModel().fromDataModel(x)).collect(Collectors.toList()) : new ArrayList<>(); -// } -// catch(Exception ex){ -// this.users = new ArrayList<>(); -// this.researchers = new ArrayList<>(); -// } -// this.finalizedAt = entity.getFinalizedAt(); -// this.publishedAt = entity.getPublishedAt(); - return this; } - @Override public DmpEntity toDataModel() { DmpEntity entity = new DmpEntity(); entity.setId(UUID.fromString(this.getId())); entity.setLabel(this.getLabel()); entity.setGroupId(this.getGroupId()); -// entity.setCreated(this.getCreatedAt()); //TODO -// entity.setFinalizedAt(this.getFinalizedAt()); -// entity.setModified(this.getModifiedAt()); -// entity.setPublishedAt(this.getPublishedAt()); -// entity.setVersion(this.getVersion()); -// -// if (this.getGrant() != null) { -// Grant grant = new Grant(); -// grant.setLabel(this.getGrant()); -// entity.setGrant(grant); -// } -// entity.setUsers(this.getUsers().stream().map(UserInfoPublicModel::toDataModel).collect(Collectors.toSet())); -// entity.setResearchers(this.getResearchers().stream().map(ResearcherPublicModel::toDataModel).collect(Collectors.toSet())); return entity; } - @Override - public String getHint() { + public static String getHint() { return "fullyDetailed"; } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/listingmodels/DatasetPublicListingModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/listingmodels/DatasetPublicListingModel.java new file mode 100644 index 000000000..a76f4158c --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/listingmodels/DatasetPublicListingModel.java @@ -0,0 +1,129 @@ +package eu.eudat.controllers.publicapi.models.listingmodels; + +import eu.eudat.data.DescriptionEntity; +import eu.eudat.model.DmpUser; +import eu.eudat.controllers.publicapi.models.datasetprofile.DatasetProfilePublicModel; + +import java.util.Date; +import java.util.List; + +public class DatasetPublicListingModel { + private String id; + private String label; + private String grant; + private String dmp; + private String dmpId; + private DatasetProfilePublicModel profile; + private Date createdAt; + private Date modifiedAt; + private String description; + private Date finalizedAt; + private Date dmpPublishedAt; + private int version; + private List users; + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + + public String getLabel() { + return label; + } + public void setLabel(String label) { + this.label = label; + } + + public String getGrant() { + return grant; + } + public void setGrant(String grant) { + this.grant = grant; + } + + public String getDmp() { + return dmp; + } + public void setDmp(String dmp) { + this.dmp = dmp; + } + + public String getDmpId() { + return dmpId; + } + public void setDmpId(String dmpId) { + this.dmpId = dmpId; + } + + public DatasetProfilePublicModel getProfile() { + return profile; + } + public void setProfile(DatasetProfilePublicModel profile) { + this.profile = profile; + } + + public Date getCreatedAt() { + return createdAt; + } + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getModifiedAt() { + return modifiedAt; + } + public void setModifiedAt(Date modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + public Date getFinalizedAt() { + return finalizedAt; + } + public void setFinalizedAt(Date finalizedAt) { + this.finalizedAt = finalizedAt; + } + + public Date getDmpPublishedAt() { + return dmpPublishedAt; + } + public void setDmpPublishedAt(Date dmpPublishedAt) { + this.dmpPublishedAt = dmpPublishedAt; + } + + public int getVersion() { + return version; + } + public void setVersion(int version) { + this.version = version; + } + + public List getUsers() { + return users; + } + + public void setUsers(List users) { + this.users = users; + } + + public DatasetPublicListingModel fromDataModel(DescriptionEntity entity) { + return this; + } + + public DescriptionEntity toDataModel() { + DescriptionEntity entity = new DescriptionEntity(); + return entity; + } + + public static String getHint() { + return "datasetListingModel"; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/organisation/OrganizationPublicModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/organisation/OrganizationPublicModel.java similarity index 98% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/organisation/OrganizationPublicModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/organisation/OrganizationPublicModel.java index 05157ceba..fded132b8 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/organisation/OrganizationPublicModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/organisation/OrganizationPublicModel.java @@ -1,4 +1,4 @@ -package eu.eudat.publicapi.models.organisation; +package eu.eudat.controllers.publicapi.models.organisation; import eu.eudat.data.old.Organisation; import eu.eudat.logic.utilities.helpers.LabelGenerator; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/overviewmodels/DataManagementPlanPublicModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/overviewmodels/DataManagementPlanPublicModel.java similarity index 93% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/overviewmodels/DataManagementPlanPublicModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/overviewmodels/DataManagementPlanPublicModel.java index 64cddf2d3..af4a81a52 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/overviewmodels/DataManagementPlanPublicModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/overviewmodels/DataManagementPlanPublicModel.java @@ -1,10 +1,10 @@ -package eu.eudat.publicapi.models.overviewmodels; +package eu.eudat.controllers.publicapi.models.overviewmodels; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import eu.eudat.commons.enums.DescriptionStatus; -import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.types.descriptiontemplate.DefinitionEntity; +import eu.eudat.controllers.publicapi.models.doi.DoiPublicModel; +import eu.eudat.controllers.publicapi.models.grant.GrantPublicOverviewModel; +import eu.eudat.controllers.publicapi.models.organisation.OrganizationPublicModel; +import eu.eudat.controllers.publicapi.models.researcher.ResearcherPublicModel; import eu.eudat.data.DescriptionEntity; import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.commons.types.xml.XmlBuilder; @@ -12,16 +12,11 @@ import eu.eudat.data.DmpEntity; import eu.eudat.model.DmpUser; import eu.eudat.models.DataModel; import eu.eudat.models.data.user.composite.PagedDatasetProfile; -import eu.eudat.publicapi.models.associatedprofile.AssociatedProfilePublicModel; -import eu.eudat.publicapi.models.doi.DoiPublicModel; -import eu.eudat.publicapi.models.grant.GrantPublicOverviewModel; -import eu.eudat.publicapi.models.organisation.OrganizationPublicModel; -import eu.eudat.publicapi.models.researcher.ResearcherPublicModel; +import eu.eudat.controllers.publicapi.models.associatedprofile.AssociatedProfilePublicModel; import org.w3c.dom.Document; import org.w3c.dom.Element; import java.util.*; -import java.util.stream.Collectors; public class DataManagementPlanPublicModel implements DataModel { private String id; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/overviewmodels/DatasetPublicModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/overviewmodels/DatasetPublicModel.java similarity index 95% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/overviewmodels/DatasetPublicModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/overviewmodels/DatasetPublicModel.java index 9f20b8fbe..c29540840 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/overviewmodels/DatasetPublicModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/overviewmodels/DatasetPublicModel.java @@ -1,15 +1,15 @@ -package eu.eudat.publicapi.models.overviewmodels; +package eu.eudat.controllers.publicapi.models.overviewmodels; import eu.eudat.commons.enums.DescriptionStatus; +import eu.eudat.controllers.publicapi.models.datasetprofile.DatasetProfilePublicModel; +import eu.eudat.controllers.publicapi.models.datasetwizard.DataRepositoryPublicModel; +import eu.eudat.controllers.publicapi.models.datasetwizard.ExternalDatasetPublicListingModel; +import eu.eudat.controllers.publicapi.models.datasetwizard.RegistryPublicModel; +import eu.eudat.controllers.publicapi.models.datasetwizard.ServicePublicModel; +import eu.eudat.controllers.publicapi.models.listingmodels.DataManagementPlanPublicListingModel; import eu.eudat.data.DescriptionEntity; import eu.eudat.models.DataModel; import eu.eudat.models.data.user.composite.PagedDatasetProfile; -import eu.eudat.publicapi.models.datasetprofile.DatasetProfilePublicModel; -import eu.eudat.publicapi.models.datasetwizard.DataRepositoryPublicModel; -import eu.eudat.publicapi.models.datasetwizard.ExternalDatasetPublicListingModel; -import eu.eudat.publicapi.models.datasetwizard.RegistryPublicModel; -import eu.eudat.publicapi.models.datasetwizard.ServicePublicModel; -import eu.eudat.publicapi.models.listingmodels.DataManagementPlanPublicListingModel; import java.util.*; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/researcher/ResearcherPublicModel.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/researcher/ResearcherPublicModel.java similarity index 98% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/models/researcher/ResearcherPublicModel.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/researcher/ResearcherPublicModel.java index bf57f8423..ca0797d1a 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/researcher/ResearcherPublicModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/models/researcher/ResearcherPublicModel.java @@ -1,4 +1,4 @@ -package eu.eudat.publicapi.models.researcher; +package eu.eudat.controllers.publicapi.models.researcher; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import eu.eudat.data.old.Researcher; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/request/dataset/DatasetPublicTableRequest.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/request/dataset/DatasetPublicTableRequest.java similarity index 97% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/request/dataset/DatasetPublicTableRequest.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/request/dataset/DatasetPublicTableRequest.java index 3c5284306..c11b12cf0 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/request/dataset/DatasetPublicTableRequest.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/request/dataset/DatasetPublicTableRequest.java @@ -1,10 +1,10 @@ -package eu.eudat.publicapi.request.dataset; +package eu.eudat.controllers.publicapi.request.dataset; import eu.eudat.commons.enums.DescriptionStatus; import eu.eudat.commons.enums.IsActive; +import eu.eudat.controllers.publicapi.criteria.dataset.DatasetPublicCriteria; import eu.eudat.data.DescriptionEntity; import eu.eudat.data.query.definition.TableQuery; -import eu.eudat.publicapi.criteria.dataset.DatasetPublicCriteria; import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.types.FieldSelectionType; import eu.eudat.queryable.types.SelectionField; diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/request/dmp/DataManagmentPlanPublicTableRequest.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/request/dmp/DataManagmentPlanPublicTableRequest.java similarity index 98% rename from dmp-backend/web/src/main/java/eu/eudat/publicapi/request/dmp/DataManagmentPlanPublicTableRequest.java rename to dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/request/dmp/DataManagmentPlanPublicTableRequest.java index 36ab1ca7d..c37848f2d 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/request/dmp/DataManagmentPlanPublicTableRequest.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/request/dmp/DataManagmentPlanPublicTableRequest.java @@ -1,10 +1,10 @@ -package eu.eudat.publicapi.request.dmp; +package eu.eudat.controllers.publicapi.request.dmp; import eu.eudat.commons.enums.IsActive; +import eu.eudat.controllers.publicapi.criteria.dmp.DataManagementPlanPublicCriteria; import eu.eudat.data.DmpEntity; import eu.eudat.data.query.PaginationService; import eu.eudat.data.query.definition.TableQuery; -import eu.eudat.publicapi.criteria.dmp.DataManagementPlanPublicCriteria; import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.types.FieldSelectionType; import eu.eudat.queryable.types.SelectionField; diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/response/DataTableData.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/response/DataTableData.java new file mode 100644 index 000000000..26092a088 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/publicapi/response/DataTableData.java @@ -0,0 +1,24 @@ +package eu.eudat.controllers.publicapi.response; + +import java.util.List; + +public class DataTableData { + private Long totalCount; + private List data; + + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(Long totalCount) { + this.totalCount = totalCount; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/configurations/SwaggerConfiguration.java b/dmp-backend/web/src/main/java/eu/eudat/publicapi/configurations/SwaggerConfiguration.java deleted file mode 100644 index 232794013..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/configurations/SwaggerConfiguration.java +++ /dev/null @@ -1,32 +0,0 @@ -package eu.eudat.publicapi.configurations; - -//import io.swagger.v3.oas.models.OpenAPI; -//import io.swagger.v3.oas.models.info.Contact; -//import io.swagger.v3.oas.models.info.Info; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.context.annotation.Bean; -//import org.springframework.context.annotation.Configuration; -//import org.springframework.core.env.Environment; -// -//@Configuration -//public class SwaggerConfiguration { -// -// // private static final TypeResolver resolver = new TypeResolver(); -// -// @Autowired -// private Environment environment; -// -// @Bean -// public OpenAPI ArgosOpenApi() { -// return new OpenAPI().info(apiInfo()); -// } -// -// private Info apiInfo() { -// return new Info() -// .title("OpenDMP public API") -// .description("Argos public API.") -// .version("1.0") -// .termsOfService("https://argos.openaire.eu/terms-and-conditions") -// .contact(new Contact().name("Argos").url("https://argos.openaire.eu/").email("argos@openaire.eu ")); -// } -//} diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/controllers/PublicDatasetsDescriptionDocumentation.java b/dmp-backend/web/src/main/java/eu/eudat/publicapi/controllers/PublicDatasetsDescriptionDocumentation.java deleted file mode 100644 index db8675a58..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/controllers/PublicDatasetsDescriptionDocumentation.java +++ /dev/null @@ -1,266 +0,0 @@ -package eu.eudat.publicapi.controllers; - -import eu.eudat.controllers.BaseController; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.helpers.common.DataTableData; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.publicapi.managers.DatasetPublicManager; -import eu.eudat.publicapi.models.listingmodels.DatasetPublicListingModel; -import eu.eudat.publicapi.models.overviewmodels.DatasetPublicModel; -import eu.eudat.publicapi.request.dataset.DatasetPublicTableRequest; -import eu.eudat.types.ApiMessageCode; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; - -@Tag(name = "Datasets Description", description = "Provides Dataset description public API's.") -@RestController -@CrossOrigin -@RequestMapping(value = {"/api/public/datasets/"}) -public class PublicDatasetsDescriptionDocumentation extends BaseController { - - private static final Logger logger = LoggerFactory.getLogger(PublicDatasetsDescriptionDocumentation.class); - - private DatasetPublicManager datasetManager; - - public static final String getPagedNotes = "The json response is of type **ResponseItem>** containing the following properties:\n" + - "
            " + - "
          1. message: string, message indicating error, null if everything went well
          2. " + - "
          3. statusCode: integer, status code indicating if something unexpected happened, otherwise 0
          4. " + - "
          5. responseType: integer, 0 for json, 1 for file
          6. " + - "
          7. payload: DataTableData, containing the number of values of actual data returned and the data of type DatasetPublicListingModel
          8. " + - "
              " + - "
            1. id: string, id of dataset returned
            2. " + - "
            3. label: string, label of dataset
            4. " + - "
            5. grant: string, grant of dataset
            6. " + - "
            7. dmp: string, dmp description
            8. " + - "
            9. dmpId: string, dmp's id
            10. " + - "
            11. profile: DatasetProfilePublicModel, dataset's profile
            12. " + - "
            13. createdAt: date, creation date
            14. " + - "
            15. modifiedAt: date, modification date
            16. " + - "
            17. description: string, dataset's description
            18. " + - "
            19. finalizedAt: date, finalization date
            20. " + - "
            21. dmpPublishedAt: date, dmp's publication date
            22. " + - "
            23. version: integer, dataset's version
            24. " + - "
            25. users: list of UserInfoPublicModel, user who collaborated on the dataset
            26. " + - "
            " + - "
          "; - public static final String getPagedResponseExample = "{\n" + - " \"statusCode\": 0,\n" + - " \"responseType\": 0,\n" + - " \"message\": null,\n" + - " \"payload\": {\n" + - " \"totalCount\": 2,\n" + - " \"data\": [\n" + - " {\n" + - " \"id\": \"ef7dfbdc-c5c1-46a7-a37b-c8d8692f1c0e\",\n" + - " \"label\": \"BARKAMOL RIVOJLANGAN SHAXSNI TARBIYALASHDA HARAKATLI O`YINLARNING O`RNI\",\n" + - " \"grant\": \"A next generation nano media tailored to capture and recycle hazardous micropollutants in contaminated industrial wastewater.\",\n" + - " \"dmp\": \"test for demo\",\n" + - " \"dmpId\": \"9dee6e72-7a4c-4fbd-b8a4-1f8cda38eb5e\",\n" + - " \"profile\": {\n" + - " \"id\": \"771283d7-a5be-4a93-bd3c-8b1883fe837c\",\n" + - " \"label\": \"Horizon Europe\",\n" + - " \"hint\": null\n" + - " },\n" + - " \"createdAt\": 1662711279000,\n" + - " \"modifiedAt\": 1662712928000,\n" + - " \"description\": \"

               Annotatsiya  Maqolada  bolalarni  o`yin  mavjud  bo`lgan  shakllarda  mavjud 
          \\nhayot  bilan  kengroq  tanishtirishga  imkon  beradi.  O`yin  bolalarning  turli  xil 
          \\nfaoliyati,o`yin  ko`nikmalarini  shakllantirishga  yordam  beradi.Ularni  fikrlash,  his-
          \\ntuyg`ular, tajribalar, o`yin muammosini hal qilishning faol usullarini izlash, ularning 
          \\no`yin sharoitlari va sharoitlariga bo`ysunishi, o`yindagi bolalarning munosabatlari, 
          \\no`yin orqali bola organik rivojlanadi,  inson madaniyatining muhim qatlami kattalar 
          \\no`rtasidagi  munosabatlar  -  oilada,  ularning  kasbiy  faoliyati  va  boshqalar.  O`yin 
          \\no`qituvchilar barcha ta’lim vazifalarini, shu jumladan o`rganishni hal qiladigan eng 
          \\nmuhim faoliyat sifatida foydalaniladi. 

          \",\n" + - " \"finalizedAt\": 1662712928000,\n" + - " \"dmpPublishedAt\": 1662713226000,\n" + - " \"version\": 0,\n" + - " \"users\": [\n" + - " {\n" + - " \"id\": \"33024e48-d528-45a5-8035-ea48641bd2f2\",\n" + - " \"name\": \"DMP author\",\n" + - " \"role\": 0,\n" + - " \"email\": \"kanavou.p@gmail.com\",\n" + - " \"hint\": \"UserInfoListingModel\"\n" + - " }\n" + - " ],\n" + - " \"hint\": \"datasetListingModel\"\n" + - " },\n" + - " {\n" + - " \"id\": \"0f253ab2-18cb-4798-adc1-135b81cfad0c\",\n" + - " \"label\": \"A \\\"zoom-elit\\\" és a kamionosok küzdelme, avagy a meritokrácia és a populizmus összecsapása\",\n" + - " \"grant\": \"Discovery Projects - Grant ID: DP140100157\",\n" + - " \"dmp\": \"TEST UPDATE 2.8.2022\",\n" + - " \"dmpId\": \"1f4daa8f-4e2f-4dc9-a60b-f6b75d313400\",\n" + - " \"profile\": {\n" + - " \"id\": \"3d43ba45-25fa-4815-81b4-9bf22ecd8316\",\n" + - " \"label\": \"HE_Final\",\n" + - " \"hint\": null\n" + - " },\n" + - " \"createdAt\": 1659392761000,\n" + - " \"modifiedAt\": 1659393655000,\n" + - " \"description\": \"

          A kanadai kamionosok „szabadságmenete” kapcsán a New York Times hasábjain Ross Donthat publicista egy régi könyvre hívja fel a figyelmet, amely sok évtizeddel ezelőtt megjósolta az elit elleni hasonló lázadásokat.

          \",\n" + - " \"finalizedAt\": 1659393654000,\n" + - " \"dmpPublishedAt\": 1659393698000,\n" + - " \"version\": 0,\n" + - " \"users\": [\n" + - " {\n" + - " \"id\": \"33024e48-d528-45a5-8035-ea48641bd2f2\",\n" + - " \"name\": \"DMP author\",\n" + - " \"role\": 0,\n" + - " \"email\": \"kanavou.p@gmail.com\",\n" + - " \"hint\": \"UserInfoListingModel\"\n" + - " }\n" + - " ],\n" + - " \"hint\": \"datasetListingModel\"\n" + - " }\n" + - " ]\n" + - " }\n" + - "}"; - public static final String getPagedRequestBodyDescription = "The datasetTableRequest is a DatasetPublicTableRequest object with the following fields:\n" + - "
            " + - "
          • length: how many datasets should be fetched (required)
          • " + - "
          • offset: offset of the returned datasets, first time should be 0, then offset += length
          • " + - "
          • orderings: array of strings specifying the order, format:= +string or -string or asc or desc.
          • " + - "+ means ascending order. - means descending order.
                Available strings are: 1) status, 2) label, 3) created.
            " + - "    asc equivalent to +label.
                desc equivalent to -label.
            " + - "
          • criteria: this is DatasetPublicCriteria object which applies filters for the datasets returned. More specifically:
          • " + - "
              " + - "
            1. periodStart: date, datasets created date greater than periodStart
            2. " + - "
            3. periodEnd: date, datasets created date less than periodEnd
            4. " + - "
            5. grants: list of uuids, dmps(datasets) with the corresponding grants
            6. " + - "
            7. collaborators: list of uuids, user who collaborated on the creation/modification of datasets
            8. " + - "
            9. datasetTemplates: list of uuids, dataset templates uuids to be included
            10. " + - "
            11. dmpOrganisations: list of strings, datasets involved in dmps which belong to these organisations
            12. " + - "
            13. tags: list of Tag objects, tags involved in datasets
            14. " + - "
            15. dmpIds: list of uuids, dmps with the specific ids
            16. " + - "
            17. groupIds: list of uuids, in which groups the datasets are
            18. " + - "
            19. allVersions: boolean, if datasets should be fetched with all their versions
            20. " + - "
            21. like: string, datasets fetched have this string matched in their label or description
            22. " + - "
            " + - "
          "; - - public static final String getOverviewSinglePublicNotes = "The json response is of type **ResponseItem< DatasetPublicModel >** containing the following properties:\n" + - "
            " + - "
          1. message: string, message indicating error, null if everything went well
          2. " + - "
          3. statusCode: integer, status code indicating if something unexpected happened, otherwise 0
          4. " + - "
          5. responseType: integer, 0 for json, 1 for file
          6. " + - "
          7. payload: DatasetPublicModel, dmp returned
          8. " + - "
              " + - "
            1. id: uuid, id of dataset returned
            2. " + - "
            3. label: string, label of dataset
            4. " + - "
            5. reference: string, reference of dataset
            6. " + - "
            7. uri: string, uri of dataset
            8. " + - "
            9. description: string, dataset's description
            10. " + - "
            11. status: string, dataset's status
            12. " + - "
            13. createdAt: date, creation time of dataset
            14. " + - "
            15. dmp: DataManagementPlanPublicListingModel, dmp to which dataset belongs
            16. " + - "
            17. datasetProfileDefinition: PagedDatasetProfile, dataset's paged description
            18. " + - "
            19. registries: list of RegistryPublicModel, dataset's registries
            20. " + - "
            21. services: list of ServicePublicModel, dataset's services
            22. " + - "
            23. dataRepositories: list of DataRepositoryPublicModel, dataset's data repositories
            24. " + - "
            25. tags: list of Tag, dataset's tags
            26. " + - "
            27. externalDatasets: list of ExternalDatasetPublicListingModel, dataset's external datasets
            28. " + - "
            29. profile: DatasetProfilePublicModel, dataset's profile
            30. " + - "
            31. modifiedAt: date, modification time of dataset
            32. " + - "
            " + - "
          "; - public static final String getOverviewSinglePublicResponseExample = "{\n" + - " \"statusCode\": 0,\n" + - " \"responseType\": 0,\n" + - " \"message\": null,\n" + - " \"payload\": {\n" + - " \"id\": \"ef7dfbdc-c5c1-46a7-a37b-c8d8692f1c0e\",\n" + - " \"label\": \"BARKAMOL RIVOJLANGAN SHAXSNI TARBIYALASHDA HARAKATLI O`YINLARNING O`RNI\",\n" + - " \"reference\": null,\n" + - " \"uri\": null,\n" + - " \"description\": \"

               Annotatsiya  Maqolada  bolalarni  o`yin  mavjud  bo`lgan  shakllarda  mavjud 
          \\nhayot  bilan  kengroq  tanishtirishga  imkon  beradi.  O`yin  bolalarning  turli  xil 
          \\nfaoliyati,o`yin  ko`nikmalarini  shakllantirishga  yordam  beradi.Ularni  fikrlash,  his-
          \\ntuyg`ular, tajribalar, o`yin muammosini hal qilishning faol usullarini izlash, ularning 
          \\no`yin sharoitlari va sharoitlariga bo`ysunishi, o`yindagi bolalarning munosabatlari, 
          \\no`yin orqali bola organik rivojlanadi,  inson madaniyatining muhim qatlami kattalar 
          \\no`rtasidagi  munosabatlar  -  oilada,  ularning  kasbiy  faoliyati  va  boshqalar.  O`yin 
          \\no`qituvchilar barcha ta’lim vazifalarini, shu jumladan o`rganishni hal qiladigan eng 
          \\nmuhim faoliyat sifatida foydalaniladi. 

          \",\n" + - " \"status\": 1,\n" + - " \"createdAt\": 1662711279000,\n" + - " \"dmp\": {\n" + - " \"id\": \"9dee6e72-7a4c-4fbd-b8a4-1f8cda38eb5e\",\n" + - " \"label\": \"test for demo\",\n" + - " \"grant\": \"A next generation nano media tailored to capture and recycle hazardous micropollutants in contaminated industrial wastewater.\",\n" + - " \"createdAt\": 1662710691000,\n" + - " \"modifiedAt\": 1662713226000,\n" + - " \"version\": 0,\n" + - " \"groupId\": \"adaa4e17-7375-45b8-b052-09edaeb6da86\",\n" + - " \"users\": [\n" + - " {\n" + - " \"id\": \"33024e48-d528-45a5-8035-ea48641bd2f2\",\n" + - " \"name\": \"DMP author\",\n" + - " \"role\": 0,\n" + - " \"email\": \"kanavou.p@gmail.com\",\n" + - " \"hint\": \"UserInfoListingModel\"\n" + - " }\n" + - " ],\n" + - " \"finalizedAt\": 1662713226000,\n" + - " \"publishedAt\": 1662713226000,\n" + - " \"hint\": \"dataManagementPlanListingModel\"\n" + - " },\n" + - " \"datasetProfileDefinition\": {\n" + - " \"pages\": [...],\n" + - " \"rules\": [...],\n" + - " \"status\": 0\n" + - " },\n" + - " \"registries\": [],\n" + - " \"services\": [],\n" + - " \"dataRepositories\": [],\n" + - " \"tags\": null,\n" + - " \"externalDatasets\": [],\n" + - " \"profile\": {\n" + - " \"id\": \"771283d7-a5be-4a93-bd3c-8b1883fe837c\",\n" + - " \"label\": \"Horizon Europe\",\n" + - " \"hint\": null\n" + - " },\n" + - " \"modifiedAt\": 1662712928000,\n" + - " \"hint\": \"datasetOverviewModel\"\n" + - " }\n" + - "}"; - - @Autowired - public PublicDatasetsDescriptionDocumentation(ApiContext apiContext, DatasetPublicManager datasetManager) { - super(apiContext); - this.datasetManager = datasetManager; - } - - @Operation(summary = "This method is used to get a listing of public datasets.", description = getPagedNotes) - @io.swagger.v3.oas.annotations.responses.ApiResponses(value = {@io.swagger.v3.oas.annotations.responses.ApiResponse( - responseCode = "200", - description = "The following example is generated using body: *{\"criteria\": {},\"length\": 2,\"offset\": 0,\"orderings\": {\"fields\": []} }*", - content = @Content(mediaType = APPLICATION_JSON_VALUE, examples = {@ExampleObject( - value = getPagedResponseExample - )}) - )}) - @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity>> getPaged(@Valid @RequestBody @io.swagger.v3.oas.annotations.parameters.RequestBody(description = getPagedRequestBodyDescription) DatasetPublicTableRequest datasetTableRequest) throws Exception { - DataTableData dataTable = this.datasetManager.getPublicPaged(datasetTableRequest); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable)); - } - - @Operation(summary = "This method is used to get the overview of a public dataset.", description = getOverviewSinglePublicNotes) - @io.swagger.v3.oas.annotations.responses.ApiResponses(value = {@ApiResponse( - responseCode = "200", - description = "The following example is generated using id: *ef7dfbdc-c5c1-46a7-a37b-c8d8692f1c0e*", - content = @Content(mediaType = APPLICATION_JSON_VALUE, examples = {@ExampleObject( - value = getOverviewSinglePublicResponseExample - )}) - )}) - @RequestMapping(method = RequestMethod.GET, value = {"/{id}"}, produces = "application/json") - public @ResponseBody - ResponseEntity> getOverviewSinglePublic(@PathVariable @Parameter(description = "fetch the dataset with the given id", example = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") String id) throws Exception { -// try { - DatasetPublicModel dataset = this.datasetManager.getOverviewSinglePublic(id); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(dataset)); -// } catch (Exception ex) { -// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).message(ex.getMessage())); -// } - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/controllers/PublicDmpsDocumentation.java b/dmp-backend/web/src/main/java/eu/eudat/publicapi/controllers/PublicDmpsDocumentation.java deleted file mode 100644 index 2808eecbe..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/controllers/PublicDmpsDocumentation.java +++ /dev/null @@ -1,300 +0,0 @@ -package eu.eudat.publicapi.controllers; - -import eu.eudat.controllers.BaseController; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.models.data.helpers.common.DataTableData; -import eu.eudat.models.data.helpers.responses.ResponseItem; -import eu.eudat.publicapi.managers.DataManagementPlanPublicManager; -import eu.eudat.publicapi.models.listingmodels.DataManagementPlanPublicListingModel; -import eu.eudat.publicapi.models.overviewmodels.DataManagementPlanPublicModel; -import eu.eudat.publicapi.request.dmp.DataManagmentPlanPublicTableRequest; -import eu.eudat.types.ApiMessageCode; -import io.swagger.annotations.*; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; - -@Tag(name = "DMPs", description = "Provides DMP public API's.") -@RestController -@CrossOrigin -@RequestMapping(value = {"/api/public/dmps"}) -public class PublicDmpsDocumentation extends BaseController { - - private static final Logger logger = LoggerFactory.getLogger(PublicDmpsDocumentation.class); - - private DataManagementPlanPublicManager dataManagementPlanManager; - - private static final String getPagedNotes = "The json response is of type **ResponseItem>** containing the following properties:\n" + - "
            " + - "
          1. message: string, message indicating error, null if everything went well
          2. " + - "
          3. statusCode: integer, status code indicating if something unexpected happened, otherwise 0
          4. " + - "
          5. responseType: integer, 0 for json, 1 for file
          6. " + - "
          7. payload: DataTableData, containing the number of values of actual data returned and the data of type DataManagementPlanPublicListingModel
          8. " + - "
              " + - "
            1. id: string, id of dmp returned
            2. " + - "
            3. label: string, label of dmp
            4. " + - "
            5. grant: string, grant of dmp
            6. " + - "
            7. createdAt: date, creation time of dmp
            8. " + - "
            9. modifiedAt: date, modification time of dmp
            10. " + - "
            11. version: integer, version of dmp
            12. " + - "
            13. groupId: uuid, group id in which dmp belongs
            14. " + - "
            15. users: list of UserInfoPublicModel, user who collaborated on the dmp
            16. " + - "
            17. researchers: list of ResearcherPublicModel, researchers involved in the dmp
            18. " + - "
            19. finalizedAt: date, finalization date
            20. " + - "
            21. publishedAt: date, publication date
            22. " + - "
            " + - "
          "; - private static final String getPagedResponseExample = "{\n" + - " \"statusCode\": 0,\n" + - " \"responseType\": 0,\n" + - " \"message\": null,\n" + - " \"payload\": {\n" + - " \"totalCount\": 2,\n" + - " \"data\": [\n" + - " {\n" + - " \"id\": \"e9a73d77-adfa-4546-974f-4a4a623b53a8\",\n" + - " \"label\": \"Giorgos's DMP\",\n" + - " \"grant\": \"Novel EOSC services for Emerging Atmosphere, Underwater and Space Challenges\",\n" + - " \"createdAt\": 1579077317000,\n" + - " \"modifiedAt\": 1586444334000,\n" + - " \"version\": 0,\n" + - " \"groupId\": \"d949592d-f862-4b31-a43a-f5f70596df5e\",\n" + - " \"users\": [],\n" + - " \"finalizedAt\": 1586444334000,\n" + - " \"publishedAt\": 1586444334000,\n" + - " \"hint\": \"dataManagementPlanListingModel\"\n" + - " },\n" + - " {\n" + - " \"id\": \"e27789f1-de35-4b4a-9587-a46d131c366e\",\n" + - " \"label\": \"TestH2020Clone3\",\n" + - " \"grant\": \"Evaluation of the Benefits of innovative Concepts of laminar nacelle and HTP installed on a business jet configuration\",\n" + - " \"createdAt\": 1600774437000,\n" + - " \"modifiedAt\": 1600879107000,\n" + - " \"version\": 0,\n" + - " \"groupId\": \"7b793c17-cb69-41d2-a97d-e8d1b03ddbed\",\n" + - " \"users\": [],\n" + - " \"finalizedAt\": 1600879107000,\n" + - " \"publishedAt\": 1600879107000,\n" + - " \"hint\": \"dataManagementPlanListingModel\"\n" + - " }\n" + - " ]\n" + - " }\n" + - "}"; - private static final String getPagedRequestBodyDescription = "The dmpTableRequest is a DataManagementPlanPublicTableRequest object with the following fields:\n" + - "
            " + - "
          • length: how many dmps should be fetched (required)
          • " + - "
          • offset: offset of the returned dmps, first time should be 0, then offset += length
          • " + - "
          • orderings: array of strings specifying the order, format:= +string or -string or asc or desc.
          • " + - "+ means ascending order. - means descending order.
                Available strings are: 1) status, 2) label, 3) publishedAt, 4) created.
            " + - "    asc equivalent to +label.
                desc equivalent to -label.
            " + - "
          • criteria: this is DataManagementPlanPublicCriteria object which applies filters for the dmp returned. More specifically:
          • " + - "
              " + - "
            1. periodStart: date, dmps created date greater than periodStart
            2. " + - "
            3. periodEnd: date, dmps created date less than periodEnd
            4. " + - "
            5. grants: list of uuids, dmps with the corresponding grants
            6. " + - "
            7. grantsLike: list of strings, dmps fetched having their grant matching any of the strings provided
            8. " + - "
            9. funders: list of uuids, dmps with the corresponding funders
            10. " + - "
            11. fundersLike: list of strings, dmps fetched having their funders matching any of the strings provided
            12. " + - "
            13. datasetTemplates: list of uuids, dataset templates which are described in the dmps
            14. " + - "
            15. dmpOrganisations: list of strings, dmps belonging to these organisations
            16. " + - "
            17. collaborators: list of uuids, user who collaborated on the creation/modification of dmps
            18. " + - "
            19. collaboratorsLike: list of strings, dmps fetched having their collaborators matching any of the strings provided
            20. " + - "
            21. allVersions: boolean, if dmps should be fetched with all their versions
            22. " + - "
            23. groupIds: list of uuids, in which groups the dmps are
            24. " + - "
            25. like: string, dmps fetched have this string matched in their label or description
            26. " + - "
            " + - "
              "; - private static final String getPagedRequestParamDescription = "The fieldsGroup is a string which indicates if the returned objects would have all their properties\n" + - "There are two available values: 1) listing and 2) autocomplete\n" + - "
                " + - "
              • listing: returns objects with all their properties completed
              • " + - "
              • autocomplete: returns objects with only id, label, groupId and creationTime assigned
              • " + - "
                  "; - - private static final String getOverviewSinglePublicNotes = "The json response is of type **ResponseItem< DataManagementPlanPublicModel >** containing the following properties:\n" + - "
                    " + - "
                  1. message: string, message indicating error, null if everything went well
                  2. " + - "
                  3. statusCode: integer, status code indicating if something unexpected happened, otherwise 0
                  4. " + - "
                  5. responseType: integer, 0 for json, 1 for file
                  6. " + - "
                  7. payload: DataManagementPlanPublicModel, dmp returned
                  8. " + - "
                      " + - "
                    1. id: string, id of dmp returned
                    2. " + - "
                    3. label: string, label of dmp
                    4. " + - "
                    5. profile: string, profile of dmp
                    6. " + - "
                    7. grant: GrantPublicOverviewModel, grant of dmp
                    8. " + - "
                    9. createdAt: date, creation time of dmp
                    10. " + - "
                    11. modifiedAt: date, modification time of dmp
                    12. " + - "
                    13. finalizedAt: date, finalization date of dmp
                    14. " + - "
                    15. organisations: list of OrganizationPublicModel, organizations in which dmp belongs
                    16. " + - "
                    17. version: integer, version of dmp
                    18. " + - "
                    19. groupId: uuid, group id in which dmp belongs
                    20. " + - "
                    21. datasets: list of DatasetPublicModel, contained datasets
                    22. " + - "
                    23. associatedProfiles: list of AssociatedProfilePublicModel, associated profiles of dmp
                    24. " + - "
                    25. researchers: list of ResearcherPublicModel, researchers involved in dmp
                    26. " + - "
                    27. users: list of UserInfoPublicModel, user who collaborated on the dmp
                    28. " + - "
                    29. description: string, description of dmp
                    30. " + - "
                    31. publishedAt: date, publication date
                    32. " + - "
                    33. doi: string, if dmp has been published to zenodo so it has doi
                    34. " + - "
                    " + - "
                  "; - private static final String getOverviewSinglePublicResponseExample = "{\n" + - " \"statusCode\": 0,\n" + - " \"responseType\": 0,\n" + - " \"message\": null,\n" + - " \"payload\": {\n" + - " \"id\": \"e9a73d77-adfa-4546-974f-4a4a623b53a8\",\n" + - " \"label\": \"Giorgos's DMP\",\n" + - " \"profile\": null,\n" + - " \"grant\": {\n" + - " \"id\": \"c8309ae5-4e56-43eb-aa5a-9950c24051fe\",\n" + - " \"label\": \"Novel EOSC services for Emerging Atmosphere, Underwater and Space Challenges\",\n" + - " \"abbreviation\": null,\n" + - " \"description\": null,\n" + - " \"startDate\": null,\n" + - " \"endDate\": null,\n" + - " \"uri\": null,\n" + - " \"funder\": {\n" + - " \"id\": \"25e76828-3539-4c66-9870-0ecea7a4d16e\",\n" + - " \"label\": \"European Commission||EC\",\n" + - " \"hint\": null\n" + - " },\n" + - " \"hint\": null\n" + - " },\n" + - " \"createdAt\": 1579077317000,\n" + - " \"modifiedAt\": 1586444334000,\n" + - " \"finalizedAt\": 1586444334000,\n" + - " \"organisations\": [],\n" + - " \"version\": 0,\n" + - " \"groupId\": \"d949592d-f862-4b31-a43a-f5f70596df5e\",\n" + - " \"datasets\": [\n" + - " {\n" + - " \"id\": \"853a24c3-def4-4978-985f-92e7fa57ef22\",\n" + - " \"label\": \"Giorgos's Dataset Desc\",\n" + - " \"reference\": null,\n" + - " \"uri\": null,\n" + - " \"description\": null,\n" + - " \"status\": 1,\n" + - " \"createdAt\": 1579077532000,\n" + - " \"dmp\": {\n" + - " \"id\": \"e9a73d77-adfa-4546-974f-4a4a623b53a8\",\n" + - " \"label\": \"Giorgos's DMP\",\n" + - " \"grant\": \"Novel EOSC services for Emerging Atmosphere, Underwater and Space Challenges\",\n" + - " \"createdAt\": 1579077317000,\n" + - " \"modifiedAt\": 1586444334000,\n" + - " \"version\": 0,\n" + - " \"groupId\": \"d949592d-f862-4b31-a43a-f5f70596df5e\",\n" + - " \"users\": [\n" + - " {\n" + - " \"id\": \"00476b4d-0491-44ca-b2fd-92e695062a48\",\n" + - " \"name\": \"OpenDMP OpenDMP\",\n" + - " \"role\": 0,\n" + - " \"email\": \"opendmpeu@gmail.com\",\n" + - " \"hint\": \"UserInfoListingModel\"\n" + - " }\n" + - " ],\n" + - " \"finalizedAt\": 1586444334000,\n" + - " \"publishedAt\": 1586444334000,\n" + - " \"hint\": \"dataManagementPlanListingModel\"\n" + - " },\n" + - " \"datasetProfileDefinition\": {\n" + - " \"pages\": [...],\n" + - " \"rules\": [...],\n" + - " \"status\": 0\n" + - " },\n" + - " \"registries\": [],\n" + - " \"services\": [],\n" + - " \"dataRepositories\": [],\n" + - " \"tags\": null,\n" + - " \"externalDatasets\": [],\n" + - " \"profile\": {\n" + - " \"id\": \"2a6e0835-349e-412c-9fcc-8e1298ce8a5a\",\n" + - " \"label\": \"Horizon 2020\",\n" + - " \"hint\": null\n" + - " },\n" + - " \"modifiedAt\": 1579077898000,\n" + - " \"hint\": \"datasetOverviewModel\"\n" + - " }\n" + - " ],\n" + - " \"associatedProfiles\": [\n" + - " {\n" + - " \"id\": \"f41bd794-761d-4fe8-ab67-3a989d982c53\",\n" + - " \"label\": \"Swedish Research Council\"\n" + - " },\n" + - " {\n" + - " \"id\": \"2a6e0835-349e-412c-9fcc-8e1298ce8a5a\",\n" + - " \"label\": \"Horizon 2020\"\n" + - " }\n" + - " ],\n" + - " \"researchers\": [],\n" + - " \"users\": [\n" + - " {\n" + - " \"id\": \"00476b4d-0491-44ca-b2fd-92e695062a48\",\n" + - " \"name\": \"OpenDMP OpenDMP\",\n" + - " \"role\": 0,\n" + - " \"email\": \"opendmpeu@gmail.com\",\n" + - " \"hint\": \"UserInfoListingModel\"\n" + - " }\n" + - " ],\n" + - " \"description\": null,\n" + - " \"publishedAt\": 1586444334000,\n" + - " \"doi\": \"10.5072/zenodo.522151\",\n" + - " \"hint\": \"dataManagementPlanOverviewModel\"\n" + - " }\n" + - "}"; - - @Autowired - public PublicDmpsDocumentation(ApiContext apiContext, DataManagementPlanPublicManager dataManagementPlanManager) { - super(apiContext); - this.dataManagementPlanManager = dataManagementPlanManager; - } - - @Operation(summary = "This method is used to get a listing of public dmps.", description = getPagedNotes) - @io.swagger.v3.oas.annotations.responses.ApiResponses(value = {@ApiResponse( - responseCode = "200", - description = "The following example is generated using:\n" + - "a) body: *{\"criteria\": {},\"length\": 2,\"offset\": 0,\"orderings\": {\"fields\": []} }*\n" + - "b) fieldsGroup: listing", - content = @Content(mediaType = APPLICATION_JSON_VALUE, examples = {@ExampleObject( - value = getPagedResponseExample - )}) - )}) - @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json") - public @ResponseBody - ResponseEntity>> getPaged(@Valid @RequestBody @io.swagger.v3.oas.annotations.parameters.RequestBody(description = getPagedRequestBodyDescription) DataManagmentPlanPublicTableRequest dmpTableRequest, - @RequestParam @Parameter(description = getPagedRequestParamDescription, example = "listing") String fieldsGroup) throws Exception { - DataTableData dataTable = this.dataManagementPlanManager.getPublicPaged(dmpTableRequest, fieldsGroup); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable)); - } - - @Operation(summary = "This method is used to get the overview of a public dmp.", description = getOverviewSinglePublicNotes) - @io.swagger.v3.oas.annotations.responses.ApiResponses(value = {@ApiResponse( - responseCode = "200", - description = "The following example is generated using id: *e9a73d77-adfa-4546-974f-4a4a623b53a8*", - content = @Content(mediaType = APPLICATION_JSON_VALUE, examples = {@ExampleObject( - value = getOverviewSinglePublicResponseExample - )}) - )}) - @RequestMapping(method = RequestMethod.GET, value = {"/{id}"}, produces = "application/json") - public @ResponseBody - ResponseEntity> getOverviewSinglePublic(@PathVariable @Parameter(description = "fetch the dmp with the given id", example = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") String id) throws Exception { -// try { - DataManagementPlanPublicModel dataManagementPlan = this.dataManagementPlanManager.getOverviewSinglePublic(id); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlan)); -// } catch (Exception ex) { -// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).message(ex.getMessage())); -// } - } - -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/managers/DatasetPublicManager.java b/dmp-backend/web/src/main/java/eu/eudat/publicapi/managers/DatasetPublicManager.java deleted file mode 100644 index 5c97c0ef1..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/managers/DatasetPublicManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package eu.eudat.publicapi.managers; - -import eu.eudat.commons.enums.DescriptionStatus; -import eu.eudat.commons.enums.IsActive; -import eu.eudat.commons.types.descriptiontemplate.DefinitionEntity; -import eu.eudat.data.DescriptionEntity; -import eu.eudat.data.DescriptionTemplateEntity; -import eu.eudat.data.query.definition.helpers.ColumnOrderings; -import eu.eudat.logic.managers.PaginationManager; -import eu.eudat.logic.services.ApiContext; -import eu.eudat.logic.services.operations.DatabaseRepository; -import eu.eudat.commons.types.xml.XmlBuilder; -import eu.eudat.models.HintedModelFactory; -import eu.eudat.models.data.helpers.common.DataTableData; -import eu.eudat.models.data.user.composite.PagedDatasetProfile; -import eu.eudat.publicapi.models.listingmodels.DatasetPublicListingModel; -import eu.eudat.publicapi.models.overviewmodels.DatasetPublicModel; -import eu.eudat.queryable.QueryableList; -import eu.eudat.types.grant.GrantStateType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import jakarta.transaction.Transactional; -import java.util.*; -import java.util.stream.Collectors; - -@Component -public class DatasetPublicManager { - private static final Logger logger = LoggerFactory.getLogger(DatasetPublicManager.class); - - private DatabaseRepository databaseRepository; -// private DatasetRepository datasetRepository; - - @Autowired - public DatasetPublicManager(ApiContext apiContext){ - this.databaseRepository = apiContext.getOperationsContext().getDatabaseRepository(); -// this.datasetRepository = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository(); - } - - public DataTableData getPublicPaged(eu.eudat.publicapi.request.dataset.DatasetPublicTableRequest datasetTableRequest) throws Exception { - Long count = 0L; -// DatasetCriteria datasetCriteria = new DatasetCriteria(); -// datasetCriteria.setPublic(true); -// datasetCriteria.setLike(datasetTableRequest.getCriteria().getLike()); -// datasetCriteria.setDatasetTemplates(datasetTableRequest.getCriteria().getDatasetTemplates()); -// datasetCriteria.setDmps(datasetTableRequest.getCriteria().getDmpIds()); -// datasetCriteria.setGrants(datasetTableRequest.getCriteria().getGrants()); -// datasetCriteria.setCollaborators(datasetTableRequest.getCriteria().getCollaborators()); -// datasetCriteria.setAllowAllVersions(datasetTableRequest.getCriteria().getAllVersions()); -// datasetCriteria.setOrganiztions(datasetTableRequest.getCriteria().getDmpOrganisations()); -// if(datasetTableRequest.getCriteria().getTags() != null && !datasetTableRequest.getCriteria().getTags().isEmpty()){ -// datasetCriteria.setHasTags(true); -// datasetCriteria.setTags(datasetTableRequest.getCriteria().getTags()); -// } -// datasetCriteria.setGroupIds(datasetTableRequest.getCriteria().getGroupIds()); -// datasetCriteria.setGrantStatus(GrantStateType.ONGOING.getValue().shortValue()); // grant status ongoing -// datasetCriteria.setStatus(DescriptionStatus.Finalized.getValue()); // dataset status finalized -// if (datasetTableRequest.getOrderings() != null) { -// datasetCriteria.setSortCriteria(DmpPublicCriteriaMapper.toElasticSorting(datasetTableRequest.getOrderings())); -// } -// datasetCriteria.setOffset(datasetTableRequest.getOffset()); -// datasetCriteria.setSize(datasetTableRequest.getLength()); -// List datasets; -// try { -//// datasets = datasetRepository.exists() ? -//// datasetRepository.queryIds(datasetCriteria) : new LinkedList<>(); -// if(datasetTableRequest.getCriteria().getPeriodStart() != null) -// datasets = datasets.stream().filter(dataset -> dataset.getCreated().after(datasetTableRequest.getCriteria().getPeriodStart())).collect(Collectors.toList()); -// if(datasetTableRequest.getCriteria().getPeriodEnd() != null) -// datasets = datasets.stream().filter(dataset -> dataset.getCreated().before(datasetTableRequest.getCriteria().getPeriodEnd())).collect(Collectors.toList()); -// count = (long) datasets.size(); -// } catch (Exception ex) { -// logger.warn(ex.getMessage()); -// datasets = null; -// } - /*datasetTableRequest.setQuery(databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetPublicListingModel.class))); - QueryableList items = datasetTableRequest.applyCriteria();*/ - datasetTableRequest.setQuery(databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetPublicListingModel.class))); - QueryableList items; -// if (datasets != null) { -// if (!datasets.isEmpty()) { -// items = databaseRepository.getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetPublicListingModel.class)); -// List finalDatasets = datasets; -// items.where((builder, root) -> root.get("id").in(finalDatasets.stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList()))); -// } else -// items = datasetTableRequest.applyCriteria(); -// //items.where((builder, root) -> root.get("id").in(new UUID[]{UUID.randomUUID()})); -// } else { - items = datasetTableRequest.applyCriteria(); -// } - - List strings = new ArrayList<>(); - strings.add("-dmp:publishedAt|join|"); - if(datasetTableRequest.getOrderings() != null) { - datasetTableRequest.getOrderings().setFields(strings); - } - else{ - datasetTableRequest.setOrderings(new ColumnOrderings()); - datasetTableRequest.getOrderings().setFields(strings); - } - if (count == 0L) { - count = items.count(); - } - QueryableList pagedItems = PaginationManager.applyPaging(items, datasetTableRequest); - DataTableData dataTable = new DataTableData<>(); - - List datasetLists = pagedItems. - select(this::mapPublicModel); - - dataTable.setData(datasetLists.stream().filter(Objects::nonNull).collect(Collectors.toList())); - dataTable.setTotalCount(count); - return dataTable; - } - - public DatasetPublicModel getOverviewSinglePublic(String id) throws Exception { - DescriptionEntity descriptionEntityEntity = databaseRepository.getDatasetDao().find(UUID.fromString(id)); - if (descriptionEntityEntity.getIsActive() == IsActive.Inactive) { - throw new Exception("Dataset is deleted."); - } - //TODO -// if (!descriptionEntityEntity.getDmp().isPublic()) { -// throw new ForbiddenException("Selected Dataset is not public"); -// } - DatasetPublicModel dataset = new DatasetPublicModel(); - dataset.setDatasetProfileDefinition(this.getPagedProfile(dataset.getStatus(), descriptionEntityEntity)); - dataset.fromDataModel(descriptionEntityEntity); - - return dataset; - } - - @Transactional - private DatasetPublicListingModel mapPublicModel(DescriptionEntity item) { - /*if (item.getProfile() == null) - return null;*/ - DatasetPublicListingModel listingPublicModel = new DatasetPublicListingModel().fromDataModel(item); - /*DatasetProfileCriteria criteria = new DatasetProfileCriteria(); - criteria.setGroupIds(Collections.singletonList(item.getProfile().getGroupId())); - List profiles = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().getWithCriteria(criteria).toList(); - boolean islast = false; - if (!profiles.isEmpty()) { - profiles = profiles.stream().sorted(Comparator.comparing(DescriptionTemplate::getVersion)).collect(Collectors.toList()); - islast = profiles.get(0).getId().equals(item.getProfile().getId()); - } - listingModel.setProfileLatestVersion(islast);*/ - return listingPublicModel; - } - - private PagedDatasetProfile getPagedProfile(DescriptionStatus status, DescriptionEntity descriptionEntityEntity){ - //TODO -// eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = this.generateDatasetProfileModel(descriptionEntityEntity.getProfile()); -// datasetprofile.setStatus(status.getValue()); -// if (descriptionEntityEntity.getProperties() != null) { -// JSONObject jObject = new JSONObject(descriptionEntityEntity.getProperties()); -// Map properties = jObject.toMap(); -// datasetprofile.fromJsonObject(properties); -// } - PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile(); -// pagedDatasetProfile.buildPagedDatasetProfile(datasetprofile); - return pagedDatasetProfile; - } - - private eu.eudat.models.data.user.composite.DatasetProfile generateDatasetProfileModel(DescriptionTemplateEntity profile) { - Document viewStyleDoc = XmlBuilder.fromXml(profile.getDefinition()); - Element root = (Element) viewStyleDoc.getDocumentElement(); - DefinitionEntity viewstyle = new DefinitionEntity().fromXml(root); - - eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = new eu.eudat.models.data.user.composite.DatasetProfile(); - datasetprofile.buildProfile(viewstyle); - - return datasetprofile; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/listingmodels/DatasetPublicListingModel.java b/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/listingmodels/DatasetPublicListingModel.java deleted file mode 100644 index 98ef1b213..000000000 --- a/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/listingmodels/DatasetPublicListingModel.java +++ /dev/null @@ -1,175 +0,0 @@ -package eu.eudat.publicapi.models.listingmodels; - -import eu.eudat.data.DescriptionEntity; -import eu.eudat.model.DmpUser; -import eu.eudat.models.DataModel; -import eu.eudat.publicapi.models.datasetprofile.DatasetProfilePublicModel; - -import java.util.Date; -import java.util.List; - -public class DatasetPublicListingModel implements DataModel { - private String id; - private String label; - private String grant; - private String dmp; - private String dmpId; - private DatasetProfilePublicModel profile; - private Date createdAt; - private Date modifiedAt; - private String description; - private Date finalizedAt; - private Date dmpPublishedAt; - private int version; - private List users; - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - public String getGrant() { - return grant; - } - public void setGrant(String grant) { - this.grant = grant; - } - - public String getDmp() { - return dmp; - } - public void setDmp(String dmp) { - this.dmp = dmp; - } - - public String getDmpId() { - return dmpId; - } - public void setDmpId(String dmpId) { - this.dmpId = dmpId; - } - - public DatasetProfilePublicModel getProfile() { - return profile; - } - public void setProfile(DatasetProfilePublicModel profile) { - this.profile = profile; - } - - public Date getCreatedAt() { - return createdAt; - } - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public Date getModifiedAt() { - return modifiedAt; - } - public void setModifiedAt(Date modifiedAt) { - this.modifiedAt = modifiedAt; - } - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - public Date getFinalizedAt() { - return finalizedAt; - } - public void setFinalizedAt(Date finalizedAt) { - this.finalizedAt = finalizedAt; - } - - public Date getDmpPublishedAt() { - return dmpPublishedAt; - } - public void setDmpPublishedAt(Date dmpPublishedAt) { - this.dmpPublishedAt = dmpPublishedAt; - } - - public int getVersion() { - return version; - } - public void setVersion(int version) { - this.version = version; - } - - public List getUsers() { - return users; - } - - public void setUsers(List users) { - this.users = users; - } - - @Override - public DatasetPublicListingModel fromDataModel(DescriptionEntity entity) { - //TODO -// this.id = entity.getId() != null ? entity.getId().toString() : ""; -// this.label = entity.getLabel(); -// this.createdAt = entity.getCreated(); -// this.modifiedAt = entity.getModified(); -// if(entity.getDmp() != null && entity.getDmp().getGrant() != null) { -// this.grant = entity.getDmp().getGrant().getLabel(); -// } -// this.dmp = entity.getDmp() != null ? entity.getDmp().getLabel() : ""; -// this.dmpId = entity.getDmp() != null ? entity.getDmp().getId().toString() : ""; -// this.profile = entity.getProfile() != null ? new DatasetProfilePublicModel().fromDataModel(entity.getProfile()) : null; -// this.description = entity.getDescription(); -// if (entity.getFinalizedAt() == null && entity.getStatus() == DescriptionEntity.Status.FINALISED.getValue()) { -// this.finalizedAt = entity.getDmp().getFinalizedAt(); -// } else { -// this.finalizedAt = entity.getFinalizedAt(); -// } -// this.dmpPublishedAt = entity.getDmp().getPublishedAt(); -// this.version = entity.getDmp().getVersion(); -// this.users = entity.getDmp() != null ? entity.getDmp().getUsers().stream().map(x -> new UserInfoPublicModel().fromDataModel(x)).collect(Collectors.toList()) : new ArrayList<>(); - return this; - } - - @Override - public DescriptionEntity toDataModel() { - //TODO - DescriptionEntity entity = new DescriptionEntity(); -// entity.setId(UUID.fromString(this.getId())); -// entity.setLabel(this.getLabel()); -// entity.setCreated(this.getCreatedAt()); -// entity.setModified(this.getModifiedAt()); -// entity.setDescription(this.getDescription()); -// entity.setFinalizedAt(this.getFinalizedAt()); -// entity.setStatus(DescriptionEntity.Status.FINALISED.getValue()); -// DMP dmp = new DMP(); -// if (this.getGrant() != null && !this.getGrant().isEmpty()) { -// Grant grant = new Grant(); -// grant.setLabel(this.getGrant()); -// dmp.setGrant(grant); -// } -// dmp.setLabel(this.getDmp()); -// dmp.setId(UUID.fromString(this.getDmpId())); -// dmp.setPublishedAt(this.getDmpPublishedAt()); -// dmp.setVersion(this.getVersion()); -// dmp.setUsers(this.getUsers().stream().map(UserInfoPublicModel::toDataModel).collect(Collectors.toSet())); -// dmp.setFinalizedAt(this.getFinalizedAt()); -// entity.setDmp(dmp); -// entity.setProfile(this.getProfile() != null ? this.getProfile().toDataModel() : null); - return entity; - } - - @Override - public String getHint() { - return "datasetListingModel"; - } -}