Added getAllVREIds method
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-networking-library@122743 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c0030bd737
commit
21e57efddb
|
@ -51,6 +51,7 @@ import com.netflix.astyanax.model.Row;
|
|||
import com.netflix.astyanax.model.Rows;
|
||||
import com.netflix.astyanax.query.PreparedIndexExpression;
|
||||
import com.netflix.astyanax.serializers.StringSerializer;
|
||||
import com.netflix.astyanax.util.RangeBuilder;
|
||||
/**
|
||||
* @author Massimiliano Assante ISTI-CNR
|
||||
*
|
||||
|
@ -379,7 +380,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -1360,7 +1361,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
toReturn.setThumbnailURL(columns.getColumnByName("ThumbnailURL").getStringValue());
|
||||
if (columns.getColumnByName("LastEditTime") != null)
|
||||
toReturn.setLastEditTime(getDateFromTimeInMillis(columns.getColumnByName("LastEditTime").getStringValue()));
|
||||
|
||||
|
||||
} catch (ConnectionException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
|
@ -2336,9 +2337,25 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getAllVREIds() throws ConnectionException{
|
||||
|
||||
List<String> ids = new ArrayList<>();
|
||||
|
||||
OperationResult<Rows<String, String>> rows = conn.getKeyspace().prepareQuery(cf_VRETline).getAllRows()
|
||||
.withColumnRange(new RangeBuilder().setLimit(0).build())
|
||||
.execute();
|
||||
|
||||
Rows<String, String> res = rows.getResult();
|
||||
|
||||
for (Row<String, String> row : res) {
|
||||
ids.add(row.getKey());
|
||||
}
|
||||
|
||||
_log.debug("VRE ids are " + ids);
|
||||
|
||||
return ids;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ import org.junit.AfterClass;
|
|||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
|
||||
|
||||
public class DatabookCassandraTest {
|
||||
private static DBCassandraAstyanaxImpl store;
|
||||
|
||||
|
@ -30,7 +32,21 @@ public class DatabookCassandraTest {
|
|||
public static void close(){
|
||||
store.closeConnection();
|
||||
System.out.println("End");
|
||||
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void vreIds(){
|
||||
//
|
||||
// try {
|
||||
// List<String> ids = store.getAllVREIds();
|
||||
// System.out.println(ids);
|
||||
// } catch (ConnectionException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void testFeedNumberPerUser() {
|
||||
|
|
|
@ -28,6 +28,8 @@ import org.gcube.portal.databook.shared.ex.NotificationIDNotFoundException;
|
|||
import org.gcube.portal.databook.shared.ex.NotificationTypeNotFoundException;
|
||||
import org.gcube.portal.databook.shared.ex.PrivacyLevelTypeNotFoundException;
|
||||
|
||||
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
|
||||
|
||||
/**
|
||||
* @author Massimiliano Assante ISTI-CNR
|
||||
*
|
||||
|
@ -427,6 +429,14 @@ public interface DatabookStore {
|
|||
* @return the list of attachments of the feed feedId, starting from the second one (first attachment is included in Feed instance already)
|
||||
*/
|
||||
List<Attachment> getAttachmentsByFeedId(String feedId) throws FeedIDNotFoundException;
|
||||
|
||||
/**
|
||||
* Retrieve all the ids of the vre
|
||||
* @return the set of ids of the vre available or empty list in case of errors.
|
||||
* @throws ConnectionException
|
||||
*/
|
||||
public List<String> getAllVREIds() throws ConnectionException;
|
||||
|
||||
/**
|
||||
* close the connection to the underlying database
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue