Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 2cbfa83

Browse files
committed
feedback from Review (SORMAS-Foundation#4057)
1 parent f448495 commit 2cbfa83

File tree

4 files changed

+35
-14
lines changed

4 files changed

+35
-14
lines changed

sormas-api/src/main/java/de/symeda/sormas/api/utils/DataHelper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public static String getShortUuid(String uuid) {
161161

162162
if (uuid == null)
163163
return null;
164-
return uuid.substring(0, Math.min(uuid.length(), 6)).toUpperCase();
164+
return uuid.substring(0, 6).toUpperCase();
165165
}
166166

167167
public static class Pair<K, V> implements Serializable {

sormas-api/src/test/java/de/symeda/sormas/api/utils/DataHelperTest.java

+22-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
import static org.junit.Assert.assertEquals;
44
import static org.junit.Assert.assertNull;
5+
import static org.junit.Assert.fail;
56

67
import org.junit.Test;
78

89
import de.symeda.sormas.api.Disease;
10+
import de.symeda.sormas.api.EntityDto;
11+
import de.symeda.sormas.api.ReferenceDto;
912
import de.symeda.sormas.api.caze.CaseDataDto;
1013
import de.symeda.sormas.api.region.RegionReferenceDto;
1114

@@ -45,8 +48,26 @@ public void testTryParseLong() {
4548

4649
@Test
4750
public void testShortUuid() {
48-
assertEquals("A", DataHelper.getShortUuid("A"));
51+
EntityDto entityDto = new EntityDto() {
52+
};
53+
entityDto.setUuid("ABCDEF-GHIJKL");
54+
55+
assertEquals("ABCDEF", DataHelper.getShortUuid(entityDto));
56+
57+
ReferenceDto referenceDto = new ReferenceDto() {
58+
};
59+
referenceDto.setUuid("MNOPQR-STUVWX");
60+
61+
assertEquals("MNOPQR", DataHelper.getShortUuid(referenceDto));
62+
4963
assertEquals("UZOUEH", DataHelper.getShortUuid("UZOUEH-HP7DRG-YOJ74F-PXWL2JZ4"));
5064
assertNull(DataHelper.getShortUuid((String) null));
65+
66+
try {
67+
assertEquals("A", DataHelper.getShortUuid("A"));
68+
fail("getShortUuid should not be graceful on Uuids that are too short.");
69+
} catch (StringIndexOutOfBoundsException e) {
70+
assertEquals("begin 0, end 6, length 1", e.getMessage());
71+
}
5172
}
5273
}

sormas-cargoserver/src/main/resources/layout/sormasfolders/custom/docgeneration/eventHandout/ExampleDocumentTemplateEventHandout.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ <h2>$event.uuid</h2>
1212
Community: <b>$!event_eventLocation_community</b>
1313
</p>
1414

15-
<p>Reported: $event_reportDateTime by $event_reportingUser_firstName $event_reportingUser_lastName</p>
15+
<p>Reported: <b>$event_reportDateTime</b> by <b>$event_reportingUser_firstName $event_reportingUser_lastName</b></p>
1616

1717
<h2>Description</h2>
1818

@@ -24,11 +24,11 @@ <h1>Actions</h1>
2424
<div class="actions">
2525
<h2>$action.title</h2>
2626
<p>
27-
date: $F.format($action.getDate())<br/>
28-
status: $!action.getStatus()<br/>
29-
status changed: $!F.format($action.getStatusChangeDate())<br/>
30-
created: $F.format($action.getCreationDate())<br/>
31-
modified: $!F.format($action.getChangeDate())
27+
date: <b>$F.format($action.getDate())</b><br/>
28+
status: <b>$!action.getActionStatus()</b><br/>
29+
status changed: <b>$!F.format($action.getStatusChangeDate())</b><br/>
30+
created: <b>$F.format($action.getCreationDate())</b><br/>
31+
modified: <b>$!F.format($action.getChangeDate())</b>
3232
</p>
3333
<div>#if($action.getDescription()) $action.getDescription() #else <span class="red">*</span> #end</div>
3434
<div>#if($action.reply) $action.reply #else <span class="red">*</span> #end</div>

sormas-ui/src/main/resources/ExampleDocumentTemplateEventHandout.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ <h2>$event.uuid</h2>
1212
Community: <b>$!event_eventLocation_community</b>
1313
</p>
1414

15-
<p>Reported: $event_reportDateTime by $event_reportingUser_firstName $event_reportingUser_lastName</p>
15+
<p>Reported: <b>$event_reportDateTime</b> by <b>$event_reportingUser_firstName $event_reportingUser_lastName</b></p>
1616

1717
<h2>Description</h2>
1818

@@ -24,11 +24,11 @@ <h1>Actions</h1>
2424
<div class="actions">
2525
<h2>$action.title</h2>
2626
<p>
27-
date: $F.format($action.getDate())<br/>
28-
status: $!action.getStatus()<br/>
29-
status changed: $!F.format($action.getStatusChangeDate())<br/>
30-
created: $F.format($action.getCreationDate())<br/>
31-
modified: $!F.format($action.getChangeDate())
27+
date: <b>$F.format($action.getDate())</b><br/>
28+
status: <b>$!action.getActionStatus()</b><br/>
29+
status changed: <b>$!F.format($action.getStatusChangeDate())</b><br/>
30+
created: <b>$F.format($action.getCreationDate())</b><br/>
31+
modified: <b>$!F.format($action.getChangeDate())</b>
3232
</p>
3333
<div>#if($action.getDescription()) $action.getDescription() #else <span class="red">*</span> #end</div>
3434
<div>#if($action.reply) $action.reply #else <span class="red">*</span> #end</div>

0 commit comments

Comments
 (0)