forked from finos/common-domain-model
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[6 Dev] STORY-3174: Enhanced commodity classification mapping (finos#…
…2804) * 5.x.x oil physical leg fwd (#63) * Add FpML 5.13 test pack * Separate incomplete processes # Conflicts: # rosetta-source/src/main/resources/cdm-sample-files/fpml-5-13/processes/execution-advice/expectations.json * Separate incomplete products * Update expectations * Update expectations * Update release note * Update ingestions.json * Fix release note * Remove unused imports * Add commodity classification mappings * Remove unused files related to the CDM Portal * Add release note * Re-add unreleased release note * Fix licence scanning * Update expectations * Update expectations * Add samples * Formatting * Update expectations # Conflicts: # rosetta-source/src/main/resources/cdm-sample-files/fpml-5-10/incomplete-products/commodity-derivatives/expectations.json # rosetta-source/src/main/resources/cdm-sample-files/fpml-5-13/incomplete-products/commodity-derivatives/expectations.json # rosetta-source/src/main/resources/mapping-analytics/fpml-5-10-incomplete-products-commodity-derivatives-aggregated-mapping-failure-report.csv # rosetta-source/src/main/resources/result-json-files/fpml-5-10/incomplete-products/commodity-derivatives/com-ex22-physical-gas-option-multiple-expiration.json # rosetta-source/src/main/resources/result-json-files/fpml-5-10/incomplete-products/commodity-derivatives/com-ex23-physical-power-option-daily-expiration-efet.json # rosetta-source/src/main/resources/result-json-files/fpml-5-10/incomplete-products/commodity-derivatives/com-ex29-physical-eu-emissions-option.json # rosetta-source/src/main/resources/result-json-files/fpml-5-10/incomplete-products/commodity-derivatives/com-ex31-physical-us-emissions-option.json # rosetta-source/src/main/resources/result-json-files/fpml-5-10/incomplete-products/commodity-derivatives/com-ex47-physical-eu-emissions-option-pred-clearing.json # rosetta-source/src/main/resources/result-json-files/fpml-5-13/incomplete-products/commodity-derivatives/com-ex22-physical-gas-option-multiple-expiration.json # rosetta-source/src/main/resources/result-json-files/fpml-5-13/incomplete-products/commodity-derivatives/com-ex23-physical-power-option-daily-expiration-efet.json # rosetta-source/src/main/resources/result-json-files/fpml-5-13/incomplete-products/commodity-derivatives/com-ex29-physical-eu-emissions-option.json # rosetta-source/src/main/resources/result-json-files/fpml-5-13/incomplete-products/commodity-derivatives/com-ex31-physical-us-emissions-option.json # rosetta-source/src/main/resources/result-json-files/fpml-5-13/incomplete-products/commodity-derivatives/com-ex47-physical-eu-emissions-option-pred-clearing.json * Add release note * Update expectations * Update PR in release note * Re-add schema file * Update RELEASE.md * Update RELEASE.md * Update RELEASE.md
- Loading branch information
1 parent
26ae072
commit dea3313
Showing
59 changed files
with
3,185 additions
and
418 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
40 changes: 40 additions & 0 deletions
40
...main/java/cdm/product/template/processor/CommodityClassificationMetaMappingProcessor.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 cdm.product.template.processor; | ||
|
||
import cdm.product.template.ForwardPayout; | ||
import com.regnosys.rosetta.common.translation.Mapping; | ||
import com.regnosys.rosetta.common.translation.MappingContext; | ||
import com.regnosys.rosetta.common.translation.MappingProcessor; | ||
import com.regnosys.rosetta.common.translation.Path; | ||
import com.regnosys.rosetta.common.util.PathUtils; | ||
import com.rosetta.model.lib.RosettaModelObjectBuilder; | ||
import com.rosetta.model.lib.meta.Reference; | ||
import com.rosetta.model.lib.path.RosettaPath; | ||
|
||
import java.util.List; | ||
|
||
@SuppressWarnings("unused") | ||
public class CommodityClassificationMetaMappingProcessor extends MappingProcessor { | ||
|
||
public CommodityClassificationMetaMappingProcessor(RosettaPath modelPath, List<Path> synonymPaths, MappingContext context) { | ||
super(modelPath, synonymPaths, context); | ||
} | ||
|
||
@Override | ||
public void map(Path synonymPath, List<? extends RosettaModelObjectBuilder> builders, RosettaModelObjectBuilder parent) { | ||
List<ForwardPayout.ForwardPayoutBuilder> forwardPayoutBuilders = (List<ForwardPayout.ForwardPayoutBuilder>) builders; | ||
if (!forwardPayoutBuilders.isEmpty()) { | ||
ForwardPayout.ForwardPayoutBuilder forwardPayoutBuilder = forwardPayoutBuilders.get(0); | ||
// create reference | ||
Reference.ReferenceBuilder referenceBuilder = | ||
forwardPayoutBuilder.getOrCreateUnderlier().getOrCreateCommodity().getOrCreateReference(); | ||
// create new mapping to make the reference work | ||
Path commodityClassificationSynonymPath = | ||
synonymPath.addElement("commodityClassification", 0).addElement("code", 0); | ||
getMappings().add(createSuccessMapping(commodityClassificationSynonymPath, getModelPath(), referenceBuilder)); | ||
} | ||
} | ||
|
||
private Mapping createSuccessMapping(Path xmlPath, RosettaPath modelPath, Reference.ReferenceBuilder reference) { | ||
return new Mapping(xmlPath, null, PathUtils.toPath(modelPath), reference, null, true, true, false); | ||
} | ||
} |
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.