java.lang.Object
it.uniroma2.art.semanticturkey.services.STServiceAdapter
it.uniroma2.art.semanticturkey.services.core.CustomForms
All Implemented Interfaces:
NewerNewStyleService, STService

@STService public class CustomForms extends STServiceAdapter
  • Constructor Details

    • CustomForms

      public CustomForms()
  • Method Details

    • removeReifiedResource

      @STServiceOperation(method=POST) @Write @PreAuthorize("@auth.isAuthorized(\'rdf(\' +@auth.typeof(#subject)+ \')\', \'D\')") public void removeReifiedResource(@Modified org.eclipse.rdf4j.model.IRI subject, org.eclipse.rdf4j.model.IRI predicate, org.eclipse.rdf4j.model.IRI resource) throws it.uniroma2.art.coda.exception.parserexception.PRParserException
      Removes a reified resource according to the CustomFormGraph that generated it
      Parameters:
      subject -
      predicate -
      resource -
      Throws:
      it.uniroma2.art.coda.exception.parserexception.PRParserException
      it.uniroma2.art.coda.exception.RDFModelNotSetException
    • executeURIConverter

      @STServiceOperation @Read public com.fasterxml.jackson.databind.JsonNode executeURIConverter(String converter, @Optional String value) throws it.uniroma2.art.coda.provisioning.ComponentProvisioningException, it.uniroma2.art.coda.exception.ConverterException
      Throws:
      it.uniroma2.art.coda.provisioning.ComponentProvisioningException
      it.uniroma2.art.coda.exception.ConverterException
    • executeLiteralConverter

      @STServiceOperation @Read public com.fasterxml.jackson.databind.JsonNode executeLiteralConverter(String converter, String value, @Optional String datatype, @Optional String lang) throws it.uniroma2.art.coda.provisioning.ComponentProvisioningException, it.uniroma2.art.coda.exception.ConverterException
      Throws:
      it.uniroma2.art.coda.provisioning.ComponentProvisioningException
      it.uniroma2.art.coda.exception.ConverterException
    • getFormCollection

      @STServiceOperation @Read @PreAuthorize("@auth.isAuthorized(\'cform(formCollection, form)\', \'R\')") public com.fasterxml.jackson.databind.JsonNode getFormCollection(String id) throws CustomFormException
      Returns the serialization of the FormCollection with the given id This serialization doesn't contain the effective forms, it contains just the id(s) of the forms.
      Parameters:
      id -
      Returns:
      Throws:
      CustomFormException
    • getAllFormCollections

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(formCollection, form)\', \'R\')") public com.fasterxml.jackson.databind.JsonNode getAllFormCollections()
      Returns all the FormCollections IDs available at system and (current) project level
      Returns:
    • createFormCollection

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(formCollection, form)\', \'C\')") public void createFormCollection(String id) throws DuplicateIdException
      Creates an empty FormCollection (without CustomForms related)
      Parameters:
      id -
      Throws:
      DuplicateIdException
    • cloneFormCollection

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(formCollection, form)\', \'C\')") public void cloneFormCollection(String sourceId, String targetId) throws CustomFormException
      Creates a new FormCollection cloning an existing one
      Parameters:
      sourceId - id of the FC to clone
      targetId - id of the FC to create
      Throws:
      CustomFormException
    • exportFormCollection

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(formCollection, form)\', \'R\')") public void exportFormCollection(jakarta.servlet.http.HttpServletResponse oRes, String id) throws CustomFormException, IOException
      Exports the FormCollection with the given id
      Parameters:
      oRes -
      id -
      Throws:
      CustomFormException
      IOException
    • importFormCollection

      @STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'cform(formCollection, form)\', \'C\')") public void importFormCollection(org.springframework.web.multipart.MultipartFile inputFile, @Optional String newId) throws IOException, CustomFormException
      Imports a FormCollection
      Parameters:
      newId - id of the new FormCollection that will be created. If not provided, the created FC will have the same ID of the loaded FC
      Throws:
      IOException
      CustomFormException
    • deleteFormCollection

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(formCollection, form)\', \'D\')") public void deleteFormCollection(String id) throws CustomFormException
      Deletes the FormCollection with the given id
      Parameters:
      id -
      Throws:
      CustomFormException
    • updateFromCollection

      @STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'cform(formCollection, form)\', \'U\')") public void updateFromCollection(String formCollectionId, List<String> customFormIds, List<org.eclipse.rdf4j.model.IRI> suggestions) throws CustomFormException
      Removes a CustomForm from an existing FormCollection
      Parameters:
      formCollectionId -
      customFormIds -
      suggestions -
      Throws:
      CustomFormException
    • getAllCustomForms

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(form)\', \'R\')") public com.fasterxml.jackson.databind.JsonNode getAllCustomForms()
      Returns all the CustomForms available
      Returns:
    • getCustomConstructors

      @STServiceOperation public com.fasterxml.jackson.databind.JsonNode getCustomConstructors(org.eclipse.rdf4j.model.IRI resource)
      Returns the FormCollection (with available CustomForms to use as constructor) linked to the given resource. This method doesn't check if the resource is a class or a property (it wouldn't have sense to use it with properties since Properties.getRange() already list the CF to use for custom ranges).
      Parameters:
      resource -
      Returns:
      Throws:
      CustomFormException
    • getCustomForm

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(form)\', \'R\')") public com.fasterxml.jackson.databind.JsonNode getCustomForm(String id) throws CustomFormException
      Returns the serialization of the CustomForm with the given id
      Parameters:
      id -
      Returns:
      Throws:
      CustomFormException
    • getCustomFormRepresentation

      @STServiceOperation @Read public com.fasterxml.jackson.databind.JsonNode getCustomFormRepresentation(String id) throws it.uniroma2.art.coda.exception.parserexception.PRParserException, it.uniroma2.art.coda.exception.RDFModelNotSetException, CustomFormException
      Returns a serialization representing the form of the CustomForm with the given id
      Parameters:
      id -
      Returns:
      Throws:
      it.uniroma2.art.coda.exception.parserexception.PRParserException
      it.uniroma2.art.coda.exception.RDFModelNotSetException
      CustomFormException
    • createCustomForm

      @STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'cform(form)\', \'C\')") public void createCustomForm(String type, String id, String name, String description, String ref) throws DuplicateIdException
      This service is thought to create a custom form from client. To be useful is necessary a proper UI for client support (e.g. a wizard) This is a POST because ref and description could be quite long for a GET parameter
      Parameters:
      type -
      id -
      name -
      description -
      ref -
      Throws:
      DuplicateIdException
    • cloneCustomForm

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(form)\', \'C\')") public void cloneCustomForm(String sourceId, String targetId) throws CustomFormException
      Creates a new CustomForm cloning an existing one
      Parameters:
      sourceId - id of the CF to clone
      targetId - id of the CF to create
      Throws:
      CustomFormException
    • exportCustomForm

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(form)\', \'R\')") public void exportCustomForm(jakarta.servlet.http.HttpServletResponse oRes, String id) throws CustomFormException, IOException
      Exports the CustomForm with the given id
      Parameters:
      oRes -
      id -
      Throws:
      CustomFormException
      IOException
    • importCustomForm

      @STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'cform(form)\', \'C\')") public void importCustomForm(org.springframework.web.multipart.MultipartFile inputFile, @Optional String newId) throws IOException, CustomFormException
      Imports a CustomForm
      Parameters:
      newId - id of the new CustomForm that will be created. If not provided, the created CF will have the same ID of the loaded CF
      Throws:
      IOException
      CustomFormException
    • deleteCustomForm

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(form)\', \'D\')") public void deleteCustomForm(String id, @Optional(defaultValue="false") boolean deleteEmptyColl) throws CustomFormException
      Deletes the CustomForm with the given id. Removes also the CustomForm from the FormCollection(s) that contain it.
      Parameters:
      id -
      deleteEmptyColl - if true deletes FormCollection that are left empty after the deletion
      Throws:
      CustomFormException
    • isFormLinkedToCollection

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(formCollection, form)\', \'R\')") public com.fasterxml.jackson.databind.JsonNode isFormLinkedToCollection(String id)
      Given the id of a CustomForm tells if it belong to a FormCollection. Useful as pre-check when it's deleting a CustomForm
      Parameters:
      id -
      Returns:
    • updateCustomForm

      @STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'cform(form)\', \'U\')") public void updateCustomForm(String id, String name, String description, String ref) throws CustomFormException
      Updates a CustomForm. Allows to change the name, the description, the ref and eventually (if the CustomForm is graph) the showProp of the CustomForm with the given id. It doesn't allow to change the type.
      Parameters:
      id -
      name -
      description -
      ref -
      Throws:
      CustomFormException
    • validatePearl

      @STServiceOperation(method=POST) @Read public com.fasterxml.jackson.databind.JsonNode validatePearl(String pearl, String formType)
      Tries to validate a pearl code.
      Parameters:
      pearl - rule to be parsed, it should be a whole pearl rule if the CustomForm is type graph or a converter if type node
      formType - tells if the CF is type "node" or "graph". Determines also the nature of the pearl parameter
      Returns:
      Throws:
      it.uniroma2.art.coda.exception.RDFModelNotSetException
      CustomFormException
    • getCustomFormConfigMap

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(form, mapping)\', \'R\')") public com.fasterxml.jackson.databind.JsonNode getCustomFormConfigMap()
      Returns all the resource-FormCollections mapping defined in the CustomForm configuration of the project
      Returns:
    • addFormsMapping

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(form, mapping)\', \'C\')") public void addFormsMapping(org.eclipse.rdf4j.model.IRI resource, String formCollId, @Optional(defaultValue="false") boolean replace) throws CustomFormException
      Adds a FormCollection to a resource, creating a FormsMapping
      Parameters:
      resource -
      formCollId -
      replace -
      Throws:
      CustomFormException
    • removeFormCollectionOfResource

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(form, mapping)\', \'D\')") public void removeFormCollectionOfResource(org.eclipse.rdf4j.model.IRI resource)
      Remove the mapping between the given resource and the FormCollection linked to it
      Parameters:
      resource -
      Throws:
      CustomFormException
    • updateReplace

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(formCollection, form)\', \'U\')") public void updateReplace(org.eclipse.rdf4j.model.IRI resource, boolean replace) throws CustomFormException
      Update the replace attribute of a FormCollectionMapping mapping for the given property
      Parameters:
      resource -
      replace -
      Throws:
      CustomFormException
    • getBrokenCustomForms

      @STServiceOperation @PreAuthorize("@auth.isAuthorized(\'cform(form)\', \'R\')") public com.fasterxml.jackson.databind.JsonNode getBrokenCustomForms()
    • updateCustomFormWithAnnotations

      @STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'cform(form)\', \'U\')") @Read public com.fasterxml.jackson.databind.JsonNode updateCustomFormWithAnnotations(String cfId, @Optional String prId, @Optional(defaultValue="true") boolean save) throws CustomFormException, it.uniroma2.art.coda.exception.parserexception.PRParserException, IOException, it.uniroma2.art.coda.provisioning.ComponentIndexingException
      Update the PEARL part of a Custom Form according to some inferences by adding the needed annotations
      Parameters:
      cfId - the id of the Custom Form tu update
      prId - the Optional Id of the Projection Rule in the Custom Form to update. If no id is specified, then all Projection Rules are analyzed
      save - set to true to save the updated PEARL in the desired Custom Form
      Returns:
      Throws:
      CustomFormException
      it.uniroma2.art.coda.exception.parserexception.PRParserException
      IOException
      it.uniroma2.art.coda.provisioning.ComponentIndexingException
    • inferPearlAnnotations

      @STServiceOperation(method=POST) @Read public String inferPearlAnnotations(String cfPearl) throws it.uniroma2.art.coda.exception.parserexception.PRParserException, IOException, it.uniroma2.art.coda.provisioning.ComponentIndexingException
      Enrich the PEARL according to some inferences by adding the needed annotations
      Parameters:
      cfPearl - the PEARL text to enrich
      Returns:
      Throws:
      it.uniroma2.art.coda.exception.parserexception.PRParserException
      IOException
      it.uniroma2.art.coda.provisioning.ComponentIndexingException