Skip to content

Commit cd947cc

Browse files
committed
forgot to add statement in RestApi [see #110]
1 parent acaa588 commit cd947cc

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/main/java/de/unirostock/sems/cbarchive/web/UserManager.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ public UserData getData() {
8989
public void setData(UserData data) {
9090
this.data = data;
9191
}
92+
93+
public boolean hasData() {
94+
return data != null ? data.hasInformation() : false;
95+
}
9296

9397
public String getWorkspaceId() {
9498
return workspace.getWorkspaceId();
@@ -237,7 +241,7 @@ public String createArchive( String name, VCard creator ) throws IOException, JD
237241
return createArchive(name, null, creator);
238242
}
239243

240-
private String createArchive( String name, File existingArchive, VCard creator ) throws IOException, JDOMException, ParseException, CombineArchiveException, TransformerException {
244+
public String createArchive( String name, File existingArchive, VCard creator ) throws IOException, JDOMException, ParseException, CombineArchiveException, TransformerException {
241245

242246
// generates new unique UID
243247
String uuid = UUID.randomUUID ().toString ();
@@ -438,6 +442,6 @@ else if( strategy == ReplaceStrategy.RENAME ) {
438442
throw new CombineArchiveWebException("Cannot pack and close archive", e);
439443
}
440444
}
441-
445+
442446

443447
}

src/main/java/de/unirostock/sems/cbarchive/web/rest/RestApi.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ public Response createArchive( @CookieParam(Fields.COOKIE_PATH) String userPath,
574574
return buildErrorResponse(507, user, "The maximum size is reached.");
575575
}
576576

577-
String id = user.createArchive( archive.getName(), archiveFile );
577+
String id = user.createArchive( archive.getName(), archiveFile, archive.isIncludeVCard() && user.hasData() ? user.getData().getVCard() : null );
578578
archive.setId(id);
579579

580580
}
@@ -588,7 +588,7 @@ public Response createArchive( @CookieParam(Fields.COOKIE_PATH) String userPath,
588588
}
589589
else {
590590
// Ordinary creation (only include VCard, if checkbox is checked)
591-
String id = user.createArchive( archive.getName(), archive.isIncludeVCard() ? user.getData().getVCard() : null );
591+
String id = user.createArchive( archive.getName(), archive.isIncludeVCard() && user.hasData() ? user.getData().getVCard() : null );
592592
archive.setId(id);
593593
}
594594

@@ -691,7 +691,7 @@ public Response createArchiveFromMultipart( @CookieParam(Fields.COOKIE_PATH) Str
691691
}
692692

693693
// creates a existing archive in the working space (check is included)
694-
String id = user.createArchive( archive.getName(), temp.toFile() );
694+
String id = user.createArchive( archive.getName(), temp.toFile(), archive.isIncludeVCard() && user.hasData() ? user.getData().getVCard() : null );
695695
archive.setId(id);
696696

697697
// trigger quota update

0 commit comments

Comments
 (0)