Skip to content

Commit 8157def

Browse files
authored
Merge pull request #818 from DevSeg/team_collaboration_branch
Team collaboration branch
2 parents 83a545f + 0d5fbcf commit 8157def

File tree

28 files changed

+212
-44
lines changed

28 files changed

+212
-44
lines changed

apmis-flow/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>de.symeda.sormas</groupId>
88
<artifactId>apmis-flow</artifactId>
99
<name>${project.artifactId}</name>
10-
<version>1.0.37</version>
10+
<version>1.0.38</version>
1111
<packaging>war</packaging>
1212

1313
<properties>

apmis-flow/src/main/java/com/cinoteck/application/views/MainLayout.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,14 @@ private AppNav createNavigation() {
326326
nav.addItem(new AppNavItem("Form Manager", FormBuilderView.class, VaadinIcon.BUILDING, "navitem"));
327327
}
328328

329-
if (userProvider.getUser().getUsertype() == UserType.WHO_USER) {
329+
if (userProvider.getUser().getUsertype() == UserType.WHO_USER || userProvider.getUser().getUsertype() == UserType.EOC_USER) {
330330
if (userProvider.hasUserRight(UserRight.USER_ACTIVITY_SUMMARYVIEW)) {
331331
nav.addItem(new AppNavItem(I18nProperties.getCaption("User Activity Summary"),
332332
UserActivitySummary.class, VaadinIcon.CHART_LINE, "navitem"));
333333
}
334334
}
335335

336-
if ((userProvider.getUser().getUsertype() == UserType.WHO_USER)
336+
if ((userProvider.getUser().getUsertype() == UserType.WHO_USER || userProvider.getUser().getUsertype() == UserType.EOC_USER)
337337
&& userProvider.hasUserRight(UserRight.PUSH_NOTIFICATION_ACCESS)) {
338338
nav.addItem(new AppNavItem("Notification", MessagingView.class, VaadinIcon.SERVER, "navitem"));
339339
}

apmis-flow/src/main/java/com/cinoteck/application/views/campaigndata/CampaignFormBuilder.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,8 @@ public CampaignFormBuilder(List<CampaignFormElement> formElements, List<Campaign
582582

583583
}
584584

585+
}else {
586+
cbCommunity.setVisible(false);
585587
}
586588

587589
if (uuidForm != null) {

apmis-flow/src/main/java/com/cinoteck/application/views/campaigndata/CampaignFormDataEditForm.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@ public CampaignFormDataEditForm(CampaignFormMetaReferenceDto campaignFormMetaRef
405405
dialog.open();
406406
}
407407
// showConfirmationDialog();
408+
409+
408410
});
409411
dialog.setCloseOnEsc(false);
410412
dialog.setCloseOnOutsideClick(false);

apmis-flow/src/main/java/com/cinoteck/application/views/user/UserForm.java

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public void configureFields(UserDto user) {
260260
.bind(userx -> userx.getLanguage(),(userx, userOrganisation) -> userx.setLanguage(userOrganisation));
261261

262262

263-
this.binder.forField(this.userRoles).withValidator(new UserRolesValidator())
263+
this.binder.forField(this.userRoles ).withValidator(new UserRolesValidator())
264264
.asRequired(I18nProperties.getCaption(Captions.userRoleRequired))//.asRequired("Please Fill Out a First and Last Name")
265265
.bind(userx -> userx.getUserRoles(),(userx, userOrganisation) -> userx.setUserRoles(userOrganisation));
266266

@@ -307,8 +307,8 @@ public void configureFields(UserDto user) {
307307
roles.remove(UserRole.PUBLISH_USER);
308308
// System.out.println("PUBLISH_USER removed +++___________333333: " + roles);
309309
}
310-
if (roles.contains(UserRole.EDITOR_USER)) {
311-
roles.remove(UserRole.EDITOR_USER);
310+
if (!roles.contains(UserRole.EDITOR_USER)) {
311+
roles.add(UserRole.EDITOR_USER);
312312
// System.out.println("PUBLISH_USER removed +++___________333333: " + roles);
313313
}
314314
}
@@ -381,7 +381,7 @@ public void configureFields(UserDto user) {
381381
final JurisdictionLevel jurisdictionLevel = UserRole.getJurisdictionLevel(userRoles.getValue());
382382
System.out.println((jurisdictionLevel == JurisdictionLevel.DISTRICT) + " +++___________111"
383383
+ userRoles.getValue());
384-
if (jurisdictionLevel == JurisdictionLevel.DISTRICT) {
384+
if (jurisdictionLevel == JurisdictionLevel.DISTRICT && userRoles.getValue().contains(UserRole.SURVEILLANCE_OFFICER)) {
385385

386386
districtMulti.setVisible(true);
387387
district.setVisible(false);
@@ -443,14 +443,26 @@ public void configureFields(UserDto user) {
443443
} else {
444444
district.setItems(districts);
445445
}
446+
447+
isDistrictMulti = false;
448+
449+
districtMulti.setVisible(false);
450+
district.setVisible(true);
451+
clusterNo.setVisible(false);
452+
453+
446454
}
447455
}
448456

449457
});
450458

