dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19644
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8660: Added markRead property to MessageConversationController, /api/messageConversations/{uid}?markRea...
------------------------------------------------------------
revno: 8660
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-23 13:59:06 +0200
message:
Added markRead property to MessageConversationController, /api/messageConversations/{uid}?markRead=true, defaults to falsedhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java 2012-10-01 20:06:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java 2012-10-23 11:59:06 +0000
@@ -35,13 +35,11 @@
import org.hisp.dhis.message.MessageService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserGroup;
-import org.hisp.dhis.user.UserGroupService;
-import org.hisp.dhis.user.UserService;
+import org.hisp.dhis.user.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@@ -50,6 +48,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.Map;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -73,6 +72,21 @@
@Autowired
private UserGroupService userGroupService;
+ @Autowired
+ private CurrentUserService currentUserService;
+
+ @Override
+ public void postProcessEntity( MessageConversation entity, Map<String, String> parameters ) throws Exception
+ {
+ Boolean markRead = Boolean.getBoolean( parameters.get( "markRead" ) );
+
+ if( markRead )
+ {
+ entity.markRead( currentUserService.getCurrentUser() );
+ manager.update( entity );
+ }
+ }
+
@Override
protected List<MessageConversation> getEntityList( WebMetaData metaData, WebOptions options )
{