Skip to content

Commit b4ee7d6

Browse files
Merge branch 'rosetta-models:master' into master
2 parents ef42f56 + 1467884 commit b4ee7d6

File tree

491 files changed

+8827
-3392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

491 files changed

+8827
-3392
lines changed

RELEASE.md

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,15 @@
1-
# _Product Model - FpML Mapping - Commodity Forwards_
1+
# _Product Model - Bond Option and Forward Qualification_
22

3-
_What is being released?_
4-
5-
This release extends the FpML mapping coverage for Commodity Forwards.
6-
7-
- FpML `commoditySwap` legs `coalPhysicalLeg`, `electricityPhysicalLeg`, `environmentalPhysicalLeg`, `gasPhysicalLeg`, `oilPhysicalLeg` have been mapped into the model as a `ForwardPayout` leg
8-
- The `payerPartyReference` and `receiverPartyReference` have been mapped to `ForwardPayout->payerReceiver`
9-
- The `commodity->commodityClassification` reference has been mapped to `ForwardPayout->underlier->commodity->productTaxonomy`
10-
11-
_Review directions_
3+
_Background_
124

13-
In Rosetta, open the Translate tab and review the `FpML 5.13 > processes` test pack samples:
14-
15-
- msg-ex69-execution-advice-commodity-swap-classification-new-trade-esma-emir-refit.xml
16-
- msg-ex69-commodity-swap-coal-physical-leg.xml
17-
- msg-ex69-commodity-swap-electricity-physical-leg.xml
18-
- msg-ex69-commodity-swap-environmental-physical-leg.xml
19-
- msg-ex69-commodity-swap-gas-physical-leg.xml
20-
21-
The changes can be reviewed in PR: [#2804](https://github.com/finos/common-domain-model/pull/2804)
22-
23-
# _Infrastructure - FpML 5.13 Ingestion Test Pack_
5+
A previous release introduced a regression in the qualification of Bond Forwards and Bond Options, that were no longer qualified due to an update in the `Qualify_AssetClass_InterestRate` function. This release addresses this issue.
246

257
_What is being released?_
268

27-
This release adds an ingestion test pack containing FpML 5.13 WD3 xml files from [www.fpml.org/spec/fpml-5-13-3-wd-3/](https://www.fpml.org/spec/fpml-5-13-3-wd-3/) examples download.
28-
29-
There are no changes to the model. Ingestion test expectations have been added for the new FpML 5.13 test pack.
9+
- Reintroduced the capability to have a security with `securityType = SecurityTypeEnum -> Debt` as underlier of the option or forward in the `Qualify_AssetClass_InterestRate` function.
3010

3111
_Review directions_
3212

33-
In Rosetta, open the Translate tab and review test packs:
34-
35-
- fpml-5-13/products
36-
- fpml-5-13/incomplete-products
37-
- fpml-5-13/processes
38-
- fpml-5-13/incomplete-processes
39-
40-
The changes can be reviewed in PR: [#2797](https://github.com/finos/common-domain-model/pull/2797)
41-
42-
# _Infrastructure - Remove Unused Folders_
43-
44-
_What is being released?_
45-
46-
This release removes files and folders that were previously used by the CDM Portal.
47-
48-
Removed folders:
49-
- distribution
50-
- rosetta-source/src/main/resources/calculation-test-cases
51-
- rosetta-source/src/main/resources/cdm-sample-files/event-sequences
52-
53-
There are no changes to the model.
54-
55-
_Review directions_
13+
In Rosetta, select the Textual View and inspect the change identified above
5614

57-
The changes can be reviewed in PR: [#2800](https://github.com/finos/common-domain-model/pull/2800)
15+
The changes can be reviewed in PR: [#2851](https://github.com/finos/common-domain-model/pull/2851)

rosetta-source/src/main/java/cdm/event/common/processor/DocumentationHelper.java

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package cdm.event.common.processor;
22

3+
import cdm.base.staticdata.party.metafields.ReferenceWithMetaParty;
34
import cdm.legaldocumentation.common.*;
45
import cdm.legaldocumentation.common.metafields.FieldWithMetaContractualDefinitionsEnum;
6+
import cdm.legaldocumentation.contract.processor.PartyMappingHelper;
57
import cdm.legaldocumentation.master.MasterAgreementTypeEnum;
68
import cdm.legaldocumentation.master.MasterConfirmationAnnexTypeEnum;
79
import cdm.legaldocumentation.master.MasterConfirmationTypeEnum;
@@ -12,24 +14,37 @@
1214
import com.regnosys.rosetta.common.translation.SynonymToEnumMap;
1315
import com.rosetta.model.lib.path.RosettaPath;
1416
import com.rosetta.model.lib.records.Date;
17+
import org.slf4j.Logger;
18+
import org.slf4j.LoggerFactory;
1519

1620
import java.util.ArrayList;
1721
import java.util.List;
1822
import java.util.Optional;
23+
import java.util.Set;
24+
import java.util.concurrent.CompletableFuture;
25+
import java.util.concurrent.ExecutorService;
26+
import java.util.stream.Collectors;
1927

2028
import static com.regnosys.rosetta.common.translation.MappingProcessorUtils.filterListMappings;
2129
import static com.regnosys.rosetta.common.translation.MappingProcessorUtils.setValueAndUpdateMappings;
2230

2331
public class DocumentationHelper {
2432

33+
private static final Logger LOGGER = LoggerFactory.getLogger(DocumentationHelper.class);
2534
private final RosettaPath rosettaPath;
35+
private final MappingContext mappingContext;
2636
private final List<Mapping> mappings;
2737
private final SynonymToEnumMap synonymToEnumMap;
38+
private final ExecutorService executor;
39+
private final List<CompletableFuture<?>> invokedTasks;
2840

29-
public DocumentationHelper(RosettaPath rosettaPath, MappingContext context) {
41+
public DocumentationHelper(RosettaPath rosettaPath, MappingContext mappingContext) {
3042
this.rosettaPath = rosettaPath;
31-
this.mappings = context.getMappings();
32-
this.synonymToEnumMap = context.getSynonymToEnumMap();
43+
this.mappingContext = mappingContext;
44+
this.mappings = mappingContext.getMappings();
45+
this.executor = mappingContext.getExecutor();
46+
this.invokedTasks = mappingContext.getInvokedTasks();
47+
this.synonymToEnumMap = mappingContext.getSynonymToEnumMap();
3348
}
3449

3550
public List<LegalAgreement> getDocumentation(Path synonymPath) {
@@ -75,6 +90,10 @@ private Optional<LegalAgreement> getMasterAgreement(Path synonymPath) {
7590
mappings,
7691
rosettaPath);
7792

93+
if (builder.hasData()) {
94+
setContractualParty(builder);
95+
}
96+
7897
return setAgreementType(builder, LegalAgreementTypeEnum.MASTER_AGREEMENT);
7998
}
8099

@@ -122,11 +141,20 @@ private Optional<LegalAgreement> getMasterConfirmation(Path synonymPath) {
122141
mappings,
123142
rosettaPath);
124143

144+
if (builder.hasData()) {
145+
setContractualParty(builder);
146+
}
147+
125148
return setAgreementType(builder, LegalAgreementTypeEnum.MASTER_CONFIRMATION);
126149
}
127150

128151
private Optional<LegalAgreement> getBrokerConfirmation(Path synonymPath) {
129152
LegalAgreement.LegalAgreementBuilder builder = LegalAgreement.builder();
153+
154+
if (builder.hasData()) {
155+
setContractualParty(builder);
156+
}
157+
130158
return setAgreementType(builder, LegalAgreementTypeEnum.BROKER_CONFIRMATION);
131159
}
132160

@@ -157,6 +185,10 @@ private Optional<LegalAgreement> getCreditSupportAgreement(Path synonymPath) {
157185
mappings,
158186
rosettaPath);
159187

188+
if (builder.hasData()) {
189+
setContractualParty(builder);
190+
}
191+
160192
return setAgreementType(builder, LegalAgreementTypeEnum.CREDIT_SUPPORT_AGREEMENT);
161193
}
162194

@@ -251,6 +283,10 @@ private Optional<LegalAgreement> getConfirmation(Path synonymPath) {
251283
}
252284
});
253285

286+
if (builder.hasData()) {
287+
setContractualParty(builder);
288+
}
289+
254290
return setAgreementType(builder, LegalAgreementTypeEnum.CONFIRMATION);
255291
}
256292

@@ -279,10 +315,13 @@ private Optional<LegalAgreement> getOtherAgreement(Path synonymPath) {
279315
mappings,
280316
rosettaPath);
281317

318+
if (builder.hasData()) {
319+
setContractualParty(builder);
320+
}
321+
282322
return setAgreementType(builder, LegalAgreementTypeEnum.OTHER);
283323
}
284324

285-
286325
private Optional<LegalAgreement> setAgreementType(LegalAgreement.LegalAgreementBuilder builder, LegalAgreementTypeEnum masterAgreement) {
287326
if (builder.hasData()) {
288327
builder.getOrCreateLegalAgreementIdentification()
@@ -293,4 +332,22 @@ private Optional<LegalAgreement> setAgreementType(LegalAgreement.LegalAgreementB
293332
return Optional.empty();
294333
}
295334
}
335+
336+
private void setContractualParty(LegalAgreement.LegalAgreementBuilder builder) {
337+
PartyMappingHelper.getInstance(mappingContext).ifPresent(helper -> {
338+
LOGGER.debug("Waiting for counterparties to be collected before updating contractual parties");
339+
// wait until both counterparties have been collected before getting party references.
340+
// also, add task to invokedTasks so the mapping process does not get shutdown prematurely.
341+
invokedTasks.add(helper.getBothCounterpartiesCollectedFuture().thenAcceptAsync(counterpartyMap -> {
342+
Set<String> counterpartyExternalRefs = counterpartyMap.keySet();
343+
LOGGER.info("Setting contractual party references {}", counterpartyExternalRefs);
344+
List<ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder> contractualParties =
345+
counterpartyExternalRefs.stream()
346+
.map(counterpartyRef ->
347+
ReferenceWithMetaParty.builder().setExternalReference(counterpartyRef))
348+
.collect(Collectors.toList());
349+
builder.setContractualParty(contractualParties);
350+
}, executor));
351+
});
352+
}
296353
}

0 commit comments

Comments
 (0)