mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15:44 +01:00
Use field injection, but suppress SQ Bugs.
We need this b/c of MapStruct
This commit is contained in:
@@ -16,18 +16,15 @@ import static de.otto.edison.hal.Links.linkingTo;
|
||||
import static sonia.scm.api.v2.resources.ResourceLinks.group;
|
||||
import static sonia.scm.api.v2.resources.ResourceLinks.user;
|
||||
|
||||
/**
|
||||
* Mapstruct does not support parameterized (i.e. non-default) constructors. Thus, we need to use field injection.
|
||||
*/
|
||||
@java.lang.SuppressWarnings("squid:S3306")
|
||||
@Mapper
|
||||
public abstract class GroupToGroupDtoMapper extends BaseMapper<Group, GroupDto> {
|
||||
|
||||
private UriInfoStore uriInfoStore;
|
||||
|
||||
GroupToGroupDtoMapper() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public GroupToGroupDtoMapper(UriInfoStore uriInfoStore) {
|
||||
this.uriInfoStore = uriInfoStore;
|
||||
}
|
||||
private UriInfoStore uriInfoStore;
|
||||
|
||||
@AfterMapping
|
||||
void appendLinks(Group group, @MappingTarget GroupDto target) {
|
||||
|
||||
@@ -7,6 +7,10 @@ import javax.inject.Inject;
|
||||
|
||||
import static sonia.scm.api.v2.resources.ResourceLinks.userCollection;
|
||||
|
||||
/**
|
||||
* Mapstruct does not support parameterized (i.e. non-default) constructors. Thus, we need to use field injection.
|
||||
*/
|
||||
@java.lang.SuppressWarnings("squid:S3306")
|
||||
public class UserCollectionToDtoMapper extends BasicCollectionToDtoMapper<User, UserDto> {
|
||||
|
||||
private final UriInfoStore uriInfoStore;
|
||||
|
||||
@@ -8,18 +8,15 @@ import javax.inject.Inject;
|
||||
|
||||
import static sonia.scm.api.rest.resources.UserResource.DUMMY_PASSWORT;
|
||||
|
||||
/**
|
||||
* Mapstruct does not support parameterized (i.e. non-default) constructors. Thus, we need to use field injection.
|
||||
*/
|
||||
@java.lang.SuppressWarnings("squid:S3306")
|
||||
@Mapper
|
||||
public abstract class UserDtoToUserMapper {
|
||||
|
||||
private PasswordService passwordService;
|
||||
|
||||
UserDtoToUserMapper() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
public UserDtoToUserMapper(PasswordService passwordService) {
|
||||
this.passwordService = passwordService;
|
||||
}
|
||||
private PasswordService passwordService;
|
||||
|
||||
@Mappings({
|
||||
@Mapping(source = "password", target = "password", qualifiedByName = "encrypt"),
|
||||
|
||||
@@ -14,6 +14,10 @@ import static de.otto.edison.hal.Link.link;
|
||||
import static de.otto.edison.hal.Links.linkingTo;
|
||||
import static sonia.scm.api.v2.resources.ResourceLinks.user;
|
||||
|
||||
/**
|
||||
* Mapstruct does not support parameterized (i.e. non-default) constructors. Thus, we need to use field injection.
|
||||
*/
|
||||
@java.lang.SuppressWarnings("squid:S3306")
|
||||
@Mapper
|
||||
public abstract class UserToUserDtoMapper extends BaseMapper<User, UserDto> {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user