mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25:44 +01:00
Merge branch 2.0.0-M3 into bugfix_illegal_sortby
This commit is contained in:
@@ -3,25 +3,15 @@ package sonia.scm.api.v2.resources;
|
||||
import de.otto.edison.hal.HalRepresentation;
|
||||
import org.mapstruct.Mapping;
|
||||
import sonia.scm.ModelObject;
|
||||
import sonia.scm.util.AssertUtil;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
|
||||
abstract class BaseMapper<T extends ModelObject, D extends HalRepresentation> {
|
||||
|
||||
|
||||
@Mapping(target = "attributes", ignore = true) // We do not map HAL attributes
|
||||
public abstract D map(T user);
|
||||
|
||||
Instant mapTime(Long epochMilli) {
|
||||
AssertUtil.assertIsNotNull(epochMilli);
|
||||
return Instant.ofEpochMilli(epochMilli);
|
||||
}
|
||||
|
||||
Optional<Instant> mapOptionalTime(Long epochMilli) {
|
||||
return Optional
|
||||
.ofNullable(epochMilli)
|
||||
.map(Instant::ofEpochMilli);
|
||||
return epochMilli == null? null: Instant.ofEpochMilli(epochMilli);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,15 +10,14 @@ import lombok.Setter;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Getter @Setter @NoArgsConstructor
|
||||
public class GroupDto extends HalRepresentation {
|
||||
|
||||
private Instant creationDate;
|
||||
private String description;
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Optional<Instant> lastModified;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private Instant lastModified;
|
||||
private String name;
|
||||
private String type;
|
||||
private Map<String, String> properties;
|
||||
|
||||
@@ -9,7 +9,6 @@ import lombok.Setter;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@NoArgsConstructor @Getter @Setter
|
||||
public class UserDto extends HalRepresentation {
|
||||
@@ -17,8 +16,8 @@ public class UserDto extends HalRepresentation {
|
||||
private boolean admin;
|
||||
private Instant creationDate;
|
||||
private String displayName;
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Optional<Instant> lastModified;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private Instant lastModified;
|
||||
private String mail;
|
||||
private String name;
|
||||
private String password;
|
||||
|
||||
Reference in New Issue
Block a user