451459
district.setItemLabelGenerator(DistrictReferenceDto::getCaption);
452460
district.addValueChangeListener(e -> {
453-
if (!isDistrictMulti) {
461+
462+
463+
System.out.println(isDistrictMulti + " isDistrictMultiisDistrictMultivvvvvvvddddddDISTRICT CHANGES!!ssssssssssefasdfa:");
464+
465+
if (!isDistrictMulti && !userRoles.getValue().contains(UserRole.DISTRICT_OBSERVER)) {
454466
DistrictReferenceDto districtDto = (DistrictReferenceDto) e.getValue();
455467
System.out.println(districtDto + " vvvvvvvddddddDISTRICT CHANGES!!ssssssssssefasdfa:" + e.getValue());
456468

@@ -516,7 +528,18 @@ public void configureFields(UserDto user) {
516528
//
517529
}
518530
}
519-
} else {
531+
}
532+
else if(!isDistrictMulti && userRoles.getValue().contains(UserRole.DISTRICT_OBSERVER)) {
533+
if (e.getValue() != null) {
534+
clusterNo.clear();
535+
536+
clusterNo.setVisible(false);
537+
538+
539+
}
540+
}
541+
else {
542+
520543
district.clear();
521544
district.setVisible(false);
522545
clusterNo.clear();
@@ -1342,18 +1365,26 @@ public Registration addUserFieldValueChangeEventListener(
13421365
protected void updateFieldsByUserRole(Set<UserRole> userRoles) {
13431366
final JurisdictionLevel jurisdictionLevel = UserRole.getJurisdictionLevel(userRoles);
13441367
final boolean useCommunity = jurisdictionLevel == JurisdictionLevel.COMMUNITY;
1345-
final boolean useDistrictOnly = jurisdictionLevel == JurisdictionLevel.DISTRICT;
1346-
final boolean useDistrict = jurisdictionLevel == JurisdictionLevel.DISTRICT || useCommunity;
1368+
final boolean useDistrictOnly = jurisdictionLevel == JurisdictionLevel.DISTRICT && userRoles.contains(UserRole.SURVEILLANCE_OFFICER);
1369+
final boolean useDistrict = jurisdictionLevel == JurisdictionLevel.DISTRICT && !userRoles.contains(UserRole.SURVEILLANCE_OFFICER) ;
13471370
final boolean useRegion = jurisdictionLevel == JurisdictionLevel.REGION || useDistrict;
13481371
final boolean useArea = jurisdictionLevel == JurisdictionLevel.AREA || useRegion;
1372+
1373+
System.out.println(useArea + "useArea" + useRegion + "useRegion" + useDistrict + "useDistrict" + useDistrictOnly + "useDistrictOnly" + useCommunity + "useCommunity");
13491374
if (useCommunity) {
1375+
1376+
System.out.println(useCommunity + "useCommunity" );
1377+
13501378
clusterNo.setVisible(true);
13511379
district.setVisible(true);
13521380
districtMulti.clear();
13531381
districtMulti.setVisible(false);
13541382
province.setVisible(true);
13551383
region.setVisible(true);
13561384
} else if (useDistrictOnly) {
1385+
1386+
System.out.println(useDistrictOnly + "useDistrictOnly" );
1387+
13571388
clusterNo.clear();
13581389
clusterNo.setVisible(false);
13591390
// district.clear();
@@ -1362,14 +1393,20 @@ protected void updateFieldsByUserRole(Set<UserRole> userRoles) {
13621393
province.setVisible(true);
13631394
region.setVisible(true);
13641395
} else if (useDistrict) {
1396+
1397+
System.out.println(useDistrict + "useDistrict" );
1398+
13651399
clusterNo.clear();
13661400
clusterNo.setVisible(false);
13671401
district.clear();
13681402
district.setVisible(false);
1369-
districtMulti.setVisible(true);
1403+
districtMulti.setVisible(false);
13701404
province.setVisible(true);
13711405
region.setVisible(true);
13721406
} else if (useRegion) {
1407+
1408+
System.out.println(useRegion + "useRegion" );
1409+
13731410
clusterNo.clear();
13741411
clusterNo.setVisible(false);
13751412
district.clear();
@@ -1379,6 +1416,9 @@ protected void updateFieldsByUserRole(Set<UserRole> userRoles) {
13791416
province.setVisible(true);
13801417
region.setVisible(true);
13811418
} else if (useArea) {
1419+
1420+
System.out.println(useArea + "useArea" );
1421+
13821422
clusterNo.clear();
13831423
clusterNo.setVisible(false);
13841424
district.clear();
@@ -1389,6 +1429,10 @@ protected void updateFieldsByUserRole(Set<UserRole> userRoles) {
13891429
province.setVisible(false);
13901430
region.setVisible(true);
13911431
} else {
1432+
1433+
1434+
System.out.println("voidddddd---- " + "useArea" );
1435+
13921436
clusterNo.clear();
13931437
clusterNo.setVisible(false);
13941438
district.clear();

sormas-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<parent>
33
<groupId>de.symeda.sormas</groupId>
44
<artifactId>sormas-base</artifactId>
5-
<version>1.0.37</version>
5+
<version>1.0.38</version>
66
<relativePath>../sormas-base</relativePath>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.20
1+
4.0.6

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/campaign/form/CampaignFormMetaRegion.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@
3737

3838
@Entity(name = CampaignFormMetaRegion.TABLE_NAME)
3939
@DatabaseTable(tableName = CampaignFormMetaRegion.TABLE_NAME)
40-
public class CampaignFormMetaRegion extends PseudonymizableAdo {
41-
40+
public class CampaignFormMetaRegion extends PseudonymizableAdo implements Serializable {
4241
public static final String TABLE_NAME = "campaignformmeta_area";
4342
public static final String I18N_PREFIX = "CampaignFormMetaArea";
4443

4544
public static final String FORM_ID = "area_id";
4645
public static final String FORM_NAME = "campaignformmeta_id";
46+
// public static final String UUID = "uuid";
47+
4748

4849
@Column(name = "area_id")
4950
private String area_id; // Change to Long to match server
@@ -52,6 +53,7 @@ public class CampaignFormMetaRegion extends PseudonymizableAdo {
5253
private String campaignformmeta_id; // Change to Long to match server
5354

5455

56+
5557
public String getArea_id() {
5658
return area_id;
5759
}
@@ -68,6 +70,7 @@ public void setCampaignformmeta_id(String campaignformmeta_id) {
6870
this.campaignformmeta_id = campaignformmeta_id;
6971
}
7072

73+
7174
// Internationalization prefix
7275
public String getI18nPrefix() {
7376
return I18N_PREFIX;

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/campaign/form/CampaignFormMetaRegionDtoHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected Call<List<PushResult>> pushAll(List<CampaignFormMetaRegionDto> campaig
6868

6969
@Override
7070
protected void fillInnerFromDto(CampaignFormMetaRegion target, CampaignFormMetaRegionDto source) {
71-
target.setUuid(source.getUuid());
71+
// target.setUuid(source.getUuid());
7272
target.setUuid(source.getUuid());
7373
target.setCampaignformmeta_id(source.getCampaignformmeta_id());
7474
target.setArea_id(source.getArea_id());

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
189189
// any time you make changes to your database objects, you may have to increase the database version
190190

191191

192-
public static final int DATABASE_VERSION = 348;
192+
public static final int DATABASE_VERSION = 350;
193193

194194
private static DatabaseHelper instance = null;
195195

@@ -3254,14 +3254,63 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
32543254
"ALTER TABLE campaignformdata ADD COLUMN recordversion BIGINT DEFAULT 1;"
32553255
);
32563256

3257+
// case 348:
3258+
// currentVersion = 348;
3259+
// getDao(User.class).executeRaw(
3260+
// "ALTER TABLE users ADD COLUMN userFormAccess varchar(255);");
3261+
//
32573262
case 348:
32583263
currentVersion = 348;
3259-
getDao(User.class).executeRaw(
3260-
"ALTER TABLE users ADD COLUMN userFormAccess varchar(255);");
32613264

3265+
// Check if userFormAccess column exists
3266+
GenericRawResults<String[]> tableColumnsx = getDao(User.class).queryRaw("pragma table_info(users)");
3267+
int nameColumnIndexx = Arrays.asList(tableColumnsx.getColumnNames()).indexOf("name");
3268+
boolean columnUserFormAccessNotExists =
3269+
tableColumnsx.getResults().stream().noneMatch(columnRowData -> "userFormAccess".equals(columnRowData[nameColumnIndexx]));
32623270

3271+
if (columnUserFormAccessNotExists) {
3272+
getDao(User.class).executeRaw("ALTER TABLE users ADD COLUMN userFormAccess varchar(255);");
3273+
}
3274+
3275+
3276+
case 349:
3277+
currentVersion = 349;
3278+
getDao(PopulationData.class).executeRaw("DROP TABLE IF EXISTS populationdata;");
3279+
getDao(CampaignFormMetaRegion.class).executeRaw("DROP TABLE IF EXISTS campaignformmeta_area;");
3280+
3281+
System.out.println("----------gggggggggggggggggggggggguuuuuuuuuuuuuuuuuuuuuuuuuuuuuu");
3282+
getDao(CampaignFormMetaRegion.class).executeRaw(
3283+
"CREATE TABLE IF NOT EXISTS campaignformmeta_area ("
3284+
+ " snapshot SMALLINT DEFAULT 0, area_id VARCHAR NOT NULL, "
3285+
+" uuid VARCHAR not null, "
3286+
+ " changeDate BIGINT NOT NULL , "
3287+
+"creationDate BIGINT NOT NULL , "
32633288

3264-
break;
3289+
+ "id INTEGER PRIMARY KEY AUTOINCREMENT , "
3290+
+ " campaignformmeta_id VARCHAR NOT NULL, "
3291+
+"lastOpenedDate BIGINT , "
3292+
+"localChangeDate BIGINT, "
3293+
+" modified SMALLINT DEFAULT 0, "
3294+
+ " pseudonymized SMALLINT"
3295+
3296+
+ " );");
3297+
3298+
getDao(PopulationData.class).executeRaw(
3299+
"CREATE TABLE IF NOT EXISTS populationdata (" +
3300+
" id INTEGER PRIMARY KEY,"
3301+
+"lastOpenedDate BIGINT , "
3302+
+"localChangeDate BIGINT, snapshot SMALLINT DEFAULT 0,"
3303+
+" modified SMALLINT DEFAULT 0, "
3304+
+ " pseudonymized SMALLINT, "
3305+
+ " campaign_id VARCHAR NOT NULL,"
3306+
+ " district_id VARCHAR NOT NULL," +
3307+
" uuid varchar not null, "
3308+
+ " changeDate BIGINT NOT NULL , "
3309+
+" creationDate BIGINT NOT NULL ,"
3310+
+ " selected varchar);");
3311+
3312+
3313+
break;
32653314

32663315

32673316
default:
@@ -3273,6 +3322,10 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
32733322
throw new RuntimeException("Database upgrade failed for version " + currentVersion + ": " + ex.getMessage(), ex);
32743323
}
32753324
}
3325+
3326+
3327+
3328+
32763329
private void updatePatchForTriggers() throws SQLException {
32773330
getDao(CampaignFormData.class).executeRaw(
32783331
"CREATE TRIGGER prevent_duplicate_on_admin_forms\n" +

0 commit comments

Comments
 (0)