Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
162 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
core/src/main/java/ch/silviowangler/dox/mappers/DocumentClassMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package ch.silviowangler.dox.mappers; | ||
|
||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.mapstruct.Mappings; | ||
|
||
import java.util.List; | ||
import java.util.SortedSet; | ||
|
||
import ch.silviowangler.dox.api.Attribute; | ||
import ch.silviowangler.dox.api.AttributeDataType; | ||
import ch.silviowangler.dox.api.Domain; | ||
import ch.silviowangler.dox.api.rest.DocumentClass; | ||
|
||
|
||
/** | ||
* @author Silvio Wangler | ||
*/ | ||
@Mapper(config = MappingConfig.class) | ||
public interface DocumentClassMapper { | ||
|
||
@Mappings({ | ||
@Mapping(target = "client", source = "client.shortName"), | ||
@Mapping(target = "attributes", ignore = true), | ||
@Mapping(target = "translation", ignore = true) | ||
}) | ||
DocumentClass toDocumentClassRestApi(ch.silviowangler.dox.domain.DocumentClass domain); | ||
|
||
@Mappings({ | ||
@Mapping(target = "client", source = "client.shortName"), | ||
@Mapping(target = "translation", ignore = true) | ||
}) | ||
ch.silviowangler.dox.api.DocumentClass toDocumentClassApi(ch.silviowangler.dox.domain.DocumentClass documentClass); | ||
|
||
@Mappings({ | ||
@Mapping(target = "modifiable", source = "updateable"), | ||
@Mapping(target = "translation", ignore = true) | ||
}) | ||
Attribute toAttributeApi(ch.silviowangler.dox.domain.Attribute domain); | ||
|
||
SortedSet<Attribute> toAttributeApi(List<ch.silviowangler.dox.domain.Attribute> attributes); | ||
|
||
@Mappings({ | ||
@Mapping(target = "translation", ignore = true) | ||
}) | ||
Domain toDomainApi(ch.silviowangler.dox.domain.Domain domain); | ||
|
||
AttributeDataType toAttributeDataTypeApi(ch.silviowangler.dox.domain.AttributeDataType domain); | ||
} |
11 changes: 11 additions & 0 deletions
11
core/src/main/java/ch/silviowangler/dox/mappers/MappingConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ch.silviowangler.dox.mappers; | ||
|
||
import org.mapstruct.MapperConfig; | ||
import org.mapstruct.ReportingPolicy; | ||
|
||
/** | ||
* @author Silvio Wangler | ||
*/ | ||
@MapperConfig(unmappedTargetPolicy = ReportingPolicy.ERROR, componentModel = "spring") | ||
public class MappingConfig { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.