Fixed bug returning sendNotification false when a Notification Preference was null for a given Notification Type

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-networking-library@95317 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-05-05 14:26:18 +00:00
parent a96221d129
commit 750b9b0d4e
6 changed files with 3227 additions and 21 deletions

View File

@ -19,7 +19,7 @@
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>

File diff suppressed because it is too large Load Diff

View File

@ -26,4 +26,7 @@
<Change>Added support for notifications retrieval by range</Change> <Change>Added support for notifications retrieval by range</Change>
<Change>Added support for unlike feature</Change> <Change>Added support for unlike feature</Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.portal.social-networking-library.1-6-1" date="2014-05-05">
<Change>Fixed bug returning sendNotification false when a Notification Preference was null for a given Notification Type</Change>
</Changeset>
</ReleaseNotes> </ReleaseNotes>

View File

@ -10,7 +10,7 @@
<groupId>org.gcube.portal</groupId> <groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId> <artifactId>social-networking-library</artifactId>
<version>1.6.0-SNAPSHOT</version> <version>1.6.1-SNAPSHOT</version>
<name>gCube Social Networking Library</name> <name>gCube Social Networking Library</name>
<description> <description>
The gCube Social Networking Library is the 'bridge' between your gCube Applications and the social networking facilities. The gCube Social Networking Library is the 'bridge' between your gCube Applications and the social networking facilities.

View File

@ -994,7 +994,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
if (toProcess == null) { if (toProcess == null) {
_log.warn("Single Notification preference of " + userid + " Type: " + notificationType + " not existing ... creating default"); _log.warn("Single Notification preference of " + userid + " Type: " + notificationType + " not existing ... creating default");
return createNewNotificationType(userid, notificationType); return createNewNotificationType(userid, notificationType);
} else }
else if (toProcess.length == 0)
return toReturn;
else
for (int i = 0; i < toProcess.length; i++) { for (int i = 0; i < toProcess.length; i++) {
toReturn.add(toProcess[i]); toReturn.add(toProcess[i]);
} }
@ -1094,13 +1097,17 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
for (Row<String, String> row : result.getResult()) for (Row<String, String> row : result.getResult())
for (Column<String> column : row.getColumns()) { for (Column<String> column : row.getColumns()) {
String[] channels = column.getStringValue().split(","); String[] channels = column.getStringValue().split(",");
if (channels != null && channels.length == 1 && channels[0].toString().equals("") ) { //it is empty, preference is set to no notification at all
toReturn.put(getNotificationType(column.getName()), new NotificationChannelType[0]);
} else {
NotificationChannelType[] toAdd = new NotificationChannelType[channels.length]; NotificationChannelType[] toAdd = new NotificationChannelType[channels.length];
for (int i = 0; i < channels.length; i++) { for (int i = 0; i < channels.length; i++) {
if (channels[i].compareTo("") != 0) if (channels[i].compareTo("") != 0) {
toAdd[i] = (getChannelType(channels[i])); toAdd[i] = (getChannelType(channels[i]));
} }
}
toReturn.put(getNotificationType(column.getName()), toAdd); toReturn.put(getNotificationType(column.getName()), toAdd);
}
} }
} }
return toReturn; return toReturn;