-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from rmgrimm/builtin-section
Add support for builtin_section
- Loading branch information
Showing
13 changed files
with
254 additions
and
37 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
14 changes: 14 additions & 0 deletions
14
rest-client/src/main/java/com/fwmotion/threescale/cms/mappers/CmsBuiltinSectionMapper.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,14 @@ | ||
package com.fwmotion.threescale.cms.mappers; | ||
|
||
import com.fwmotion.threescale.cms.model.CmsBuiltinSection; | ||
import com.redhat.threescale.rest.cms.model.BuiltinSection; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
|
||
@Mapper | ||
public interface CmsBuiltinSectionMapper { | ||
|
||
@Mapping(target = "path", source = "partialPath") | ||
CmsBuiltinSection fromRest(BuiltinSection builtinSection); | ||
|
||
} |
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
40 changes: 40 additions & 0 deletions
40
rest-client/src/main/java/com/fwmotion/threescale/cms/mixins/SectionMergingList.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,40 @@ | ||
package com.fwmotion.threescale.cms.mixins; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; | ||
import com.redhat.threescale.rest.cms.model.BuiltinSection; | ||
import com.redhat.threescale.rest.cms.model.Section; | ||
import com.redhat.threescale.rest.cms.model.SectionList; | ||
import jakarta.xml.bind.annotation.XmlElement; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* This is used for deserialization to facilitate interlaced unwrapped lists. | ||
* Per | ||
* <a href="https://github.com/FasterXML/jackson-dataformat-xml/issues/275">jackson-dataformat-xml Issue #275</a>, | ||
* interlaced unwrapped lists is not supported, so this class will be used | ||
* as a workaround to merge the lists as they're "set" into the object. | ||
* | ||
* @see SectionListMixIn | ||
* @see SectionList | ||
*/ | ||
public class SectionMergingList extends SectionList { | ||
|
||
@JsonProperty(SectionListMixIn.ELEMENT_NAME_BUILTIN_SECTION) | ||
@XmlElement(name = SectionListMixIn.ELEMENT_NAME_BUILTIN_SECTION) | ||
@JacksonXmlElementWrapper(useWrapping = false, localName = SectionListMixIn.ELEMENT_NAME_BUILTIN_SECTION) | ||
@Override | ||
public void setBuiltinSections(List<BuiltinSection> builtinSections) { | ||
builtinSections.forEach(super::addBuiltinSectionsItem); | ||
} | ||
|
||
@JsonProperty(SectionListMixIn.ELEMENT_NAME_BUILTIN_SECTION) | ||
@XmlElement(name = SectionListMixIn.ELEMENT_NAME_BUILTIN_SECTION) | ||
@JacksonXmlElementWrapper(useWrapping = false, localName = SectionListMixIn.ELEMENT_NAME_BUILTIN_SECTION) | ||
@Override | ||
public void setSections(List<Section> sections) { | ||
sections.forEach(super::addSectionsItem); | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
rest-client/src/main/java/com/fwmotion/threescale/cms/model/CmsBuiltinSection.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,9 @@ | ||
package com.fwmotion.threescale.cms.model; | ||
|
||
/** | ||
* Subclass of {@link CmsSection} to differentiate builtin_section from section. | ||
* <p> | ||
* The properties all appear to remain identical. | ||
*/ | ||
public class CmsBuiltinSection extends CmsSection { | ||
} |
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
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.