Skip to content

Commit 594d866

Browse files
Merge pull request #281 from com-pas/feat/RSR-588_rename_ResumedDataTemplate
feat(#280): RSR-588 rename ResumedDataType to a better name
2 parents db735e7 + da7e00a commit 594d866

30 files changed

+742
-667
lines changed

sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/ResumedDataTemplate.java renamed to sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/DataAttributeRef.java

Lines changed: 141 additions & 66 deletions
Large diffs are not rendered by default.

sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/LNodeDTO.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* <li>{@link LNodeDTO#getGooseControlBlocks <em>Refers To GooseControl Blocks</em>}</li>
3737
* <li>{@link LNodeDTO#getSmvControlBlocks <em>Refers To SmvControl Blocks</em>}</li>
3838
* <li>{@link LNodeDTO#getReportControlBlocks <em>Refers To ReportControl Blocks</em>}</li>
39-
* <li>{@link LNodeDTO#getResumedDataTemplates <em>Refers To DataTemplates Objects</em>}</li>
39+
* <li>{@link LNodeDTO#getDataAttributeRefs <em>Refers To DataTemplates Objects</em>}</li>
4040
* </ul>
4141
*
4242
* @see org.lfenergy.compas.scl2007b4.model.TLNode
@@ -55,7 +55,7 @@ public class LNodeDTO {
5555
private Set<SMVControlBlock> smvControlBlocks = new HashSet<>();
5656
private Set<ReportControlBlock> reportControlBlocks = new HashSet<>();
5757
private Set<DataSetInfo> datSets = new HashSet<>();
58-
private Set<ResumedDataTemplate> resumedDataTemplates = new HashSet<>();
58+
private Set<DataAttributeRef> dataAttributeRefs = new HashSet<>();
5959

6060
/**
6161
* Constructor
@@ -113,7 +113,7 @@ public static <T extends TAnyLN> LNodeDTO from(AbstractLNAdapter<T> nodeAdapter,
113113
lNodeDTO.datSets = DataSetInfo.getDataSets(nodeAdapter);
114114
}
115115

116-
if(options.isWithResumedDtt()) {
116+
if(options.isWithDataAttributeRef()) {
117117
DataTypeTemplateAdapter dttAdapter = nodeAdapter.getDataTypeTemplateAdapter();
118118
LNodeTypeAdapter lNodeTypeAdapter = dttAdapter.getLNodeTypeAdapterById(nodeAdapter.getLnType())
119119
.orElseThrow(
@@ -124,13 +124,13 @@ public static <T extends TAnyLN> LNodeDTO from(AbstractLNAdapter<T> nodeAdapter,
124124
)
125125
)
126126
);
127-
ResumedDataTemplate filter = ResumedDataTemplate.builder()
127+
DataAttributeRef filter = DataAttributeRef.builder()
128128
.lnInst(nodeAdapter.getLNInst())
129129
.lnClass(nodeAdapter.getLNClass())
130130
.prefix(nodeAdapter.getPrefix())
131131
.lnType(nodeAdapter.getLnType()).build();
132-
List<ResumedDataTemplate> resumedDataTemplateList = lNodeTypeAdapter.getResumedDTTs(filter);
133-
lNodeDTO.addAllResumedDataTemplate(resumedDataTemplateList);
132+
List<DataAttributeRef> dataAttributeRefList = lNodeTypeAdapter.getDataAttributeRefs(filter);
133+
lNodeDTO.addAllDataAttributeRef(dataAttributeRefList);
134134
}
135135

136136
if(options.isWithCB()) {
@@ -241,26 +241,26 @@ public void addAllDatSets(List<DataSetInfo> dataSetList) {
241241

242242
/**
243243
* Adds DataTypeTemplate's sumarised data
244-
* @param dtt input
244+
* @param dataAttributeRef input
245245
*/
246-
public void addResumedDataTemplate(ResumedDataTemplate dtt) {
247-
resumedDataTemplates.add(dtt);
246+
public void addDataAttributeRef(DataAttributeRef dataAttributeRef) {
247+
dataAttributeRefs.add(dataAttributeRef);
248248
}
249249

250250
/**
251251
* Adds list of DataTypeTemplate's sumarised data
252-
* @param dtt input
252+
* @param dataAttributeRefs input
253253
*/
254-
public void addAllResumedDataTemplate(List<ResumedDataTemplate> dtt) {
255-
this.resumedDataTemplates.addAll(dtt);
254+
public void addAllDataAttributeRef(List<DataAttributeRef> dataAttributeRefs) {
255+
this.dataAttributeRefs.addAll(dataAttributeRefs);
256256
}
257257

258258
/**
259259
* Gets DataTypeTemplate's sumarised data
260-
* @return Set of ResumedDataTemplate object
260+
* @return Set of DataAttributeRef object
261261
*/
262-
public Set<ResumedDataTemplate> getResumedDataTemplates(){
263-
return Set.of(resumedDataTemplates.toArray(new ResumedDataTemplate[0]));
262+
public Set<DataAttributeRef> getDataAttributeRefs(){
263+
return Set.of(dataAttributeRefs.toArray(new DataAttributeRef[0]));
264264
}
265265

266266
/**

sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/LogicalNodeOptions.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* </p>
1616
* <ul>
1717
* <li>{@link LogicalNodeOptions#withExtRef <em>withExtRef</em>}</li>
18-
* <li>{@link LogicalNodeOptions#withResumedDtt <em>withResumedDtt</em>}</li>
18+
* <li>{@link LogicalNodeOptions#withDataAttributeRef <em>withDataAttributeRef</em>}</li>
1919
* <li>{@link LogicalNodeOptions#withDatSet <em>withDatSet</em>}</li>
2020
* <li>{@link LogicalNodeOptions#withCB <em>withCB</em>}</li>
2121
* </ul>
@@ -25,20 +25,20 @@
2525
@NoArgsConstructor
2626
public class LogicalNodeOptions {
2727
private boolean withExtRef = false;
28-
private boolean withResumedDtt = false;
28+
private boolean withDataAttributeRef = false;
2929
private boolean withCB = false;
3030
private boolean withDatSet = false;
3131

3232
/**
3333
* Constructor
3434
* @param withExtRef input
35-
* @param withResumedDtt input
35+
* @param withDataAttributeRef input
3636
* @param withCB input
3737
* @param withDatSet input
3838
*/
39-
public LogicalNodeOptions(boolean withExtRef, boolean withResumedDtt, boolean withCB, boolean withDatSet) {
39+
public LogicalNodeOptions(boolean withExtRef, boolean withDataAttributeRef, boolean withCB, boolean withDatSet) {
4040
this.withExtRef = withExtRef;
41-
this.withResumedDtt = withResumedDtt;
41+
this.withDataAttributeRef = withDataAttributeRef;
4242
this.withCB = withCB;
4343
this.withDatSet = withDatSet;
4444
}

sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
* </ol>
6060
* <li>DAI features</li>
6161
* <ol>
62-
* <li>{@link SclService#getDAI <em>Returns list of <b>ResumedDataTemplate </b></em>}</li>
63-
* <li>{@link SclService#updateDAI(SCL, String, String, ResumedDataTemplate)
64-
* <em>Update the <b>TDAI </b> reference object for given <b>iedName</b>, <b>ldInst </b> and <b>ResumedDataTemplate </b> model</em>}</li>
62+
* <li>{@link SclService#getDAI <em>Returns list of <b>DataAttributeRef </b></em>}</li>
63+
* <li>{@link SclService#updateDAI(SCL, String, String, DataAttributeRef)
64+
* <em>Update the <b>TDAI </b> reference object for given <b>iedName</b>, <b>ldInst </b> and <b>DataAttributeRef </b> model</em>}</li>
6565
* </ol>
6666
* <li>EnumType features</li>
6767
* <ol>
@@ -392,43 +392,43 @@ public static TExtRef updateExtRefSource(SCL scd, ExtRefInfo extRefInfo) throws
392392

393393
/**
394394
* Gets a list of summarized DataTypeTemplate for DataAttribute DA (updatable or not) related to the one given
395-
* in <em>rDtt</em>
395+
* in <em>dataAttributeRef</em>
396396
*
397397
* @param scd SCL file in which DataTypeTemplate of DAIs should be found
398398
* @param iedName name of IED in which DAs are localized
399399
* @param ldInst ldInst of LDevice in which DAIs are localized
400-
* @param rDtt reference summarized DataTypeTemplate related to IED DAIs
400+
* @param dataAttributeRef reference summarized DataTypeTemplate related to IED DAIs
401401
* @param updatable true to retrieve DataTypeTemplate's related to only updatable DAIs, false to retrieve all
402-
* @return List of resumed DataTypeTemplate for DataAttribute (updatable or not)
402+
* @return Set of Data Attribute Reference for DataAttribute (updatable or not)
403403
* @throws ScdException SCD illegal arguments exception, missing mandatory data
404404
*/
405-
public static Set<ResumedDataTemplate> getDAI(SCL scd, String iedName, String ldInst, ResumedDataTemplate rDtt, boolean updatable) throws ScdException {
405+
public static Set<DataAttributeRef> getDAI(SCL scd, String iedName, String ldInst, DataAttributeRef dataAttributeRef, boolean updatable) throws ScdException {
406406
LDeviceAdapter lDeviceAdapter = createLDeviceAdapter(scd, iedName, ldInst);
407-
return lDeviceAdapter.getDAI(rDtt, updatable);
407+
return lDeviceAdapter.getDAI(dataAttributeRef, updatable);
408408
}
409409

410410
/**
411-
* Updates DAI based on given data in <em>rDtt</em>
411+
* Updates DAI based on given data in <em>dataAttributeRef</em>
412412
*
413413
* @param scd SCL file in which DataTypeTemplate of DAI should be found
414414
* @param iedName name of IED in which DAI is localized
415415
* @param ldInst ldInst of LDevice in which DAI is localized
416-
* @param rDtt reference summarized DataTypeTemplate related to DAI to update
416+
* @param dataAttributeRef reference summarized DataTypeTemplate related to DAI to update
417417
* @throws ScdException when inconsistency are found in th SCL's
418418
* DataTypeTemplate. Which should normally not happens.
419419
*/
420-
public static void updateDAI(SCL scd, String iedName, String ldInst, ResumedDataTemplate rDtt) throws ScdException {
420+
public static void updateDAI(SCL scd, String iedName, String ldInst, DataAttributeRef dataAttributeRef) throws ScdException {
421421
long startTime = System.nanoTime();
422422
log.info(Utils.entering());
423423
SclRootAdapter sclRootAdapter = new SclRootAdapter(scd);
424424
DataTypeTemplateAdapter dttAdapter = sclRootAdapter.getDataTypeTemplateAdapter();
425-
LNodeTypeAdapter lNodeTypeAdapter = dttAdapter.getLNodeTypeAdapterById(rDtt.getLnType())
426-
.orElseThrow(() -> new ScdException("Unknown LNodeType : " + rDtt.getLnType()));
427-
lNodeTypeAdapter.check(rDtt.getDoName(), rDtt.getDaName());
425+
LNodeTypeAdapter lNodeTypeAdapter = dttAdapter.getLNodeTypeAdapterById(dataAttributeRef.getLnType())
426+
.orElseThrow(() -> new ScdException("Unknown LNodeType : " + dataAttributeRef.getLnType()));
427+
lNodeTypeAdapter.check(dataAttributeRef.getDoName(), dataAttributeRef.getDaName());
428428

429-
if (TPredefinedBasicTypeEnum.OBJ_REF == rDtt.getBType()) {
430-
Long sGroup = rDtt.getDaName().getDaiValues().keySet().stream().findFirst().orElse(-1L);
431-
String val = sGroup < 0 ? null : rDtt.getDaName().getDaiValues().get(sGroup);
429+
if (TPredefinedBasicTypeEnum.OBJ_REF == dataAttributeRef.getBType()) {
430+
Long sGroup = dataAttributeRef.getDaName().getDaiValues().keySet().stream().findFirst().orElse(-1L);
431+
String val = sGroup < 0 ? null : dataAttributeRef.getDaName().getDaiValues().get(sGroup);
432432
sclRootAdapter.checkObjRef(val);
433433
}
434434

@@ -438,16 +438,16 @@ public static void updateDAI(SCL scd, String iedName, String ldInst, ResumedData
438438

439439
AbstractLNAdapter<?> lnAdapter = AbstractLNAdapter.builder()
440440
.withLDeviceAdapter(lDeviceAdapter)
441-
.withLnClass(rDtt.getLnClass())
442-
.withLnInst(rDtt.getLnInst())
443-
.withLnPrefix(rDtt.getPrefix())
441+
.withLnClass(dataAttributeRef.getLnClass())
442+
.withLnInst(dataAttributeRef.getLnInst())
443+
.withLnPrefix(dataAttributeRef.getPrefix())
444444
.build();
445445

446-
if (TPredefinedCDCEnum.ING == rDtt.getCdc() || TPredefinedCDCEnum.ASG == rDtt.getCdc()) {
447-
DAITracker daiTracker = new DAITracker(lnAdapter, rDtt.getDoName(), rDtt.getDaName());
446+
if (TPredefinedCDCEnum.ING == dataAttributeRef.getCdc() || TPredefinedCDCEnum.ASG == dataAttributeRef.getCdc()) {
447+
DAITracker daiTracker = new DAITracker(lnAdapter, dataAttributeRef.getDoName(), dataAttributeRef.getDaName());
448448
daiTracker.validateBoundedDAI();
449449
}
450-
lnAdapter.updateDAI(rDtt);
450+
lnAdapter.updateDAI(dataAttributeRef);
451451
log.info(Utils.leaving(startTime));
452452
}
453453

0 commit comments

Comments
 (0)