Class SocialDBDatastaxDriver

  • All Implemented Interfaces:
    SocialDBDriver

    public final class SocialDBDatastaxDriver
    extends Object
    implements SocialDBDriver
    Author:
    Massimiliano Assante ISTI-CNR, Costantino Perciante ISTI-CNR, Ahmed Ibrahim ISTI-CNR This class is used for querying and adding data to Cassandra via Datastax High Level API
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        SocialDBDatastaxDriver()
      public constructor, no dropping schema is allowed
      protected SocialDBDatastaxDriver​(boolean dropSchema)
      use this constructor carefully from test classes
        SocialDBDatastaxDriver​(String infrastructureName)
      public constructor, no dropping schema is allowed, infrastructureName is given.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Boolean BatchCreateChildOfWithParameter​(String parentid, String parameterName, String parameterValue, List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> childResource, String parentResourceName, String childResourceName)
      batch create a child resource given its parent id in the DB
      Boolean BatchDeleteChildOfWithParameter​(String parentid, String parameterName, String parameterValue, List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> childResource, String parentResourceName, String childResourceName)
      batch delete a child resource with a certain attribute value given its parent id
      Boolean BatchUpdateChildOf​(String parentid, List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> childResource, String parentResourceName)
      Batch update a child resource given its id and its parent id in the DB
      Boolean check​(String id, String parameterName, String parameterValue, String resourceName)
      check attribute value of a resource given its id from the DB
      Boolean checkChildOf​(String parentid, String parameterName, String parameterValue, String parentResourceName, String childResourceName)
      check attribute value of a child resource given its parent id from the DB
      void closeConnection()
      close the connection to the underlying database
      Boolean create​(org.gcube.social_networking.socialnetworking.model.shared.IdResource resource)
      create a resource in the DB
      Boolean createChildOf​(String parentid, org.gcube.social_networking.socialnetworking.model.shared.IdResource childResource, String parentResourceName)
      create a child resource given its parent id in the DB
      Boolean delete​(String id, String resourceName)
      delete a resource given its id in the DB
      Boolean deleteChildOf​(String parentid, String childid, String childResourceName)
      delete a child resource given its id and its parent id in the DB
      Boolean deleteChildOfWithParameter​(String parentid, String childid, String parameterName, String parameterValue, String parentResourceName, String childResourceName)
      delete a child resource with a certain attribute value given its parent id
      Boolean deleteWithParameter​(String parameterName, String parameterValue, String resourceName)
      delete resources with a certain attribute value
      protected org.gcube.social_networking.server.CassandraClusterConnection getConnection()  
      org.gcube.social_networking.socialnetworking.model.shared.IdResource read​(String id, String resourceName)
      read a resource given its id from the DB
      List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> readAll​(String resourceName)
      list all instances of a resource in the DB
      List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> readChildOf​(String parentid, String parentResourceName, String childResourceName)
      read a list of the children of a resource given its id from the DB
      List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> readChildOfWithParameter​(String parentid, String parameterName, String parameterValue, String parentResourceName, String childResourceName)
      read a list of the children of a resource with a specific attribute value
      List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> readWithParameter​(String parameterName, String parameterValue, String resourceName)
      read a list of resources with a specific attribute value
      org.gcube.social_networking.socialnetworking.model.shared.InviteOperationResult saveInvite​(org.gcube.social_networking.socialnetworking.model.shared.Invite invite)  
      Boolean update​(org.gcube.social_networking.socialnetworking.model.shared.IdResource resource)
      update a resource given its id in the DB
      Boolean updateChildOf​(String parentid, String childid, org.gcube.social_networking.socialnetworking.model.shared.IdResource childResource, String parentResourceName)
      update a child resource given its id and its parent id in the DB
      Boolean updateChildOfWithParameter​(String parentid, String parameterName, String parameterValue, org.gcube.social_networking.socialnetworking.model.shared.IdResource childResource, String parentResourceName)
      update a child resource with a certain attribute value given its parent id
      Boolean updateWithParameter​(String parameterName, String parameterValue, org.gcube.social_networking.socialnetworking.model.shared.IdResource resource)
      update a resource with a certain attribute value
    • Constructor Detail

      • SocialDBDatastaxDriver

        protected SocialDBDatastaxDriver​(boolean dropSchema)
        use this constructor carefully from test classes
        Parameters:
        dropSchema - set true if you want do drop the current and set up new one
      • SocialDBDatastaxDriver

        public SocialDBDatastaxDriver()
        public constructor, no dropping schema is allowed
      • SocialDBDatastaxDriver

        public SocialDBDatastaxDriver​(String infrastructureName)
        public constructor, no dropping schema is allowed, infrastructureName is given.
    • Method Detail

      • getConnection

        protected org.gcube.social_networking.server.CassandraClusterConnection getConnection()
      • create

        public Boolean create​(org.gcube.social_networking.socialnetworking.model.shared.IdResource resource)
        Description copied from interface: SocialDBDriver
        create a resource in the DB
        Specified by:
        create in interface SocialDBDriver
      • createChildOf

        public Boolean createChildOf​(String parentid,
                                     org.gcube.social_networking.socialnetworking.model.shared.IdResource childResource,
                                     String parentResourceName)
        Description copied from interface: SocialDBDriver
        create a child resource given its parent id in the DB
        Specified by:
        createChildOf in interface SocialDBDriver
      • read

        public org.gcube.social_networking.socialnetworking.model.shared.IdResource read​(String id,
                                                                                         String resourceName)
        Description copied from interface: SocialDBDriver
        read a resource given its id from the DB
        Specified by:
        read in interface SocialDBDriver
      • readAll

        public List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> readAll​(String resourceName)
        Description copied from interface: SocialDBDriver
        list all instances of a resource in the DB
        Specified by:
        readAll in interface SocialDBDriver
      • readChildOf

        public List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> readChildOf​(String parentid,
                                                                                                      String parentResourceName,
                                                                                                      String childResourceName)
        Description copied from interface: SocialDBDriver
        read a list of the children of a resource given its id from the DB
        Specified by:
        readChildOf in interface SocialDBDriver
      • readChildOfWithParameter

        public List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> readChildOfWithParameter​(String parentid,
                                                                                                                   String parameterName,
                                                                                                                   String parameterValue,
                                                                                                                   String parentResourceName,
                                                                                                                   String childResourceName)
        Description copied from interface: SocialDBDriver
        read a list of the children of a resource with a specific attribute value
        Specified by:
        readChildOfWithParameter in interface SocialDBDriver
      • readWithParameter

        public List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> readWithParameter​(String parameterName,
                                                                                                            String parameterValue,
                                                                                                            String resourceName)
        Description copied from interface: SocialDBDriver
        read a list of resources with a specific attribute value
        Specified by:
        readWithParameter in interface SocialDBDriver
      • BatchDeleteChildOfWithParameter

        public Boolean BatchDeleteChildOfWithParameter​(String parentid,
                                                       String parameterName,
                                                       String parameterValue,
                                                       List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> childResource,
                                                       String parentResourceName,
                                                       String childResourceName)
        Description copied from interface: SocialDBDriver
        batch delete a child resource with a certain attribute value given its parent id
        Specified by:
        BatchDeleteChildOfWithParameter in interface SocialDBDriver
      • update

        public Boolean update​(org.gcube.social_networking.socialnetworking.model.shared.IdResource resource)
        Description copied from interface: SocialDBDriver
        update a resource given its id in the DB
        Specified by:
        update in interface SocialDBDriver
      • updateChildOf

        public Boolean updateChildOf​(String parentid,
                                     String childid,
                                     org.gcube.social_networking.socialnetworking.model.shared.IdResource childResource,
                                     String parentResourceName)
        Description copied from interface: SocialDBDriver
        update a child resource given its id and its parent id in the DB
        Specified by:
        updateChildOf in interface SocialDBDriver
      • BatchUpdateChildOf

        public Boolean BatchUpdateChildOf​(String parentid,
                                          List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> childResource,
                                          String parentResourceName)
        Description copied from interface: SocialDBDriver
        Batch update a child resource given its id and its parent id in the DB
        Specified by:
        BatchUpdateChildOf in interface SocialDBDriver
      • updateWithParameter

        public Boolean updateWithParameter​(String parameterName,
                                           String parameterValue,
                                           org.gcube.social_networking.socialnetworking.model.shared.IdResource resource)
        Description copied from interface: SocialDBDriver
        update a resource with a certain attribute value
        Specified by:
        updateWithParameter in interface SocialDBDriver
      • updateChildOfWithParameter

        public Boolean updateChildOfWithParameter​(String parentid,
                                                  String parameterName,
                                                  String parameterValue,
                                                  org.gcube.social_networking.socialnetworking.model.shared.IdResource childResource,
                                                  String parentResourceName)
        Description copied from interface: SocialDBDriver
        update a child resource with a certain attribute value given its parent id
        Specified by:
        updateChildOfWithParameter in interface SocialDBDriver
      • saveInvite

        public org.gcube.social_networking.socialnetworking.model.shared.InviteOperationResult saveInvite​(org.gcube.social_networking.socialnetworking.model.shared.Invite invite)
                                                                                                   throws ServerException
        Specified by:
        saveInvite in interface SocialDBDriver
        Throws:
        ServerException