diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/ResumedDataTemplate.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/DataAttributeRef.java
similarity index 58%
rename from sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/ResumedDataTemplate.java
rename to sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/DataAttributeRef.java
index b41db1eee..e373f2871 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/ResumedDataTemplate.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/DataAttributeRef.java
@@ -20,15 +20,15 @@
/**
- * A representation of the model object ResumedDataTemplate.
+ * A representation of the model object DataAttributeRef.
*
* The following features are supported:
*
*
- * - {@link ResumedDataTemplate#lnInst LN Inst}
- * - {@link ResumedDataTemplate#lnClass LN Class}
- * - {@link ResumedDataTemplate#lnType LN Type}
- * - {@link ResumedDataTemplate#prefix Prefix}
+ * - {@link DataAttributeRef#lnInst LN Inst}
+ * - {@link DataAttributeRef#lnClass LN Class}
+ * - {@link DataAttributeRef#lnType LN Type}
+ * - {@link DataAttributeRef#prefix Prefix}
* - {@link org.lfenergy.compas.sct.commons.dto.DoTypeName Refers To DoTypeName}
* - {@link org.lfenergy.compas.sct.commons.dto.DaTypeName Refers To DaTypeName}
*
@@ -37,9 +37,8 @@
@Getter
@AllArgsConstructor
@NoArgsConstructor
-@EqualsAndHashCode
@Builder(toBuilder = true)
-public class ResumedDataTemplate {
+public class DataAttributeRef {
private String prefix;
private String lnType;
@@ -55,7 +54,8 @@ public class ResumedDataTemplate {
/**
* Constructor
*/
- public ResumedDataTemplate(AbstractLNAdapter> lnAdapter, DoTypeName doName, DaTypeName daName) {
+
+ public DataAttributeRef(AbstractLNAdapter> lnAdapter, DoTypeName doName, DaTypeName daName) {
this.lnClass = lnAdapter.getLNClass();
this.lnInst = lnAdapter.getLNInst();
this.prefix = lnAdapter.getPrefix();
@@ -64,7 +64,7 @@ public ResumedDataTemplate(AbstractLNAdapter> lnAdapter, DoTypeName doName, Da
this.daName = daName;
}
- public ResumedDataTemplate(TFCDA fcda) {
+ public DataAttributeRef(TFCDA fcda) {
this.lnClass = fcda.isSetLnClass() ? fcda.getLnClass().get(0) : null;
this.lnInst = fcda.getLnInst();
this.prefix = fcda.getPrefix();
@@ -77,108 +77,116 @@ public ResumedDataTemplate(TFCDA fcda) {
/**
* Copies summarized DataTypeTemplate information to another one
*
- * @param dtt input
- * @return Updated ResumedDataTemplate object
+ * @param source input
+ * @return Updated DataAttributeRef object
*/
- public static ResumedDataTemplate copyFrom(ResumedDataTemplate dtt) {
- ResumedDataTemplate resumedDataTemplate = new ResumedDataTemplate();
- resumedDataTemplate.prefix = dtt.prefix;
- resumedDataTemplate.lnClass = dtt.lnClass;
- resumedDataTemplate.lnInst = dtt.lnInst;
- resumedDataTemplate.lnType = dtt.lnType;
- resumedDataTemplate.doName = DoTypeName.from(dtt.getDoName());
- resumedDataTemplate.daName = DaTypeName.from(dtt.getDaName());
-
- return resumedDataTemplate;
+ public static DataAttributeRef copyFrom(DataAttributeRef source) {
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
+ dataAttributeRef.prefix = source.prefix;
+ dataAttributeRef.lnClass = source.lnClass;
+ dataAttributeRef.lnInst = source.lnInst;
+ dataAttributeRef.lnType = source.lnType;
+ dataAttributeRef.doName = DoTypeName.from(source.getDoName());
+ dataAttributeRef.daName = DaTypeName.from(source.getDaName());
+
+ return dataAttributeRef;
}
/**
* Checks if DA/DO is updatable
+ *
* @return true if updatable, false otherwise
*/
- public boolean isUpdatable(){
+ public boolean isUpdatable() {
return isDOModDAstVal() || daName.isDefined() && daName.isUpdatable();
}
/**
* Checks if DO is Mod and DA is stVal
+ *
* @return true if DO is "Mod" and DA is "stVal", false otherwise
*/
- private boolean isDOModDAstVal(){
+ private boolean isDOModDAstVal() {
return doName.getName().equals(MOD_DO_NAME) && daName.getName().equals(STVAL_DA_NAME);
}
@JsonIgnore
- public String getObjRef(String iedName, String ldInst){
+ public String getObjRef(String iedName, String ldInst) {
//LDName
return iedName + ldInst + "/" + getLNRef();
}
/**
* Gets LNode reference information
+ *
* @return String LNode information concatenated
*/
@JsonIgnore
- public String getLNRef(){
+ public String getLNRef() {
StringBuilder stringBuilder = new StringBuilder();
- if(TLLN0Enum.LLN_0.value().equals(lnClass)){
+ if (TLLN0Enum.LLN_0.value().equals(lnClass)) {
stringBuilder.append(TLLN0Enum.LLN_0.value());
} else {
stringBuilder.append(prefix)
- .append(lnClass)
- .append(lnInst);
+ .append(lnClass)
+ .append(lnInst);
}
stringBuilder.append('.')
- .append(getDoRef())
- .append('.')
- .append(getDaRef());
+ .append(getDoRef())
+ .append('.')
+ .append(getDaRef());
return stringBuilder.toString();
}
/**
* Gets Data Attributes value
+ *
* @return String Data Attributes reference by concatenated DO reference and DA reference
*/
@JsonIgnore
- public String getDataAttributes(){
+ public String getDataAttributes() {
return getDoRef() + "." + getDaRef();
}
/**
* Gets DO reference value
+ *
* @return String DO (Data Object) reference value
*/
@JsonIgnore
- public String getDoRef(){
+ public String getDoRef() {
return isDoNameDefined() ? doName.toString() : "";
}
/**
* Gets DA (Data Attribut) reference value
+ *
* @return DA reference value
*/
@JsonIgnore
- public String getDaRef(){
+ public String getDaRef() {
return isDaNameDefined() ? daName.toString() : "";
}
/**
* Gets FC (Functional Constraints) reference value
+ *
* @return
*/
@JsonIgnore
- public TFCEnum getFc(){
+ public TFCEnum getFc() {
return daName.isDefined() ? daName.getFc() : null;
}
/**
* Sets DA/DO FC's value
+ *
* @param fc input
*/
@JsonIgnore
- public void setFc(TFCEnum fc){
- if(isDaNameDefined()){
+ public void setFc(TFCEnum fc) {
+ if (isDaNameDefined()) {
daName.setFc(fc);
} else {
throw new IllegalArgumentException("Cannot set functional constrain for undefined DA");
@@ -187,20 +195,22 @@ public void setFc(TFCEnum fc){
/**
* Gets DA/DO CDC's value
+ *
* @return CDC enum value
*/
@JsonIgnore
- public TPredefinedCDCEnum getCdc(){
+ public TPredefinedCDCEnum getCdc() {
return daName.isDefined() ? doName.getCdc() : null;
}
/**
* Sets DA/DO CDC's value
+ *
* @param cdc input
*/
@JsonIgnore
- public void setCdc(TPredefinedCDCEnum cdc){
- if(isDoNameDefined()){
+ public void setCdc(TPredefinedCDCEnum cdc) {
+ if (isDoNameDefined()) {
doName.setCdc(cdc);
} else {
throw new IllegalArgumentException("Cannot set CDC for undefined DOType");
@@ -209,50 +219,55 @@ public void setCdc(TPredefinedCDCEnum cdc){
/**
* Gets SDO names'
+ *
* @return List of SDO name
*/
@JsonIgnore
- public List getSdoNames(){
- if(!isDoNameDefined()) return new ArrayList<>();
+ public List getSdoNames() {
+ if (!isDoNameDefined()) return new ArrayList<>();
return List.of(doName.getStructNames().toArray(new String[0]));
}
/**
* GEts BDA names'
+ *
* @return List of BDA name
*/
@JsonIgnore
- public List getBdaNames(){
- if(!isDaNameDefined()) return new ArrayList<>();
+ public List getBdaNames() {
+ if (!isDaNameDefined()) return new ArrayList<>();
return List.of(daName.getStructNames().toArray(new String[0]));
}
/**
* Adds DO Structure name
+ *
* @param structName input
*/
- public void addDoStructName(String structName){
- if(isDoNameDefined()) {
+ public void addDoStructName(String structName) {
+ if (isDoNameDefined()) {
doName.addStructName(structName);
- } else {
+ } else {
throw new IllegalArgumentException("DO name must be defined before adding DO StructName");
}
}
/**
* Adds DA Structure name
+ *
* @param structName input
*/
- public void addDaStructName(String structName){
- if(isDaNameDefined()) {
+ public void addDaStructName(String structName) {
+ if (isDaNameDefined()) {
daName.addStructName(structName);
- } else {
+ } else {
throw new IllegalArgumentException("DA name must be defined before adding DA StructName");
}
}
/**
* Checks if DO name is defined
+ *
* @return definition state
*/
public boolean isDoNameDefined() {
@@ -261,6 +276,7 @@ public boolean isDoNameDefined() {
/**
* Checks if DA name is defined
+ *
* @return definition state
*/
public boolean isDaNameDefined() {
@@ -269,20 +285,22 @@ public boolean isDaNameDefined() {
/**
* Gets DA Basic Type value
+ *
* @return Basic Type enum value
*/
@JsonIgnore
- public TPredefinedBasicTypeEnum getBType(){
+ public TPredefinedBasicTypeEnum getBType() {
return daName != null ? daName.getBType() : null;
}
/**
* Sets DA type
+ *
* @param type input
*/
@JsonIgnore
- public void setType(String type){
- if(isDaNameDefined()){
+ public void setType(String type) {
+ if (isDaNameDefined()) {
daName.setType(type);
} else {
throw new IllegalArgumentException("Cannot define type for undefined BDA");
@@ -291,20 +309,22 @@ public void setType(String type){
/**
* Gets DA type
+ *
* @return string DA type
*/
@JsonIgnore
- public String getType(){
+ public String getType() {
return daName != null ? daName.getType() : null;
}
/**
* Sets DA Basic Type value
+ *
* @param bType input
*/
@JsonIgnore
- public void setBType(String bType){
- if(isDaNameDefined()){
+ public void setBType(String bType) {
+ if (isDaNameDefined()) {
daName.setBType(TPredefinedBasicTypeEnum.fromValue(bType));
} else {
throw new IllegalArgumentException("Cannot define Basic type for undefined DA or BDA");
@@ -313,60 +333,66 @@ public void setBType(String bType){
/**
* Set DO name
+ *
* @param doName input
*/
- public void setDoName(DoTypeName doName){
- if(doName != null) {
+ public void setDoName(DoTypeName doName) {
+ if (doName != null) {
this.doName = DoTypeName.from(doName);
}
}
/**
* Sets DA name
+ *
* @param daName input
*/
- public void setDaName(DaTypeName daName){
- if(daName != null) {
+ public void setDaName(DaTypeName daName) {
+ if (daName != null) {
this.daName = DaTypeName.from(daName);
}
}
/**
* Adds DAI values to DA
+ *
* @param values input
*/
@JsonIgnore
public void setDaiValues(List values) {
- if(isDaNameDefined()){
+ if (isDaNameDefined()) {
daName.addDaiValues(values);
}
}
/**
* Set DA ValImport value
+ *
* @param valImport input
*/
@JsonIgnore
public void setValImport(boolean valImport) {
- if(isDaNameDefined()){
+ if (isDaNameDefined()) {
daName.setValImport(valImport);
}
}
/**
* Checks ValImport value
+ *
* @return ValImport value
*/
- public boolean isValImport(){
+ public boolean isValImport() {
return daName.isValImport();
}
/**
* Set Val of DA
+ *
* @param daiValue daiValue to set
* @return this
*/
- public ResumedDataTemplate setVal(String daiValue) {
+ public DataAttributeRef setVal(String daiValue) {
this.setDaiValues(List.of(SclConstructorHelper.newVal(daiValue)));
return this;
}
@@ -374,12 +400,61 @@ public ResumedDataTemplate setVal(String daiValue) {
/**
* Retrieve value of the DAI, if present. If multiples values are found,
* the value with the lowest index is returned.
+ *
* @return Return the DAI value with the lowest key from getDaName().getdaiValues() map,
* or empty Optional if this DAI has no value.
*/
public Optional findFirstValue() {
return getDaName().getDaiValues().keySet().stream()
- .min(Long::compareTo)
- .map(key -> getDaName().getDaiValues().get(key));
+ .min(Long::compareTo)
+ .map(key -> getDaName().getDaiValues().get(key));
+ }
+
+ public boolean equals(final Object o) {
+ if (o == this) return true;
+ if (!(o instanceof DataAttributeRef)) return false;
+ final DataAttributeRef other = (DataAttributeRef) o;
+ if (!other.canEqual((Object) this)) return false;
+ final Object this$prefix = this.getPrefix();
+ final Object other$prefix = other.getPrefix();
+ if (this$prefix == null ? other$prefix != null : !this$prefix.equals(other$prefix)) return false;
+ final Object this$lnType = this.getLnType();
+ final Object other$lnType = other.getLnType();
+ if (this$lnType == null ? other$lnType != null : !this$lnType.equals(other$lnType)) return false;
+ final Object this$lnClass = this.getLnClass();
+ final Object other$lnClass = other.getLnClass();
+ if (this$lnClass == null ? other$lnClass != null : !this$lnClass.equals(other$lnClass)) return false;
+ final Object this$lnInst = this.getLnInst();
+ final Object other$lnInst = other.getLnInst();
+ if (this$lnInst == null ? other$lnInst != null : !this$lnInst.equals(other$lnInst)) return false;
+ final Object this$doName = this.getDoName();
+ final Object other$doName = other.getDoName();
+ if (this$doName == null ? other$doName != null : !this$doName.equals(other$doName)) return false;
+ final Object this$daName = this.getDaName();
+ final Object other$daName = other.getDaName();
+ if (this$daName == null ? other$daName != null : !this$daName.equals(other$daName)) return false;
+ return true;
+ }
+
+ protected boolean canEqual(final Object other) {
+ return other instanceof DataAttributeRef;
+ }
+
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ final Object $prefix = this.getPrefix();
+ result = result * PRIME + ($prefix == null ? 43 : $prefix.hashCode());
+ final Object $lnType = this.getLnType();
+ result = result * PRIME + ($lnType == null ? 43 : $lnType.hashCode());
+ final Object $lnClass = this.getLnClass();
+ result = result * PRIME + ($lnClass == null ? 43 : $lnClass.hashCode());
+ final Object $lnInst = this.getLnInst();
+ result = result * PRIME + ($lnInst == null ? 43 : $lnInst.hashCode());
+ final Object $doName = this.getDoName();
+ result = result * PRIME + ($doName == null ? 43 : $doName.hashCode());
+ final Object $daName = this.getDaName();
+ result = result * PRIME + ($daName == null ? 43 : $daName.hashCode());
+ return result;
}
}
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/LNodeDTO.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/LNodeDTO.java
index 7d32c5bd3..adba8b9f2 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/LNodeDTO.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/LNodeDTO.java
@@ -36,7 +36,7 @@
* {@link LNodeDTO#getGooseControlBlocks Refers To GooseControl Blocks}
* {@link LNodeDTO#getSmvControlBlocks Refers To SmvControl Blocks}
* {@link LNodeDTO#getReportControlBlocks Refers To ReportControl Blocks}
- * {@link LNodeDTO#getResumedDataTemplates Refers To DataTemplates Objects}
+ * {@link LNodeDTO#getDataAttributeRefs Refers To DataTemplates Objects}
*
*
* @see org.lfenergy.compas.scl2007b4.model.TLNode
@@ -55,7 +55,7 @@ public class LNodeDTO {
private Set smvControlBlocks = new HashSet<>();
private Set reportControlBlocks = new HashSet<>();
private Set datSets = new HashSet<>();
- private Set resumedDataTemplates = new HashSet<>();
+ private Set dataAttributeRefs = new HashSet<>();
/**
* Constructor
@@ -113,7 +113,7 @@ public static LNodeDTO from(AbstractLNAdapter nodeAdapter,
lNodeDTO.datSets = DataSetInfo.getDataSets(nodeAdapter);
}
- if(options.isWithResumedDtt()) {
+ if(options.isWithDataAttributeRef()) {
DataTypeTemplateAdapter dttAdapter = nodeAdapter.getDataTypeTemplateAdapter();
LNodeTypeAdapter lNodeTypeAdapter = dttAdapter.getLNodeTypeAdapterById(nodeAdapter.getLnType())
.orElseThrow(
@@ -124,13 +124,13 @@ public static LNodeDTO from(AbstractLNAdapter nodeAdapter,
)
)
);
- ResumedDataTemplate filter = ResumedDataTemplate.builder()
+ DataAttributeRef filter = DataAttributeRef.builder()
.lnInst(nodeAdapter.getLNInst())
.lnClass(nodeAdapter.getLNClass())
.prefix(nodeAdapter.getPrefix())
.lnType(nodeAdapter.getLnType()).build();
- List resumedDataTemplateList = lNodeTypeAdapter.getResumedDTTs(filter);
- lNodeDTO.addAllResumedDataTemplate(resumedDataTemplateList);
+ List dataAttributeRefList = lNodeTypeAdapter.getDataAttributeRefs(filter);
+ lNodeDTO.addAllDataAttributeRef(dataAttributeRefList);
}
if(options.isWithCB()) {
@@ -241,26 +241,26 @@ public void addAllDatSets(List dataSetList) {
/**
* Adds DataTypeTemplate's sumarised data
- * @param dtt input
+ * @param dataAttributeRef input
*/
- public void addResumedDataTemplate(ResumedDataTemplate dtt) {
- resumedDataTemplates.add(dtt);
+ public void addDataAttributeRef(DataAttributeRef dataAttributeRef) {
+ dataAttributeRefs.add(dataAttributeRef);
}
/**
* Adds list of DataTypeTemplate's sumarised data
- * @param dtt input
+ * @param dataAttributeRefs input
*/
- public void addAllResumedDataTemplate(List dtt) {
- this.resumedDataTemplates.addAll(dtt);
+ public void addAllDataAttributeRef(List dataAttributeRefs) {
+ this.dataAttributeRefs.addAll(dataAttributeRefs);
}
/**
* Gets DataTypeTemplate's sumarised data
- * @return Set of ResumedDataTemplate object
+ * @return Set of DataAttributeRef object
*/
- public Set getResumedDataTemplates(){
- return Set.of(resumedDataTemplates.toArray(new ResumedDataTemplate[0]));
+ public Set getDataAttributeRefs(){
+ return Set.of(dataAttributeRefs.toArray(new DataAttributeRef[0]));
}
/**
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/LogicalNodeOptions.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/LogicalNodeOptions.java
index 50406d529..268abcac9 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/LogicalNodeOptions.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/dto/LogicalNodeOptions.java
@@ -15,7 +15,7 @@
*
*
* - {@link LogicalNodeOptions#withExtRef withExtRef}
- * - {@link LogicalNodeOptions#withResumedDtt withResumedDtt}
+ * - {@link LogicalNodeOptions#withDataAttributeRef withDataAttributeRef}
* - {@link LogicalNodeOptions#withDatSet withDatSet}
* - {@link LogicalNodeOptions#withCB withCB}
*
@@ -25,20 +25,20 @@
@NoArgsConstructor
public class LogicalNodeOptions {
private boolean withExtRef = false;
- private boolean withResumedDtt = false;
+ private boolean withDataAttributeRef = false;
private boolean withCB = false;
private boolean withDatSet = false;
/**
* Constructor
* @param withExtRef input
- * @param withResumedDtt input
+ * @param withDataAttributeRef input
* @param withCB input
* @param withDatSet input
*/
- public LogicalNodeOptions(boolean withExtRef, boolean withResumedDtt, boolean withCB, boolean withDatSet) {
+ public LogicalNodeOptions(boolean withExtRef, boolean withDataAttributeRef, boolean withCB, boolean withDatSet) {
this.withExtRef = withExtRef;
- this.withResumedDtt = withResumedDtt;
+ this.withDataAttributeRef = withDataAttributeRef;
this.withCB = withCB;
this.withDatSet = withDatSet;
}
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java
index b271f5adf..b7f29e624 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/SclService.java
@@ -59,9 +59,9 @@
*
* DAI features
*
- * - {@link SclService#getDAI Returns list of ResumedDataTemplate }
- * - {@link SclService#updateDAI(SCL, String, String, ResumedDataTemplate)
- * Update the TDAI reference object for given iedName, ldInst and ResumedDataTemplate model}
+ * - {@link SclService#getDAI Returns list of DataAttributeRef }
+ * - {@link SclService#updateDAI(SCL, String, String, DataAttributeRef)
+ * Update the TDAI reference object for given iedName, ldInst and DataAttributeRef model}
*
* EnumType features
*
@@ -392,43 +392,43 @@ public static TExtRef updateExtRefSource(SCL scd, ExtRefInfo extRefInfo) throws
/**
* Gets a list of summarized DataTypeTemplate for DataAttribute DA (updatable or not) related to the one given
- * in rDtt
+ * in dataAttributeRef
*
* @param scd SCL file in which DataTypeTemplate of DAIs should be found
* @param iedName name of IED in which DAs are localized
* @param ldInst ldInst of LDevice in which DAIs are localized
- * @param rDtt reference summarized DataTypeTemplate related to IED DAIs
+ * @param dataAttributeRef reference summarized DataTypeTemplate related to IED DAIs
* @param updatable true to retrieve DataTypeTemplate's related to only updatable DAIs, false to retrieve all
- * @return List of resumed DataTypeTemplate for DataAttribute (updatable or not)
+ * @return Set of Data Attribute Reference for DataAttribute (updatable or not)
* @throws ScdException SCD illegal arguments exception, missing mandatory data
*/
- public static Set getDAI(SCL scd, String iedName, String ldInst, ResumedDataTemplate rDtt, boolean updatable) throws ScdException {
+ public static Set getDAI(SCL scd, String iedName, String ldInst, DataAttributeRef dataAttributeRef, boolean updatable) throws ScdException {
LDeviceAdapter lDeviceAdapter = createLDeviceAdapter(scd, iedName, ldInst);
- return lDeviceAdapter.getDAI(rDtt, updatable);
+ return lDeviceAdapter.getDAI(dataAttributeRef, updatable);
}
/**
- * Updates DAI based on given data in rDtt
+ * Updates DAI based on given data in dataAttributeRef
*
* @param scd SCL file in which DataTypeTemplate of DAI should be found
* @param iedName name of IED in which DAI is localized
* @param ldInst ldInst of LDevice in which DAI is localized
- * @param rDtt reference summarized DataTypeTemplate related to DAI to update
+ * @param dataAttributeRef reference summarized DataTypeTemplate related to DAI to update
* @throws ScdException when inconsistency are found in th SCL's
* DataTypeTemplate. Which should normally not happens.
*/
- public static void updateDAI(SCL scd, String iedName, String ldInst, ResumedDataTemplate rDtt) throws ScdException {
+ public static void updateDAI(SCL scd, String iedName, String ldInst, DataAttributeRef dataAttributeRef) throws ScdException {
long startTime = System.nanoTime();
log.info(Utils.entering());
SclRootAdapter sclRootAdapter = new SclRootAdapter(scd);
DataTypeTemplateAdapter dttAdapter = sclRootAdapter.getDataTypeTemplateAdapter();
- LNodeTypeAdapter lNodeTypeAdapter = dttAdapter.getLNodeTypeAdapterById(rDtt.getLnType())
- .orElseThrow(() -> new ScdException("Unknown LNodeType : " + rDtt.getLnType()));
- lNodeTypeAdapter.check(rDtt.getDoName(), rDtt.getDaName());
+ LNodeTypeAdapter lNodeTypeAdapter = dttAdapter.getLNodeTypeAdapterById(dataAttributeRef.getLnType())
+ .orElseThrow(() -> new ScdException("Unknown LNodeType : " + dataAttributeRef.getLnType()));
+ lNodeTypeAdapter.check(dataAttributeRef.getDoName(), dataAttributeRef.getDaName());
- if (TPredefinedBasicTypeEnum.OBJ_REF == rDtt.getBType()) {
- Long sGroup = rDtt.getDaName().getDaiValues().keySet().stream().findFirst().orElse(-1L);
- String val = sGroup < 0 ? null : rDtt.getDaName().getDaiValues().get(sGroup);
+ if (TPredefinedBasicTypeEnum.OBJ_REF == dataAttributeRef.getBType()) {
+ Long sGroup = dataAttributeRef.getDaName().getDaiValues().keySet().stream().findFirst().orElse(-1L);
+ String val = sGroup < 0 ? null : dataAttributeRef.getDaName().getDaiValues().get(sGroup);
sclRootAdapter.checkObjRef(val);
}
@@ -438,16 +438,16 @@ public static void updateDAI(SCL scd, String iedName, String ldInst, ResumedData
AbstractLNAdapter> lnAdapter = AbstractLNAdapter.builder()
.withLDeviceAdapter(lDeviceAdapter)
- .withLnClass(rDtt.getLnClass())
- .withLnInst(rDtt.getLnInst())
- .withLnPrefix(rDtt.getPrefix())
+ .withLnClass(dataAttributeRef.getLnClass())
+ .withLnInst(dataAttributeRef.getLnInst())
+ .withLnPrefix(dataAttributeRef.getPrefix())
.build();
- if (TPredefinedCDCEnum.ING == rDtt.getCdc() || TPredefinedCDCEnum.ASG == rDtt.getCdc()) {
- DAITracker daiTracker = new DAITracker(lnAdapter, rDtt.getDoName(), rDtt.getDaName());
+ if (TPredefinedCDCEnum.ING == dataAttributeRef.getCdc() || TPredefinedCDCEnum.ASG == dataAttributeRef.getCdc()) {
+ DAITracker daiTracker = new DAITracker(lnAdapter, dataAttributeRef.getDoName(), dataAttributeRef.getDaName());
daiTracker.validateBoundedDAI();
}
- lnAdapter.updateDAI(rDtt);
+ lnAdapter.updateDAI(dataAttributeRef);
log.info(Utils.leaving(startTime));
}
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/DATypeAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/DATypeAdapter.java
index 0d4f4c91a..626b156f1 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/DATypeAdapter.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/DATypeAdapter.java
@@ -11,7 +11,7 @@
import org.lfenergy.compas.scl2007b4.model.TPredefinedBasicTypeEnum;
import org.lfenergy.compas.scl2007b4.model.TProtNs;
import org.lfenergy.compas.sct.commons.dto.DaTypeName;
-import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate;
+import org.lfenergy.compas.sct.commons.dto.DataAttributeRef;
import org.lfenergy.compas.sct.commons.exception.ScdException;
import org.lfenergy.compas.sct.commons.util.Utils;
@@ -38,9 +38,9 @@
*
* - {@link DATypeAdapter#addPrivate Add TPrivate under this object}
* - {@link DATypeAdapter#getBDAByName Returns the value of the TBDA reference object By name}
- * - {@link DATypeAdapter#getResumedDTTByDaName Returns List Of ResumedDataTemplate By DaTypeName }
- * - {@link DATypeAdapter#getResumedDTTs Returns List Of ResumedDataTemplate By Custom filter}
- * - {@link DATypeAdapter#completeResumedDTT Returns Completed list Of ResumedDataTemplate }
+ * - {@link DATypeAdapter#getDataAttributeRefByDaName Returns List Of DataAttributeRef By DaTypeName }
+ * - {@link DATypeAdapter#getDataAttributeRefs Returns List Of DataAttributeRef By Custom filter}
+ * - {@link DATypeAdapter#completeDataAttributeRef Returns Completed list Of DataAttributeRef }
*
* - Checklist functions
*
@@ -64,19 +64,19 @@ public DATypeAdapter(DataTypeTemplateAdapter parentAdapter, TDAType currentElem)
/**
* Completes recursively given summarized DataTypeTemplate information from BDAs
- * @param rDtt summarized DataTypeTemplate to complete
+ * @param dataAttributeRef summarized DataTypeTemplate to complete
* @return list of completed (updated) summarized DataTypeTemplate
*/
- public List completeResumedDTT(ResumedDataTemplate rDtt) {
- List result = new ArrayList<>();
+ public List completeDataAttributeRef(DataAttributeRef dataAttributeRef) {
+ List result = new ArrayList<>();
for(BDAAdapter bdaAdapter : getBdaAdapters()){
- ResumedDataTemplate copyRDtt = ResumedDataTemplate.copyFrom(rDtt);
- copyRDtt.getDaName().addStructName(bdaAdapter.getName());
- copyRDtt.getDaName().setType(bdaAdapter.getType());
- copyRDtt.getDaName().setBType(bdaAdapter.getBType());
- copyRDtt.getDaName().setValImport(bdaAdapter.isValImport());
+ DataAttributeRef copyDataAttributeRef = DataAttributeRef.copyFrom(dataAttributeRef);
+ copyDataAttributeRef.getDaName().addStructName(bdaAdapter.getName());
+ copyDataAttributeRef.getDaName().setType(bdaAdapter.getType());
+ copyDataAttributeRef.getDaName().setBType(bdaAdapter.getBType());
+ copyDataAttributeRef.getDaName().setValImport(bdaAdapter.isValImport());
if(bdaAdapter.isTail()){
- copyRDtt.getDaName().addDaiValues(bdaAdapter.getCurrentElem().getVal());
+ copyDataAttributeRef.getDaName().addDaiValues(bdaAdapter.getCurrentElem().getVal());
} else {
DATypeAdapter daTypeAdapter = bdaAdapter.getDATypeAdapter()
.orElseThrow(
@@ -87,29 +87,29 @@ public List completeResumedDTT(ResumedDataTemplate rDtt) {
)
)
);
- result.addAll(daTypeAdapter.completeResumedDTT(copyRDtt));
+ result.addAll(daTypeAdapter.completeDataAttributeRef(copyDataAttributeRef));
}
- result.add(copyRDtt);
+ result.add(copyDataAttributeRef);
}
return result;
}
/**
- * complete the input resumed data type template from DataTypeTemplate filtered out by the given DaTypeName
+ * complete the input Data Attribute Reference from DataTypeTemplate filtered out by the given DaTypeName
* @param daTypeName the Data attributes, eventually with BDAs
* @param idx index of the BDAs list in the given DaTypeName
- * @param rDtt Resumed Data Template to complete
- * @return completed Resumed Data Template or null if the filter constrains are not met
+ * @param dataAttributeRef Data Attribute Reference
+ * @return completed Data Attribute Reference or null if the filter constrains are not met
* @throws ScdException if last BDA is of type STRUCT or intermediate BDA is not of type STRUCT
*/
- public Optional getResumedDTTByDaName(DaTypeName daTypeName,int idx,ResumedDataTemplate rDtt) throws ScdException {
+ public Optional getDataAttributeRefByDaName(DaTypeName daTypeName, int idx, DataAttributeRef dataAttributeRef) throws ScdException {
int sz= daTypeName.getStructNames().size();
String strBDAs = StringUtils.join(daTypeName.getStructNames());
if(sz - idx <= 0) {
- return Optional.of(rDtt);
+ return Optional.of(dataAttributeRef);
}
- DaTypeName typeName = rDtt.getDaName();
+ DaTypeName typeName = dataAttributeRef.getDaName();
DATypeAdapter daTypeAdapter = this;
String bdaName = daTypeName.getStructNames().get(idx);
@@ -128,16 +128,16 @@ public Optional getResumedDTTByDaName(DaTypeName daTypeName
String.format("Last BDA(%s) in '%s' cannot be of type STRUCT", bdaName, strBDAs)
);
}
- return Optional.of(rDtt);
+ return Optional.of(dataAttributeRef);
}
daTypeAdapter = daTypeAdapter.getDATypeAdapterByBdaName(bdaName)
.orElseThrow(
() -> new ScdException(String.format("Invalid BDA(%s) in '%s'",bdaName,strBDAs ))
);
- Optional opRDtt = daTypeAdapter.getResumedDTTByDaName(daTypeName,idx+1,rDtt);
- if(opRDtt.isPresent()){
- return opRDtt;
+ Optional opDataAttributeRef = daTypeAdapter.getDataAttributeRefByDaName(daTypeName,idx+1,dataAttributeRef);
+ if(opDataAttributeRef.isPresent()){
+ return opDataAttributeRef;
}
return Optional.empty();
@@ -276,37 +276,37 @@ public void check(DaTypeName daTypeName) throws ScdException {
}
/**
- * return a list of completed Resumed Data Type Templates beginning from this DoType (Do or SDO).
- * Each Resumed Data Type Template is instantiated from a reference resumed Data Type.
+ * return a list of completed Data Attribute References beginning from this DoType (Do or SDO).
+ * Each Data Attribute Reference is instantiated from a reference Data Type.
* @apiNote This method doesn't check relationship between DO/SDO and DA. Check should be done by caller
- * @param rootRDTT reference Resumed Data Type Template used to build the list
+ * @param rootDataAttributeRef reference Data Attribute Reference used to build the list
* @param filter filter for DO/SDO and DA/BDA
- * @return list of completed Resumed Data Type Templates beginning from this DoType (Do or SDO).
+ * @return list of completed Data Attribute References beginning from this DoType (Do or SDO).
*/
- public List getResumedDTTs(ResumedDataTemplate rootRDTT, ResumedDataTemplate filter) {
+ public List getDataAttributeRefs(DataAttributeRef rootDataAttributeRef, DataAttributeRef filter) {
- List resultRDTTs = new ArrayList<>();
+ List resultDataAttributeRefs = new ArrayList<>();
for(TBDA bda : currentElem.getBDA()){
if(filter != null && filter.isDaNameDefined() &&
!filter.getBdaNames().contains(bda.getName())){
continue;
}
- ResumedDataTemplate currentRDTT = ResumedDataTemplate.copyFrom(rootRDTT);
- currentRDTT.setBType(bda.getBType().value());
+ DataAttributeRef currentDataAttributeRef = DataAttributeRef.copyFrom(rootDataAttributeRef);
+ currentDataAttributeRef.setBType(bda.getBType().value());
if(bda.getBType() == TPredefinedBasicTypeEnum.STRUCT) {
- currentRDTT.addDaStructName(bda.getName());
+ currentDataAttributeRef.addDaStructName(bda.getName());
parentAdapter.getDATypeAdapterById(bda.getType()).ifPresent(
- daTypeAdapter -> resultRDTTs.addAll(daTypeAdapter.getResumedDTTs(currentRDTT, filter)));
+ daTypeAdapter -> resultDataAttributeRefs.addAll(daTypeAdapter.getDataAttributeRefs(currentDataAttributeRef, filter)));
} else {
- currentRDTT.addDaStructName(bda.getName());
- currentRDTT.setType(bda.getType());
- currentRDTT.getDaName().setValImport(bda.isValImport());
- currentRDTT.getDaName().addDaiValues(bda.getVal());
- resultRDTTs.add(currentRDTT);
+ currentDataAttributeRef.addDaStructName(bda.getName());
+ currentDataAttributeRef.setType(bda.getType());
+ currentDataAttributeRef.getDaName().setValImport(bda.isValImport());
+ currentDataAttributeRef.getDaName().addDaiValues(bda.getVal());
+ resultDataAttributeRefs.add(currentDataAttributeRef);
}
}
- return resultRDTTs;
+ return resultDataAttributeRefs;
}
/**
@@ -361,9 +361,9 @@ public Optional getBdaAdapterByName(String name) {
*
* - {@link BDAAdapter#addPrivate add Private}
* - {@link BDAAdapter#getBDAByName get TBDA By Name}
- * - {@link BDAAdapter#getResumedDTTByDaName get ResumedDTT By DaTypeName}
- * - {@link BDAAdapter#getResumedDTTs get ResumedDTTs By Custom filter}
- * - {@link BDAAdapter#completeResumedDTT Construct and Complete ResumedDTTs}
+ * - {@link BDAAdapter#getDataAttributeRefByDaName get DataAttributeRef By DaTypeName}
+ * - {@link BDAAdapter#getDataAttributeRefs get DataAttributeRefs By Custom filter}
+ * - {@link BDAAdapter#completeDataAttributeRef Construct and Complete DataAttributeRefs}
*
* - Check rules
*
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/DOTypeAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/DOTypeAdapter.java
index 3b85f4fd1..fc78d8b82 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/DOTypeAdapter.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/DOTypeAdapter.java
@@ -7,8 +7,8 @@
import org.apache.commons.lang3.tuple.Pair;
import org.lfenergy.compas.scl2007b4.model.*;
import org.lfenergy.compas.sct.commons.dto.DaTypeName;
+import org.lfenergy.compas.sct.commons.dto.DataAttributeRef;
import org.lfenergy.compas.sct.commons.dto.DoTypeName;
-import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate;
import org.lfenergy.compas.sct.commons.exception.ScdException;
import org.lfenergy.compas.sct.commons.util.Utils;
@@ -33,10 +33,10 @@
*
* - {@link DOTypeAdapter#addPrivate Add TPrivate under this object}
* - {@link DOTypeAdapter#getDAByName Returns the value of the TDA reference object By name}
- * - {@link DOTypeAdapter#getResumedDTTByDaName Returns ResumedDTT By DaTypeName }
- * - {@link DOTypeAdapter#getResumedDTTByDoName Returns ResumedDTT By DoTypeName }
- * - {@link DOTypeAdapter#getResumedDTTs Returns List Of ResumedDTT By Custom filter}
- * - {@link DOTypeAdapter#getResumedDTTsOfDA Returns List Of ResumedDTT By DA Object}
+ * - {@link DOTypeAdapter#getDataAttributeRefByDaName Returns DataAttributeRef By DaTypeName }
+ * - {@link DOTypeAdapter#getDataAttributeRefByDoName Returns DataAttributeRef By DoTypeName }
+ * - {@link DOTypeAdapter#getDataAttributeRefs Returns List Of DataAttributeRef By Custom filter}
+ * - {@link DOTypeAdapter#getDataAttributeRefsOfDA Returns List Of DataAttributeRef By DA Object}
* - {@link DOTypeAdapter#getSdoOrDAs Returns List of TSDO or TDA }
* - {@link DOTypeAdapter#getCdc Returns the value of the cdc attribute}
*
@@ -64,40 +64,40 @@ public DOTypeAdapter(DataTypeTemplateAdapter parentAdapter, TDOType currentElem)
}
/**
- * complete the input resumed data type template from DataTypeTemplate filtered out by the given DoTypeName
+ * complete the input Data Attribute Reference from DataTypeTemplate filtered out by the given DoTypeName
* @param doTypeName the Data object, eventually with DOs
* @param idx index of the DOs in the given DoTypeName
- * @param rDtt Resumed Data Template to complete
- * @return completed Resumed Data Template or null if the filter constrains are not met
+ * @param dataAttributeRef Data Attribute Reference to complete
+ * @return completed Data Attribute Reference or null if the filter constrains are not met
*/
- public List getResumedDTTByDoName(DoTypeName doTypeName, int idx, ResumedDataTemplate rDtt) {
+ public List getDataAttributeRefByDoName(DoTypeName doTypeName, int idx, DataAttributeRef dataAttributeRef) {
int sz = doTypeName.getStructNames().size();
if(!doTypeName.isDefined()) {
return new ArrayList<>();
}
- List result = new ArrayList<>();
+ List result = new ArrayList<>();
if(sz - idx > 0){
String sdoName = doTypeName.getStructNames().get(idx);
TSDO tsdo = getSDOByName(sdoName).orElse(null);
if(tsdo == null) {
return new ArrayList<>();
}
- ResumedDataTemplate copyRDtt = ResumedDataTemplate.copyFrom(rDtt);
- copyRDtt.getDoName().setCdc(getCdc());
- copyRDtt.getDoName().addStructName(sdoName);
+ DataAttributeRef copyDataAttributeRef = DataAttributeRef.copyFrom(dataAttributeRef);
+ copyDataAttributeRef.getDoName().setCdc(getCdc());
+ copyDataAttributeRef.getDoName().addStructName(sdoName);
DOTypeAdapter doTypeAdapter = getDataTypeTemplateAdapter().getDOTypeAdapterById(tsdo.getType())
.orElseThrow();
- result.addAll( doTypeAdapter.getResumedDTTByDoName(doTypeName,idx+1,copyRDtt));
+ result.addAll( doTypeAdapter.getDataAttributeRefByDoName(doTypeName,idx+1,copyDataAttributeRef));
} else {
for(TDA tda : getSdoOrDAs(TDA.class)){
- ResumedDataTemplate copyRDtt = ResumedDataTemplate.copyFrom(rDtt);
+ DataAttributeRef copyDataAttributeRef = DataAttributeRef.copyFrom(dataAttributeRef);
DAAdapter daAdapter = new DAAdapter(this,tda);
- copyRDtt.getDaName().setName(daAdapter.getName());
- copyRDtt.getDaName().setType(daAdapter.getType());
- copyRDtt.getDaName().setBType(daAdapter.getBType());
- copyRDtt.getDaName().setValImport(daAdapter.isValImport());
+ copyDataAttributeRef.getDaName().setName(daAdapter.getName());
+ copyDataAttributeRef.getDaName().setType(daAdapter.getType());
+ copyDataAttributeRef.getDaName().setBType(daAdapter.getBType());
+ copyDataAttributeRef.getDaName().setValImport(daAdapter.isValImport());
if(!daAdapter.isTail()){
DATypeAdapter daTypeAdapter = daAdapter.getDATypeAdapter()
.orElseThrow(
@@ -108,10 +108,10 @@ public List getResumedDTTByDoName(DoTypeName doTypeName, in
)
)
);
- result.addAll( daTypeAdapter.completeResumedDTT(copyRDtt));
+ result.addAll( daTypeAdapter.completeDataAttributeRef(copyDataAttributeRef));
} else {
- copyRDtt.getDaName().addDaiValues(tda.getVal());
- result.add(copyRDtt);
+ copyDataAttributeRef.getDaName().addDaiValues(tda.getVal());
+ result.add(copyDataAttributeRef);
}
}
}
@@ -119,18 +119,18 @@ public List getResumedDTTByDoName(DoTypeName doTypeName, in
}
/**
- * Completes recursively summarize Data Type Templates (rdtt) from DOType to specified DaTypeName.
+ * Completes recursively summarize Data Type Templates (dataAttributeRef) from DOType to specified DaTypeName.
* @param daTypeName the Data object, eventually with DA
- * @param rDtt reference Resumed Data Type Template to complete
- * @return optional of ResumedDataTemplate object
+ * @param dataAttributeRef reference Data Attribute Reference to complete
+ * @return optional of DataAttributeRef object
* @throws ScdException
*/
- public Optional getResumedDTTByDaName(DaTypeName daTypeName,
- ResumedDataTemplate rDtt) throws ScdException {
- if(!rDtt.getDoName().isDefined()) {
+ public Optional getDataAttributeRefByDaName(DaTypeName daTypeName,
+ DataAttributeRef dataAttributeRef) throws ScdException {
+ if(!dataAttributeRef.getDoName().isDefined()) {
return Optional.empty();
}
- DoTypeName doTypeName = rDtt.getDoName();
+ DoTypeName doTypeName = dataAttributeRef.getDoName();
for(TUnNaming tUnNaming : currentElem.getSDOOrDA()){
if(tUnNaming.getClass().equals(TSDO.class)) {
@@ -138,22 +138,22 @@ public Optional getResumedDTTByDaName(DaTypeName daTypeName
DOTypeAdapter doTypeAdapter = getDOTypeAdapterBySdoName(sdo.getName()).orElseThrow();
doTypeName.addStructName(sdo.getName());
doTypeName.setCdc(getCdc());
- Optional opRDtt = doTypeAdapter.getResumedDTTByDaName(daTypeName,rDtt);
- if (opRDtt.isPresent()) {
- return opRDtt;
+ Optional opDataAttributeRef = doTypeAdapter.getDataAttributeRefByDaName(daTypeName,dataAttributeRef);
+ if (opDataAttributeRef.isPresent()) {
+ return opDataAttributeRef;
}
} else {
TDA tda = (TDA)tUnNaming;
- rDtt.getDaName().setValImport(tda.isValImport());
- rDtt.getDaName().setFc(tda.getFc());
- rDtt.getDaName().setType(tda.getType());
- rDtt.getDaName().setBType(tda.getBType());
- rDtt.getDaName().setName(tda.getName());
- rDtt.setDaiValues(tda.getVal());
+ dataAttributeRef.getDaName().setValImport(tda.isValImport());
+ dataAttributeRef.getDaName().setFc(tda.getFc());
+ dataAttributeRef.getDaName().setType(tda.getType());
+ dataAttributeRef.getDaName().setBType(tda.getBType());
+ dataAttributeRef.getDaName().setName(tda.getName());
+ dataAttributeRef.setDaiValues(tda.getVal());
if(tda.getBType() != TPredefinedBasicTypeEnum.STRUCT &&
tda.getName().equals(daTypeName.getName()) &&
daTypeName.getStructNames().isEmpty() ){
- return Optional.of(rDtt);
+ return Optional.of(dataAttributeRef);
}
if(tda.getBType() == TPredefinedBasicTypeEnum.STRUCT &&
@@ -164,9 +164,9 @@ public Optional getResumedDTTByDaName(DaTypeName daTypeName
DATypeAdapter daTypeAdapter = daAdapter.getDATypeAdapter()
.orElseThrow(() -> new AssertionError(""));
- Optional opRDtt = daTypeAdapter.getResumedDTTByDaName(daTypeName,0,rDtt);
- if (opRDtt.isPresent()) {
- return opRDtt;
+ Optional opDataAttributeRef = daTypeAdapter.getDataAttributeRefByDaName(daTypeName,0,dataAttributeRef);
+ if (opDataAttributeRef.isPresent()) {
+ return opDataAttributeRef;
}
}
}
@@ -446,83 +446,83 @@ public TPredefinedCDCEnum getCdc() {
}
/**
- * return a list of Resumed Data Type Templates beginning from this DoType (Do or SDO).
+ * return a list of Data Attribute References beginning from this DoType (Do or SDO).
* @apiNote This method doesn't check relationship between DO/SDO and DA. Check should be done by caller
- * @param rootRDTT reference Resumed Data Type Template used to build the list
+ * @param rootDataAttributeRef reference Data Attribute Reference used to build the list
* @param filter filter for DO/SDO and DA/BDA
- * @return list of Resumed Data Type Templates beginning from this DoType (Do or SDO)
+ * @return list of Data Attribute References beginning from this DoType (Do or SDO)
*/
- public List getResumedDTTs(ResumedDataTemplate rootRDTT, ResumedDataTemplate filter) {
- List resultRDTTs = new ArrayList<>();
+ public List getDataAttributeRefs(DataAttributeRef rootDataAttributeRef, DataAttributeRef filter) {
+ List resultDataAttributeRefs = new ArrayList<>();
for(TUnNaming tUnNaming: currentElem.getSDOOrDA()){
if(tUnNaming.getClass() == TDA.class){
TDA tda = (TDA)tUnNaming;
- resultRDTTs.addAll(getResumedDTTsOfDA(rootRDTT, filter, tda));
+ resultDataAttributeRefs.addAll(getDataAttributeRefsOfDA(rootDataAttributeRef, filter, tda));
} else {
TSDO tsdo = (TSDO)tUnNaming;
if(excludedByFilter(filter, tsdo)){
continue;
}
- ResumedDataTemplate currentRDTT = ResumedDataTemplate.copyFrom(rootRDTT);
- currentRDTT.addDoStructName(tsdo.getName());
+ DataAttributeRef currentDataAttributeRef = DataAttributeRef.copyFrom(rootDataAttributeRef);
+ currentDataAttributeRef.addDoStructName(tsdo.getName());
parentAdapter.getDOTypeAdapterById(tsdo.getType()).ifPresent(
doTypeAdapter ->
- resultRDTTs.addAll(doTypeAdapter.getResumedDTTs(currentRDTT, filter)));
+ resultDataAttributeRefs.addAll(doTypeAdapter.getDataAttributeRefs(currentDataAttributeRef, filter)));
}
}
- return resultRDTTs;
+ return resultDataAttributeRefs;
}
/**
- * return a list of summarized Resumed Data Type Templates beginning from given DA/BDA.
+ * return a list of summarized Data Attribute References beginning from given DA/BDA.
*
- * - If DA the list will contain only one summarized Resumed Data Type Templates
- * - If BDA list will contain all summarized Resumed Data Type Templates for each DA in BDA
+ * - If DA the list will contain only one summarized Data Attribute References
+ * - If BDA list will contain all summarized Data Attribute References for each DA in BDA
*
* @apiNote This method doesn't check relationship between DO/SDO and DA. Check should be done by caller
- * @param rootRDTT reference Resumed Data Type Template used to build the list
+ * @param rootDataAttributeRef reference Data Attribute Reference used to build the list
* @param filter filter for DA/BDA
* @param da DA containing information to summarize
- * @return list of completed Resumed Data Type Templates beginning from this DoType.
+ * @return list of completed Data Attribute References beginning from this DoType.
*/
- private List getResumedDTTsOfDA(ResumedDataTemplate rootRDTT, ResumedDataTemplate filter, TDA da){
+ private List getDataAttributeRefsOfDA(DataAttributeRef rootDataAttributeRef, DataAttributeRef filter, TDA da){
if(excludedByFilter(filter, da)){
return Collections.emptyList();
}
- ResumedDataTemplate currentRDTT = ResumedDataTemplate.copyFrom(rootRDTT);
- currentRDTT.getDaName().setName(da.getName());
- currentRDTT.getDaName().setFc(da.getFc());
- currentRDTT.getDaName().setBType(da.getBType());
+ DataAttributeRef currentDataAttributeRef = DataAttributeRef.copyFrom(rootDataAttributeRef);
+ currentDataAttributeRef.getDaName().setName(da.getName());
+ currentDataAttributeRef.getDaName().setFc(da.getFc());
+ currentDataAttributeRef.getDaName().setBType(da.getBType());
if(da.getBType() == TPredefinedBasicTypeEnum.STRUCT){
return parentAdapter.getDATypeAdapterById(da.getType())
- .map(daTypeAdapter -> daTypeAdapter.getResumedDTTs(currentRDTT, filter))
+ .map(daTypeAdapter -> daTypeAdapter.getDataAttributeRefs(currentDataAttributeRef, filter))
.orElse(Collections.emptyList());
} else {
- currentRDTT.getDaName().setType(da.getType());
- currentRDTT.getDaName().setValImport(da.isValImport());
- currentRDTT.setDaiValues(da.getVal());
- return List.of(currentRDTT);
+ currentDataAttributeRef.getDaName().setType(da.getType());
+ currentDataAttributeRef.getDaName().setValImport(da.isValImport());
+ currentDataAttributeRef.setDaiValues(da.getVal());
+ return List.of(currentDataAttributeRef);
}
}
/**
- * Checks if given Resumed Data Type Template contains specified DA
- * @param filter Resumed Data Type Template to check contain
+ * Checks if given Data Attribute Reference contains specified DA
+ * @param filter Data Attribute Reference to check contain
* @param da SDO to checked
* @return Boolean exclusion result
*/
- private boolean excludedByFilter(ResumedDataTemplate filter, TDA da) {
+ private boolean excludedByFilter(DataAttributeRef filter, TDA da) {
return filter != null && filter.isDaNameDefined() &&
!filter.getDaName().getName().equals(da.getName());
}
/**
- * Checks if given Resumed Data Type Template contains specified SDO
- * @param filter Resumed Data Type Template to check contain
+ * Checks if given Data Attribute Reference contains specified SDO
+ * @param filter Data Attribute Reference to check contain
* @param tsdo SDO to checked
* @return Boolean exclusion result
*/
- private boolean excludedByFilter(ResumedDataTemplate filter, TSDO tsdo) {
+ private boolean excludedByFilter(DataAttributeRef filter, TSDO tsdo) {
return filter != null &&
!filter.getSdoNames().isEmpty() &&
!filter.getSdoNames().contains(tsdo.getName());
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/DataTypeTemplateAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/DataTypeTemplateAdapter.java
index 6f6e388cf..d81ab1360 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/DataTypeTemplateAdapter.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/DataTypeTemplateAdapter.java
@@ -558,7 +558,7 @@ protected String generateDttId(String iedName,String dttId){
* @return ExtRef binding information in ExtRefBindingInfo object
* @throws ScdException
*/
- public ExtRefBindingInfo getBinderResumedDTT(String lnType, ExtRefSignalInfo signalInfo) throws ScdException {
+ public ExtRefBindingInfo getBinderDataAttribute(String lnType, ExtRefSignalInfo signalInfo) throws ScdException {
ExtRefBindingInfo binder = new ExtRefBindingInfo();
// LNodeType check
LNodeTypeAdapter lNodeTypeAdapter = getLNodeTypeAdapterById(lnType)
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/LNodeTypeAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/LNodeTypeAdapter.java
index ffe1396b1..7e27d6c77 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/LNodeTypeAdapter.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/dtt/LNodeTypeAdapter.java
@@ -11,9 +11,9 @@
import org.lfenergy.compas.scl2007b4.model.TLNodeType;
import org.lfenergy.compas.scl2007b4.model.TPredefinedBasicTypeEnum;
import org.lfenergy.compas.sct.commons.dto.DaTypeName;
+import org.lfenergy.compas.sct.commons.dto.DataAttributeRef;
import org.lfenergy.compas.sct.commons.dto.DoTypeName;
import org.lfenergy.compas.sct.commons.dto.ExtRefSignalInfo;
-import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate;
import org.lfenergy.compas.sct.commons.exception.ScdException;
import org.lfenergy.compas.sct.commons.scl.SclElementAdapter;
import org.lfenergy.compas.sct.commons.util.Utils;
@@ -41,7 +41,7 @@
* - {@link LNodeTypeAdapter#getDOTypeId Returns the value of the type attribute By DOType Id}
* - {@link LNodeTypeAdapter#getId() Returns the value of the id attribute}
* - {@link LNodeTypeAdapter#getLNClass Returns the value of the lnClass attribute}
- * - {@link LNodeTypeAdapter#getResumedDTTs Returns ResumedDataTemplate list}
+ * - {@link LNodeTypeAdapter#getDataAttributeRefs Returns DataAttributeRef list}
*
* - Checklist functions
*
@@ -153,27 +153,27 @@ public Optional getDOTypeId(String doName){
}
/**
- * return a list of summarized Resumed Data Type Templates beginning from given this LNodeType.
+ * return a list of summarized Data Attribute References beginning from given this LNodeType.
* @apiNote This method doesn't check relationship between DO/SDO and DA. Check should be done by caller
* @param filter filter for LNodeType
- * @return list of completed Resumed Data Type Templates beginning from this LNodeType.
+ * @return list of completed Data Attribute References beginning from this LNodeType.
*/
- public List getResumedDTTs(@NonNull ResumedDataTemplate filter) {
+ public List getDataAttributeRefs(@NonNull DataAttributeRef filter) {
- List resumedDataTemplates = new ArrayList<>();
+ List dataAttributeRefs = new ArrayList<>();
if(filter.isDaNameDefined()) {
try {
check(filter.getDoName(),filter.getDaName());
} catch (ScdException e){
log.error(e.getMessage());
- return resumedDataTemplates;
+ return dataAttributeRefs;
}
}
- ResumedDataTemplate rootRDTT = new ResumedDataTemplate();
- rootRDTT.setLnType(currentElem.getId());
- rootRDTT.setLnClass(filter.getLnClass());
- rootRDTT.setLnInst(filter.getLnInst());
- rootRDTT.setPrefix(filter.getPrefix());
+ DataAttributeRef rootDataAttributeRef = new DataAttributeRef();
+ rootDataAttributeRef.setLnType(currentElem.getId());
+ rootDataAttributeRef.setLnClass(filter.getLnClass());
+ rootDataAttributeRef.setLnInst(filter.getLnInst());
+ rootDataAttributeRef.setPrefix(filter.getPrefix());
for(TDO tdo : currentElem.getDO()){
if(filter.isDoNameDefined() &&
@@ -183,14 +183,14 @@ public List getResumedDTTs(@NonNull ResumedDataTemplate fil
parentAdapter.getDOTypeAdapterById(tdo.getType()).ifPresent(
doTypeAdapter -> {
- ResumedDataTemplate currentRDTT = ResumedDataTemplate.copyFrom(rootRDTT);
- currentRDTT.getDoName().setName(tdo.getName());
- currentRDTT.getDoName().setCdc(doTypeAdapter.getCdc());
- resumedDataTemplates.addAll(doTypeAdapter.getResumedDTTs(currentRDTT, filter));
+ DataAttributeRef currentDataAttributeRef = DataAttributeRef.copyFrom(rootDataAttributeRef);
+ currentDataAttributeRef.getDoName().setName(tdo.getName());
+ currentDataAttributeRef.getDoName().setCdc(doTypeAdapter.getCdc());
+ dataAttributeRefs.addAll(doTypeAdapter.getDataAttributeRefs(currentDataAttributeRef, filter));
}
); // else this should never happen or the scd won't be built in the first place and we'd never be here
}
- return resumedDataTemplates;
+ return dataAttributeRefs;
}
/**
@@ -301,37 +301,37 @@ public void check(@NonNull DoTypeName doTypeName, @NonNull DaTypeName daTypeName
/**
* Gets list of summarized data type template from DaTypeName
* @param daTypeName DaTypeName from which summarized data type templates are created
- * @return list of ResumedDataTemplate object
+ * @return list of DataAttributeRef object
*/
- public List getResumedDTTByDaName(DaTypeName daTypeName) throws ScdException {
- Optional opRDtt;
- List rDtts = new ArrayList<>();
+ public List getDataAttributeRefByDaName(DaTypeName daTypeName) throws ScdException {
+ Optional opDataAttributeRef;
+ List dataAttributeRefs = new ArrayList<>();
for(TDO tdo : currentElem.getDO()){
DOAdapter doAdapter = new DOAdapter(this,tdo);
DOTypeAdapter doTypeAdapter = doAdapter.getDoTypeAdapter().orElseThrow();
- ResumedDataTemplate rDtt = new ResumedDataTemplate();
- rDtt.setLnType(currentElem.getId());
- rDtt.getDoName().setName(doAdapter.getCurrentElem().getName());
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
+ dataAttributeRef.setLnType(currentElem.getId());
+ dataAttributeRef.getDoName().setName(doAdapter.getCurrentElem().getName());
- opRDtt = doTypeAdapter.getResumedDTTByDaName(daTypeName, rDtt);
- opRDtt.ifPresent(rDtts::add);
+ opDataAttributeRef = doTypeAdapter.getDataAttributeRefByDaName(daTypeName, dataAttributeRef);
+ opDataAttributeRef.ifPresent(dataAttributeRefs::add);
}
- return rDtts;
+ return dataAttributeRefs;
}
/**
* Gets list of summarized data type template from DoTypeName
* @param doTypeName DoTypeName from which summarized data type templates are created
- * @return list of ResumedDataTemplate object
+ * @return list of DataAttributeRef object
*/
- public List getResumedDTTByDoName(DoTypeName doTypeName) {
+ public List getDataAttributeRefByDoName(DoTypeName doTypeName) {
DOAdapter doAdapter = getDOAdapterByName(doTypeName.getName()).orElseThrow();
- ResumedDataTemplate rDtt = new ResumedDataTemplate();
- rDtt.getDoName().setName(doTypeName.getName());
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
+ dataAttributeRef.getDoName().setName(doTypeName.getName());
DOTypeAdapter doTypeAdapter = doAdapter.getDoTypeAdapter().orElseThrow();
- return doTypeAdapter.getResumedDTTByDoName(doTypeName,0,rDtt);
+ return doTypeAdapter.getDataAttributeRefByDoName(doTypeName,0,dataAttributeRef);
}
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/AbstractLNAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/AbstractLNAdapter.java
index 30bf9f5ed..cb36bc0f4 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/AbstractLNAdapter.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/AbstractLNAdapter.java
@@ -47,8 +47,8 @@
* - {@link AbstractLNAdapter#getExtRefs() Returns the value of the TExtRef containment reference list}
* - {@link AbstractLNAdapter#getExtRefs(ExtRefSignalInfo) Returns the value of the TExtRef containment reference list By ExtRefSignalInfo }
*
- * - {@link AbstractLNAdapter#getDAI Returns the value of the ResumedDataTemplate containment reference By filter}
- * - {@link AbstractLNAdapter#getDAIValues(ResumedDataTemplate) Returns DAI (sGroup, value) containment reference list By ResumedDataTemplate filter}
+ * - {@link AbstractLNAdapter#getDAI Returns the value of the DataAttributeRef containment reference By filter}
+ * - {@link AbstractLNAdapter#getDAIValues(DataAttributeRef) Returns DAI (sGroup, value) containment reference list By DataAttributeRef filter}
*
* - {@link AbstractLNAdapter#getDataSetByName(String) Returns the value of the TDataSet object reference By the value of the name attribute }
*
@@ -103,7 +103,7 @@ public static LNAdapterBuilder builder() {
public abstract String getPrefix();
/**
- * Returns sets of enum value for given ResumedDataTemplate object
+ * Returns sets of enum value for given DataAttributeRef object
*
* @param enumType enum Type
* @return Enum value list
@@ -577,19 +577,19 @@ public TExtRef extractExtRefFromExtRefInfo(@NonNull ExtRefInfo extRefInfo) {
}
/**
- * Returns a list of resumed DataTypeTemplate for DataAttribute (updatable or not)
+ * Returns a list of Data Attribute Reference for DataAttribute (updatable or not)
*
- * @param rDtt reference resumed DataTypeTemplate (used as filter)
+ * @param dataAttributeRef Data Attribute Reference (used as filter)
* @param updatableOnly true to retrieve DataTypeTemplate's related to only updatable DAI, false to retrieve all
- * @return List of resumed DataTypeTemplate for DataAttribute (updatable or not)
+ * @return List of Data Attribute Reference (updatable or not)
* @throws ScdException SCD illegal arguments exception
*/
- public List getDAI(ResumedDataTemplate rDtt, boolean updatableOnly) throws ScdException {
+ public List getDAI(DataAttributeRef dataAttributeRef, boolean updatableOnly) throws ScdException {
String lnType = currentElem.getLnType();
- if (!StringUtils.isBlank(rDtt.getLnType())) {
- lnType = rDtt.getLnType();
+ if (!StringUtils.isBlank(dataAttributeRef.getLnType())) {
+ lnType = dataAttributeRef.getLnType();
}
- // get resumedDTT from DataTypeTemplate (it might be overridden in the DAI)
+ // get dataAttributeRef from DataTypeTemplate (it might be overridden in the DAI)
DataTypeTemplateAdapter dttAdapter = getDataTypeTemplateAdapter();
LNodeTypeAdapter lNodeTypeAdapter = dttAdapter.getLNodeTypeAdapterById(lnType)
.orElseThrow(
@@ -597,39 +597,39 @@ public List getDAI(ResumedDataTemplate rDtt, boolean updata
String.format("Corrupted SCD : lnType missing for LN : %s%s", getLNClass(), getLNInst())
)
);
- List resumedDTTs = lNodeTypeAdapter.getResumedDTTs(rDtt);
+ List dataAttributeRefs = lNodeTypeAdapter.getDataAttributeRefs(dataAttributeRef);
- resumedDTTs.forEach(this::overrideAttributesFromDAI);
+ dataAttributeRefs.forEach(this::overrideAttributesFromDAI);
if (updatableOnly) {
- return resumedDTTs.stream().filter(ResumedDataTemplate::isUpdatable).toList();
+ return dataAttributeRefs.stream().filter(DataAttributeRef::isUpdatable).toList();
} else {
- return resumedDTTs;
+ return dataAttributeRefs;
}
}
/**
- * Update given ResumedDataTemplate DAI datas from LNode
+ * Update given DataAttributeRef DAI datas from LNode
*
- * @param rDtt summarized Data Type Template object to update DAI datas
+ * @param dataAttributeRef summarized Data Type Template object to update DAI datas
*/
- protected void overrideAttributesFromDAI(final ResumedDataTemplate rDtt) {
- findMatch(rDtt.getDoName(), rDtt.getDaName())
+ protected void overrideAttributesFromDAI(final DataAttributeRef dataAttributeRef) {
+ findMatch(dataAttributeRef.getDoName(), dataAttributeRef.getDaName())
.map(iDataAdapter -> (AbstractDAIAdapter>) iDataAdapter)
.map(AbstractDAIAdapter::getCurrentElem)
.ifPresent(tdai -> {
- rDtt.setDaiValues(tdai.getVal());
- if (rDtt.getDaName().getFc() == TFCEnum.SG || rDtt.getDaName().getFc() == TFCEnum.SE) {
+ dataAttributeRef.setDaiValues(tdai.getVal());
+ if (dataAttributeRef.getDaName().getFc() == TFCEnum.SG || dataAttributeRef.getDaName().getFc() == TFCEnum.SE) {
boolean isGroup = hasSgGroup(tdai);
if (isGroup) {
- rDtt.setValImport((!tdai.isSetValImport() || tdai.isValImport()) && iedHasConfSG());
+ dataAttributeRef.setValImport((!tdai.isSetValImport() || tdai.isValImport()) && iedHasConfSG());
} else {
- rDtt.setValImport(false);
+ dataAttributeRef.setValImport(false);
log.warn("Inconsistency in the SCD file - DAI {} with fc={} must have a sGroup attribute",
- rDtt.getObjRef(getParentIed().getName(), parentAdapter.getInst()), rDtt.getDaName().getFc());
+ dataAttributeRef.getObjRef(getParentIed().getName(), parentAdapter.getInst()), dataAttributeRef.getDaName().getFc());
}
} else if (tdai.isSetValImport()) {
- rDtt.setValImport(tdai.isValImport());
+ dataAttributeRef.setValImport(tdai.isValImport());
}
});
}
@@ -711,28 +711,28 @@ protected Optional findMatch(DoTypeName doTypeName, DaTypeName daT
/**
* Updates DAI in LN/LN0 section.
* It will create the missing DOI/SDI/DAI in this LN/LN0 if needed.
- * Be careful, this method does not check that the given rDtt is allowed by the lnType of this LN/LN0.
- * It does not even check if rDtt exists in DataTypeTemplate section.
+ * Be careful, this method does not check that the given dataAttributeRef is allowed by the lnType of this LN/LN0.
+ * It does not even check if dataAttributeRef exists in DataTypeTemplate section.
* That means that it will create the missing DOI/SDI/DAI, even if it is not consistent with DataTypeTemplate section.
- * It is the caller responsibility to ensure the consistency between the given rDtt and the lnType of this LN/LN0 (which points to DataTypeTemplate section).
+ * It is the caller responsibility to ensure the consistency between the given dataAttributeRef and the lnType of this LN/LN0 (which points to DataTypeTemplate section).
* See 9.3.5 "LN0 and other Logical Nodes" of IEC 61850-6.
- * If given rDtt.isUpdatable() is false, the method does nothing (it will not check if DA/BDA is updatable in DataTypeTemplate section).
- * This method will not remove any Val, it will only create new Val or replace existing Val (for example if rDtt.getDaName().getDaiValues() is empty, it does nothing)
+ * If given dataAttributeRef.isUpdatable() is false, the method does nothing (it will not check if DA/BDA is updatable in DataTypeTemplate section).
+ * This method will not remove any Val, it will only create new Val or replace existing Val (for example if dataAttributeRef.getDaName().getDaiValues() is empty, it does nothing)
*
- * @param rDtt summarized Data Type Temple containing new DA val
- * @throws ScdException when given rDtt is missing DoName or DaName
+ * @param dataAttributeRef summarized Data Type Temple containing new DA val
+ * @throws ScdException when given dataAttributeRef is missing DoName or DaName
*/
- public void updateDAI(@NonNull ResumedDataTemplate rDtt) throws ScdException {
+ public void updateDAI(@NonNull DataAttributeRef dataAttributeRef) throws ScdException {
- if (!rDtt.isDoNameDefined() || !rDtt.isDaNameDefined()) {
+ if (!dataAttributeRef.isDoNameDefined() || !dataAttributeRef.isDaNameDefined()) {
throw new ScdException("Cannot update undefined DAI");
}
- if (!rDtt.isUpdatable() || rDtt.getDaName().getDaiValues().isEmpty()) {
+ if (!dataAttributeRef.isUpdatable() || dataAttributeRef.getDaName().getDaiValues().isEmpty()) {
return;
}
- AbstractDAIAdapter> daiAdapter = createDoiSdiDaiChainIfNotExists(rDtt.getDataAttributes(), rDtt.isUpdatable());
- daiAdapter.update(rDtt.getDaName().getDaiValues());
+ AbstractDAIAdapter> daiAdapter = createDoiSdiDaiChainIfNotExists(dataAttributeRef.getDataAttributes(), dataAttributeRef.isUpdatable());
+ daiAdapter.update(dataAttributeRef.getDaName().getDaiValues());
}
/**
@@ -813,14 +813,14 @@ public boolean matches(ObjectReference objRef) {
String.format("Corrupted SCD file: Reference to unknown LNodeType(%s)", getLnType())
)
);
- ResumedDataTemplate filter = ResumedDataTemplate.builder()
+ DataAttributeRef filter = DataAttributeRef.builder()
.lnInst(getLNInst())
.lnClass(getLNClass())
.lnType(currentElem.getLnType()).build();
- List rDtts = lNodeTypeAdapter.getResumedDTTs(filter);
+ List dataAttributeRefs = lNodeTypeAdapter.getDataAttributeRefs(filter);
return matchesDataAttributes(dataAttribute) ||
- rDtts.stream().anyMatch(rDtt -> rDtt.getDataAttributes().startsWith(dataAttribute));
+ dataAttributeRefs.stream().anyMatch(dataAttributeRef -> dataAttributeRef.getDataAttributes().startsWith(dataAttribute));
}
/**
@@ -851,11 +851,11 @@ public Optional getDataSetByName(String dataSetName) {
/**
* Gets DAI values for specified DA in summaraized Data Type Template
*
- * @param rDtt summaraized Data Type Template containing DA datas
+ * @param dataAttributeRef summaraized Data Type Template containing DA datas
* @return map of Setting Group and it's VAL
*/
- public Map getDAIValues(ResumedDataTemplate rDtt) {
- DAITracker daiTracker = new DAITracker(this, rDtt.getDoName(), rDtt.getDaName());
+ public Map getDAIValues(DataAttributeRef dataAttributeRef) {
+ DAITracker daiTracker = new DAITracker(this, dataAttributeRef.getDoName(), dataAttributeRef.getDaName());
DAITracker.MatchResult matchResult = daiTracker.search();
if (matchResult != DAITracker.MatchResult.FULL_MATCH) {
return new HashMap<>();
@@ -1042,11 +1042,11 @@ public List getFCDAs(TExtRef tExtRef) {
*/
public Optional getDaiModStValValue() {
return getDaiModStVal()
- .flatMap(ResumedDataTemplate::findFirstValue);
+ .flatMap(DataAttributeRef::findFirstValue);
}
- protected Optional getDaiModStVal() {
- ResumedDataTemplate daiModFilter = new ResumedDataTemplate(this, MOD_DO_TYPE_NAME, STVAL_DA_TYPE_NAME);
+ protected Optional getDaiModStVal() {
+ DataAttributeRef daiModFilter = new DataAttributeRef(this, MOD_DO_TYPE_NAME, STVAL_DA_TYPE_NAME);
return getDAI(daiModFilter, false).stream()
.findFirst();
}
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/DAITracker.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/DAITracker.java
index 7369710ef..40ee993c7 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/DAITracker.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/DAITracker.java
@@ -9,8 +9,8 @@
import org.apache.commons.lang3.tuple.Pair;
import org.lfenergy.compas.scl2007b4.model.TPredefinedCDCEnum;
import org.lfenergy.compas.sct.commons.dto.DaTypeName;
+import org.lfenergy.compas.sct.commons.dto.DataAttributeRef;
import org.lfenergy.compas.sct.commons.dto.DoTypeName;
-import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate;
import org.lfenergy.compas.sct.commons.exception.ScdException;
import org.lfenergy.compas.sct.commons.scl.dtt.DataTypeTemplateAdapter;
import org.lfenergy.compas.sct.commons.scl.dtt.LNodeTypeAdapter;
@@ -157,17 +157,17 @@ public void validateBoundedDAI() throws ScdException {
LNodeTypeAdapter lNodeTypeAdapter = dttAdapter.getLNodeTypeAdapterById(lnAdapter.getLnType())
.orElseThrow(() -> new ScdException("Unknown LNodeType : " + lnAdapter.getLnType()));
- List rDtts = lNodeTypeAdapter.getResumedDTTByDoName(doTypeName);
+ List dataAttributeRefs = lNodeTypeAdapter.getDataAttributeRefByDoName(doTypeName);
try{
- ResumedDataTemplate tempRDtt = rDtts.stream()
+ DataAttributeRef tempDataAttributeRef = dataAttributeRefs.stream()
.filter(rData -> rData.getDaName().getName().equals("minVal")).findFirst().orElse(null);
- if(tempRDtt != null) {
- Map daiValues = lnAdapter.getDAIValues(tempRDtt);
+ if(tempDataAttributeRef != null) {
+ Map daiValues = lnAdapter.getDAIValues(tempDataAttributeRef);
if (!daiValues.isEmpty()) {
- tempRDtt.getDaName().setDaiValues(daiValues);
+ tempDataAttributeRef.getDaName().setDaiValues(daiValues);
}
- double min = getDaiNumericValue(tempRDtt.getDaName(), Double.MIN_VALUE);
+ double min = getDaiNumericValue(tempDataAttributeRef.getDaName(), Double.MIN_VALUE);
if (val < min) {
throw new ScdException(
String.format("The DA(%s) value(%f) must be greater than(%f)",daTypeName, val,min)
@@ -175,15 +175,15 @@ public void validateBoundedDAI() throws ScdException {
}
}
- tempRDtt = rDtts.stream()
+ tempDataAttributeRef = dataAttributeRefs.stream()
.filter(rData -> rData.getDaName().getName().equals("maxVal")).findFirst().orElse(null);
- if(tempRDtt != null) {
- Map daiValues = lnAdapter.getDAIValues(tempRDtt);
+ if(tempDataAttributeRef != null) {
+ Map daiValues = lnAdapter.getDAIValues(tempDataAttributeRef);
if (!daiValues.isEmpty()) {
- tempRDtt.getDaName().setDaiValues(daiValues);
+ tempDataAttributeRef.getDaName().setDaiValues(daiValues);
}
- double max = getDaiNumericValue(tempRDtt.getDaName(), Double.MAX_VALUE);
+ double max = getDaiNumericValue(tempDataAttributeRef.getDaName(), Double.MAX_VALUE);
if (val > max) {
throw new ScdException(
String.format("The DA(%s) value(%f) must be less than(%f)",daTypeName, val,max)
@@ -191,15 +191,15 @@ public void validateBoundedDAI() throws ScdException {
}
}
- tempRDtt = rDtts.stream()
+ tempDataAttributeRef = dataAttributeRefs.stream()
.filter(rData -> rData.getDaName().getName().equals("stepSize")).findFirst().orElse(null);
- if(tempRDtt != null) {
- Map daiValues = lnAdapter.getDAIValues(tempRDtt);
+ if(tempDataAttributeRef != null) {
+ Map daiValues = lnAdapter.getDAIValues(tempDataAttributeRef);
if (!daiValues.isEmpty()) {
- tempRDtt.getDaName().setDaiValues(daiValues);
+ tempDataAttributeRef.getDaName().setDaiValues(daiValues);
}
- double step = getDaiNumericValue(tempRDtt.getDaName(),val);
+ double step = getDaiNumericValue(tempDataAttributeRef.getDaName(),val);
if (Math.abs((int)val)% Math.abs((int)step) > Math.pow(10,-9)) {
throw new ScdException(
String.format("The DA(%s) value(%f) divisible by (%f)",daTypeName,val,step)
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/DOIAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/DOIAdapter.java
index 1d4d90937..d36f26577 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/DOIAdapter.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/DOIAdapter.java
@@ -134,12 +134,12 @@ public List updateDaiFromExtRef(List tExtRefs) {
}
private Optional updateDAI(String daName, String value) {
- ResumedDataTemplate daiFilterSrcRef = new ResumedDataTemplate(getParentAdapter(), new DoTypeName(getName()), new DaTypeName(daName));
- Optional foundDais = getParentAdapter().getDAI(daiFilterSrcRef, true).stream().findFirst();
+ DataAttributeRef daiFilterSrcRef = new DataAttributeRef(getParentAdapter(), new DoTypeName(getName()), new DaTypeName(daName));
+ Optional foundDais = getParentAdapter().getDAI(daiFilterSrcRef, true).stream().findFirst();
if (foundDais.isEmpty()) {
return Optional.of(SclReportItem.warning(getXPath() + "/DAI@name=\"" + daName + "\"/Val", "The DAI cannot be updated"));
}
- ResumedDataTemplate filterForUpdate = foundDais.get();
+ DataAttributeRef filterForUpdate = foundDais.get();
filterForUpdate.setVal(value);
getParentAdapter().updateDAI(filterForUpdate);
return Optional.empty();
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/InputsAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/InputsAdapter.java
index cf71ba2f1..c12675970 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/InputsAdapter.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/InputsAdapter.java
@@ -8,7 +8,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.lfenergy.compas.scl2007b4.model.*;
-import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate;
+import org.lfenergy.compas.sct.commons.dto.DataAttributeRef;
import org.lfenergy.compas.sct.commons.dto.SclReportItem;
import org.lfenergy.compas.sct.commons.exception.ScdException;
import org.lfenergy.compas.sct.commons.scl.ExtRefService;
@@ -314,7 +314,7 @@ private Optional updateSourceDataSetsAndControlBlocks(TExtRef ext
return warningReportItem(extRef, String.format(MESSAGE_SOURCE_LDEVICE_NOT_FOUND, sourceIed.getXPath()));
}
LDeviceAdapter sourceLDevice = optionalSourceLDevice.get();
- Set sourceDas = sourceLDevice.findSourceDA(extRef);
+ Set sourceDas = sourceLDevice.findSourceDA(extRef);
if (sourceDas.isEmpty()) {
return warningReportItem(extRef, String.format(MESSAGE_SOURCE_LN_NOT_FOUND, optionalSourceLDevice.get().getXPath()));
}
@@ -341,7 +341,7 @@ private Optional updateSourceDataSetsAndControlBlocks(TExtRef ext
return Optional.empty();
}
- private void createDataSetWithFCDA(TExtRef extRef, LDeviceAdapter sourceLDevice, ResumedDataTemplate sourceDa, String dataSetName) {
+ private void createDataSetWithFCDA(TExtRef extRef, LDeviceAdapter sourceLDevice, DataAttributeRef sourceDa, String dataSetName) {
DataSetAdapter dataSetAdapter = sourceLDevice.getLN0Adapter().createDataSetIfNotExists(dataSetName, ControlBlockEnum.from(extRef.getServiceType()));
String fcdaDaName = extRef.getServiceType() == TServiceType.REPORT ? null : sourceDa.getDaRef();
String fcdaLnClass = extRef.getLnClass().stream().findFirst().orElse(null);
@@ -351,7 +351,7 @@ private void createDataSetWithFCDA(TExtRef extRef, LDeviceAdapter sourceLDevice,
sourceDa.getFc());
}
- private void createControlBlockWithTarget(TExtRef extRef, LDeviceAdapter sourceLDevice, ResumedDataTemplate sourceDa, String cbName, String datSet) {
+ private void createControlBlockWithTarget(TExtRef extRef, LDeviceAdapter sourceLDevice, DataAttributeRef sourceDa, String cbName, String datSet) {
String sourceLDName = sourceLDevice.getLdName();
String cbId = getParentAdapter().generateControlBlockId(sourceLDName, cbName);
ControlBlockAdapter controlBlockAdapter = sourceLDevice.getLN0Adapter().createControlBlockIfNotExists(cbName, cbId, datSet, ControlBlockEnum.from(extRef.getServiceType()));
@@ -371,7 +371,7 @@ private void setExtRefSrcAttributes(TExtRef extRef, String cbName) {
extRef.unsetSrcLNClass();
}
- private static String generateDataSetSuffix(TExtRef extRef, ResumedDataTemplate sourceDa, boolean isBayInternal) {
+ private static String generateDataSetSuffix(TExtRef extRef, DataAttributeRef sourceDa, boolean isBayInternal) {
return extRef.getLdInst().toUpperCase(Locale.ENGLISH) + ATTRIBUTE_VALUE_SEPARATOR
+ switch (extRef.getServiceType()) {
case GOOSE -> "G" + ((sourceDa.getFc() == TFCEnum.ST) ? "S" : "M");
@@ -382,7 +382,7 @@ private static String generateDataSetSuffix(TExtRef extRef, ResumedDataTemplate
+ (isBayInternal ? "I" : "E");
}
- private Optional removeFilteredSourceDas(TExtRef extRef, final Set sourceDas) {
+ private Optional removeFilteredSourceDas(TExtRef extRef, final Set sourceDas) {
sourceDas.removeIf(da -> da.getFc() != TFCEnum.MX && da.getFc() != TFCEnum.ST);
return switch (extRef.getServiceType()) {
case GOOSE, SMV -> {
@@ -394,12 +394,12 @@ private Optional removeFilteredSourceDas(TExtRef extRef, final Se
};
}
- private Optional removeFilterSourceDaForReport(TExtRef extRef, Set sourceDas) {
+ private Optional removeFilterSourceDaForReport(TExtRef extRef, Set sourceDas) {
String daName = Utils.extractField(extRef.getDesc(), ATTRIBUTE_VALUE_SEPARATOR, EXTREF_DESC_DA_NAME_POSITION);
if (StringUtils.isBlank(daName)) {
return fatalReportItem(extRef, MESSAGE_EXTREF_DESC_MALFORMED);
}
- sourceDas.removeIf(resumedDataTemplate -> !resumedDataTemplate.getDaName().toString().equals(daName));
+ sourceDas.removeIf(dataAttributeRef -> !dataAttributeRef.getDaName().toString().equals(daName));
return Optional.empty();
}
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/LDeviceAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/LDeviceAdapter.java
index 99ce8a387..239fc85ca 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/LDeviceAdapter.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/LDeviceAdapter.java
@@ -40,7 +40,7 @@
* - {@link LDeviceAdapter#getLdName Returns the value of the ldName attribute}
* - {@link LDeviceAdapter#getExtRefInfo em>Returns the value of the ExtRefInfo containment reference}
* - {@link LDeviceAdapter#getExtRefBinders Returns the value of the ExtRefBindingInfo containment reference list By ExtRefSignalInfo}
- * - {@link LDeviceAdapter#getDAI Returns the value of the ResumedDataTemplate containment reference By filter}
+ * - {@link LDeviceAdapter#getDAI Returns the value of the DataAttributeRef containment reference By filter}
* - {@link LDeviceAdapter#addPrivate Add TPrivate under this object}
*
*
@@ -83,9 +83,9 @@ public void createHmiReportControlBlocks(List fcdas) {
.forEach(fcda -> (fcda.getLnClass().get(0).equals(TLLN0Enum.LLN_0.value()) ?
Optional.of(ln0) // ln0 Mod stVal "ON" has already been checked, no need to check it again
: findLnAdapter(fcda.getLnClass().get(0), fcda.getLnInst(), fcda.getPrefix()).filter(lnAdapter -> lnAdapter.getDaiModStValValue().map(LDeviceStatus.ON::equals).orElse(true)))
- .map(sourceLn -> sourceLn.getDAI(new ResumedDataTemplate(fcda), false))
+ .map(sourceLn -> sourceLn.getDAI(new DataAttributeRef(fcda), false))
.filter(das -> das.stream().anyMatch(da -> fcda.getFc() == da.getFc())) // getDAI does not filter on DA.
- .ifPresent(resumedDataTemplates -> createHmiReportCB(ln0, fcda)));
+ .ifPresent(dataAttributeRefs -> createHmiReportCB(ln0, fcda)));
}
private void createHmiReportCB(LN0Adapter ln0, TFCDA fcda) {
@@ -270,7 +270,7 @@ public List getExtRefBinders(ExtRefSignalInfo signalInfo) {
.filter(abstractLNAdapter -> StringUtils.isBlank(signalInfo.getPLN()) || abstractLNAdapter.getLNClass().equals(signalInfo.getPLN()))
.map(lnAdapter -> {
String lnType = lnAdapter.getLnType();
- ExtRefBindingInfo extRefBindingInfo = dttAdapter.getBinderResumedDTT(lnType, signalInfo);
+ ExtRefBindingInfo extRefBindingInfo = dttAdapter.getBinderDataAttribute(lnType, signalInfo);
extRefBindingInfo.setIedName(parentAdapter.getName());
extRefBindingInfo.setLdInst(currentElem.getInst());
extRefBindingInfo.setLnClass(lnAdapter.getLNClass());
@@ -301,31 +301,31 @@ public List getExtRefInfo() {
/**
* Gets a list of summarized DataTypeTemplate for DataAttribute DAIs (updatableOnly or not)
*
- * @param rDtt reference resumed DataTypeTemplate (used as filter)
+ * @param dataAttributeRef Data Attribute Reference (used as filter)
* @param updatableOnly true to retrieve only updatableOnly DAIs, false to retrieve all DAIs
- * @return Set of ResumedDataTemplate (updatableOnly or not)
+ * @return Set of DataAttributeRef (updatableOnly or not)
* @throws ScdException SCD illegal arguments exception
*/
- public Set getDAI(ResumedDataTemplate rDtt, boolean updatableOnly) throws ScdException {
+ public Set getDAI(DataAttributeRef dataAttributeRef, boolean updatableOnly) throws ScdException {
List extends AbstractLNAdapter>> lnAdapters;
- if (StringUtils.isBlank(rDtt.getLnClass())) {
+ if (StringUtils.isBlank(dataAttributeRef.getLnClass())) {
lnAdapters = getLNAdaptersIncludingLN0();
- } else if (rDtt.getLnClass().equals(TLLN0Enum.LLN_0.value())) {
+ } else if (dataAttributeRef.getLnClass().equals(TLLN0Enum.LLN_0.value())) {
lnAdapters = hasLN0() ? Collections.singletonList(getLN0Adapter()) : Collections.emptyList();
} else {
- lnAdapters = findLnAdapter(rDtt.getLnClass(), rDtt.getLnInst(), rDtt.getPrefix()).stream().toList();
+ lnAdapters = findLnAdapter(dataAttributeRef.getLnClass(), dataAttributeRef.getLnInst(), dataAttributeRef.getPrefix()).stream().toList();
}
- Set resumedDataTemplateSet = new HashSet<>();
+ Set dataAttributeRefSet = new HashSet<>();
for (AbstractLNAdapter> lnAdapter : lnAdapters) {
- ResumedDataTemplate filter = ResumedDataTemplate.copyFrom(rDtt);
+ DataAttributeRef filter = DataAttributeRef.copyFrom(dataAttributeRef);
filter.setLnClass(lnAdapter.getLNClass());
filter.setLnInst(lnAdapter.getLNInst());
filter.setPrefix(lnAdapter.getPrefix());
filter.setLnType(lnAdapter.getLnType());
- resumedDataTemplateSet.addAll(lnAdapter.getDAI(filter, updatableOnly));
+ dataAttributeRefSet.addAll(lnAdapter.getDAI(filter, updatableOnly));
}
- return resumedDataTemplateSet;
+ return dataAttributeRefSet;
}
@@ -357,9 +357,9 @@ public List createDataSetAndControlBlocks() {
.updateAllSourceDataSetsAndControlBlocks();
}
- public Set findSourceDA(TExtRef extRef) {
+ public Set findSourceDA(TExtRef extRef) {
String extRefLnClass = extRef.getLnClass().stream().findFirst().orElse("");
- ResumedDataTemplate filter = ResumedDataTemplate.builder()
+ DataAttributeRef filter = DataAttributeRef.builder()
.lnClass(extRefLnClass)
.prefix(extRef.getPrefix())
.lnInst(extRef.getLnInst())
@@ -435,13 +435,13 @@ public Optional manageMonitoringLns(List tExtRefs, Strin
return getLNAdapters().stream().filter(lnAdapter -> monitoringLnClassEnum.value().equals(lnAdapter.getLNClass()))
.map(lnAdapter -> {
Optional optionalSclReportItem = Optional.empty();
- ResumedDataTemplate filter = new ResumedDataTemplate(lnAdapter, new DoTypeName(doName), new DaTypeName(DA_SETSRCREF));
- Optional foundDai = lnAdapter.getDAI(filter, true).stream().findFirst();
+ DataAttributeRef filter = new DataAttributeRef(lnAdapter, new DoTypeName(doName), new DaTypeName(DA_SETSRCREF));
+ Optional foundDai = lnAdapter.getDAI(filter, true).stream().findFirst();
if (foundDai.isEmpty()) {
optionalSclReportItem = Optional.of(SclReportItem.warning(lnAdapter.getXPath() + "/DOI@name=\"" + doName + "\"/DAI@name=\"setSrcRef\"/Val",
"The DAI cannot be updated"));
} else {
- ResumedDataTemplate daToUpdateFilter = foundDai.get();
+ DataAttributeRef daToUpdateFilter = foundDai.get();
TLN lnToUpdate = lnAdapter.getCurrentElem();
removeLnsByLnClass(monitoringLnClassEnum);
for (int i = 0; i < tExtRefs.size(); i++) {
@@ -463,7 +463,7 @@ private void removeLnsByLnClass(MonitoringLnClassEnum monitoringLnClassEnum) {
getCurrentElem().getLN().addAll(lnToKeep);
}
- private void updateNewCreatedLnDaiValue(TLN tln, TExtRef tExtRef, String lnInst, ResumedDataTemplate daToUpdate) {
+ private void updateNewCreatedLnDaiValue(TLN tln, TExtRef tExtRef, String lnInst, DataAttributeRef daToUpdate) {
LNAdapter lnAdapter = new LNAdapter(this, tln);
String value = createVal(tExtRef);
lnAdapter.getCurrentElem().setInst(lnInst);
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/LN0Adapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/LN0Adapter.java
index 5bd312aa3..f30f32da3 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/LN0Adapter.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/LN0Adapter.java
@@ -42,8 +42,8 @@
* {@link LN0Adapter#getExtRefs(ExtRefSignalInfo) Returns the value of the TExtRef containment reference list By ExtRefSignalInfo }
* {@link LN0Adapter#isExtRefExist(ExtRefSignalInfo) throws exception when specified signal not found in LN target}
*
- * {@link LN0Adapter#getDAI Returns the value of the ResumedDataTemplate containment reference By filter}
- * {@link LN0Adapter#getDAIValues(ResumedDataTemplate) Returns DAI (sGroup, value) containment reference list By ResumedDataTemplate filter}
+ * {@link LN0Adapter#getDAI Returns the value of the DataAttributeRef containment reference By filter}
+ * {@link LN0Adapter#getDAIValues(DataAttributeRef) Returns DAI (sGroup, value) containment reference list By DataAttributeRef filter}
*
* {@link LN0Adapter#getDataSetByName(String) Returns the value of the TDataSet object reference By the value of the name attribute }
*
@@ -181,8 +181,8 @@ public Optional updateLDeviceStatus(List> ie
LDeviceActivation lDeviceActivation = new LDeviceActivation(iedNameLDeviceInstList);
final String iedName = getParentAdapter().getParentAdapter().getName();
final String ldInst = getParentAdapter().getInst();
- ResumedDataTemplate daiBehFilter = new ResumedDataTemplate(this, BEHAVIOUR_DO_TYPE_NAME, BEHAVIOUR_DA_TYPE_NAME);
- List daiBehList = getDAI(daiBehFilter, false);
+ DataAttributeRef daiBehFilter = new DataAttributeRef(this, BEHAVIOUR_DO_TYPE_NAME, BEHAVIOUR_DA_TYPE_NAME);
+ List daiBehList = getDAI(daiBehFilter, false);
if (daiBehList.isEmpty()) {
return Optional.of(buildFatalReportItem("The LDevice doesn't have a DO @name='Beh' OR its associated DA@fc='ST' AND DA@name='stVal'"));
}
@@ -195,11 +195,11 @@ public Optional updateLDeviceStatus(List> ie
return Optional.of(buildFatalReportItem("The Private compas:LDevice doesn't have the attribute 'LDeviceStatus'"));
}
TCompasLDeviceStatus compasLDeviceStatus = compasLDevicePrivateList.get(0).getLDeviceStatus();
- Optional optionalModStVal = getDaiModStVal();
+ Optional optionalModStVal = getDaiModStVal();
if (optionalModStVal.isEmpty()) {
return Optional.of(buildFatalReportItem("The LDevice doesn't have a DO @name='Mod'"));
}
- ResumedDataTemplate newDaModToSetInLN0 = optionalModStVal.get();
+ DataAttributeRef newDaModToSetInLN0 = optionalModStVal.get();
String initialValue = newDaModToSetInLN0.findFirstValue().orElse("");
lDeviceActivation.checkLDeviceActivationStatus(iedName, ldInst, compasLDeviceStatus, enumValues);
if (lDeviceActivation.isUpdatable()) {
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/LNAdapter.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/LNAdapter.java
index 222e93c6b..983156336 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/LNAdapter.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/scl/ied/LNAdapter.java
@@ -7,7 +7,7 @@
import org.lfenergy.compas.scl2007b4.model.TLN;
import org.lfenergy.compas.scl2007b4.model.TServiceType;
import org.lfenergy.compas.sct.commons.dto.ExtRefSignalInfo;
-import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate;
+import org.lfenergy.compas.sct.commons.dto.DataAttributeRef;
import org.lfenergy.compas.sct.commons.scl.ObjectReference;
import org.lfenergy.compas.sct.commons.util.Utils;
@@ -36,8 +36,8 @@
* {@link LNAdapter#getExtRefs(ExtRefSignalInfo) Returns the value of the TExtRef containment reference list By ExtRefSignalInfo }
* {@link LNAdapter#isExtRefExist(ExtRefSignalInfo) Returns the value of the TExtRef containment reference list By ExtRefSignalInfo }
*
- * {@link LNAdapter#getDAI Returns the value of the ResumedDataTemplate containment reference By filter}
- * {@link LNAdapter#getDAIValues(ResumedDataTemplate) Returns DAI (sGroup, value) containment reference list By ResumedDataTemplate filter}
+ * {@link LNAdapter#getDAI Returns the value of the DataAttributeRef containment reference By filter}
+ * {@link LNAdapter#getDAIValues(DataAttributeRef) Returns DAI (sGroup, value) containment reference list By DataAttributeRef filter}
* {@link LNAdapter#getDataSetByName(String) Returns the value of the TDataSet object reference By the value of the name attribute }
*
diff --git a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/FcdaCandidates.java b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/FcdaCandidates.java
index 0858f28e4..a33b5343d 100644
--- a/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/FcdaCandidates.java
+++ b/sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/FcdaCandidates.java
@@ -7,7 +7,7 @@
import com.opencsv.bean.CsvBindByPosition;
import lombok.*;
import org.apache.commons.lang3.StringUtils;
-import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate;
+import org.lfenergy.compas.sct.commons.dto.DataAttributeRef;
import java.nio.charset.StandardCharsets;
import java.util.HashSet;
@@ -21,15 +21,15 @@ public enum FcdaCandidates {
private Set candidates;
/**
- * Check if resumedDataTemplate is contains
+ * Check if dataAttributeRef is contains
*
- * @see #contains(ResumedDataTemplate)
+ * @see #contains(DataAttributeRef)
*/
- public boolean contains(ResumedDataTemplate resumedDataTemplate) {
- return contains(resumedDataTemplate.getLnClass(),
- resumedDataTemplate.getDoName().toStringWithoutInst(),
- resumedDataTemplate.getDaName().toString(),
- resumedDataTemplate.getFc().value());
+ public boolean contains(DataAttributeRef dataAttributeRef) {
+ return contains(dataAttributeRef.getLnClass(),
+ dataAttributeRef.getDoName().toStringWithoutInst(),
+ dataAttributeRef.getDaName().toString(),
+ dataAttributeRef.getFc().value());
}
boolean contains(String lnClass, String doName, String daName, String fc) {
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/DTO.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/DTO.java
index fb54f52c0..a31c47d99 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/DTO.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/DTO.java
@@ -163,43 +163,43 @@ public static LNodeMetaData createMetaDataInfo() {
/*-----------------------------------------------*/
- /* ResumedDataTemplate */
+ /* DataAttributeRef */
/*-----------------------------------------------*/
public static final String LN_TYPE = "LN_TYPE";
public static final String CDC = TPredefinedCDCEnum.WYE.value();
public static final String FC = TFCEnum.CF.value();
- public static ResumedDataTemplate createRTT() {
- ResumedDataTemplate rDTT = new ResumedDataTemplate();
+ public static DataAttributeRef createDataAttributeRef() {
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
- rDTT.setLnType(LN_TYPE);
- rDTT.setLnClass(TLLN0Enum.LLN_0.value());
- rDTT.setDoName(new DoTypeName(DO_NAME));
- rDTT.setDaName(new DaTypeName(DA_NAME));
- rDTT.getDoName().setCdc(TPredefinedCDCEnum.fromValue(CDC));
- rDTT.getDaName().setFc(TFCEnum.fromValue(FC));
+ dataAttributeRef.setLnType(LN_TYPE);
+ dataAttributeRef.setLnClass(TLLN0Enum.LLN_0.value());
+ dataAttributeRef.setDoName(new DoTypeName(DO_NAME));
+ dataAttributeRef.setDaName(new DaTypeName(DA_NAME));
+ dataAttributeRef.getDoName().setCdc(TPredefinedCDCEnum.fromValue(CDC));
+ dataAttributeRef.getDaName().setFc(TFCEnum.fromValue(FC));
- return rDTT;
+ return dataAttributeRef;
}
- public static ResumedDataTemplate createRTT(String prefix, String lnClass, String lnInst) {
- ResumedDataTemplate rDTT = new ResumedDataTemplate();
+ public static DataAttributeRef createDataAttributeRef(String prefix, String lnClass, String lnInst) {
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
- rDTT.setLnType(LN_TYPE);
- rDTT.setLnClass(lnClass);
- rDTT.setLnInst(lnInst);
- rDTT.setPrefix(prefix);
+ dataAttributeRef.setLnType(LN_TYPE);
+ dataAttributeRef.setLnClass(lnClass);
+ dataAttributeRef.setLnInst(lnInst);
+ dataAttributeRef.setPrefix(prefix);
- rDTT.setDoName(new DoTypeName("do.sdo1.sdo2"));
- rDTT.setDaName(new DaTypeName("da.bda1.bda2"));
- rDTT.setCdc(TPredefinedCDCEnum.fromValue(CDC));
- rDTT.setFc(TFCEnum.fromValue(FC));
- rDTT.setBType("Check");
- rDTT.setType("type");
- rDTT.setValImport(true);
+ dataAttributeRef.setDoName(new DoTypeName("do.sdo1.sdo2"));
+ dataAttributeRef.setDaName(new DaTypeName("da.bda1.bda2"));
+ dataAttributeRef.setCdc(TPredefinedCDCEnum.fromValue(CDC));
+ dataAttributeRef.setFc(TFCEnum.fromValue(FC));
+ dataAttributeRef.setBType("Check");
+ dataAttributeRef.setType("type");
+ dataAttributeRef.setValImport(true);
- return rDTT;
+ return dataAttributeRef;
}
/*-----------------------------------------------*/
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/ResumedDataTemplateTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/DataAttributeRefTest.java
similarity index 51%
rename from sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/ResumedDataTemplateTest.java
rename to sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/DataAttributeRefTest.java
index 385a09f01..ab15c4f78 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/ResumedDataTemplateTest.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/DataAttributeRefTest.java
@@ -23,23 +23,23 @@
import static org.lfenergy.compas.sct.commons.util.CommonConstants.STVAL_DA_NAME;
import static org.lfenergy.compas.sct.commons.util.SclConstructorHelper.newFcda;
-class ResumedDataTemplateTest {
+class DataAttributeRefTest {
public static final String CTL_MODEL = "ctlModel";
@Test
void testGetObjRef(){
String expected = "IEDLDTM/prelnclass1.do.sdo1.sdo2.da.bda1.bda2";
- ResumedDataTemplate resumedDataTemplate = DTO.createRTT("pre","lnclass","1");
- String objRef = resumedDataTemplate.getObjRef("IED","LDTM");
+ DataAttributeRef dataAttributeRef = DTO.createDataAttributeRef("pre","lnclass","1");
+ String objRef = dataAttributeRef.getObjRef("IED","LDTM");
assertEquals(expected,objRef);
}
@Test
void testGetObjRefWhenLLN0(){
// given
- ResumedDataTemplate resumedDataTemplate = DTO.createRTT("pre","LLN0","1");
+ DataAttributeRef dataAttributeRef = DTO.createDataAttributeRef("pre","LLN0","1");
// when
- String objRef = resumedDataTemplate.getObjRef("IED","LDTM");
+ String objRef = dataAttributeRef.getObjRef("IED","LDTM");
// then
assertEquals("IEDLDTM/LLN0.do.sdo1.sdo2.da.bda1.bda2",objRef);
}
@@ -47,9 +47,9 @@ void testGetObjRefWhenLLN0(){
@Test
void testGetDataAttributes(){
// given
- ResumedDataTemplate resumedDataTemplate = DTO.createRTT("pre","lnclass","1");
+ DataAttributeRef dataAttributeRef = DTO.createDataAttributeRef("pre","lnclass","1");
// when
- String dataAttributes = resumedDataTemplate.getDataAttributes();
+ String dataAttributes = dataAttributeRef.getDataAttributes();
// then
String expected = "do.sdo1.sdo2.da.bda1.bda2";
assertEquals(expected, dataAttributes);
@@ -58,62 +58,62 @@ void testGetDataAttributes(){
@Test
void testAddDoStructName(){
// given
- ResumedDataTemplate resumedDataTemplate = DTO.createRTT("pre","lnclass","1");
- resumedDataTemplate.setDaName(new DaTypeName());
+ DataAttributeRef dataAttributeRef = DTO.createDataAttributeRef("pre","lnclass","1");
+ dataAttributeRef.setDaName(new DaTypeName());
// when
- resumedDataTemplate.addDoStructName("added_sdo");
+ dataAttributeRef.addDoStructName("added_sdo");
// then
String expected = "do.sdo1.sdo2.added_sdo";
- assertEquals(expected, resumedDataTemplate.getDoRef());
+ assertEquals(expected, dataAttributeRef.getDoRef());
}
@Test
void testAddDoStructNameWhenNoDoName(){
// given
- ResumedDataTemplate resumedDataTemplate = DTO.createRTT("pre","lnclass","1");
- resumedDataTemplate.setDaName(new DaTypeName());
- resumedDataTemplate.setDoName(new DoTypeName());
+ DataAttributeRef dataAttributeRef = DTO.createDataAttributeRef("pre","lnclass","1");
+ dataAttributeRef.setDaName(new DaTypeName());
+ dataAttributeRef.setDoName(new DoTypeName());
// when & then
- assertThrows(IllegalArgumentException.class, () -> resumedDataTemplate.addDoStructName("added_sdo"));
+ assertThrows(IllegalArgumentException.class, () -> dataAttributeRef.addDoStructName("added_sdo"));
}
@Test
void testAddDaStructName(){
// given
- ResumedDataTemplate resumedDataTemplate = DTO.createRTT("pre","lnclass","1");
+ DataAttributeRef dataAttributeRef = DTO.createDataAttributeRef("pre","lnclass","1");
// when
- resumedDataTemplate.addDaStructName("added_bda");
+ dataAttributeRef.addDaStructName("added_bda");
// then
String expected = "da.bda1.bda2.added_bda";
- assertEquals(expected, resumedDataTemplate.getDaRef());
+ assertEquals(expected, dataAttributeRef.getDaRef());
}
@Test
void testAddDaStructNameWhenNoDoName(){
// given
- ResumedDataTemplate resumedDataTemplate = DTO.createRTT("pre","lnclass","1");
- resumedDataTemplate.setDaName(new DaTypeName());
- resumedDataTemplate.setDoName(new DoTypeName());
+ DataAttributeRef dataAttributeRef = DTO.createDataAttributeRef("pre","lnclass","1");
+ dataAttributeRef.setDaName(new DaTypeName());
+ dataAttributeRef.setDoName(new DoTypeName());
// when & then
- assertThrows(IllegalArgumentException.class, () -> resumedDataTemplate.addDaStructName("added_sda"));
+ assertThrows(IllegalArgumentException.class, () -> dataAttributeRef.addDaStructName("added_sda"));
}
@Test
void testSetDaiValues(){
// given
- ResumedDataTemplate resumedDataTemplate = DTO.createRTT("pre","lnclass","1");
+ DataAttributeRef dataAttributeRef = DTO.createDataAttributeRef("pre","lnclass","1");
TVal val = new TVal();
val.setValue("test");
// when
- resumedDataTemplate.setDaiValues(List.of(val));
+ dataAttributeRef.setDaiValues(List.of(val));
// then
- assertEquals(Map.of(0L, "test"), resumedDataTemplate.getDaName().getDaiValues());
+ assertEquals(Map.of(0L, "test"), dataAttributeRef.getDaName().getDaiValues());
}
@Test
void testSetDaiValuesWhenMultipleVal(){
// given
- ResumedDataTemplate resumedDataTemplate = DTO.createRTT("pre","lnclass","1");
+ DataAttributeRef dataAttributeRef = DTO.createDataAttributeRef("pre","lnclass","1");
TVal val1 = new TVal();
val1.setValue("test1");
val1.setSGroup(0L);
@@ -121,41 +121,41 @@ void testSetDaiValuesWhenMultipleVal(){
val2.setValue("test2");
val2.setSGroup(1L);
// when
- resumedDataTemplate.setDaiValues(List.of(val1, val2));
+ dataAttributeRef.setDaiValues(List.of(val1, val2));
// then
- assertEquals(Map.of(0L, "test1", 1L, "test2"), resumedDataTemplate.getDaName().getDaiValues());
+ assertEquals(Map.of(0L, "test1", 1L, "test2"), dataAttributeRef.getDaName().getDaiValues());
}
@Test
void testCopyFrom() {
- ResumedDataTemplate rDtt = DTO.createRTT("pre","lnclass","1");
- ResumedDataTemplate rDtt_b = ResumedDataTemplate.copyFrom(rDtt);
+ DataAttributeRef dataAttributeRef = DTO.createDataAttributeRef("pre","lnclass","1");
+ DataAttributeRef dataAttributeRef_b = DataAttributeRef.copyFrom(dataAttributeRef);
assertAll("COPY FROM",
- () -> assertEquals(rDtt_b.getLnClass(), rDtt.getLnClass()),
- () -> assertEquals(rDtt_b.getPrefix(), rDtt.getPrefix()),
- () -> assertEquals(rDtt_b.getDaName(), rDtt.getDaName()),
- () -> assertEquals(rDtt_b.getDoName(), rDtt.getDoName()),
- () -> assertEquals(rDtt_b.getLnInst(), rDtt.getLnInst()),
- () -> assertEquals(rDtt_b.getLnType(), rDtt.getLnType()),
- () -> assertArrayEquals(rDtt_b.getSdoNames().toArray(new String[0]),
- rDtt.getSdoNames().toArray(new String[0])),
- () -> assertArrayEquals(rDtt_b.getBdaNames().toArray(new String[0]),
- rDtt.getBdaNames().toArray(new String[0])),
- () -> assertEquals(rDtt_b.getType(), rDtt.getType()),
- () -> assertTrue(rDtt.isValImport())
+ () -> assertEquals(dataAttributeRef_b.getLnClass(), dataAttributeRef.getLnClass()),
+ () -> assertEquals(dataAttributeRef_b.getPrefix(), dataAttributeRef.getPrefix()),
+ () -> assertEquals(dataAttributeRef_b.getDaName(), dataAttributeRef.getDaName()),
+ () -> assertEquals(dataAttributeRef_b.getDoName(), dataAttributeRef.getDoName()),
+ () -> assertEquals(dataAttributeRef_b.getLnInst(), dataAttributeRef.getLnInst()),
+ () -> assertEquals(dataAttributeRef_b.getLnType(), dataAttributeRef.getLnType()),
+ () -> assertArrayEquals(dataAttributeRef_b.getSdoNames().toArray(new String[0]),
+ dataAttributeRef.getSdoNames().toArray(new String[0])),
+ () -> assertArrayEquals(dataAttributeRef_b.getBdaNames().toArray(new String[0]),
+ dataAttributeRef.getBdaNames().toArray(new String[0])),
+ () -> assertEquals(dataAttributeRef_b.getType(), dataAttributeRef.getType()),
+ () -> assertTrue(dataAttributeRef.isValImport())
);
- ResumedDataTemplate rDtt_t = new ResumedDataTemplate();
- assertNull(rDtt_t.getFc());
- assertNull(rDtt_t.getCdc());
- assertNull(rDtt_t.getBType());
- assertNull(rDtt_t.getType());
- assertTrue(rDtt_t.getBdaNames().isEmpty());
- assertTrue(rDtt_t.getSdoNames().isEmpty());
- assertThrows(IllegalArgumentException.class, () -> rDtt_t.setCdc(TPredefinedCDCEnum.WYE));
- assertThrows(IllegalArgumentException.class, () -> rDtt_t.setBType("BType"));
- assertThrows(IllegalArgumentException.class, () -> rDtt_t.setType("Type"));
- assertThrows(IllegalArgumentException.class, () -> rDtt_t.setFc(TFCEnum.BL));
+ DataAttributeRef dataAttributeRef_t = new DataAttributeRef();
+ assertNull(dataAttributeRef_t.getFc());
+ assertNull(dataAttributeRef_t.getCdc());
+ assertNull(dataAttributeRef_t.getBType());
+ assertNull(dataAttributeRef_t.getType());
+ assertTrue(dataAttributeRef_t.getBdaNames().isEmpty());
+ assertTrue(dataAttributeRef_t.getSdoNames().isEmpty());
+ assertThrows(IllegalArgumentException.class, () -> dataAttributeRef_t.setCdc(TPredefinedCDCEnum.WYE));
+ assertThrows(IllegalArgumentException.class, () -> dataAttributeRef_t.setBType("BType"));
+ assertThrows(IllegalArgumentException.class, () -> dataAttributeRef_t.setType("Type"));
+ assertThrows(IllegalArgumentException.class, () -> dataAttributeRef_t.setFc(TFCEnum.BL));
}
/**
@@ -165,15 +165,15 @@ void testCopyFrom() {
@MethodSource("daParametersProviderUpdatable")
void isUpdatable_case0(String testName, String daName, TFCEnum fc, boolean valImport) {
//Given
- ResumedDataTemplate rDTT = new ResumedDataTemplate();
- rDTT.setDoName(new DoTypeName(MOD_DO_NAME));
- rDTT.setDaName(new DaTypeName(daName));
- rDTT.setFc(fc);
- rDTT.setValImport(valImport);
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
+ dataAttributeRef.setDoName(new DoTypeName(MOD_DO_NAME));
+ dataAttributeRef.setDaName(new DaTypeName(daName));
+ dataAttributeRef.setFc(fc);
+ dataAttributeRef.setValImport(valImport);
//When
- boolean isRdttUpdatable = rDTT.isUpdatable();
+ boolean isDataAttributeRefUpdatable = dataAttributeRef.isUpdatable();
// Then
- assertThat(isRdttUpdatable).isTrue();
+ assertThat(isDataAttributeRefUpdatable).isTrue();
}
private static Stream daParametersProviderUpdatable() {
@@ -192,15 +192,15 @@ private static Stream daParametersProviderUpdatable() {
@MethodSource("daParametersProviderNotUpdatable")
void isUpdatable_case1(String testName, String daName, TFCEnum fc, boolean valImport) {
//Given
- ResumedDataTemplate rDTT = new ResumedDataTemplate();
- rDTT.setDoName(new DoTypeName(MOD_DO_NAME));
- rDTT.setDaName(new DaTypeName(daName));
- rDTT.setFc(fc);
- rDTT.setValImport(valImport);
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
+ dataAttributeRef.setDoName(new DoTypeName(MOD_DO_NAME));
+ dataAttributeRef.setDaName(new DaTypeName(daName));
+ dataAttributeRef.setFc(fc);
+ dataAttributeRef.setValImport(valImport);
//When
- boolean isRdttUpdatable = rDTT.isUpdatable();
+ boolean isDataAttributeRefUpdatable = dataAttributeRef.isUpdatable();
// Then
- assertThat(isRdttUpdatable).isFalse();
+ assertThat(isDataAttributeRefUpdatable).isFalse();
}
private static Stream daParametersProviderNotUpdatable() {
@@ -216,11 +216,11 @@ private static Stream daParametersProviderNotUpdatable() {
@Test
void findFirstValue_should_return_value(){
// Given
- ResumedDataTemplate rDTT = new ResumedDataTemplate();
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
DaTypeName da1 = createDa("da1", TFCEnum.CF, true, Map.of(10L, "a value"));
- rDTT.setDaName(da1);
+ dataAttributeRef.setDaName(da1);
// When
- Optional firstValue = rDTT.findFirstValue();
+ Optional firstValue = dataAttributeRef.findFirstValue();
// Then
assertThat(firstValue).hasValue("a value");
}
@@ -228,12 +228,12 @@ void findFirstValue_should_return_value(){
@Test
void findFirstValue_should_return_first_value(){
// Given
- ResumedDataTemplate rDTT = new ResumedDataTemplate();
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
DaTypeName da1 = createDa("da1", TFCEnum.CF, true,
Map.of(1L, "value 1", 0L, "value 0"));
- rDTT.setDaName(da1);
+ dataAttributeRef.setDaName(da1);
// When
- Optional firstValue = rDTT.findFirstValue();
+ Optional firstValue = dataAttributeRef.findFirstValue();
// Then
assertThat(firstValue).hasValue("value 0");
}
@@ -241,11 +241,11 @@ void findFirstValue_should_return_first_value(){
@Test
void findFirstValue_should_return_empty_optional(){
// Given
- ResumedDataTemplate rDTT = new ResumedDataTemplate();
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
DaTypeName da1 = createDa("da1", TFCEnum.CF, true, Map.of());
- rDTT.setDaName(da1);
+ dataAttributeRef.setDaName(da1);
// When
- Optional firstValue = rDTT.findFirstValue();
+ Optional firstValue = dataAttributeRef.findFirstValue();
// Then
assertThat(firstValue).isNotPresent();
}
@@ -253,26 +253,26 @@ void findFirstValue_should_return_empty_optional(){
@Test
void setVal_should_add_reference_val(){
// Given
- ResumedDataTemplate rDTT = new ResumedDataTemplate();
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
DaTypeName da1 = createDa("da1", TFCEnum.CF, true, Map.of());
- rDTT.setDaName(da1);
+ dataAttributeRef.setDaName(da1);
// When
- rDTT.setVal("value");
+ dataAttributeRef.setVal("value");
// Then
- assertThat(rDTT.getDaName().getDaiValues()).hasSize(1)
+ assertThat(dataAttributeRef.getDaName().getDaiValues()).hasSize(1)
.isEqualTo(Map.of(0L, "value"));
}
@Test
void setVal_should_replace_reference_val(){
// Given
- ResumedDataTemplate rDTT = new ResumedDataTemplate();
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
DaTypeName da1 = createDa("da1", TFCEnum.CF, true, Map.of(0L, "oldValue"));
- rDTT.setDaName(da1);
+ dataAttributeRef.setDaName(da1);
// When
- rDTT.setVal("newValue");
+ dataAttributeRef.setVal("newValue");
// Then
- assertThat(rDTT.getDaName().getDaiValues()).hasSize(1)
+ assertThat(dataAttributeRef.getDaName().getDaiValues()).hasSize(1)
.isEqualTo(Map.of(0L, "newValue"));
}
@@ -288,9 +288,9 @@ void constructor_should_create_new_instance() {
DoTypeName doName = new DoTypeName("do");
DaTypeName daName = new DaTypeName("da");
// When
- ResumedDataTemplate expected = new ResumedDataTemplate(lnAdapter, doName, daName);
+ DataAttributeRef expected = new DataAttributeRef(lnAdapter, doName, daName);
// Then
- assertThat(expected).extracting(ResumedDataTemplate::getLnType, ResumedDataTemplate::getLnClass, ResumedDataTemplate::getPrefix, ResumedDataTemplate::getLnInst)
+ assertThat(expected).extracting(DataAttributeRef::getLnType, DataAttributeRef::getLnClass, DataAttributeRef::getPrefix, DataAttributeRef::getLnInst)
.containsExactly("T1", TLLN0Enum.LLN_0.value(), "P1", "1");
assertThat(expected.getDoName()).isEqualTo(new DoTypeName("do"));
assertThat(expected.getDaName()).isEqualTo(new DaTypeName("da"));
@@ -302,13 +302,13 @@ void constructor_from_TFCDA_should_create_new_instance_with_same_attributes() {
//Given
TFCDA tfcda = newFcda("ldInst", "lnClass", "lnInst", "prefix", "DoName.sdo", "daName.bda", TFCEnum.ST);
//When
- ResumedDataTemplate resumedDataTemplate = new ResumedDataTemplate(tfcda);
+ DataAttributeRef dataAttributeRef = new DataAttributeRef(tfcda);
//Then
- assertThat(resumedDataTemplate.getLNRef())
+ assertThat(dataAttributeRef.getLNRef())
.isEqualTo("prefixlnClasslnInst.DoName.sdo.daName.bda");
DaTypeName expectedDa = new DaTypeName("daName.bda");
expectedDa.setFc(TFCEnum.ST);
- assertThat(resumedDataTemplate.getDaName()).isEqualTo(expectedDa);
+ assertThat(dataAttributeRef.getDaName()).isEqualTo(expectedDa);
}
@Test
@@ -316,10 +316,10 @@ void constructor_from_TFCDA_should_ignore_blank_DaName() {
//Given
TFCDA tfcda = newFcda("ldInst", "lnClass", "lnInst", "prefix", "DoName.sdo", "", TFCEnum.ST);
//When
- ResumedDataTemplate resumedDataTemplate = new ResumedDataTemplate(tfcda);
+ DataAttributeRef dataAttributeRef = new DataAttributeRef(tfcda);
//Then
- assertThat(resumedDataTemplate.isDaNameDefined()).isFalse();
- assertThat(resumedDataTemplate.getFc()).isNull();
+ assertThat(dataAttributeRef.isDaNameDefined()).isFalse();
+ assertThat(dataAttributeRef.getFc()).isNull();
}
@Test
@@ -327,10 +327,10 @@ void constructor_from_TFCDA_should_ignore_blank_fc() {
//Given
TFCDA tfcda = newFcda("ldInst", "lnClass", "lnInst", "prefix", "DoName.sdo", "daName.bda", null);
//When
- ResumedDataTemplate resumedDataTemplate = new ResumedDataTemplate(tfcda);
+ DataAttributeRef dataAttributeRef = new DataAttributeRef(tfcda);
//Then
- assertThat(resumedDataTemplate.getLNRef())
+ assertThat(dataAttributeRef.getLNRef())
.isEqualTo("prefixlnClasslnInst.DoName.sdo.daName.bda");
- assertThat(resumedDataTemplate.getFc()).isNull();
+ assertThat(dataAttributeRef.getFc()).isNull();
}
}
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/LNodeDTOTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/LNodeDTOTest.java
index c60471399..a6ef62b05 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/LNodeDTOTest.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/LNodeDTOTest.java
@@ -29,7 +29,7 @@ void testConstructor(){
lNodeDTO.setNodeType(DTO.LN_TYPE);
assertAll("LNODE",
()-> assertTrue(lNodeDTO.getGooseControlBlocks().isEmpty()),
- ()-> assertTrue(lNodeDTO.getResumedDataTemplates().isEmpty()),
+ ()-> assertTrue(lNodeDTO.getDataAttributeRefs().isEmpty()),
()-> assertTrue(lNodeDTO.getDatSets().isEmpty()),
()-> assertTrue(lNodeDTO.getExtRefs().isEmpty()),
()-> assertEquals(DTO.HOLDER_LN_INST,lNodeDTO.getInst()),
@@ -37,7 +37,7 @@ void testConstructor(){
()-> assertEquals(DTO.LN_TYPE,lNodeDTO.getNodeType()),
()-> assertEquals(DTO.HOLDER_LN_PREFIX,lNodeDTO.getPrefix())
);
- lNodeDTO.addResumedDataTemplate(ResumedDataTemplate.builder().daName(new DaTypeName("da1")).build());
+ lNodeDTO.addDataAttributeRef(DataAttributeRef.builder().daName(new DaTypeName("da1")).build());
lNodeDTO.addExtRefInfo(new ExtRefInfo());
lNodeDTO.addControlBlock(new ReportControlBlock("rpt", "rptID", "rptDatSet"));
lNodeDTO.addDataSet(new DataSetInfo());
@@ -45,13 +45,13 @@ void testConstructor(){
lNodeDTO.addAllControlBlocks(List.of(new SMVControlBlock("smv", "smvID", "smvDatSet")));
lNodeDTO.addAllDatSets(List.of(new DataSetInfo()));
lNodeDTO.addAllExtRefInfo(List.of(new ExtRefInfo()));
- lNodeDTO.addAllResumedDataTemplate(List.of(ResumedDataTemplate.builder().daName(new DaTypeName("da2")).build()));
+ lNodeDTO.addAllDataAttributeRef(List.of(DataAttributeRef.builder().daName(new DaTypeName("da2")).build()));
assertEquals(2, lNodeDTO.getExtRefs().size());
assertEquals(2, lNodeDTO.getDatSets().size());
assertEquals(1, lNodeDTO.getSmvControlBlocks().size());
assertEquals(1, lNodeDTO.getReportControlBlocks().size());
- assertEquals(2, lNodeDTO.getResumedDataTemplates().size());
+ assertEquals(2, lNodeDTO.getDataAttributeRefs().size());
}
@Test
@@ -73,7 +73,7 @@ void testFrom(){
when(lnAdapter.getDataTypeTemplateAdapter()).thenReturn(dataTypeTemplateAdapter);
LNodeTypeAdapter lNodeTypeAdapter = mock(LNodeTypeAdapter.class);
when(dataTypeTemplateAdapter.getLNodeTypeAdapterById(any())).thenReturn(Optional.of(lNodeTypeAdapter));
- when(lNodeTypeAdapter.getResumedDTTs(any())).thenReturn(List.of(ResumedDataTemplate.builder().build()));
+ when(lNodeTypeAdapter.getDataAttributeRefs(any())).thenReturn(List.of(DataAttributeRef.builder().build()));
TExtRef extRef = DTO.createExtRef();
when(lnAdapter.getExtRefs(null)).thenReturn(List.of(extRef));
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/LogicalNodeOptionsTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/LogicalNodeOptionsTest.java
index 57143434e..5e0c7a696 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/LogicalNodeOptionsTest.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/dto/LogicalNodeOptionsTest.java
@@ -16,23 +16,23 @@ void testConstructor(){
assertFalse(logicalNodeOptions.isWithExtRef());
assertFalse(logicalNodeOptions.isWithCB());
assertFalse(logicalNodeOptions.isWithDatSet());
- assertFalse(logicalNodeOptions.isWithResumedDtt());
+ assertFalse(logicalNodeOptions.isWithDataAttributeRef());
logicalNodeOptions.setWithCB(true);
logicalNodeOptions.setWithDatSet(false);
logicalNodeOptions.setWithExtRef(false);
- logicalNodeOptions.setWithResumedDtt(false);
+ logicalNodeOptions.setWithDataAttributeRef(false);
assertFalse(logicalNodeOptions.isWithExtRef());
assertTrue(logicalNodeOptions.isWithCB());
assertFalse(logicalNodeOptions.isWithDatSet());
- assertFalse(logicalNodeOptions.isWithResumedDtt());
+ assertFalse(logicalNodeOptions.isWithDataAttributeRef());
logicalNodeOptions = new LogicalNodeOptions(true,false,
true,false);
assertTrue(logicalNodeOptions.isWithExtRef());
assertTrue(logicalNodeOptions.isWithCB());
assertFalse(logicalNodeOptions.isWithDatSet());
- assertFalse(logicalNodeOptions.isWithResumedDtt());
+ assertFalse(logicalNodeOptions.isWithDataAttributeRef());
}
}
\ No newline at end of file
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java
index 59d60b8f4..5a0d9d6a5 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/SclServiceTest.java
@@ -549,34 +549,34 @@ void getDAI_should_return_all_dai() {
SCL scd = SclTestMarshaller.getSCLFromFile("/scl-srv-import-ieds/ied_1_test.xml");
// when
- Set allResults = SclService.getDAI(scd, "IED_NAME1", "LD_INST12", new ResumedDataTemplate(), true);
+ Set allResults = SclService.getDAI(scd, "IED_NAME1", "LD_INST12", new DataAttributeRef(), true);
// then
assertThat(allResults).hasSize(733);
- List resultsWithDa = allResults.stream().filter(rdt -> StringUtils.isNotBlank(rdt.getDaRef())).collect(Collectors.toList());
+ List resultsWithDa = allResults.stream().filter(rdt -> StringUtils.isNotBlank(rdt.getDaRef())).collect(Collectors.toList());
assertThat(resultsWithDa).hasSize(733);
- List resultsWithNoBda = allResults.stream().filter(rdt -> rdt.getBdaNames().isEmpty()).collect(Collectors.toList());
+ List resultsWithNoBda = allResults.stream().filter(rdt -> rdt.getBdaNames().isEmpty()).collect(Collectors.toList());
assertThat(resultsWithNoBda).hasSize(3);
- List resultsWithBdaDepth1 = allResults.stream().filter(rdt -> rdt.getBdaNames().size() == 1).collect(Collectors.toList());
+ List resultsWithBdaDepth1 = allResults.stream().filter(rdt -> rdt.getBdaNames().size() == 1).collect(Collectors.toList());
assertThat(resultsWithBdaDepth1).isEmpty();
- List resultsWithBdaDepth2 = allResults.stream().filter(rdt -> rdt.getBdaNames().size() == 2).collect(Collectors.toList());
+ List resultsWithBdaDepth2 = allResults.stream().filter(rdt -> rdt.getBdaNames().size() == 2).collect(Collectors.toList());
assertThat(resultsWithBdaDepth2).hasSize(1);
- List resultsWithBdaDepth3 = allResults.stream().filter(rdt -> rdt.getBdaNames().size() == 3).collect(Collectors.toList());
+ List resultsWithBdaDepth3 = allResults.stream().filter(rdt -> rdt.getBdaNames().size() == 3).collect(Collectors.toList());
assertThat(resultsWithBdaDepth3).hasSize(729);
- List resultsWithDo = allResults.stream().filter(rdt -> StringUtils.isNotBlank(rdt.getDoRef())).collect(Collectors.toList());
+ List resultsWithDo = allResults.stream().filter(rdt -> StringUtils.isNotBlank(rdt.getDoRef())).collect(Collectors.toList());
assertThat(resultsWithDo).hasSize(733);
- List resultsWithNoSdo = allResults.stream().filter(rdt -> rdt.getSdoNames().isEmpty()).collect(Collectors.toList());
+ List resultsWithNoSdo = allResults.stream().filter(rdt -> rdt.getSdoNames().isEmpty()).collect(Collectors.toList());
assertThat(resultsWithNoSdo).hasSize(3);
- List resultsWithSdoDepth1 = allResults.stream().filter(rdt -> rdt.getSdoNames().size() == 1).collect(Collectors.toList());
+ List resultsWithSdoDepth1 = allResults.stream().filter(rdt -> rdt.getSdoNames().size() == 1).collect(Collectors.toList());
assertThat(resultsWithSdoDepth1).isEmpty();
- List resultsWithSdoDepth2 = allResults.stream().filter(rdt -> rdt.getSdoNames().size() == 2).collect(Collectors.toList());
+ List resultsWithSdoDepth2 = allResults.stream().filter(rdt -> rdt.getSdoNames().size() == 2).collect(Collectors.toList());
assertThat(resultsWithSdoDepth2).hasSize(730);
- List resultsWithSdoDepth3 = allResults.stream().filter(rdt -> rdt.getSdoNames().size() == 3).collect(Collectors.toList());
+ List resultsWithSdoDepth3 = allResults.stream().filter(rdt -> rdt.getSdoNames().size() == 3).collect(Collectors.toList());
assertThat(resultsWithSdoDepth3).isEmpty();
}
@@ -586,12 +586,12 @@ void getDAI_should_aggregate_attribute_from_DAI() {
SCL scd = SclTestMarshaller.getSCLFromFile("/scl-srv-import-ieds/ied_test_aggregate_DAI.xml");
// when
- Set dais = SclService.getDAI(scd, "VirtualBCU", "LDMODEXPF", new ResumedDataTemplate(), false);
+ Set dais = SclService.getDAI(scd, "VirtualBCU", "LDMODEXPF", new DataAttributeRef(), false);
// then
- ResumedDataTemplate lln0 = ResumedDataTemplate.builder().prefix("").lnType("lntype1").lnClass("LLN0").lnInst("").build();
- ResumedDataTemplate lln0DoA = lln0.toBuilder().doName(createDo("DoA", TPredefinedCDCEnum.DPL)).build();
- ResumedDataTemplate lln0DoB = lln0.toBuilder().doName(createDo("DoB", TPredefinedCDCEnum.ACD)).build();
+ DataAttributeRef lln0 = DataAttributeRef.builder().prefix("").lnType("lntype1").lnClass("LLN0").lnInst("").build();
+ DataAttributeRef lln0DoA = lln0.toBuilder().doName(createDo("DoA", TPredefinedCDCEnum.DPL)).build();
+ DataAttributeRef lln0DoB = lln0.toBuilder().doName(createDo("DoB", TPredefinedCDCEnum.ACD)).build();
assertThat(dais).containsExactlyInAnyOrder(
lln0DoA.toBuilder().daName(createDa("daNotInDai", TFCEnum.CF, false, Map.of(0L, "0"))).build(),
@@ -606,7 +606,7 @@ void getDAI_should_aggregate_attribute_from_DAI() {
lln0DoB.toBuilder().daName(createDa("structDa.daiOverrideValImport", TFCEnum.ST, true, Map.of())).build(),
lln0DoB.toBuilder().daName(createDa("structDa.daiOverrideValImport2", TFCEnum.ST, false, Map.of())).build(),
- ResumedDataTemplate.builder().prefix("").lnType("lntype2").lnClass("LPHD").lnInst("0")
+ DataAttributeRef.builder().prefix("").lnType("lntype2").lnClass("LPHD").lnInst("0")
.doName(createDo("PhyNam", TPredefinedCDCEnum.DPS))
.daName(createDa("aDa", TFCEnum.BL, false, Map.of())).build()
);
@@ -618,9 +618,9 @@ void getDAI_when_LDevice_not_found_should_throw_exception() {
SCL scd = SclTestMarshaller.getSCLFromFile("/scl-srv-import-ieds/ied_1_test.xml");
// when & then
- ResumedDataTemplate resumedDataTemplate = new ResumedDataTemplate();
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
assertThrows(ScdException.class,
- () -> SclService.getDAI(scd, "IED_NAME1", "UNKNOWNLD", resumedDataTemplate, true));
+ () -> SclService.getDAI(scd, "IED_NAME1", "UNKNOWNLD", dataAttributeRef, true));
}
@Test
@@ -629,13 +629,13 @@ void getDAI_should_filter_updatable_DA() {
SCL scd = SclTestMarshaller.getSCLFromFile("/scl-srv-import-ieds/ied_test_updatable_DAI.xml");
// when
- Set dais = SclService.getDAI(scd, "VirtualBCU", "LDMODEXPF", new ResumedDataTemplate(), true);
+ Set dais = SclService.getDAI(scd, "VirtualBCU", "LDMODEXPF", new DataAttributeRef(), true);
// then
assertThat(dais).isNotNull();
List resultSimpleDa = dais.stream()
- .filter(rdtt -> rdtt.getBdaNames().isEmpty()) // test only simple DA
- .map(ResumedDataTemplate::getLNRef).collect(Collectors.toList());
+ .filter(dataAttributeRef -> dataAttributeRef.getBdaNames().isEmpty()) // test only simple DA
+ .map(DataAttributeRef::getLNRef).collect(Collectors.toList());
assertThat(resultSimpleDa).containsExactlyInAnyOrder(
// ...AndTrueInDai : If ValImport is True in DAI, DA is updatable
"LLN0.DoA.valImportNotSetAndTrueInDai",
@@ -661,13 +661,13 @@ void getDAI_should_filter_updatable_BDA() {
SCL scd = SclTestMarshaller.getSCLFromFile("/scl-srv-import-ieds/ied_test_updatable_DAI.xml");
// when
- Set dais = SclService.getDAI(scd, "VirtualBCU", "LDMODEXPF", new ResumedDataTemplate(), true);
+ Set dais = SclService.getDAI(scd, "VirtualBCU", "LDMODEXPF", new DataAttributeRef(), true);
// then
assertThat(dais).isNotNull();
List resultStructDa = dais.stream()
- .filter(rdtt -> !rdtt.getBdaNames().isEmpty()) // test only struct DA
- .map(ResumedDataTemplate::getLNRef).collect(Collectors.toList());
+ .filter(dataAttributeRef -> !dataAttributeRef.getBdaNames().isEmpty()) // test only struct DA
+ .map(DataAttributeRef::getLNRef).collect(Collectors.toList());
assertThat(resultStructDa).containsExactlyInAnyOrder(
// ...AndTrueInDai : If ValImport is True in DAI, BDA is updatable
"LLN0.DoB.structValImportNotSet.bValImportFalseAndTrueInDai",
@@ -703,13 +703,13 @@ void getDAI_should_filter_updatable_DA_with_sGroup_Val() {
SCL scd = SclTestMarshaller.getSCLFromFile("/scl-srv-import-ieds/ied_test_updatable_DAI.xml");
// when
- Set dais = SclService.getDAI(scd, "VirtualBCU", "LDCAP", new ResumedDataTemplate(), true);
+ Set dais = SclService.getDAI(scd, "VirtualBCU", "LDCAP", new DataAttributeRef(), true);
// then
assertThat(dais).isNotNull();
List resultSimpleDa = dais.stream()
- .filter(rdtt -> rdtt.getBdaNames().isEmpty()) // test only simple DA
- .map(ResumedDataTemplate::getLNRef).collect(Collectors.toList());
+ .filter(dataAttributeRef -> dataAttributeRef.getBdaNames().isEmpty()) // test only simple DA
+ .map(DataAttributeRef::getLNRef).collect(Collectors.toList());
assertThat(resultSimpleDa).containsExactlyInAnyOrder(
"LLN0.DoD.sGroupValImportNotSet",
"LLN0.DoD.sGroupValImportTrue"
@@ -722,7 +722,7 @@ void getDAI_should_filter_updatable_DA_with_sGroup_Val_without_ConfSg() {
SCL scd = SclTestMarshaller.getSCLFromFile("/scl-srv-import-ieds/ied_test_updatable_DAI.xml");
// when
- Set dais = SclService.getDAI(scd, "VirtualBCU", "LDMOD", new ResumedDataTemplate(), true);
+ Set dais = SclService.getDAI(scd, "VirtualBCU", "LDMOD", new DataAttributeRef(), true);
// then
assertThat(dais)
@@ -772,22 +772,22 @@ void testUpdateHeader() {
@Test
void testUpdateDAI() {
- ResumedDataTemplate rDtt = new ResumedDataTemplate();
- rDtt.setLnType("unknownID");
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
+ dataAttributeRef.setLnType("unknownID");
SCL scd = SclTestMarshaller.getSCLFromFile("/ied-test-schema-conf/ied_unit_test.xml");
assertThrows(ScdException.class, () -> SclService.updateDAI(
- scd, "IED", "LD", rDtt
+ scd, "IED", "LD", dataAttributeRef
));
- rDtt.setLnType("LNO1");
- rDtt.setLnClass(TLLN0Enum.LLN_0.value());
+ dataAttributeRef.setLnType("LNO1");
+ dataAttributeRef.setLnClass(TLLN0Enum.LLN_0.value());
DoTypeName doTypeName = new DoTypeName("Do.sdo1.d");
- rDtt.setDoName(doTypeName);
- rDtt.setDaName(new DaTypeName("antRef.bda1.bda2.bda3"));
+ dataAttributeRef.setDoName(doTypeName);
+ dataAttributeRef.setDaName(new DaTypeName("antRef.bda1.bda2.bda3"));
TVal tVal = new TVal();
tVal.setValue("newValue");
- rDtt.setDaiValues(List.of(tVal));
- assertDoesNotThrow(() -> SclService.updateDAI(scd, "IED_NAME", "LD_INS1", rDtt));
+ dataAttributeRef.setDaiValues(List.of(tVal));
+ assertDoesNotThrow(() -> SclService.updateDAI(scd, "IED_NAME", "LD_INS1", dataAttributeRef));
assertIsMarshallable(scd);
}
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DATypeAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DATypeAdapterTest.java
index dc2483b95..51c49746d 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DATypeAdapterTest.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DATypeAdapterTest.java
@@ -10,8 +10,8 @@
import org.lfenergy.compas.scl2007b4.model.TPredefinedBasicTypeEnum;
import org.lfenergy.compas.scl2007b4.model.TPrivate;
import org.lfenergy.compas.sct.commons.dto.DaTypeName;
+import org.lfenergy.compas.sct.commons.dto.DataAttributeRef;
import org.lfenergy.compas.sct.commons.dto.DoTypeName;
-import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate;
import org.lfenergy.compas.sct.commons.exception.ScdException;
import org.mockito.Mockito;
@@ -116,31 +116,31 @@ void testCheckStructuredData() throws Exception {
}
@Test
- void testGetResumedRTTs() throws Exception {
+ void testGetDataAttributeRefs() throws Exception {
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(AbstractDTTLevel.SCD_DTT);
DATypeAdapter daTypeAdapter = assertDoesNotThrow(() ->dttAdapter.getDATypeAdapterById("DA1").get());
- ResumedDataTemplate rootRDtt = new ResumedDataTemplate();
- rootRDtt.getDaName().setName("origin");
- rootRDtt.getDoName().setName("StrVal");
- List rDtts = daTypeAdapter.getResumedDTTs(rootRDtt, new ResumedDataTemplate());
- assertEquals(2,rDtts.size());
+ DataAttributeRef rootDataAttributeRef = new DataAttributeRef();
+ rootDataAttributeRef.getDaName().setName("origin");
+ rootDataAttributeRef.getDoName().setName("StrVal");
+ List dataAttributeRefs = daTypeAdapter.getDataAttributeRefs(rootDataAttributeRef, new DataAttributeRef());
+ assertEquals(2,dataAttributeRefs.size());
}
@Test
- void getResumedDTTByDaName() throws Exception {
+ void getDataAttributeRefByDaName() throws Exception {
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(
AbstractDTTLevel.SCD_DTT_DIFF_CONTENT_SAME_ID
);
DaTypeName daTypeName = new DaTypeName("antRef","origin.ctlVal");
DoTypeName doTypeName = new DoTypeName("Op.origin");
- ResumedDataTemplate rDtt = new ResumedDataTemplate();
- rDtt.setDoName(doTypeName);
- rDtt.getDaName().setName("antRef");
- assertTrue(rDtt.getBdaNames().isEmpty());
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
+ dataAttributeRef.setDoName(doTypeName);
+ dataAttributeRef.getDaName().setName("antRef");
+ assertTrue(dataAttributeRef.getBdaNames().isEmpty());
DATypeAdapter daTypeAdapter = assertDoesNotThrow(() ->dttAdapter.getDATypeAdapterById("DA1").get());
- assertDoesNotThrow(() -> daTypeAdapter.getResumedDTTByDaName(daTypeName,0,rDtt).get());
+ assertDoesNotThrow(() -> daTypeAdapter.getDataAttributeRefByDaName(daTypeName,0,dataAttributeRef).get());
}
@Test
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DOTypeAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DOTypeAdapterTest.java
index 6a7551e23..9f885d402 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DOTypeAdapterTest.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DOTypeAdapterTest.java
@@ -9,8 +9,8 @@
import org.junit.jupiter.params.provider.CsvSource;
import org.lfenergy.compas.scl2007b4.model.*;
import org.lfenergy.compas.sct.commons.dto.DaTypeName;
+import org.lfenergy.compas.sct.commons.dto.DataAttributeRef;
import org.lfenergy.compas.sct.commons.dto.DoTypeName;
-import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate;
import org.lfenergy.compas.sct.commons.exception.ScdException;
import org.mockito.Mockito;
@@ -96,37 +96,37 @@ void testCheckAndCompleteStructData() throws Exception {
}
@Test
- void testGetResumedDTTs_filter_on_DO() throws Exception {
+ void testGetDataAttributeRefs_filter_on_DO() throws Exception {
// given
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(AbstractDTTLevel.SCD_DTT);
DOTypeAdapter doTypeAdapter = assertDoesNotThrow(() ->dttAdapter.getDOTypeAdapterById("DO2").get());
- ResumedDataTemplate rootRDtt = new ResumedDataTemplate();
- rootRDtt.setDoName(new DoTypeName("Op"));
- ResumedDataTemplate filter = new ResumedDataTemplate();
+ DataAttributeRef rootDataAttributeRef = new DataAttributeRef();
+ rootDataAttributeRef.setDoName(new DoTypeName("Op"));
+ DataAttributeRef filter = new DataAttributeRef();
filter.setDoName(new DoTypeName("Op.res"));
// when
- List rDtts = doTypeAdapter.getResumedDTTs(rootRDtt, filter);
+ List dataAttributeRefs = doTypeAdapter.getDataAttributeRefs(rootDataAttributeRef, filter);
// then
- assertEquals(2,rDtts.size());
+ assertEquals(2,dataAttributeRefs.size());
}
@Test
- void testGetResumedDTTs_filter_on_DO_and_DA() throws Exception {
+ void testGetDataAttributeRefs_filter_on_DO_and_DA() throws Exception {
// given
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(AbstractDTTLevel.SCD_DTT);
DOTypeAdapter doTypeAdapter = assertDoesNotThrow(() ->dttAdapter.getDOTypeAdapterById("DO2").get());
- ResumedDataTemplate rootRDtt = new ResumedDataTemplate();
- rootRDtt.setDoName(new DoTypeName("Op"));
- ResumedDataTemplate filter = new ResumedDataTemplate();
+ DataAttributeRef rootDataAttributeRef = new DataAttributeRef();
+ rootDataAttributeRef.setDoName(new DoTypeName("Op"));
+ DataAttributeRef filter = new DataAttributeRef();
filter.setDoName(new DoTypeName("Op.res"));
filter.setDaName(new DaTypeName("d"));
// when
- List rDtts = doTypeAdapter.getResumedDTTs(rootRDtt, filter);
+ List dataAttributeRefs = doTypeAdapter.getDataAttributeRefs(rootDataAttributeRef, filter);
// then
- assertEquals(1,rDtts.size());
+ assertEquals(1,dataAttributeRefs.size());
}
@@ -147,17 +147,17 @@ void testFindPathSDO2DA() throws Exception {
}
@Test
- void getResumedDTTByDaName() throws Exception {
+ void getDataAttributeRefByDaName() throws Exception {
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(
AbstractDTTLevel.SCD_DTT_DIFF_CONTENT_SAME_ID
);
DaTypeName daTypeName = new DaTypeName("antRef","origin.ctlVal");
- ResumedDataTemplate rDtt = new ResumedDataTemplate();
- rDtt.setDoName(new DoTypeName("Op"));
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
+ dataAttributeRef.setDoName(new DoTypeName("Op"));
DOTypeAdapter doTypeAdapter = assertDoesNotThrow(() -> dttAdapter.getDOTypeAdapterById("DO2").get());
- assertDoesNotThrow(() -> doTypeAdapter.getResumedDTTByDaName(daTypeName,rDtt));
- assertEquals("Op.origin",rDtt.getDoName().toString());
- assertEquals("antRef.origin.ctlVal",rDtt.getDaName().toString());
+ assertDoesNotThrow(() -> doTypeAdapter.getDataAttributeRefByDaName(daTypeName,dataAttributeRef));
+ assertEquals("Op.origin",dataAttributeRef.getDoName().toString());
+ assertEquals("antRef.origin.ctlVal",dataAttributeRef.getDaName().toString());
}
@Test
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DataTypeTemplateAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DataTypeTemplateAdapterTest.java
index c825b14a0..355bd3cd0 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DataTypeTemplateAdapterTest.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/DataTypeTemplateAdapterTest.java
@@ -381,7 +381,7 @@ void testImportDAType() throws Exception {
@CsvSource({"A,LN1,No coherence or path between DOType(DO2) and DA(A)",
"antRef,LN1,Invalid ExtRef signal: no coherence between pDO(Op.origin) and pDA(antRef)",
"antRef.origin.ctlVal,LN_Type1,Unknown LNodeType:LN_Type1"})
- void getBinderResumedDTT_shouldThrowScdException_whenDONotContainDA(String pDA, String lnType, String message) throws Exception {
+ void getBinderDataAttributeRef_shouldThrowScdException_whenDONotContainDA(String pDA, String lnType, String message) throws Exception {
//Given
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(AbstractDTTLevel.SCD_DTT_DIFF_CONTENT_SAME_ID);
ExtRefSignalInfo signalInfo = new ExtRefSignalInfo();
@@ -389,13 +389,13 @@ void getBinderResumedDTT_shouldThrowScdException_whenDONotContainDA(String pDA,
signalInfo.setPDO("Op.origin");
signalInfo.setPDA(pDA);
//When Then
- assertThatThrownBy(() -> dttAdapter.getBinderResumedDTT(lnType,signalInfo))
+ assertThatThrownBy(() -> dttAdapter.getBinderDataAttribute(lnType,signalInfo))
.isInstanceOf(ScdException.class)
.hasMessage(message);
}
@Test
- void getBinderResumedDTT_shouldThrowScdException_whenLnClassNotMatches() throws Exception {
+ void getBinderDataAttributeRef_shouldThrowScdException_whenLnClassNotMatches() throws Exception {
//Given
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(AbstractDTTLevel.SCD_DTT_DIFF_CONTENT_SAME_ID);
LNodeTypeAdapter lNodeTypeAdapter = dttAdapter.getLNodeTypeAdapterById("LN1").get();
@@ -406,13 +406,13 @@ void getBinderResumedDTT_shouldThrowScdException_whenLnClassNotMatches() throws
signalInfo.setPDO("Op.origin");
signalInfo.setPDA("antRef.origin.ctlVal");
//When Then
- assertThatThrownBy(() -> dttAdapter.getBinderResumedDTT("LN1",signalInfo))
+ assertThatThrownBy(() -> dttAdapter.getBinderDataAttribute("LN1",signalInfo))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("lnClass is mandatory for LNodeType in DataTemplate : LN1");
}
@Test
- void getBinderResumedDTT_shouldThrowScdException_whenDOIdNotFound() throws Exception {
+ void getBinderDataAttributeRef_shouldThrowScdException_whenDOIdNotFound() throws Exception {
//Given
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(AbstractDTTLevel.SCD_DTT_DIFF_CONTENT_SAME_ID);
@@ -420,13 +420,13 @@ void getBinderResumedDTT_shouldThrowScdException_whenDOIdNotFound() throws Excep
signalInfo.setPLN("PIOC");
signalInfo.setPDO("Do");
//When Then
- assertThatThrownBy(() -> dttAdapter.getBinderResumedDTT("LN1",signalInfo))
+ assertThatThrownBy(() -> dttAdapter.getBinderDataAttribute("LN1",signalInfo))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Unknown doName :Do");
}
@Test
- void getBinderResumedDTT_shouldReturnBindingInfoWithoutDO_whenSignalPDOEmpty() throws Exception {
+ void getBinderDataAttributeRef_shouldReturnBindingInfoWithoutDO_whenSignalPDOEmpty() throws Exception {
//Given
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(AbstractDTTLevel.SCD_DTT_DIFF_CONTENT_SAME_ID);
@@ -434,7 +434,7 @@ void getBinderResumedDTT_shouldReturnBindingInfoWithoutDO_whenSignalPDOEmpty() t
signalInfo.setPLN("PIOC");
signalInfo.setPDO(null);
//When Then
- ExtRefBindingInfo bindingInfo = assertDoesNotThrow(() -> dttAdapter.getBinderResumedDTT("LN1",signalInfo));
+ ExtRefBindingInfo bindingInfo = assertDoesNotThrow(() -> dttAdapter.getBinderDataAttribute("LN1",signalInfo));
assertThat(bindingInfo)
.extracting("lnType", "lnClass")
.containsExactlyInAnyOrder("LN1", "PIOC");
@@ -442,7 +442,7 @@ void getBinderResumedDTT_shouldReturnBindingInfoWithoutDO_whenSignalPDOEmpty() t
}
@Test
- void getBinderResumedDTT_shouldReturnBindingInfoWithoutDA_whenSignalPDAEmpty() throws Exception {
+ void getBinderDataAttributeRef_shouldReturnBindingInfoWithoutDA_whenSignalPDAEmpty() throws Exception {
//Given
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(AbstractDTTLevel.SCD_DTT_DIFF_CONTENT_SAME_ID);
@@ -451,7 +451,7 @@ void getBinderResumedDTT_shouldReturnBindingInfoWithoutDA_whenSignalPDAEmpty() t
signalInfo.setPDO("Op.origin");
signalInfo.setPDA(null);
//When Then
- ExtRefBindingInfo bindingInfo = assertDoesNotThrow(() -> dttAdapter.getBinderResumedDTT("LN1",signalInfo));
+ ExtRefBindingInfo bindingInfo = assertDoesNotThrow(() -> dttAdapter.getBinderDataAttribute("LN1",signalInfo));
assertThat(bindingInfo)
.extracting("lnType", "lnClass")
.containsExactlyInAnyOrder("LN1", "PIOC");
@@ -460,7 +460,7 @@ void getBinderResumedDTT_shouldReturnBindingInfoWithoutDA_whenSignalPDAEmpty() t
}
@Test
- void getBinderResumedDTT_shouldReturnBindingInfo_whenExist() throws Exception {
+ void getBinderDataAttributeRef_shouldReturnBindingInfo_whenExist() throws Exception {
//Given
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(AbstractDTTLevel.SCD_DTT_DIFF_CONTENT_SAME_ID);
@@ -469,7 +469,7 @@ void getBinderResumedDTT_shouldReturnBindingInfo_whenExist() throws Exception {
signalInfo.setPDO("Op.origin");
signalInfo.setPDA("antRef.origin.ctlVal");
//When Then
- ExtRefBindingInfo bindingInfo = assertDoesNotThrow(() -> dttAdapter.getBinderResumedDTT("LN1",signalInfo));
+ ExtRefBindingInfo bindingInfo = assertDoesNotThrow(() -> dttAdapter.getBinderDataAttribute("LN1",signalInfo));
assertThat(bindingInfo)
.extracting("lnType", "lnClass")
.containsExactlyInAnyOrder("LN1", "PIOC");
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/LNodeTypeAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/LNodeTypeAdapterTest.java
index cd1c9dd1f..521b6affb 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/LNodeTypeAdapterTest.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/dtt/LNodeTypeAdapterTest.java
@@ -122,24 +122,24 @@ private TLNodeType createLNOdeType(){
}
@Test
- void testGetResumedDTTs() throws Exception {
+ void testGetDataAttributeRefs() throws Exception {
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(AbstractDTTLevel.SCD_DTT);
LNodeTypeAdapter lNodeTypeAdapter = assertDoesNotThrow(() ->dttAdapter.getLNodeTypeAdapterById("LN1").get());
- ResumedDataTemplate rootRDtt = new ResumedDataTemplate();
- rootRDtt.setDoName(new DoTypeName("Op"));
- ResumedDataTemplate filter = new ResumedDataTemplate();
+ DataAttributeRef rootDataAttributeRef = new DataAttributeRef();
+ rootDataAttributeRef.setDoName(new DoTypeName("Op"));
+ DataAttributeRef filter = new DataAttributeRef();
filter.setDoName(new DoTypeName("Op.res"));
- var rDtts = lNodeTypeAdapter.getResumedDTTs(filter);
- assertEquals(2,rDtts.size());
+ var dataAttributeRefs = lNodeTypeAdapter.getDataAttributeRefs(filter);
+ assertEquals(2,dataAttributeRefs.size());
filter.setDoName(new DoTypeName("Op.res"));
filter.setDaName(new DaTypeName("d"));
- rDtts = lNodeTypeAdapter.getResumedDTTs(filter);
- assertEquals(1,rDtts.size());
+ dataAttributeRefs = lNodeTypeAdapter.getDataAttributeRefs(filter);
+ assertEquals(1,dataAttributeRefs.size());
filter.setDoName(new DoTypeName("Op.res"));
filter.setDaName(new DaTypeName("antRef"));
- assertTrue(lNodeTypeAdapter.getResumedDTTs(filter).isEmpty());
+ assertTrue(lNodeTypeAdapter.getDataAttributeRefs(filter).isEmpty());
}
@Test
@@ -169,14 +169,14 @@ void testCheck() throws Exception {
}
@Test
- void getResumedDTTByDaName() throws Exception {
+ void getDataAttributeRefByDaName() throws Exception {
DataTypeTemplateAdapter dttAdapter = AbstractDTTLevel.initDttAdapterFromFile(
AbstractDTTLevel.SCD_DTT_DIFF_CONTENT_SAME_ID
);
DaTypeName daTypeName = new DaTypeName("antRef","origin.ctlVal");
LNodeTypeAdapter lNodeTypeAdapter = assertDoesNotThrow(() -> dttAdapter.getLNodeTypeAdapterById("LN1").get());
- List rDtts = assertDoesNotThrow(()-> lNodeTypeAdapter.getResumedDTTByDaName(daTypeName));
- assertEquals(2,rDtts.size());
+ List dataAttributeRefs = assertDoesNotThrow(()-> lNodeTypeAdapter.getDataAttributeRefByDaName(daTypeName));
+ assertEquals(2,dataAttributeRefs.size());
}
@Test
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/LDeviceAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/LDeviceAdapterTest.java
index 25c5ea7b0..94ed35add 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/LDeviceAdapterTest.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/LDeviceAdapterTest.java
@@ -117,21 +117,21 @@ void testGetExtRefInfo() {
@Test
void TestGetDAI() {
LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.getLDeviceAdapterByLdInst("LD_INS1"));
- var rDtts = lDeviceAdapter.getDAI(new ResumedDataTemplate(),true);
- assertEquals(4,rDtts.size());
+ var dataAttributeRefs = lDeviceAdapter.getDAI(new DataAttributeRef(),true);
+ assertEquals(4,dataAttributeRefs.size());
- ResumedDataTemplate filter = new ResumedDataTemplate();
+ DataAttributeRef filter = new DataAttributeRef();
filter.setLnClass(TLLN0Enum.LLN_0.value());
- rDtts = lDeviceAdapter.getDAI(filter,true);
- assertEquals(4,rDtts.size());
+ dataAttributeRefs = lDeviceAdapter.getDAI(filter,true);
+ assertEquals(4,dataAttributeRefs.size());
lDeviceAdapter = assertDoesNotThrow(()-> iAdapter.findLDeviceAdapterByLdInst("LD_INS2").get());
filter.setLnClass("ANCR");
filter.setLnInst("1");
- rDtts = lDeviceAdapter.getDAI(filter,true);
- assertEquals(2,rDtts.size());
+ dataAttributeRefs = lDeviceAdapter.getDAI(filter,true);
+ assertEquals(2,dataAttributeRefs.size());
}
@Test
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/LN0AdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/LN0AdapterTest.java
index eee07ad71..80b27d291 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/LN0AdapterTest.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/LN0AdapterTest.java
@@ -470,7 +470,7 @@ void testGetDAI() {
IEDAdapter iAdapter = assertDoesNotThrow(() -> sclRootAdapter.getIEDAdapterByName("IED4d4fe1a8cda64cf88a5ee4176a1a0eef"));
LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(() -> iAdapter.findLDeviceAdapterByLdInst("LDSUIED").get());
LN0Adapter ln0Adapter = lDeviceAdapter.getLN0Adapter();
- ResumedDataTemplate filter = new ResumedDataTemplate();
+ DataAttributeRef filter = new DataAttributeRef();
filter.setLnClass(ln0Adapter.getLNClass());
filter.setLnInst(ln0Adapter.getLNInst());
filter.setPrefix(ln0Adapter.getPrefix());
@@ -482,12 +482,12 @@ void testGetDAI() {
daTypeName.setFc(TFCEnum.ST);
filter.setDaName(daTypeName);
//When
- var rDtts = ln0Adapter.getDAI(filter, false);
+ var dataAttributeRefs = ln0Adapter.getDAI(filter, false);
//Then
- assertFalse(rDtts.isEmpty());
- assertEquals(1, rDtts.size());
- assertNotNull(rDtts.get(0).getDaName().getType());
- assertEquals("BehaviourModeKind", rDtts.get(0).getDaName().getType());
+ assertFalse(dataAttributeRefs.isEmpty());
+ assertEquals(1, dataAttributeRefs.size());
+ assertNotNull(dataAttributeRefs.get(0).getDaName().getType());
+ assertEquals("BehaviourModeKind", dataAttributeRefs.get(0).getDaName().getType());
}
@Test
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/LNAdapterTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/LNAdapterTest.java
index 35fce2034..8025bca31 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/LNAdapterTest.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/scl/ied/LNAdapterTest.java
@@ -35,18 +35,18 @@ class LNAdapterTest {
private static DoTypeName DO_TYPE_NAME;
private static DaTypeName DA_TYPE_NAME;
private static String DATA_TYPE_REF;
- private static ResumedDataTemplate RDDT_DO_SDO1_D_ANTREF_BDA1_BDA2_BDA3;
- private static ResumedDataTemplate RDTT_DO_DA2;
+ private static DataAttributeRef RDDT_DO_SDO1_D_ANTREF_BDA1_BDA2_BDA3;
+ private static DataAttributeRef DATA_ATTRIBUTE_REF_DO_DA2;
@BeforeEach
void setUp() {
- // As DoTypeName, DaTypeName and ResumedDataTemplate are mutable, make sure to re-init them before each test
+ // As DoTypeName, DaTypeName and DataAttributeRef are mutable, make sure to re-init them before each test
DO_TYPE_NAME = createDo("Do.sdo1.d", TPredefinedCDCEnum.WYE);
DA_TYPE_NAME = createDa("antRef.bda1.bda2.bda3", TFCEnum.CF, true, Map.of(0L, NEW_VALUE));
DATA_TYPE_REF = DO_TYPE_NAME + "." + DA_TYPE_NAME;
- RDDT_DO_SDO1_D_ANTREF_BDA1_BDA2_BDA3 = createResumedDataTemplate(DO_TYPE_NAME, DA_TYPE_NAME);
- RDTT_DO_DA2 = createResumedDataTemplate(createDo("Do", TPredefinedCDCEnum.WYE), createDa("da2", TFCEnum.CF, true, Map.of(0L, NEW_VALUE)));
+ RDDT_DO_SDO1_D_ANTREF_BDA1_BDA2_BDA3 = createDataAttributeRef(DO_TYPE_NAME, DA_TYPE_NAME);
+ DATA_ATTRIBUTE_REF_DO_DA2 = createDataAttributeRef(createDo("Do", TPredefinedCDCEnum.WYE), createDa("da2", TFCEnum.CF, true, Map.of(0L, NEW_VALUE)));
}
@Test
@@ -457,41 +457,41 @@ void testGetLNodeName() {
}
@Test
- void updateDAI_should_throw_ScdException_when_ResumedDataTemplate_is_empty() {
+ void updateDAI_should_throw_ScdException_when_DataAttributeRef_is_empty() {
// Given
- ResumedDataTemplate rDtt = new ResumedDataTemplate();
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
SCL scd = SclTestMarshaller.getSCLFromFile("/ied-test-schema-conf/ied_unit_test.xml");
SclRootAdapter sclRootAdapter = new SclRootAdapter(scd);
LN0Adapter lnAdapter = findLn0(sclRootAdapter, "IED_NAME", "LD_INS1");
// When Then
- assertThatThrownBy(() -> lnAdapter.updateDAI(rDtt))
+ assertThatThrownBy(() -> lnAdapter.updateDAI(dataAttributeRef))
.isInstanceOf(ScdException.class)
.hasMessage("Cannot update undefined DAI");
}
@Test
- void updateDAI_should_throw_ScdException_when_ResumedDataTemplate_DA_name_is_not_defined() {
+ void updateDAI_should_throw_ScdException_when_DataAttributeRef_DA_name_is_not_defined() {
// Given
SCL scd = SclTestMarshaller.getSCLFromFile("/ied-test-schema-conf/ied_unit_test.xml");
AbstractLNAdapter> lnAdapter = findLn0(new SclRootAdapter(scd), "IED_NAME", "LD_INS1");
- ResumedDataTemplate rDtt = createResumedDataTemplate(DO_TYPE_NAME, null);
+ DataAttributeRef dataAttributeRef = createDataAttributeRef(DO_TYPE_NAME, null);
// When Then
- assertThatThrownBy(() -> lnAdapter.updateDAI(rDtt))
+ assertThatThrownBy(() -> lnAdapter.updateDAI(dataAttributeRef))
.isInstanceOf(ScdException.class)
.hasMessage("Cannot update undefined DAI");
}
@Test
- void updateDAI_should_throw_ScdException_when_ResumedDataTemplate_DO_name_is_not_defined() {
+ void updateDAI_should_throw_ScdException_when_DataAttributeRef_DO_name_is_not_defined() {
// Given
SCL scd = SclTestMarshaller.getSCLFromFile("/ied-test-schema-conf/ied_unit_test.xml");
AbstractLNAdapter> lnAdapter = findLn0(new SclRootAdapter(scd), "IED_NAME", "LD_INS1");
- ResumedDataTemplate rDtt = createResumedDataTemplate(null, DA_TYPE_NAME);
+ DataAttributeRef dataAttributeRef = createDataAttributeRef(null, DA_TYPE_NAME);
// When Then
- assertThatThrownBy(() -> lnAdapter.updateDAI(rDtt))
+ assertThatThrownBy(() -> lnAdapter.updateDAI(dataAttributeRef))
.isInstanceOf(ScdException.class)
.hasMessage("Cannot update undefined DAI");
}
@@ -501,14 +501,14 @@ void updateDAI_should_not_update_DAI_Val_when_DTT_Fc_not_allowed_to_update() {
// Given
SCL scd = SclTestMarshaller.getSCLFromFile("/ied-test-schema-conf/ied_unit_test.xml");
AbstractLNAdapter> lnAdapter = findLn0(new SclRootAdapter(scd), "IED_NAME", "LD_INS1");
- ResumedDataTemplate rDtt = ResumedDataTemplate.copyFrom(RDDT_DO_SDO1_D_ANTREF_BDA1_BDA2_BDA3);
- rDtt.setFc(TFCEnum.BL);
+ DataAttributeRef dataAttributeRef = DataAttributeRef.copyFrom(RDDT_DO_SDO1_D_ANTREF_BDA1_BDA2_BDA3);
+ dataAttributeRef.setFc(TFCEnum.BL);
final String OLD_VALUE = "Completed-diff";
- assertThat(rDtt.isUpdatable()).isFalse();
+ assertThat(dataAttributeRef.isUpdatable()).isFalse();
assertThat(getValue(findDai(lnAdapter, RDDT_DO_SDO1_D_ANTREF_BDA1_BDA2_BDA3.getDataAttributes())))
.isEqualTo(OLD_VALUE);
// When
- lnAdapter.updateDAI(rDtt);
+ lnAdapter.updateDAI(dataAttributeRef);
// Then
TDAI tdai = findDai(lnAdapter, DATA_TYPE_REF).getCurrentElem();
@@ -538,13 +538,13 @@ void updateDAI_should_update_DOI_DAI_that_exists_when_data_updatable() {
// Given
SCL scd = SclTestMarshaller.getSCLFromFile("/ied-test-schema-conf/ied_unit_test.xml");
AbstractLNAdapter> lnAdapter = findLn0(new SclRootAdapter(scd), "IED_NAME", "LD_INS1");
- assertThat(RDTT_DO_DA2.isUpdatable()).isTrue();
+ assertThat(DATA_ATTRIBUTE_REF_DO_DA2.isUpdatable()).isTrue();
// When
- lnAdapter.updateDAI(RDTT_DO_DA2);
+ lnAdapter.updateDAI(DATA_ATTRIBUTE_REF_DO_DA2);
// Then
- AbstractDAIAdapter> daiAdapter = findDai(lnAdapter, RDTT_DO_DA2.getDataAttributes());
+ AbstractDAIAdapter> daiAdapter = findDai(lnAdapter, DATA_ATTRIBUTE_REF_DO_DA2.getDataAttributes());
assertThat(getValue(daiAdapter)).isEqualTo(NEW_VALUE);
MarshallerWrapper.assertValidateXmlSchema(scd);
}
@@ -570,14 +570,14 @@ void updateDAI_should_create_DOI_DAI_elements_with_new_value_when_data_updatable
// Given
SCL scd = SclTestMarshaller.getSCLFromFile("/ied-test-schema-conf/ied_unit_test.xml");
AbstractLNAdapter> lnAdapter = findLn0(new SclRootAdapter(scd), "IED_NAME", "LD_INS2");
- ResumedDataTemplate rDtt = RDTT_DO_DA2;
+ DataAttributeRef dataAttributeRef = DATA_ATTRIBUTE_REF_DO_DA2;
assertThat(lnAdapter.getCurrentElem().getDOI()).isEmpty();
// When
- lnAdapter.updateDAI(rDtt);
+ lnAdapter.updateDAI(dataAttributeRef);
// Then
- AbstractDAIAdapter> daiAdapter = findDai(lnAdapter, RDTT_DO_DA2.getDataAttributes());
+ AbstractDAIAdapter> daiAdapter = findDai(lnAdapter, DATA_ATTRIBUTE_REF_DO_DA2.getDataAttributes());
assertThat(getValue(daiAdapter)).isEqualTo(NEW_VALUE);
MarshallerWrapper.assertValidateXmlSchema(scd);
}
@@ -594,12 +594,12 @@ void updateDAI_should_not_update_DAI_values_when_not_updatable() {
.withLnClass(TLLN0Enum.LLN_0.value())
.build();
- ResumedDataTemplate rDtt = ResumedDataTemplate.copyFrom(RDDT_DO_SDO1_D_ANTREF_BDA1_BDA2_BDA3);
- rDtt.setValImport(false);
- assertThat(rDtt.isUpdatable()).isFalse();
+ DataAttributeRef dataAttributeRef = DataAttributeRef.copyFrom(RDDT_DO_SDO1_D_ANTREF_BDA1_BDA2_BDA3);
+ dataAttributeRef.setValImport(false);
+ assertThat(dataAttributeRef.isUpdatable()).isFalse();
// When & Then
- assertThatCode(() -> lnAdapter.updateDAI(rDtt)).doesNotThrowAnyException();
+ assertThatCode(() -> lnAdapter.updateDAI(dataAttributeRef)).doesNotThrowAnyException();
}
@Test
@@ -611,10 +611,10 @@ void updateDAI_when_nothing_instantiated_should_create_DOI_and_DAI() {
assertThat(lnAdapter.getCurrentElem().getDOI()).isEmpty();
// When
- lnAdapter.updateDAI(RDTT_DO_DA2);
+ lnAdapter.updateDAI(DATA_ATTRIBUTE_REF_DO_DA2);
// Then
- TDAI dai = findDai(lnAdapter, RDTT_DO_DA2.getDataAttributes()).getCurrentElem();
+ TDAI dai = findDai(lnAdapter, DATA_ATTRIBUTE_REF_DO_DA2.getDataAttributes()).getCurrentElem();
assertThat(dai.isValImport()).isTrue();
assertThat(getValue(dai)).isEqualTo(NEW_VALUE);
MarshallerWrapper.assertValidateXmlSchema(scd);
@@ -625,14 +625,14 @@ void updateDAI_when_only_DOI_instantiated_should_create_DOI() {
// Given
SCL scd = SclTestMarshaller.getSCLFromFile("/ied-test-schema-conf/ied_unit_test.xml");
AbstractLNAdapter> lnAdapter = findLn0(new SclRootAdapter(scd), "IED_NAME", "LD_INS1");
- lnAdapter.getDOIAdapterByName(RDTT_DO_DA2.getDoRef()).getSDIOrDAI().clear();
- assertThat(findDoiOrSdi(lnAdapter, RDTT_DO_DA2.getDoName().getName()).getSDIOrDAI()).isEmpty();
+ lnAdapter.getDOIAdapterByName(DATA_ATTRIBUTE_REF_DO_DA2.getDoRef()).getSDIOrDAI().clear();
+ assertThat(findDoiOrSdi(lnAdapter, DATA_ATTRIBUTE_REF_DO_DA2.getDoName().getName()).getSDIOrDAI()).isEmpty();
// When
- lnAdapter.updateDAI(RDTT_DO_DA2);
+ lnAdapter.updateDAI(DATA_ATTRIBUTE_REF_DO_DA2);
// Then
- TDAI dai = findDai(lnAdapter, RDTT_DO_DA2.getDataAttributes()).getCurrentElem();
+ TDAI dai = findDai(lnAdapter, DATA_ATTRIBUTE_REF_DO_DA2.getDataAttributes()).getCurrentElem();
assertThat(dai.isValImport()).isTrue();
assertThat(getValue(dai)).isEqualTo(NEW_VALUE);
MarshallerWrapper.assertValidateXmlSchema(scd);
@@ -643,13 +643,13 @@ void updateDAI_when_already_instantiated_should_do_nothing() {
// Given
SCL scd = SclTestMarshaller.getSCLFromFile("/ied-test-schema-conf/ied_unit_test.xml");
AbstractLNAdapter> lnAdapter = findLn0(new SclRootAdapter(scd), "IED_NAME", "LD_INS1");
- assertThat(findDai(lnAdapter, RDTT_DO_DA2.getDataAttributes())).isNotNull();
+ assertThat(findDai(lnAdapter, DATA_ATTRIBUTE_REF_DO_DA2.getDataAttributes())).isNotNull();
// When
- lnAdapter.updateDAI(RDTT_DO_DA2);
+ lnAdapter.updateDAI(DATA_ATTRIBUTE_REF_DO_DA2);
// Then
- TDAI dai = findDai(lnAdapter, RDTT_DO_DA2.getDataAttributes()).getCurrentElem();
+ TDAI dai = findDai(lnAdapter, DATA_ATTRIBUTE_REF_DO_DA2.getDataAttributes()).getCurrentElem();
assertThat(dai.isValImport()).isTrue();
assertThat(getValue(dai)).isEqualTo(NEW_VALUE);
MarshallerWrapper.assertValidateXmlSchema(scd);
@@ -754,8 +754,8 @@ void testGetDAI() {
IEDAdapter iAdapter = assertDoesNotThrow(() -> sclRootAdapter.getIEDAdapterByName("IED_NAME"));
LDeviceAdapter lDeviceAdapter = assertDoesNotThrow(() -> iAdapter.findLDeviceAdapterByLdInst("LDSUIED").get());
LNAdapter lnAdapter = lDeviceAdapter.getLNAdapter("PIOC", "1", null);
- var rDtts = lnAdapter.getDAI(new ResumedDataTemplate(), true);
- assertFalse(rDtts.isEmpty());
+ var dataAttributeRefs = lnAdapter.getDAI(new DataAttributeRef(), true);
+ assertFalse(dataAttributeRefs.isEmpty());
}
private LNAdapter initLNAdapter(TLN tln) {
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/testhelpers/DataTypeUtils.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/testhelpers/DataTypeUtils.java
index 7731d7dec..6566a6006 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/testhelpers/DataTypeUtils.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/testhelpers/DataTypeUtils.java
@@ -8,8 +8,8 @@
import org.lfenergy.compas.scl2007b4.model.TPredefinedBasicTypeEnum;
import org.lfenergy.compas.scl2007b4.model.TPredefinedCDCEnum;
import org.lfenergy.compas.sct.commons.dto.DaTypeName;
+import org.lfenergy.compas.sct.commons.dto.DataAttributeRef;
import org.lfenergy.compas.sct.commons.dto.DoTypeName;
-import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate;
import java.util.Map;
@@ -29,11 +29,11 @@ public static DoTypeName createDo(String nameRef, TPredefinedCDCEnum cdc) {
return resultDo;
}
- public static ResumedDataTemplate createResumedDataTemplate(DoTypeName doTypeName, DaTypeName daTypeName) {
- ResumedDataTemplate rDtt = new ResumedDataTemplate();
- rDtt.setDoName(doTypeName);
- rDtt.setDaName(daTypeName);
- return rDtt;
+ public static DataAttributeRef createDataAttributeRef(DoTypeName doTypeName, DaTypeName daTypeName) {
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
+ dataAttributeRef.setDoName(doTypeName);
+ dataAttributeRef.setDaName(daTypeName);
+ return dataAttributeRef;
}
private DataTypeUtils() {
diff --git a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/FcdaCandidatesTest.java b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/FcdaCandidatesTest.java
index 16b73210c..e092fc344 100644
--- a/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/FcdaCandidatesTest.java
+++ b/sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/FcdaCandidatesTest.java
@@ -7,8 +7,8 @@
import org.junit.jupiter.api.Test;
import org.lfenergy.compas.scl2007b4.model.TFCEnum;
import org.lfenergy.compas.sct.commons.dto.DaTypeName;
+import org.lfenergy.compas.sct.commons.dto.DataAttributeRef;
import org.lfenergy.compas.sct.commons.dto.DoTypeName;
-import org.lfenergy.compas.sct.commons.dto.ResumedDataTemplate;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -19,13 +19,13 @@ class FcdaCandidatesTest {
void contains_should_return_true() {
//Given
FcdaCandidates fcdaCandidates = FcdaCandidates.SINGLETON;
- ResumedDataTemplate resumedDataTemplate = new ResumedDataTemplate();
- resumedDataTemplate.setLnClass("ANCR");
- resumedDataTemplate.setDoName(new DoTypeName("DoName"));
- resumedDataTemplate.setDaName(new DaTypeName("daNameST"));
- resumedDataTemplate.setFc(TFCEnum.ST);
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
+ dataAttributeRef.setLnClass("ANCR");
+ dataAttributeRef.setDoName(new DoTypeName("DoName"));
+ dataAttributeRef.setDaName(new DaTypeName("daNameST"));
+ dataAttributeRef.setFc(TFCEnum.ST);
//When
- boolean result = fcdaCandidates.contains(resumedDataTemplate);
+ boolean result = fcdaCandidates.contains(dataAttributeRef);
//Then
assertThat(result).isTrue();
}
@@ -34,13 +34,13 @@ void contains_should_return_true() {
void contains_should_return_false() {
//Given
FcdaCandidates fcdaCandidates = FcdaCandidates.SINGLETON;
- ResumedDataTemplate resumedDataTemplate = new ResumedDataTemplate();
- resumedDataTemplate.setLnClass("Non existent");
- resumedDataTemplate.setDoName(new DoTypeName("Non existent"));
- resumedDataTemplate.setDaName(new DaTypeName("Non existent"));
- resumedDataTemplate.setFc(TFCEnum.ST);
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
+ dataAttributeRef.setLnClass("Non existent");
+ dataAttributeRef.setDoName(new DoTypeName("Non existent"));
+ dataAttributeRef.setDaName(new DaTypeName("Non existent"));
+ dataAttributeRef.setFc(TFCEnum.ST);
//When
- boolean result = fcdaCandidates.contains(resumedDataTemplate);
+ boolean result = fcdaCandidates.contains(dataAttributeRef);
//Then
assertThat(result).isFalse();
}
@@ -49,13 +49,13 @@ void contains_should_return_false() {
void contains_when_a_parameter_is_blank_should_throw_exception() {
//Given
FcdaCandidates fcdaCandidates = FcdaCandidates.SINGLETON;
- ResumedDataTemplate resumedDataTemplate = new ResumedDataTemplate();
- resumedDataTemplate.setLnClass(" ");
- resumedDataTemplate.setDoName(new DoTypeName("Non existent"));
- resumedDataTemplate.setDaName(new DaTypeName("Non existent"));
- resumedDataTemplate.setFc(TFCEnum.ST);
+ DataAttributeRef dataAttributeRef = new DataAttributeRef();
+ dataAttributeRef.setLnClass(" ");
+ dataAttributeRef.setDoName(new DoTypeName("Non existent"));
+ dataAttributeRef.setDaName(new DaTypeName("Non existent"));
+ dataAttributeRef.setFc(TFCEnum.ST);
//When
- assertThatThrownBy(() -> fcdaCandidates.contains(resumedDataTemplate))
+ assertThatThrownBy(() -> fcdaCandidates.contains(dataAttributeRef))
.isInstanceOf(IllegalArgumentException.class);
}