Make partial file attributes explicit.

This commit is contained in:
Rene Pfeuffer
2019-12-18 11:48:17 +01:00
parent 0d6dcbd6bd
commit cf9d1edb70
16 changed files with 190 additions and 103 deletions

View File

@@ -15,6 +15,9 @@ import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.time.Instant;
import java.util.Optional;
import java.util.OptionalLong;
@Mapper
public abstract class BrowserResultToFileObjectDtoMapper extends BaseFileObjectDtoMapper {
@@ -39,6 +42,14 @@ public abstract class BrowserResultToFileObjectDtoMapper extends BaseFileObjectD
applyEnrichers(appender, fileObject, namespaceAndName, browserResult, browserResult.getRevision());
}
Optional<Instant> mapOptionalInstant(OptionalLong optionalLong) {
if (optionalLong.isPresent()) {
return Optional.of(Instant.ofEpochMilli(optionalLong.getAsLong()));
} else {
return Optional.empty();
}
}
@Qualifier
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.CLASS)

View File

@@ -10,6 +10,8 @@ import lombok.Setter;
import java.time.Instant;
import java.util.List;
import java.util.Optional;
import java.util.OptionalLong;
@Getter
@Setter
@@ -19,10 +21,10 @@ public class FileObjectDto extends HalRepresentation {
private String path;
private boolean directory;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String description;
private long length;
private Optional<String> description;
private OptionalLong length;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Instant lastModified;
private Optional<Instant> commitDate;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private SubRepositoryDto subRepository;
@JsonInclude(JsonInclude.Include.NON_EMPTY)