mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +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.group;
|
||||||
import static sonia.scm.api.v2.resources.ResourceLinks.user;
|
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
|
@Mapper
|
||||||
public abstract class GroupToGroupDtoMapper extends BaseMapper<Group, GroupDto> {
|
public abstract class GroupToGroupDtoMapper extends BaseMapper<Group, GroupDto> {
|
||||||
|
|
||||||
private UriInfoStore uriInfoStore;
|
|
||||||
|
|
||||||
GroupToGroupDtoMapper() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public GroupToGroupDtoMapper(UriInfoStore uriInfoStore) {
|
private UriInfoStore uriInfoStore;
|
||||||
this.uriInfoStore = uriInfoStore;
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterMapping
|
@AfterMapping
|
||||||
void appendLinks(Group group, @MappingTarget GroupDto target) {
|
void appendLinks(Group group, @MappingTarget GroupDto target) {
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import static sonia.scm.api.v2.resources.ResourceLinks.userCollection;
|
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> {
|
public class UserCollectionToDtoMapper extends BasicCollectionToDtoMapper<User, UserDto> {
|
||||||
|
|
||||||
private final UriInfoStore uriInfoStore;
|
private final UriInfoStore uriInfoStore;
|
||||||
|
|||||||
@@ -8,18 +8,15 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import static sonia.scm.api.rest.resources.UserResource.DUMMY_PASSWORT;
|
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
|
@Mapper
|
||||||
public abstract class UserDtoToUserMapper {
|
public abstract class UserDtoToUserMapper {
|
||||||
|
|
||||||
private PasswordService passwordService;
|
|
||||||
|
|
||||||
UserDtoToUserMapper() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public UserDtoToUserMapper(PasswordService passwordService) {
|
private PasswordService passwordService;
|
||||||
this.passwordService = passwordService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Mappings({
|
@Mappings({
|
||||||
@Mapping(source = "password", target = "password", qualifiedByName = "encrypt"),
|
@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 de.otto.edison.hal.Links.linkingTo;
|
||||||
import static sonia.scm.api.v2.resources.ResourceLinks.user;
|
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
|
@Mapper
|
||||||
public abstract class UserToUserDtoMapper extends BaseMapper<User, UserDto> {
|
public abstract class UserToUserDtoMapper extends BaseMapper<User, UserDto> {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user