dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24316
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11898: Background processes, when a process fails a dhis message is now sent to the feedback user group ...
------------------------------------------------------------
revno: 11898
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-09-04 09:35:34 +0200
message:
Background processes, when a process fails a dhis message is now sent to the feedback user group with a notification.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/scheduling/AnalyticsTableTask.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DataMartTask.java
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/message.vm
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm
--
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-api/src/main/java/org/hisp/dhis/message/MessageConversation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java 2013-09-04 07:35:34 +0000
@@ -267,6 +267,13 @@
{
userMessages.clear();
}
+
+ public String getLastSenderName()
+ {
+ boolean hasName = lastSenderFirstname != null || lastSenderSurname != null;
+
+ return hasName ? ( lastSenderFirstname + " " + lastSenderSurname ) : null;
+ }
// -------------------------------------------------------------------------------------------------------
// Persistent fields
@@ -374,11 +381,6 @@
this.followUp = followUp;
}
- public String getLastSenderName()
- {
- return lastSenderFirstname + " " + lastSenderSurname;
- }
-
public String getLastSenderSurname()
{
return lastSenderSurname;
@@ -420,8 +422,7 @@
subject = messageConversation.getSubject() == null ? subject : messageConversation.getSubject();
lastSender = messageConversation.getLastSender() == null ? lastSender : messageConversation.getLastSender();
- lastMessage = messageConversation.getLastMessage() == null ? lastMessage : messageConversation
- .getLastMessage();
+ lastMessage = messageConversation.getLastMessage() == null ? lastMessage : messageConversation.getLastMessage();
removeAllUserMessages();
userMessages.addAll( messageConversation.getUserMessages() );
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java 2013-09-03 19:31:42 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java 2013-09-04 07:35:34 +0000
@@ -28,6 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.message.MessageService;
import org.hisp.dhis.resourcetable.ResourceTableService;
import org.hisp.dhis.scheduling.TaskId;
import org.hisp.dhis.system.notification.NotificationLevel;
@@ -46,6 +47,9 @@
@Autowired
private Notifier notifier;
+ @Autowired
+ private MessageService messageService;
+
private TaskId taskId;
public void setTaskId( TaskId taskId )
@@ -71,6 +75,10 @@
catch ( RuntimeException ex )
{
notifier.notify( taskId, NotificationLevel.ERROR, "Process failed: " + ex.getMessage(), true );
+
+ messageService.sendFeedback( "Resource table process failed", "Resource table process failed, please check the logs.", null );
+
+ throw ex;
}
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/scheduling/AnalyticsTableTask.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/scheduling/AnalyticsTableTask.java 2013-09-03 19:31:42 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/scheduling/AnalyticsTableTask.java 2013-09-04 07:35:34 +0000
@@ -34,6 +34,7 @@
import javax.annotation.Resource;
import org.hisp.dhis.analytics.AnalyticsTableService;
+import org.hisp.dhis.message.MessageService;
import org.hisp.dhis.resourcetable.ResourceTableService;
import org.hisp.dhis.scheduling.TaskId;
import org.hisp.dhis.system.notification.Notifier;
@@ -62,6 +63,9 @@
@Autowired
private Notifier notifier;
+
+ @Autowired
+ private MessageService messageService;
private boolean last3Years;
@@ -111,6 +115,10 @@
catch ( RuntimeException ex )
{
notifier.notify( taskId, ERROR, "Process failed: " + ex.getMessage(), true );
+
+ messageService.sendFeedback( "Analytics table process failed", "Analytics table process failed, please check the logs.", null );
+
+ throw ex;
}
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java 2013-09-04 07:35:34 +0000
@@ -123,6 +123,7 @@
if ( sender == null )
{
sender = currentUserService.getCurrentUser();
+
if ( sender != null )
{
users.add( sender );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-09-04 07:35:34 +0000
@@ -619,7 +619,7 @@
executeSql( "ALTER TABLE dataelement ALTER COLUMN domaintype SET NOT NULL" );
executeSql( "update dataelementcategory set datadimension = false where datadimension is null" );
- executeSql( "UPDATE dataset SET dataelementdecoration=false WHERE dataelementdecoration is null" );
+ executeSql( "UPDATE dataset SET dataelementdecoration=false WHERE dataelementdecoration is null" );
executeSql( "alter table validationrulegroup rename column validationgroupid to validationrulegroupid" );
executeSql( "alter table sqlview rename column viewid to sqlviewid" );
@@ -629,6 +629,7 @@
executeSql( "UPDATE optionset SET version=1 WHERE version IS NULL" );
executeSql( "ALTER TABLE datavalue ALTER COLUMN lastupdated TYPE timestamp" );
+ executeSql( "ALTER TABLE message ALTER COLUMN userid DROP NOT NULL" );
log.info( "Tables updated" );
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DataMartTask.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DataMartTask.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DataMartTask.java 2013-09-04 07:35:34 +0000
@@ -30,6 +30,7 @@
import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_SCHEDULED_PERIOD_TYPES;
import static org.hisp.dhis.setting.SystemSettingManager.KEY_SCHEDULED_PERIOD_TYPES;
+import static org.hisp.dhis.system.notification.NotificationLevel.ERROR;
import java.util.ArrayList;
import java.util.Collection;
@@ -40,10 +41,12 @@
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.completeness.DataSetCompletenessEngine;
import org.hisp.dhis.datamart.DataMartEngine;
+import org.hisp.dhis.message.MessageService;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.RelativePeriods;
import org.hisp.dhis.setting.SystemSettingManager;
+import org.hisp.dhis.system.notification.Notifier;
import org.hisp.dhis.system.util.ConversionUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -67,6 +70,12 @@
@Autowired
private SystemSettingManager systemSettingManager;
+ @Autowired
+ private Notifier notifier;
+
+ @Autowired
+ private MessageService messageService;
+
private List<Period> periods;
public void setPeriods( List<Period> periods )
@@ -111,8 +120,19 @@
Collection<Integer> periodIds = ConversionUtils.getIdentifiers( Period.class, periodService.reloadPeriods( periods ) );
- dataMartEngine.export( periodIds, taskId );
- completenessEngine.exportDataSetCompleteness( periodIds, taskId );
+ try
+ {
+ dataMartEngine.export( periodIds, taskId );
+ completenessEngine.exportDataSetCompleteness( periodIds, taskId );
+ }
+ catch ( RuntimeException ex )
+ {
+ notifier.notify( taskId, ERROR, "Process failed: " + ex.getMessage(), true );
+
+ messageService.sendFeedback( "Data mart process failed", "Data mart process failed, please check the logs.", null );
+
+ throw ex;
+ }
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2013-08-23 11:12:24 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2013-09-04 07:35:34 +0000
@@ -114,4 +114,5 @@
add_stuff_by_searching=Add stuff by searching from the search field above
arrange_dashboard_by_dragging_and_dropping=Tip: arrange dashboard by dragging and dropping items
click_to_explore_drag_to_new_position=Click to explore or drag to new position
-drag_to_new_position=Drag to new position
\ No newline at end of file
+drag_to_new_position=Drag to new position
+system_notification=System notification
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/message.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/message.vm 2012-10-15 10:28:30 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/message.vm 2013-09-04 07:35:34 +0000
@@ -29,7 +29,8 @@
<td style="width:40px;padding-left:5px;" onclick="toggleFollowUp( '${conversation.id}' )">
<img id="followUp${conversation.id}" #if( $conversation.followUp ) src="../images/marked.png"#else src="../images/unmarked.png"#end></td>
<td style="width:200px" onclick="read( '${conversation.id}' )">
- $!encoder.htmlEncode( $conversation.lastSenderName )#if( $conversation.messageCount > 1 ) <span class="normal">(${conversation.messageCount})</span>#end
+ #if( $conversation.lastSenderName )$!encoder.htmlEncode( $conversation.lastSenderName )#else$i18n.getString( "system_notification" )#end
+ #if( $conversation.messageCount > 1 ) <span class="normal">(${conversation.messageCount})</span>#end
</td>
<td onclick="read( '${conversation.id}' )">$!encoder.htmlEncode( $conversation.subject )</td>
<td onclick="read( '${conversation.id}' )" style="width:80px">$!format.formatDate( $conversation.lastMessage )</td>
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm 2013-01-16 12:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm 2013-09-04 07:35:34 +0000
@@ -33,8 +33,12 @@
#foreach( $message in $conversation.messages )
<div class="messageSymbol"><img src="../images/mail_small.png" onclick="toggleMetaData( '${message.id}' )"></div>
<div class="messageDiv">
-<a class="bold userLink" href="profile.action?id=${message.sender.uid}">$encoder.htmlEncode( $message.sender.name )</a>
-<span class="grey">$format.formatDate( $message.lastUpdated )</span>
+#if( $message.sender )
+<a class="bold userLink" href="profile.action?id=${message.sender.uid}">$encoder.htmlEncode( $message.sender.name )</a>
+#else
+<span class="bold">$i18n.getString( "system_notification" )</span>
+#end
+<span class="grey"> $format.formatDate( $message.lastUpdated )</span>
<div class="messageText">$!dhisTextUtils.htmlify( $encoder.htmlEncode( $message.text ) )</div>
<div id="metaData${message.id}" class="messageMetaData">$!encoder.htmlEncode( $message.metaData )</div>