Class SocialDBDatastaxDriver
- java.lang.Object
-
- org.gcube.social_networking.server.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 allowedprotectedSocialDBDatastaxDriver(boolean dropSchema)use this constructor carefully from test classesSocialDBDatastaxDriver(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 BooleanBatchCreateChildOfWithParameter(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 DBBooleanBatchDeleteChildOfWithParameter(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 idBooleanBatchUpdateChildOf(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 DBBooleancheck(String id, String parameterName, String parameterValue, String resourceName)check attribute value of a resource given its id from the DBBooleancheckChildOf(String parentid, String parameterName, String parameterValue, String parentResourceName, String childResourceName)check attribute value of a child resource given its parent id from the DBvoidcloseConnection()close the connection to the underlying databaseBooleancreate(org.gcube.social_networking.socialnetworking.model.shared.IdResource resource)create a resource in the DBBooleancreateChildOf(String parentid, org.gcube.social_networking.socialnetworking.model.shared.IdResource childResource, String parentResourceName)create a child resource given its parent id in the DBBooleandelete(String id, String resourceName)delete a resource given its id in the DBBooleandeleteChildOf(String parentid, String childid, String childResourceName)delete a child resource given its id and its parent id in the DBBooleandeleteChildOfWithParameter(String parentid, String childid, String parameterName, String parameterValue, String parentResourceName, String childResourceName)delete a child resource with a certain attribute value given its parent idBooleandeleteWithParameter(String parameterName, String parameterValue, String resourceName)delete resources with a certain attribute valueprotected org.gcube.social_networking.server.CassandraClusterConnectiongetConnection()org.gcube.social_networking.socialnetworking.model.shared.IdResourceread(String id, String resourceName)read a resource given its id from the DBList<org.gcube.social_networking.socialnetworking.model.shared.IdResource>readAll(String resourceName)list all instances of a resource in the DBList<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 DBList<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 valueList<org.gcube.social_networking.socialnetworking.model.shared.IdResource>readWithParameter(String parameterName, String parameterValue, String resourceName)read a list of resources with a specific attribute valueorg.gcube.social_networking.socialnetworking.model.shared.InviteOperationResultsaveInvite(org.gcube.social_networking.socialnetworking.model.shared.Invite invite)Booleanupdate(org.gcube.social_networking.socialnetworking.model.shared.IdResource resource)update a resource given its id in the DBBooleanupdateChildOf(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 DBBooleanupdateChildOfWithParameter(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 idBooleanupdateWithParameter(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:SocialDBDrivercreate a resource in the DB- Specified by:
createin interfaceSocialDBDriver
-
createChildOf
public Boolean createChildOf(String parentid, org.gcube.social_networking.socialnetworking.model.shared.IdResource childResource, String parentResourceName)
Description copied from interface:SocialDBDrivercreate a child resource given its parent id in the DB- Specified by:
createChildOfin interfaceSocialDBDriver
-
BatchCreateChildOfWithParameter
public Boolean BatchCreateChildOfWithParameter(String parentid, String parameterName, String parameterValue, List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> childResource, String parentResourceName, String childResourceName)
Description copied from interface:SocialDBDriverbatch create a child resource given its parent id in the DB- Specified by:
BatchCreateChildOfWithParameterin interfaceSocialDBDriver
-
read
public org.gcube.social_networking.socialnetworking.model.shared.IdResource read(String id, String resourceName)
Description copied from interface:SocialDBDriverread a resource given its id from the DB- Specified by:
readin interfaceSocialDBDriver
-
check
public Boolean check(String id, String parameterName, String parameterValue, String resourceName)
Description copied from interface:SocialDBDrivercheck attribute value of a resource given its id from the DB- Specified by:
checkin interfaceSocialDBDriver
-
checkChildOf
public Boolean checkChildOf(String parentid, String parameterName, String parameterValue, String parentResourceName, String childResourceName)
Description copied from interface:SocialDBDrivercheck attribute value of a child resource given its parent id from the DB- Specified by:
checkChildOfin interfaceSocialDBDriver
-
readAll
public List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> readAll(String resourceName)
Description copied from interface:SocialDBDriverlist all instances of a resource in the DB- Specified by:
readAllin interfaceSocialDBDriver
-
readChildOf
public List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> readChildOf(String parentid, String parentResourceName, String childResourceName)
Description copied from interface:SocialDBDriverread a list of the children of a resource given its id from the DB- Specified by:
readChildOfin interfaceSocialDBDriver
-
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:SocialDBDriverread a list of the children of a resource with a specific attribute value- Specified by:
readChildOfWithParameterin interfaceSocialDBDriver
-
readWithParameter
public List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> readWithParameter(String parameterName, String parameterValue, String resourceName)
Description copied from interface:SocialDBDriverread a list of resources with a specific attribute value- Specified by:
readWithParameterin interfaceSocialDBDriver
-
delete
public Boolean delete(String id, String resourceName)
Description copied from interface:SocialDBDriverdelete a resource given its id in the DB- Specified by:
deletein interfaceSocialDBDriver
-
deleteChildOf
public Boolean deleteChildOf(String parentid, String childid, String childResourceName)
Description copied from interface:SocialDBDriverdelete a child resource given its id and its parent id in the DB- Specified by:
deleteChildOfin interfaceSocialDBDriver
-
deleteWithParameter
public Boolean deleteWithParameter(String parameterName, String parameterValue, String resourceName)
Description copied from interface:SocialDBDriverdelete resources with a certain attribute value- Specified by:
deleteWithParameterin interfaceSocialDBDriver
-
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:SocialDBDriverbatch delete a child resource with a certain attribute value given its parent id- Specified by:
BatchDeleteChildOfWithParameterin interfaceSocialDBDriver
-
deleteChildOfWithParameter
public Boolean deleteChildOfWithParameter(String parentid, String childid, String parameterName, String parameterValue, String parentResourceName, String childResourceName)
Description copied from interface:SocialDBDriverdelete a child resource with a certain attribute value given its parent id- Specified by:
deleteChildOfWithParameterin interfaceSocialDBDriver
-
update
public Boolean update(org.gcube.social_networking.socialnetworking.model.shared.IdResource resource)
Description copied from interface:SocialDBDriverupdate a resource given its id in the DB- Specified by:
updatein interfaceSocialDBDriver
-
updateChildOf
public Boolean updateChildOf(String parentid, String childid, org.gcube.social_networking.socialnetworking.model.shared.IdResource childResource, String parentResourceName)
Description copied from interface:SocialDBDriverupdate a child resource given its id and its parent id in the DB- Specified by:
updateChildOfin interfaceSocialDBDriver
-
BatchUpdateChildOf
public Boolean BatchUpdateChildOf(String parentid, List<org.gcube.social_networking.socialnetworking.model.shared.IdResource> childResource, String parentResourceName)
Description copied from interface:SocialDBDriverBatch update a child resource given its id and its parent id in the DB- Specified by:
BatchUpdateChildOfin interfaceSocialDBDriver
-
updateWithParameter
public Boolean updateWithParameter(String parameterName, String parameterValue, org.gcube.social_networking.socialnetworking.model.shared.IdResource resource)
Description copied from interface:SocialDBDriverupdate a resource with a certain attribute value- Specified by:
updateWithParameterin interfaceSocialDBDriver
-
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:SocialDBDriverupdate a child resource with a certain attribute value given its parent id- Specified by:
updateChildOfWithParameterin interfaceSocialDBDriver
-
saveInvite
public org.gcube.social_networking.socialnetworking.model.shared.InviteOperationResult saveInvite(org.gcube.social_networking.socialnetworking.model.shared.Invite invite) throws ServerException- Specified by:
saveInvitein interfaceSocialDBDriver- Throws:
ServerException
-
closeConnection
public void closeConnection()
Description copied from interface:SocialDBDriverclose the connection to the underlying database- Specified by:
closeConnectionin interfaceSocialDBDriver
-
-