Skip to content

Commit

Permalink
[GITFLOW]merging 'hotfix-1.72.2' into 'master-1.72.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
MateStrysewske committed Jun 23, 2022
2 parents cd89f01 + d6be27c commit 8933ae1
Show file tree
Hide file tree
Showing 53 changed files with 620 additions and 380 deletions.
2 changes: 1 addition & 1 deletion sormas-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<version>1.72.1</version>
<version>1.72.2</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ public static SymptomsDto build() {
ANTHRAX })
@DependantOn(LESIONS)
@HideForCountries
@SymptomGrouping(SymptomGroup.SKIN)
private Date lesionsOnsetDate;

@Diseases({
Expand All @@ -941,23 +942,27 @@ public static SymptomsDto build() {
MONKEYPOX })
@DependantOn(LESIONS)
@HideForCountries
@SymptomGrouping(SymptomGroup.SKIN)
private SymptomState lesionsResembleImg1;
@Diseases({
MONKEYPOX })
@DependantOn(LESIONS)
@HideForCountries
@SymptomGrouping(SymptomGroup.SKIN)
private SymptomState lesionsResembleImg2;

@Diseases({
MONKEYPOX })
@DependantOn(LESIONS)
@HideForCountries
@SymptomGrouping(SymptomGroup.SKIN)
private SymptomState lesionsResembleImg3;

@Diseases({
MONKEYPOX })
@DependantOn(LESIONS)
@HideForCountries
@SymptomGrouping(SymptomGroup.SKIN)
private SymptomState lesionsResembleImg4;

@Diseases({
Expand All @@ -969,6 +974,7 @@ public static SymptomsDto build() {
OTHER })
@DependantOn(LESIONS)
@HideForCountries
@SymptomGrouping(SymptomGroup.SKIN)
private SymptomState lesionsSameSize;

@Diseases({
Expand All @@ -980,6 +986,7 @@ public static SymptomsDto build() {
OTHER })
@DependantOn(LESIONS)
@HideForCountries
@SymptomGrouping(SymptomGroup.SKIN)
private SymptomState lesionsSameState;

@Diseases({
Expand All @@ -991,6 +998,7 @@ public static SymptomsDto build() {
OTHER })
@DependantOn(LESIONS)
@HideForCountries
@SymptomGrouping(SymptomGroup.SKIN)
private Boolean lesionsSolesFeet;

@Diseases({
Expand All @@ -1002,6 +1010,7 @@ public static SymptomsDto build() {
OTHER })
@DependantOn(LESIONS)
@HideForCountries
@SymptomGrouping(SymptomGroup.SKIN)
private SymptomState lesionsThatItch;

@Diseases({
Expand All @@ -1013,6 +1022,7 @@ public static SymptomsDto build() {
OTHER })
@DependantOn(LESIONS)
@HideForCountries
@SymptomGrouping(SymptomGroup.SKIN)
private Boolean lesionsThorax;

@Diseases({
Expand Down
1 change: 1 addition & 0 deletions sormas-app/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ dependencies {
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.12.4'
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation "androidx.paging:paging-runtime:$paging_version"
implementation 'androidx.work:work-runtime-ktx:2.7.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.hamcrest:hamcrest-core:2.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import android.content.Intent;
import android.content.res.Resources;
import android.location.Location;
import android.os.Build;
import android.text.Html;
import android.util.Log;

Expand Down Expand Up @@ -411,7 +412,11 @@ public Case mergeOrCreate(Case source) throws DaoException {

Intent notificationIntent = new Intent(context, CaseReadActivity.class);
notificationIntent.putExtras(CaseReadActivity.buildBundle(mergedCase.getUuid(), false).get());
PendingIntent pi = PendingIntent.getActivity(context, mergedCase.getId().intValue(), notificationIntent, 0);
PendingIntent pi = PendingIntent.getActivity(
context,
mergedCase.getId().intValue(),
notificationIntent,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_ONE_SHOT);
Resources r = context.getResources();

NotificationCompat.Builder notificationBuilder =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.IBinder;

import de.symeda.sormas.api.utils.DateHelper;
Expand All @@ -29,7 +30,11 @@ public static void startFeatureConfigurationService(Context context) {
AlarmManager alarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);

Intent intent = new Intent(context, FeatureConfigurationService.class);
PendingIntent alarmIntent = PendingIntent.getService(context, 1515, intent, 0);
PendingIntent alarmIntent = PendingIntent.getService(
context,
1515,
intent,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_ONE_SHOT);

Date date = DateHelper.getEndOfDay(new Date());
alarmMgr.setInexactRepeating(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,25 @@

package de.symeda.sormas.app.core;

import java.util.Date;
import java.util.List;

import org.joda.time.DateTime;

import android.app.AlarmManager;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Build;
import android.os.IBinder;
import android.text.Html;
import android.text.TextUtils;

import androidx.core.app.NotificationCompat;

import org.joda.time.DateTime;

import java.util.Date;
import java.util.List;

import de.symeda.sormas.api.feature.FeatureType;
import de.symeda.sormas.api.user.UserRight;
import de.symeda.sormas.api.utils.DateHelper;
Expand Down Expand Up @@ -96,10 +97,10 @@ public int onStartCommand(Intent intent, int flags, int startId) {

public static void doTaskNotification(Context context) {

if (!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_GENERAL) ||
!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_CASE_SURVEILLANCE) ||
!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_CONTACT_TRACING) ||
!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_EVENT_SURVEILLANCE)) {
if (!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_GENERAL)
|| !DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_CASE_SURVEILLANCE)
|| !DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_CONTACT_TRACING)
|| !DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_EVENT_SURVEILLANCE)) {

Date notificationRangeStart = ConfigProvider.getLastNotificationDate();
if (notificationRangeStart == null) {
Expand All @@ -120,50 +121,58 @@ public static void doTaskNotification(Context context) {
Event event = null;
StringBuilder content = new StringBuilder();
switch (task.getTaskContext()) {
case CASE:
if (task.getCaze() != null && !DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_CASE_SURVEILLANCE)) {
caze = caseDAO.queryForId(task.getCaze().getId());
content.append("<b>").append(caze.toString()).append("</b><br/>");
}
break;
case CONTACT:
if (task.getContact() != null && !DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_CONTACT_TRACING)) {
contact = contactDAO.queryForId(task.getContact().getId());
content.append("<b>").append(contact.toString()).append("</b><br/>");
}
break;
case EVENT:
if (task.getEvent() != null && !DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_EVENT_SURVEILLANCE)) {
event = eventDAO.queryForId(task.getEvent().getId());
content.append("<b>").append(event.toString()).append("</b><br/>");
}
break;
case GENERAL:
break;
default:
continue;
case CASE:
if (task.getCaze() != null
&& !DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_CASE_SURVEILLANCE)) {
caze = caseDAO.queryForId(task.getCaze().getId());
content.append("<b>").append(caze.toString()).append("</b><br/>");
}
break;
case CONTACT:
if (task.getContact() != null
&& !DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_CONTACT_TRACING)) {
contact = contactDAO.queryForId(task.getContact().getId());
content.append("<b>").append(contact.toString()).append("</b><br/>");
}
break;
case EVENT:
if (task.getEvent() != null
&& !DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.TASK_GENERATION_EVENT_SURVEILLANCE)) {
event = eventDAO.queryForId(task.getEvent().getId());
content.append("<b>").append(event.toString()).append("</b><br/>");
}
break;
case GENERAL:
break;
default:
continue;
}

Intent notificationIntent = new Intent(context, TaskEditActivity.class);
notificationIntent.putExtras(TaskEditActivity.buildBundle(task.getUuid()).get());
// Just for your information: The issue here was that the second argument of the getActivity call
// was set to 0, which leads to previous intents to be recycled; passing the task's ID instead
// makes sure that a new intent with the right task behind it is created
PendingIntent pi = PendingIntent.getActivity(context, task.getId().intValue(), notificationIntent, 0);
PendingIntent pi = PendingIntent.getActivity(
context,
task.getId().intValue(),
notificationIntent,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_ONE_SHOT);
Resources r = context.getResources();

if (!TextUtils.isEmpty(task.getCreatorComment())) {
content.append(task.getCreatorComment());
}

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, NotificationHelper.NOTIFICATION_CHANNEL_TASKS_ID)
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(context, NotificationHelper.NOTIFICATION_CHANNEL_TASKS_ID)
.setTicker(r.getString(R.string.heading_task_notification))
.setSmallIcon(R.mipmap.ic_launcher_foreground)
.setContentTitle(
task.getTaskType().toString()
+ (caze != null
? " (" + caze.getDisease().toShortString() + ")"
: contact != null ? " (" + contact.getDisease().toShortString() + ")" : ""))
task.getTaskType().toString()
+ (caze != null
? " (" + caze.getDisease().toShortString() + ")"
: contact != null ? " (" + contact.getDisease().toShortString() + ")" : ""))
.setStyle(new NotificationCompat.BigTextStyle().bigText(Html.fromHtml(content.toString())))
.setContentIntent(pi)
.setAutoCancel(true)
Expand All @@ -184,7 +193,7 @@ public static void doTaskNotification(Context context) {

private static void doWeeklyReportNotification(Context context, Date notificationRangeStart, Date notificationRangeEnd) {
if (ConfigProvider.hasUserRight(UserRight.WEEKLYREPORT_CREATE)
&& !DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.WEEKLY_REPORTING)) {
&& !DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.WEEKLY_REPORTING)) {
// notify at 6:00
Date notificationPoint = DateHelper.addSeconds(DateHelper.getStartOfDay(new Date()), 60 * 60 * 6);
if (DateHelper.isBetween(notificationPoint, notificationRangeStart, notificationRangeEnd)) {
Expand All @@ -194,7 +203,11 @@ private static void doWeeklyReportNotification(Context context, Date notificatio

int notificationId = (int) notificationPoint.getTime();
Intent notificationIntent = new Intent(context, ReportActivity.class);
PendingIntent pi = PendingIntent.getActivity(context, notificationId, notificationIntent, 0);
PendingIntent pi = PendingIntent.getActivity(
context,
notificationId,
notificationIntent,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_ONE_SHOT);

String title = context.getResources().getString(R.string.action_submit_report);

Expand All @@ -218,7 +231,11 @@ public static void startTaskNotificationAlarm(Context context) {
AlarmManager alarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);

Intent intent = new Intent(context, TaskNotificationService.class);
PendingIntent alarmIntent = PendingIntent.getService(context, 1414, intent, 0);
PendingIntent alarmIntent = PendingIntent.getService(
context,
1414,
intent,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_ONE_SHOT);

// setRepeating() lets you specify a precise custom interval--in this case, 5 minutes.
Date now = new Date();
Expand Down
2 changes: 1 addition & 1 deletion sormas-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.72.1</version>
<version>1.72.2</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion sormas-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>1.72.1</version>
<version>1.72.2</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.List;
import java.util.stream.Collectors;

import javax.annotation.security.RolesAllowed;
import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
Expand All @@ -47,9 +46,10 @@
import de.symeda.sormas.backend.user.UserService;
import de.symeda.sormas.backend.util.DtoHelper;
import de.symeda.sormas.backend.util.ModelConstants;
import de.symeda.sormas.backend.util.RightsAllowed;

@Stateless(name = "ActionFacade")
@RolesAllowed(UserRight._EVENT_VIEW)
@RightsAllowed(UserRight._EVENT_VIEW)
public class ActionFacadeEjb implements ActionFacade {

@PersistenceContext(unitName = ModelConstants.PERSISTENCE_UNIT_NAME)
Expand Down Expand Up @@ -126,7 +126,9 @@ public ActionDto toDto(Action source) {
}

@Override
@RolesAllowed({UserRight._ACTION_CREATE, UserRight._ACTION_EDIT})
@RightsAllowed({
UserRight._ACTION_CREATE,
UserRight._ACTION_EDIT })
public ActionDto saveAction(@Valid ActionDto dto) {

Action ado = fromDto(dto, true);
Expand All @@ -140,7 +142,7 @@ public ActionDto getByUuid(String uuid) {
}

@Override
@RolesAllowed(UserRight._ACTION_DELETE)
@RightsAllowed(UserRight._ACTION_DELETE)
public void deleteAction(ActionDto actionDto) {
Action action = actionService.getByUuid(actionDto.getUuid());
actionService.deletePermanent(action);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.Optional;
import java.util.stream.Collectors;

import javax.annotation.security.RolesAllowed;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
Expand Down Expand Up @@ -61,9 +60,10 @@
import de.symeda.sormas.backend.symptoms.Symptoms;
import de.symeda.sormas.backend.util.ModelConstants;
import de.symeda.sormas.backend.util.QueryHelper;
import de.symeda.sormas.backend.util.RightsAllowed;

@Stateless(name = "BAGExportFacade")
@RolesAllowed(UserRight._BAG_EXPORT)
@RightsAllowed(UserRight._BAG_EXPORT)
public class BAGExportFacadeEjb implements BAGExportFacade {

private static final String TODO_VALUE = "";
Expand Down
Loading

0 comments on commit 8933ae1

Please sign in to comment.