{
  "_id" : "profiledConcessioni",
  "_version" : "1.0.0",
  "_name" : "Concessione",

  "_schema" : {
    "abstractRelazione" : { "_min" : 1,
      "_children" : [
        {"filesetIta" :{"_type" : "RegisteredFileSet", "_min": 1}},
        {"filesetEng" :{"_type" : "RegisteredFileSet"}},
        {"title" : {"_min" : 1}}
      ]
    },
    "relazioneScavo" : { "_max" : 1, "_min" : 1,
      "_children" : [
        {"fileset" :{"_type" : "RegisteredFileSet", "_min": 1}},
        {"title" : {"_min" : 1}}
      ]
    },
    "immaginiRappresentative" : {
      "_max" : 8,
      "_children" : [
        {"fileset" :{"_type" : "RegisteredFileSet","_min": 1}},
        {"title" : {"_min" : 1}}
      ]
    },
    "posizionamentoScavo" : { "_max" : 1, "_min" : 1,
      "_children" : [
        {"fileset" :{"_type" : "RegisteredFileSet","_min": 1}},
        {"title" : {"_min" : 1}}
      ]
    },
    "pianteFineScavo" : { "_max" : -1,
      "_children" : [
        {"fileset" :{"_type" : "RegisteredFileSet","_min": 1}},
        {"title" : {"_min" : 1}}
      ]
    }
  },


  "_description" : "Embedded profile for concessioni [mibac] management",
  "_creationInfo": {
    "_user" : {
      "_username": "fabio.sinibaldi"
    }
  },

  "_data_access_policy" : [
    {"_policy" : {"_read" : "own", "_write" : "own"}, "_roles":[]},
    {"_policy" : {"_read" : "any", "_write" : "none"}, "_roles":["Guest"],
      "_enforcer": {"_filter" :  {"_lifecycleInformation._phase" :  {"$eq" :  "Published"}}}},
    {"_policy" : {"_read" : "any", "_write" : "none"}, "_roles":["Admin"]},
    {"_policy" : {"_read" : "any", "_write" : "any"}, "_roles":["Data-Manager"]}
  ],

  "_handlers" : [
    {
      "_id" :  "GNA-CONCESSIONI-LC",
      "_type" :  "LifecycleManagement",
      "_configuration" : {
        "step_access" : [
          {"STEP" : "PUBLISH", "roles" :[ "DataManager"]}
        ]
      }
    },

    {
      "_id" :  "SDI-Default-Materializer",
      "_type" :  "Materializer",
      "_configuration" : {
        "registeredFileSetPaths" : [
          {"schemaField" :  "pianteFineScavo","documentPath" :  "pianteFineScavo[*].fileset"},
          {"schemaField" :  "posizionamentoScavo","documentPath" :  "posizionamentoScavo.fileset"}
        ]
      }
    },



    {
      "_id" : "SDI-Indexer-Plugin",
      "_type" : "Indexer",
      "_configuration" : {
        "bboxEvaluation" : ["$..posizionamentoScavo.._bbox"],
        "explicitFieldMapping" : [
          {"name" :  "titolo", "path" :  "$._theDocument.title", "type" : "TEXT"}
        ],
        "jslt" : {},
        "additionalLayers" : [
          {"source" : {"url" :  "..."},"toSetTitle":""}
        ]
      }
    },

    {
      "_id": "org.gcube.portlets.user.geoportal-data-entry-app",
      "_type": "DATA_ENTRY_GUI",
      "_item_type": "Concessione",
      "_configuration": {
        "gcubeProfiles": [
          {
            "gcubeSecondaryType": "GeoNaMetadata",
            "gcubeName": "Informazioni_di_progetto",
            "sectionName": "$.",
            "sectionTitle": "Informazioni di Progetto"
          },
          {
            "gcubeSecondaryType": "GeoNaMetadata",
            "gcubeName": "Abstract_Relazione_di_Scavo",
            "sectionName": "abstractRelazione",
            "sectionTitle": "Abstract Relazione Scavo",
            "parentName": "$.",
            "filePaths": [
              {
                "gcubeProfileFieldName": "Carica Abstract Ita (in PDF)",
                "fieldDefinition": "abstractRelazione.children[?(@.filesetIta)]",
                "fieldName": "filesetIta"
              },
              {
                "gcubeProfileFieldName": "Carica Abstract Eng (in PDF)",
                "fieldDefinition": "abstractRelazione.children[?(@.filesetEng)]",
                "fieldName": "filesetEng"
              }
            ]
          },
          {
            "gcubeSecondaryType": "GeoNaMetadata",
            "gcubeName": "Relazione_di_Scavo",
            "sectionName": "relazioneScavo",
            "sectionTitle": "Relazione di Scavo",
            "parentName": "$.",
            "filePaths": [
              {
                "gcubeProfileFieldName": "Relazione di fine scavo (in PDF)",
                "fieldDefinition": "relazioneScavo.children[?(@.fileset)]",
                "fieldName": "fileset"
              }
            ]
          },
          {
            "gcubeSecondaryType": "GeoNaMetadata",
            "gcubeName": "Immagine_Rappresentativa_di_Scavo",
            "sectionName": "immaginiRappresentative",
            "sectionTitle": "Immagini Rappresentative",
            "minOccurs": 1,
            "maxOccurs": 8,
            "parentName": "$.",
            "filePaths": [
              {
                "gcubeProfileFieldName": "Immagine",
                "fieldDefinition": "immaginiRappresentative.children[?(@.fileset)]",
                "fieldName": "fileset"
              }
            ]
          },
          {
            "gcubeSecondaryType": "GeoNaMetadata",
            "gcubeName": "Posizionamento_dell_area_di_indagine",
            "sectionName": "posizionamentoScavo",
            "sectionTitle": "Posizionamento dell'Area di Indagine",
            "parentName": "$.",
            "filePaths": [
              {
                "gcubeProfileFieldName": "File",
                "fieldDefinition": "posizionamentoScavo.children[?(@.fileset)]",
                "fieldName": "fileset"
              }
            ]
          },
          {
            "gcubeSecondaryType": "GeoNaMetadata",
            "gcubeName": "Pianta_di_fine_Scavo",
            "sectionName": "pianteFineScavo",
            "sectionTitle": "Piante di fine Scavo",
            "parentName": "$.",
            "minOccurs": 0,
            "maxOccurs": 0,
            "filePaths": [
              {
                "gcubeProfileFieldName": "File",
                "fieldDefinition": "pianteFineScavo.children[?(@.fileset)]",
                "fieldName": "fileset"
              }
            ]
          }
        ],
        "saveStep": "SUBMIT-FOR-REVIEW"
      }
    },

    {
      "_id" : "org.gcubegeoportal-data-list",
      "_type" : "DATA_LIST_GUI",
      "_case" : "smallList",
      "_configuration" : {
        "projection" : "{\"nome\" : 1, \"lifecycleInformation.phase\" :  1}",
        "orderPaths":[
          {"label" : "author", "path" : "info.creationInfo.user.username"}],
        "searchPaths":[
          {"label" : "author", "path" : "info.creationInfo.user.username"}],
        "actions" :[
          { "status" : "OK",
            "phase" : "VALIDATE_DRAFT",
            "butoonsDefintion" : [
              {"id" : "report_forward","action" : "STEP", "label" : "Sottometti"},
              {"id" : "list_back_workflow", "action" : "STEP" , "label" : "Rifiuta"},
              {"id" : "report_backward", "action" : "STEP" , "label" : "Rifiuta"}
            ]}
        ],
        "implicit_filter":"{\"nome\" :  {\"$eq\" : \"ciao\" }}"
      }
    }
  ]
}