Klasse ProductArchiveManager

java.lang.Object
de.dlr.proseo.archivemgr.rest.ProductArchiveManager

@Component @Transactional public class ProductArchiveManager extends Object
Service methods required to create, modify and delete product archives in the prosEO database, and to query the database about such archives
Autor:
Denys Chaykovskiy
  • Felddetails

  • Konstruktordetails

    • ProductArchiveManager

      public ProductArchiveManager()
  • Methodendetails

    • createArchive

      public RestProductArchive createArchive(RestProductArchive restArchive) throws IllegalArgumentException
      Creation of the product archive
      Parameter:
      restArchive - Rest Product Archive
      Gibt zurück:
      created Rest Product Archive
      Löst aus:
      IllegalArgumentException - if mandatory parameters missed or wrong
    • archiveExistsByCode

      public boolean archiveExistsByCode(String code)
      Checks if archive exists, filtered by code
      Parameter:
      code - code of the archive
      Gibt zurück:
      true if exists
    • archiveExistsById

      public boolean archiveExistsById(Long id)
      Checks if archive exists, filtered by id
      Parameter:
      id - id of the archive
      Gibt zurück:
      true if exists
    • getArchiveByCode

      public RestProductArchive getArchiveByCode(String code)
      Gets a product archive, searched by code
      Parameter:
      code - the code of the product archive
      Gibt zurück:
      product archive
      Löst aus:
      IllegalArgumentException - if no product archive matching the given code could be found
    • getArchivesByCode

      public List<RestProductArchive> getArchivesByCode(String code)
      List of all product archives archives filtered by code
      Parameter:
      code - the code of the product archive
      Gibt zurück:
      a list of product archives, if code == null, returns all archives
      Löst aus:
      javax.persistence.NoResultException - if no product archives matching the given search criteria could be found
    • getArchiveById

      public RestProductArchive getArchiveById(Long id) throws IllegalArgumentException, javax.persistence.NoResultException
      Find the product archive with the given ID
      Parameter:
      id - the ID to look for
      Gibt zurück:
      a Json object corresponding to the product archive found
      Löst aus:
      IllegalArgumentException - if no product archive ID was given
      javax.persistence.NoResultException - if no product archive with the given ID exists
    • createArchivesQuery

      public javax.persistence.Query createArchivesQuery(Long id, String code, String name, String archiveType, Boolean count)
      Create database query to count or get objects
      Parameter:
      code - the archive code
      name - the archive name
      archiveType - the archive type
      count - if true create query for count of objects
      Gibt zurück:
      a database query
    • getArchives

      public List<RestProductArchive> getArchives(Long id, String code, String name, String archiveType, Integer recordFrom, Integer recordTo) throws javax.persistence.NoResultException
      Get product archives by name and archive type
      Parameter:
      code - the archive code
      name - the archive name
      archiveType - the archive type
      recordFrom - first record of filtered and ordered result to return
      recordTo - last record of filtered and ordered result to return
      Gibt zurück:
      a list of Json objects representing product archives satisfying the search criteria
      Löst aus:
      javax.persistence.NoResultException - if no product archives matching the given search criteria could be found
    • countArchives

      public String countArchives(Long id, String code, String name, String archiveType)
      Count the product archives matching the specified name and archive type
      Parameter:
      name - the product archive name
      archiveType - the product archive type
      Gibt zurück:
      the number of product archives found as string
    • modifyArchive

      public RestProductArchive modifyArchive(Long id, RestProductArchive restArchive)
      Update the product archive with the given ID with the attribute values of the given Json object. Unchanged values must be provided, too, or they will be changed to null.
      Parameter:
      id - the ID of the product archive to update
      restArchive - a Json object containing the modified (and unmodified) attributes
      Gibt zurück:
      a Json object corresponding to the product archive after modification (with ID and version for all contained objects)
      Löst aus:
      javax.persistence.EntityNotFoundException - if no product with the given ID exists
      IllegalArgumentException - if any of the input data was invalid
      ConcurrentModificationException - if the facility has been modified since retrieval by the client
    • deleteArchiveById

      public void deleteArchiveById(Long id) throws javax.persistence.EntityNotFoundException, IllegalArgumentException, RuntimeException
      Delete a product archive by ID
      Parameter:
      id - the ID of the product archive to delete
      Löst aus:
      javax.persistence.EntityNotFoundException - if the product archive to delete does not exist in the database
      IllegalArgumentException - if the product archive to delete still has stored products
      RuntimeException - if the deletion was not performed as expected