Bugs fixed
This commit is contained in:
parent
b968a6f7dd
commit
785511f6a3
|
@ -554,18 +554,52 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static Post feed2post(Feed feed){
|
private static Post feed2post(Feed feed){
|
||||||
Post post = new Post(feed.getKey(), PostType.valueOf(feed.getType().toString()), feed.getEntityId(), feed.getTime(),
|
Post post = new Post();
|
||||||
feed.getVreid(), feed.getUri(), feed.getUriThumbnail(), feed.getDescription(), feed.getPrivacy(),
|
if (feed.getKey()!=null)post.setKey(feed.getKey());
|
||||||
feed.getFullName(), feed.getEmail(), feed.getThumbnailURL(), feed.getCommentsNo(),
|
if (feed.getType()!=null)post.setType(PostType.valueOf(feed.getType().toString()));
|
||||||
feed.getLikesNo(), feed.getLinkTitle(), feed.getLinkDescription(), feed.getLinkHost(), feed.isApplicationFeed(), feed.isMultiFileUpload());
|
if (feed.getEntityId()!=null)post.setEntityId(feed.getEntityId());
|
||||||
|
if (feed.getTime()!=null)post.setTime(feed.getTime());
|
||||||
|
if (feed.getVreid()!=null)post.setVreid(feed.getVreid());
|
||||||
|
if (feed.getUri()!=null)post.setUri(feed.getUri());
|
||||||
|
if (feed.getUriThumbnail()!=null)post.setUriThumbnail(feed.getUriThumbnail());
|
||||||
|
if (feed.getDescription()!=null)post.setDescription(feed.getDescription());
|
||||||
|
if (feed.getPrivacy()!=null)post.setPrivacy(feed.getPrivacy());
|
||||||
|
if (feed.getFullName()!=null)post.setFullName(feed.getFullName());
|
||||||
|
if (feed.getEmail()!=null)post.setEmail(feed.getEmail());
|
||||||
|
if (feed.getThumbnailURL()!=null)post.setThumbnailURL(feed.getThumbnailURL());
|
||||||
|
if (feed.getCommentsNo()!=null)post.setCommentsNo(feed.getCommentsNo());
|
||||||
|
if (feed.getLikesNo()!=null)post.setLikesNo(feed.getLikesNo());
|
||||||
|
if (feed.getLinkTitle()!=null)post.setLinkTitle(feed.getLinkTitle());
|
||||||
|
if (feed.getLinkDescription()!=null)post.setLinkDescription(feed.getLinkDescription());
|
||||||
|
if (feed.getLinkHost()!=null)post.setLinkHost(feed.getLinkHost());
|
||||||
|
post.setApplicationFeed(feed.isApplicationFeed());
|
||||||
|
post.setMultiFileUpload(feed.isMultiFileUpload());
|
||||||
return post;
|
return post;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Feed post2feed(Post post){
|
private static Feed post2feed(Post post){
|
||||||
Feed feed = new Feed(post.getKey(), FeedType.valueOf(post.getType().toString()), post.getEntityId(), post.getTime(),
|
Feed feed = new Feed();
|
||||||
post.getVreid(), post.getUri(), post.getUriThumbnail(), post.getDescription(), post.getPrivacy(),
|
|
||||||
post.getFullName(), post.getEmail(), post.getThumbnailURL(), post.getCommentsNo(),
|
if (post.getKey()!=null)feed.setKey(post.getKey());
|
||||||
post.getLikesNo(), post.getLinkTitle(), post.getLinkDescription(), post.getLinkHost(), post.isApplicationFeed(), post.isMultiFileUpload());
|
if (post.getType()!=null)feed.setType(FeedType.valueOf(post.getType().toString()));
|
||||||
|
if (post.getEntityId()!=null)feed.setEntityId(post.getEntityId());
|
||||||
|
if (post.getTime()!=null)feed.setTime(post.getTime());
|
||||||
|
if (post.getVreid()!=null)feed.setVreid(post.getVreid());
|
||||||
|
if (post.getUri()!=null)feed.setUri(post.getUri());
|
||||||
|
if (post.getUriThumbnail()!=null)feed.setUriThumbnail(post.getUriThumbnail());
|
||||||
|
if (post.getDescription()!=null)feed.setDescription(post.getDescription());
|
||||||
|
if (post.getPrivacy()!=null)feed.setPrivacy(post.getPrivacy());
|
||||||
|
if (post.getFullName()!=null)feed.setFullName(post.getFullName());
|
||||||
|
if (post.getEmail()!=null)feed.setEmail(post.getEmail());
|
||||||
|
if (post.getThumbnailURL()!=null)feed.setThumbnailURL(post.getThumbnailURL());
|
||||||
|
if (post.getCommentsNo()!=null)feed.setCommentsNo(post.getCommentsNo());
|
||||||
|
if (post.getLikesNo()!=null)feed.setLikesNo(post.getLikesNo());
|
||||||
|
if (post.getLinkTitle()!=null)feed.setLinkTitle(post.getLinkTitle());
|
||||||
|
if (post.getLinkDescription()!=null)feed.setLinkDescription(post.getLinkDescription());
|
||||||
|
if (post.getLinkHost()!=null)feed.setLinkHost(post.getLinkHost());
|
||||||
|
feed.setApplicationFeed(post.isApplicationFeed());
|
||||||
|
feed.setMultiFileUpload(post.isMultiFileUpload());
|
||||||
|
|
||||||
return feed;
|
return feed;
|
||||||
}
|
}
|
||||||
private List<BoundStatement> insertIntoPosts(CqlSession session, Post post){
|
private List<BoundStatement> insertIntoPosts(CqlSession session, Post post){
|
||||||
|
@ -1049,29 +1083,21 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
List<Feed> toReturn = result.all().stream().map(row-> {
|
List<Feed>toReturn = new ArrayList<>();
|
||||||
try {
|
List<Row>rows=result.all();
|
||||||
|
for (Row row: rows){
|
||||||
Instant postTime = row.getInstant(TIMESTAMP);
|
Instant postTime = row.getInstant(TIMESTAMP);
|
||||||
if (Date.from(postTime).getTime() > timeInMillis){
|
if (Date.from(postTime).getTime() > timeInMillis){
|
||||||
try{
|
try{
|
||||||
Feed toCheck = readFeed(row.getUuid(POST_ID).toString());
|
Feed toCheck = readFeed(row.getUuid(POST_ID).toString());
|
||||||
if (toCheck.getType() != FeedType.DISABLED)
|
if (toCheck.getType() != FeedType.DISABLED)
|
||||||
return toCheck;
|
toReturn.add(toCheck);
|
||||||
} catch (ColumnNameNotFoundException |
|
} catch (ColumnNameNotFoundException | PrivacyLevelTypeNotFoundException | FeedTypeNotFoundException |
|
||||||
PrivacyLevelTypeNotFoundException e) {
|
FeedIDNotFoundException e) {
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (FeedIDNotFoundException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (FeedTypeNotFoundException e) {
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -1096,29 +1122,21 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
List<Post> toReturn = result.all().stream().map(row-> {
|
List<Row>rows = result.all();
|
||||||
try {
|
List<Post> toReturn = new ArrayList<>();
|
||||||
|
for (Row row: rows){
|
||||||
Instant postTime = row.getInstant(TIMESTAMP);
|
Instant postTime = row.getInstant(TIMESTAMP);
|
||||||
if (Date.from(postTime).getTime() > timeInMillis){
|
if (Date.from(postTime).getTime() > timeInMillis){
|
||||||
try{
|
try{
|
||||||
Post toCheck = readPost(row.getUuid(POST_ID).toString());
|
Post toCheck = readPost(row.getUuid(POST_ID).toString());
|
||||||
if (toCheck.getType() != PostType.DISABLED)
|
if (toCheck.getType() != PostType.DISABLED)
|
||||||
return toCheck;
|
toReturn.add(toCheck);
|
||||||
} catch (ColumnNameNotFoundException |
|
} catch (ColumnNameNotFoundException | PrivacyLevelTypeNotFoundException | FeedIDNotFoundException |
|
||||||
PrivacyLevelTypeNotFoundException e) {
|
FeedTypeNotFoundException e) {
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (FeedIDNotFoundException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (FeedTypeNotFoundException e) {
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -1326,16 +1344,16 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
List<Row>rows = result.all();
|
||||||
List<String> toReturn = result.all().stream().map(row-> {
|
List<String>toReturn = new ArrayList<>();
|
||||||
|
for (Row row: rows){
|
||||||
try {
|
try {
|
||||||
String postid = row.getUuid(POST_ID).toString();
|
String postid = row.getUuid(POST_ID).toString();
|
||||||
return postid;
|
toReturn.add(postid);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}).collect(Collectors.toList());
|
}
|
||||||
|
|
||||||
return (ArrayList<String>) toReturn;
|
return (ArrayList<String>) toReturn;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -1358,17 +1376,17 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
ArrayList<String> toReturn = new ArrayList<>();
|
||||||
List<String> toReturn = result.all().stream().map(row-> {
|
List<Row>rows = result.all();
|
||||||
|
for(Row row: rows){
|
||||||
try {
|
try {
|
||||||
String postid = row.getUuid(POST_ID).toString();
|
String postid = row.getUuid(POST_ID).toString();
|
||||||
return postid;
|
toReturn.add(postid);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}).collect(Collectors.toList());
|
}
|
||||||
|
return toReturn;
|
||||||
return (ArrayList<String>) toReturn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1394,7 +1412,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
for (Row row: result.all()){
|
List<Row>rows = result.all();
|
||||||
|
for (Row row: rows){
|
||||||
if (row.getUuid(POST_ID).toString().equals(postid)){
|
if (row.getUuid(POST_ID).toString().equals(postid)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1425,17 +1444,19 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
List<Row>rows=result.all();
|
||||||
List<String> toReturn = result.all().stream().map(row-> {
|
ArrayList<String> toReturn=new ArrayList<>();
|
||||||
|
for(Row row: rows){
|
||||||
try {
|
try {
|
||||||
String postid = row.getUuid(POST_ID).toString();
|
String postid = row.getUuid(POST_ID).toString();
|
||||||
return postid;
|
toReturn.add(postid);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}).collect(Collectors.toList());
|
}
|
||||||
|
|
||||||
return (ArrayList<String>) toReturn;
|
|
||||||
|
return toReturn;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* helper method that retrieve all the post Ids belonging to an application
|
* helper method that retrieve all the post Ids belonging to an application
|
||||||
|
@ -1458,16 +1479,19 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> toReturn = result.all().stream().map(row-> {
|
List<Row>rows=result.all();
|
||||||
|
ArrayList<String> toReturn=new ArrayList<>();
|
||||||
|
for(Row row: rows){
|
||||||
try {
|
try {
|
||||||
String postid = row.getUuid(POST_ID).toString();
|
String postid = row.getUuid(POST_ID).toString();
|
||||||
return postid;
|
toReturn.add(postid);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}).collect(Collectors.toList());
|
}
|
||||||
|
|
||||||
return (ArrayList<String>) toReturn;
|
|
||||||
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1492,7 +1516,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
for (Row row: result.all()) {
|
List<Row>rows=result.all();
|
||||||
|
for (Row row: rows) {
|
||||||
Feed toAdd = readFeedFromRow(row);
|
Feed toAdd = readFeedFromRow(row);
|
||||||
if (toAdd.getType() == FeedType.TWEET || toAdd.getType() == FeedType.SHARE || toAdd.getType() == FeedType.PUBLISH)
|
if (toAdd.getType() == FeedType.TWEET || toAdd.getType() == FeedType.SHARE || toAdd.getType() == FeedType.PUBLISH)
|
||||||
toReturn.add(toAdd);
|
toReturn.add(toAdd);
|
||||||
|
@ -1517,7 +1542,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
for (Row row: result.all()) {
|
List<Row>rows=result.all();
|
||||||
|
for (Row row: rows) {
|
||||||
Post toAdd = readPostFromRow(row);
|
Post toAdd = readPostFromRow(row);
|
||||||
if (toAdd.getType() == PostType.TWEET || toAdd.getType() == PostType.SHARE || toAdd.getType() == PostType.PUBLISH)
|
if (toAdd.getType() == PostType.TWEET || toAdd.getType() == PostType.SHARE || toAdd.getType() == PostType.PUBLISH)
|
||||||
toReturn.add(toAdd);
|
toReturn.add(toAdd);
|
||||||
|
@ -1743,16 +1769,18 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> toReturn = result.all().stream().map(row-> {
|
List<Row>rows=result.all();
|
||||||
|
ArrayList<String> toReturn=new ArrayList<>();
|
||||||
|
for(Row row: rows){
|
||||||
try {
|
try {
|
||||||
String postid = row.getUuid(POST_ID).toString();
|
String postid = row.getUuid(POST_ID).toString();
|
||||||
return postid;
|
toReturn.add(postid);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}).collect(Collectors.toList());
|
}
|
||||||
|
|
||||||
return (ArrayList<String>) toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get a list of user vre post UUIDs in chronological order from the oldest to the more recent
|
* get a list of user vre post UUIDs in chronological order from the oldest to the more recent
|
||||||
|
@ -1775,16 +1803,19 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> toReturn = result.all().stream().map(row-> {
|
List<Row>rows=result.all();
|
||||||
|
ArrayList<String> toReturn=new ArrayList<>();
|
||||||
|
for(Row row: rows){
|
||||||
try {
|
try {
|
||||||
String postid = row.getUuid(POST_ID).toString();
|
String postid = row.getUuid(POST_ID).toString();
|
||||||
return postid;
|
toReturn.add(postid);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}).collect(Collectors.toList());
|
}
|
||||||
|
|
||||||
return (ArrayList<String>) toReturn;
|
|
||||||
|
return toReturn;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -1962,7 +1993,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
ArrayList<String> toReturn = new ArrayList<String>();
|
ArrayList<String> toReturn = new ArrayList<String>();
|
||||||
|
|
||||||
// Iterate rows and their columns
|
// Iterate rows and their columns
|
||||||
for (Row row : result.all()) {
|
List<Row>rows=result.all();
|
||||||
|
for (Row row : rows) {
|
||||||
toReturn.add(row.getUuid(NOT_ID).toString());
|
toReturn.add(row.getUuid(NOT_ID).toString());
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
|
@ -1991,7 +2023,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
ArrayList<String> toReturn = new ArrayList<String>();
|
ArrayList<String> toReturn = new ArrayList<String>();
|
||||||
|
|
||||||
// Iterate rows and their columns
|
// Iterate rows and their columns
|
||||||
for (Row row : result.all()) {
|
List<Row>rows=result.all();
|
||||||
|
for (Row row : rows) {
|
||||||
toReturn.add(row.getUuid(NOT_ID).toString());
|
toReturn.add(row.getUuid(NOT_ID).toString());
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
|
@ -2204,9 +2237,11 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
for (NotificationType nType : enabledChannels.keySet()) {
|
for (NotificationType nType : enabledChannels.keySet()) {
|
||||||
String valueToInsert = "";
|
String valueToInsert = "";
|
||||||
|
_log.info("Type: " + nType.toString());
|
||||||
int channelsNo = (enabledChannels.get(nType) != null) ? enabledChannels.get(nType).length : 0;
|
int channelsNo = (enabledChannels.get(nType) != null) ? enabledChannels.get(nType).length : 0;
|
||||||
for (int i = 0; i < channelsNo; i++) {
|
for (int i = 0; i < channelsNo; i++) {
|
||||||
valueToInsert += enabledChannels.get(nType)[i];
|
_log.info(enabledChannels.get(nType)[i].toString());
|
||||||
|
valueToInsert += NotificationChannelType.valueOf(enabledChannels.get(nType)[i].toString());
|
||||||
if (i < channelsNo-1)
|
if (i < channelsNo-1)
|
||||||
valueToInsert += ",";
|
valueToInsert += ",";
|
||||||
}
|
}
|
||||||
|
@ -2221,9 +2256,9 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
BatchStatement writeBatch = getBatch().addAll(boundStatements);
|
BatchStatement writeBatch = getBatch().addAll(boundStatements);
|
||||||
boolean overAllresult = session.execute(writeBatch).wasApplied();
|
boolean overAllresult = session.execute(writeBatch).wasApplied();
|
||||||
if (overAllresult)
|
if (overAllresult)
|
||||||
_log.trace("Set Notification Map for " + userid + " OK");
|
_log.info("Set Notification Map for " + userid + " OK");
|
||||||
else
|
else
|
||||||
_log.trace("Set Notification Map for " + userid + " FAILED");
|
_log.info("Set Notification Map for " + userid + " FAILED");
|
||||||
return overAllresult;
|
return overAllresult;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -2437,8 +2472,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());*/
|
.build());*/
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(UUID.fromString(postid)));
|
result = session.execute(stmtFind.bind(UUID.fromString(postid)));
|
||||||
|
List<Row>rows=result.all();
|
||||||
for (Row row : result.all()) {
|
for (Row row : rows) {
|
||||||
Comment toAdd = readCommentFromRow(row);
|
Comment toAdd = readCommentFromRow(row);
|
||||||
toReturn.add(toAdd);
|
toReturn.add(toAdd);
|
||||||
}
|
}
|
||||||
|
@ -2645,6 +2680,9 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
//an entry in the feed CF
|
//an entry in the feed CF
|
||||||
//and an entry in the UserLikesCF
|
//and an entry in the UserLikesCF
|
||||||
List<BoundStatement> boundStatements = insertIntoLikes(session,like);
|
List<BoundStatement> boundStatements = insertIntoLikes(session,like);
|
||||||
|
BoundStatement stmt2 = createNewUserLikesEntry(session).bind(like.getUserid(), UUID.fromString(like.getKey()), UUID.fromString(like.getFeedid()));
|
||||||
|
boundStatements.add(stmt2);
|
||||||
|
|
||||||
//boundStatements.forEach(stmt->writeBatch.add(stmt));
|
//boundStatements.forEach(stmt->writeBatch.add(stmt));
|
||||||
BatchStatement writeBatch = getBatch().addAll(boundStatements);
|
BatchStatement writeBatch = getBatch().addAll(boundStatements);
|
||||||
|
|
||||||
|
@ -3040,8 +3078,9 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
HashMap<String, Integer> toReturn = new HashMap<String, Integer> ();
|
HashMap<String, Integer> toReturn = new HashMap<String, Integer> ();
|
||||||
|
|
||||||
|
List<Row> rows = result.all();
|
||||||
// Iterate rows and their columns
|
// Iterate rows and their columns
|
||||||
for (Row row : result.all()) {
|
for (Row row : rows) {
|
||||||
Integer curValue = (int) row.getLong(COUNT);
|
Integer curValue = (int) row.getLong(COUNT);
|
||||||
if (curValue > 0)
|
if (curValue > 0)
|
||||||
toReturn.put(row.getString(HASHTAG), curValue);
|
toReturn.put(row.getString(HASHTAG), curValue);
|
||||||
|
@ -3070,9 +3109,9 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap<String, Integer> toReturn = new HashMap<String, Integer> ();
|
HashMap<String, Integer> toReturn = new HashMap<String, Integer> ();
|
||||||
|
List<Row> rows = result.all();
|
||||||
// Iterate rows and their columns
|
// Iterate rows and their columns
|
||||||
for (Row row : result.all()) {
|
for (Row row : rows) {
|
||||||
// retrieve the feeds list for this hashtag
|
// retrieve the feeds list for this hashtag
|
||||||
List<Post> feeds = null;
|
List<Post> feeds = null;
|
||||||
try{
|
try{
|
||||||
|
@ -3141,12 +3180,14 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
Set<String> postIds = new HashSet<>();
|
Set<String> postIds = new HashSet<>();
|
||||||
// Iterate rows and their columns (feed)
|
// Iterate rows and their columns (feed)
|
||||||
for (Row row : resultPost.all()) {
|
List<Row>rowsPost=resultPost.all();
|
||||||
|
for (Row row : rowsPost) {
|
||||||
if (row.getString(VRE_ID).compareTo(vreid)==0)
|
if (row.getString(VRE_ID).compareTo(vreid)==0)
|
||||||
postIds.add(row.getUuid(POST_ID).toString());
|
postIds.add(row.getUuid(POST_ID).toString());
|
||||||
}
|
}
|
||||||
// Iterate rows and their columns (comments)
|
// Iterate rows and their columns (comments)
|
||||||
for (Row row : resultComment.all()) {
|
List<Row>rowsComment=resultComment.all();
|
||||||
|
for (Row row : rowsComment) {
|
||||||
if (row.getString(VRE_ID).compareTo(vreid)==0){
|
if (row.getString(VRE_ID).compareTo(vreid)==0){
|
||||||
try {
|
try {
|
||||||
Comment c = readCommentById(row.getUuid(COMMENT_ID).toString());
|
Comment c = readCommentById(row.getUuid(COMMENT_ID).toString());
|
||||||
|
@ -3195,12 +3236,14 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
Set<String> postIds = new HashSet<>();
|
Set<String> postIds = new HashSet<>();
|
||||||
// Iterate rows and their columns (feed)
|
// Iterate rows and their columns (feed)
|
||||||
for (Row row : resultPost.all()) {
|
List<Row>rowsPost=resultPost.all();
|
||||||
|
for (Row row : rowsPost) {
|
||||||
if (row.getString(VRE_ID).compareTo(vreid)==0)
|
if (row.getString(VRE_ID).compareTo(vreid)==0)
|
||||||
postIds.add(row.getUuid(POST_ID).toString());
|
postIds.add(row.getUuid(POST_ID).toString());
|
||||||
}
|
}
|
||||||
// Iterate rows and their columns (comments)
|
// Iterate rows and their columns (comments)
|
||||||
for (Row row : resultComment.all()) {
|
List<Row>rowsComment=resultComment.all();
|
||||||
|
for (Row row : rowsComment) {
|
||||||
if (row.getString(VRE_ID).compareTo(vreid)==0){
|
if (row.getString(VRE_ID).compareTo(vreid)==0){
|
||||||
try {
|
try {
|
||||||
Comment c = readCommentById(row.getUuid(COMMENT_ID).toString());
|
Comment c = readCommentById(row.getUuid(COMMENT_ID).toString());
|
||||||
|
@ -3317,7 +3360,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate rows and their columns
|
// Iterate rows and their columns
|
||||||
for (Row row : result.all()) {
|
List<Row>rows=result.all();
|
||||||
|
for (Row row : rows) {
|
||||||
if (row.getString(VRE_ID).compareTo(vreid)==0)
|
if (row.getString(VRE_ID).compareTo(vreid)==0)
|
||||||
return row.getUuid(INVITE_ID).toString();
|
return row.getUuid(INVITE_ID).toString();
|
||||||
|
|
||||||
|
@ -3439,7 +3483,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
ArrayList<String> invitesIds = new ArrayList<String>();
|
ArrayList<String> invitesIds = new ArrayList<String>();
|
||||||
// Iterate rows and their columns
|
// Iterate rows and their columns
|
||||||
for (Row row : result.all()) {
|
List<Row>rows=result.all();
|
||||||
|
for (Row row : rows) {
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
for (int i = 0; i < status.length; i++) {
|
for (int i = 0; i < status.length; i++) {
|
||||||
if (row.getString(STATUS).compareTo(status[i].toString())==0)
|
if (row.getString(STATUS).compareTo(status[i].toString())==0)
|
||||||
|
@ -3477,7 +3522,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(UUID.fromString(feedId)));
|
result = session.execute(stmtFind.bind(UUID.fromString(feedId)));
|
||||||
// Iterate rows and their columns
|
// Iterate rows and their columns
|
||||||
for (Row row : result.all()) {
|
List<Row>rows=result.all();
|
||||||
|
for (Row row : rows) {
|
||||||
_log.trace("Reading attachment if feed=" + row.getUuid(POST_ID).toString());
|
_log.trace("Reading attachment if feed=" + row.getUuid(POST_ID).toString());
|
||||||
Attachment toAdd = readAttachmentFromRow(row);
|
Attachment toAdd = readAttachmentFromRow(row);
|
||||||
toReturn.add(toAdd);
|
toReturn.add(toAdd);
|
||||||
|
@ -3975,7 +4021,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
@Override
|
@Override
|
||||||
public List<String> getAllVREIds(){
|
public List<String> getAllVREIds(){
|
||||||
|
|
||||||
List<String> ids = new ArrayList<>();
|
Set<String> ids = new HashSet<>();
|
||||||
|
|
||||||
CqlSession session = conn.getKeyspaceSession();
|
CqlSession session = conn.getKeyspaceSession();
|
||||||
ResultSet result = null;
|
ResultSet result = null;
|
||||||
|
@ -3990,13 +4036,14 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Row row : result.all()) {
|
List<Row>rows=result.all();
|
||||||
|
for (Row row : rows) {
|
||||||
ids.add(row.getString(VRE_ID));
|
ids.add(row.getString(VRE_ID));
|
||||||
}
|
}
|
||||||
|
List<String> toReturn = new ArrayList<>();
|
||||||
|
toReturn.addAll(ids);
|
||||||
_log.debug("VRE ids are " + ids);
|
_log.debug("VRE ids are " + ids);
|
||||||
|
|
||||||
return ids;
|
return toReturn;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class RunningCluster implements Serializable {
|
||||||
|
|
||||||
host = "10.1.28.55:9042, 10.1.30.142:9042, 10.1.28.100:9042";
|
host = "10.1.28.55:9042, 10.1.30.142:9042, 10.1.28.100:9042";
|
||||||
datacenterName = "1";
|
datacenterName = "1";
|
||||||
keyspaceName = "dev_mig_new_schema_test";
|
keyspaceName = "dev_mig_consistent";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue