Skip to content

Commit 8bf969b

Browse files
AliouDIAITEmassifbengleizesDorSaintierFrpsabatierrte
authored
Merge develop into main (#181)
* feat(170) generate source artefact for each module * feat() exclude logback conf from Jar * feat() suppress useless Slf4J decorators * feat(165) exclude DO Mod and DA stVal from updatability check : it's always updatable * feat(77): update ExtRef iedName part 1/3 * feat(176): alphabetically order possible source of ExtRef binding * feat(78): update ExtRef iedName part 2/3 * fix(175): gets all control blocks source for DataSet for which at least FCDA match ExtRef * fix(181): resolve conflicts between main and develop after rebase and for merge Signed-off-by: Aliou DIAITE <[email protected]> Signed-off-by: massifben <[email protected]> Signed-off-by: gleizesDor <[email protected]> Signed-off-by: SaintierFr <[email protected]> Signed-off-by: SABATIER Philippe Ext <[email protected]> Co-authored-by: massifben <[email protected]> Co-authored-by: gleizesDor <[email protected]> Co-authored-by: SaintierFr <[email protected]> Co-authored-by: psabatierrte <[email protected]>
1 parent 4c80b8c commit 8bf969b

File tree

58 files changed

+2742
-771
lines changed

Some content is hidden

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

58 files changed

+2742
-771
lines changed

pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<scl-extension.version>0.9.1</scl-extension.version>
4040
<compas-scl-xsd.version>0.0.4</compas-scl-xsd.version>
4141
<maven.plugin.javadoc>3.4.1</maven.plugin.javadoc>
42+
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
4243
</properties>
4344

4445
<dependencyManagement>
@@ -156,6 +157,20 @@
156157
</execution>
157158
</executions>
158159
</plugin>
160+
<plugin>
161+
<groupId>org.apache.maven.plugins</groupId>
162+
<artifactId>maven-source-plugin</artifactId>
163+
<version>${maven-source-plugin.version}</version>
164+
<executions>
165+
<execution>
166+
<id>attach-sources</id>
167+
<phase>verify</phase>
168+
<goals>
169+
<goal>jar-no-fork</goal>
170+
</goals>
171+
</execution>
172+
</executions>
173+
</plugin>
159174
</plugins>
160175
</pluginManagement>
161176

sct-app/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@
126126
</execution>
127127
</executions>
128128
</plugin>
129+
<plugin>
130+
<groupId>org.apache.maven.plugins</groupId>
131+
<artifactId>maven-source-plugin</artifactId>
132+
</plugin>
129133
</plugins>
130134
</build>
131-
</project>
135+
</project>

sct-app/src/main/java/org/lfenergy/compas/sct/app/SclAutomationService.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package org.lfenergy.compas.sct.app;
66

77
import lombok.NonNull;
8-
import lombok.extern.slf4j.Slf4j;
98
import org.apache.commons.lang3.tuple.Pair;
109
import org.lfenergy.compas.scl2007b4.model.SCL;
1110
import org.lfenergy.compas.sct.commons.dto.HeaderDTO;
@@ -26,7 +25,6 @@
2625
* <li>{@link SclAutomationService#createSCD(SCL, HeaderDTO, Set) Adds all elements under the <b>SCL </b> object from given <b>SSD </b> and <b>STD </b> files}
2726
* </ul>
2827
*/
29-
@Slf4j
3028
public class SclAutomationService {
3129

3230
/**

sct-app/src/main/resources/logback.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

sct-commons/pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@
218218
</execution>
219219
</executions>
220220
</plugin>
221-
221+
<plugin>
222+
<groupId>org.apache.maven.plugins</groupId>
223+
<artifactId>maven-source-plugin</artifactId>
224+
</plugin>
222225
</plugins>
223226
</build>
224227
</project>

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import lombok.Getter;
1010
import lombok.NoArgsConstructor;
1111
import lombok.Setter;
12-
import lombok.extern.slf4j.Slf4j;
1312
import org.apache.commons.lang3.StringUtils;
1413

1514
import java.util.ArrayList;
@@ -43,7 +42,6 @@
4342
*/
4443
@Getter
4544
@Setter
46-
@Slf4j
4745
@NoArgsConstructor
4846
@EqualsAndHashCode
4947
public class DataTypeName {
@@ -58,7 +56,7 @@ public class DataTypeName {
5856
public DataTypeName(String dataName){
5957
if(dataName == null) return;
6058
String[] tokens = dataName.split("\\.");
61-
name = tokens[0];
59+
this.name = tokens[0];
6260
if(tokens.length > 1){
6361
structNames.addAll(List.of(tokens).subList(1, tokens.length));
6462
}

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

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.lfenergy.compas.scl2007b4.model.TLLN0Enum;
1313
import org.lfenergy.compas.scl2007b4.model.TServiceType;
1414

15+
import java.util.Comparator;
1516
import java.util.Objects;
1617
import java.util.regex.Matcher;
1718
import java.util.regex.Pattern;
@@ -39,8 +40,12 @@
3940
@Getter
4041
@Setter
4142
@NoArgsConstructor
42-
public class ExtRefBindingInfo {
43+
public class ExtRefBindingInfo implements Comparable<ExtRefBindingInfo> {
4344

45+
public static final Comparator<ExtRefBindingInfo> EXT_REF_BINDING_INFO_COMPARATOR = Comparator.comparing(ExtRefBindingInfo::getIedName)
46+
.thenComparing(ExtRefBindingInfo::getLdInst)
47+
.thenComparing(ExtRefBindingInfo::getLnClass)
48+
.thenComparing(ExtRefBindingInfo::getLnInst);
4449
private String iedName;
4550
private String ldInst;
4651
private String prefix;
@@ -53,23 +58,24 @@ public class ExtRefBindingInfo {
5358

5459
/**
5560
* Constructor
61+
*
5662
* @param tExtRef input
5763
*/
58-
public ExtRefBindingInfo(TExtRef tExtRef){
64+
public ExtRefBindingInfo(TExtRef tExtRef) {
5965
iedName = tExtRef.getIedName();
6066
ldInst = tExtRef.getLdInst();
6167
prefix = tExtRef.getPrefix();
62-
if(!tExtRef.getLnClass().isEmpty()) {
68+
if (!tExtRef.getLnClass().isEmpty()) {
6369
this.lnClass = tExtRef.getLnClass().get(0);
6470
}
6571
lnInst = tExtRef.getLnInst();
66-
if(tExtRef.getDoName() != null) {
72+
if (tExtRef.getDoName() != null) {
6773
doName = new DoTypeName(tExtRef.getDoName());
6874
}
69-
if(tExtRef.getDaName() != null) {
75+
if (tExtRef.getDaName() != null) {
7076
daName = new DaTypeName(tExtRef.getDaName());
7177
}
72-
if(tExtRef.getServiceType() != null) {
78+
if (tExtRef.getServiceType() != null) {
7379
serviceType = tExtRef.getServiceType();
7480
}
7581
}
@@ -100,33 +106,35 @@ public int hashCode() {
100106

101107
/**
102108
* Check validity of ExtRef binding information
109+
*
103110
* @return validity state
104111
*/
105112
public boolean isValid() {
106113
final String validationRegex = DaTypeName.VALIDATION_REGEX;
107114
String doRef = doName == null ? "" : doName.toString();
108115

109-
Pattern pattern = Pattern.compile(validationRegex,Pattern.MULTILINE);
116+
Pattern pattern = Pattern.compile(validationRegex, Pattern.MULTILINE);
110117
Matcher matcher = pattern.matcher(doRef);
111118
matcher.find();
112119

113-
if(!StringUtils.isBlank(doRef) && doRef.length() != matcher.end()){
120+
if (!StringUtils.isBlank(doRef) && doRef.length() != matcher.end()) {
114121
return false;
115122
}
116123
return !StringUtils.isBlank(iedName) &&
117124
!StringUtils.isBlank(ldInst) &&
118125
!StringUtils.isBlank(lnClass) &&
119-
(TLLN0Enum.LLN_0.value().equals(lnClass) || !StringUtils.isBlank(lnInst)) ;
126+
(TLLN0Enum.LLN_0.value().equals(lnClass) || !StringUtils.isBlank(lnInst));
120127
}
121128

122129
/**
123130
* Check dependency between ExtRef binding information and ExtRef
131+
*
124132
* @param tExtRef object containing ExtRef data's'
125133
* @return dependency state
126134
*/
127-
public boolean isWrappedIn(TExtRef tExtRef){
128-
return Objects.equals(iedName,tExtRef.getIedName()) &&
129-
Objects.equals(ldInst,tExtRef.getLdInst()) &&
135+
public boolean isWrappedIn(TExtRef tExtRef) {
136+
return Objects.equals(iedName, tExtRef.getIedName()) &&
137+
Objects.equals(ldInst, tExtRef.getLdInst()) &&
130138
Objects.equals(prefix, tExtRef.getPrefix()) &&
131139
Objects.equals(lnInst, tExtRef.getLnInst()) &&
132140
tExtRef.getLnClass().contains(lnClass) &&
@@ -135,9 +143,10 @@ public boolean isWrappedIn(TExtRef tExtRef){
135143

136144
/**
137145
* Check nullability of ExtRef binding information
138-
* @return nullability state
146+
*
147+
* @return nullability state
139148
*/
140-
public boolean isNull(){
149+
public boolean isNull() {
141150
return iedName == null &&
142151
ldInst == null &&
143152
prefix == null &&
@@ -149,19 +158,27 @@ public boolean isNull(){
149158
}
150159

151160
/**
152-
* Convert to string
153-
* @return ExtRef binding information formatted to string
161+
* Define the way to compare 2 objects ExtRefBindingInfo in order to allow sorting items
162+
*
163+
* @param o the object to be compared.
164+
* @return the comparaison's result (a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second)
154165
*/
166+
public int compareTo(ExtRefBindingInfo o) {
167+
return EXT_REF_BINDING_INFO_COMPARATOR.compare(this, o);
168+
}
169+
155170
@Override
156171
public String toString() {
172+
String sType = serviceType != null ? serviceType.value() : null;
157173
return "ExtRefBindingInfo{" +
158174
"iedName='" + iedName + '\'' +
159175
", ldInst='" + ldInst + '\'' +
160176
", prefix='" + prefix + '\'' +
161177
", lnClass='" + lnClass + '\'' +
162178
", lnInst='" + lnInst + '\'' +
163179
", lnType='" + lnType + '\'' +
164-
", serviceType=" + serviceType.value() +
180+
", serviceType=" + sType +
165181
'}';
182+
166183
}
167184
}

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

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
package org.lfenergy.compas.sct.commons.dto;
66

77

8-
import lombok.Getter;
9-
import lombok.NoArgsConstructor;
10-
import lombok.NonNull;
11-
import lombok.Setter;
8+
import lombok.*;
129
import org.apache.commons.lang3.StringUtils;
1310
import org.lfenergy.compas.scl2007b4.model.TExtRef;
1411
import org.lfenergy.compas.scl2007b4.model.TFCDA;
@@ -38,6 +35,7 @@
3835
@Getter
3936
@Setter
4037
@NoArgsConstructor
38+
@AllArgsConstructor
4139
public class ExtRefInfo extends LNodeMetaDataEmbedder{
4240

4341
private ExtRefSignalInfo signalInfo;
@@ -82,9 +80,10 @@ public static ExtRefInfo from(TExtRef tExtRef, String iedName, String ldInst,
8280
* @param tfcda FCDA data object
8381
* @return match state
8482
*/
83+
//TODO this method should be checked, return if parameter tested are not present in FCDA even if two object are different
8584
public boolean matchFCDA(@NonNull TFCDA tfcda){
8685
boolean returnValue = true;
87-
if(AbstractLNAdapter.isNull(tfcda)) {
86+
if(AbstractLNAdapter.isFCDANull(tfcda)) {
8887
returnValue = false;
8988
}
9089

@@ -118,4 +117,25 @@ public boolean matchFCDA(@NonNull TFCDA tfcda){
118117
}
119118
return returnValue;
120119
}
120+
/**
121+
* Check matching between FCDA and ExtRef information (for external binding)
122+
* Check is done for parameter lDInst(mandatory), lNClass(mandatory), lNInst, prefix doName as pDO(mandatory) and daName as pDA
123+
* present in ExtRef and FCDA
124+
* @param tfcda FCDA data to check compatibilities with ExtRef
125+
* @return true if ExtRef matches FCDA for parameters ahead false otherwise
126+
*/
127+
public boolean checkMatchingFCDA(@NonNull TFCDA tfcda){
128+
if(bindingInfo == null || signalInfo == null) return false;
129+
FCDAInfo fcdaInfo = new FCDAInfo(tfcda);
130+
FCDAInfo fcdaOfBinding = FCDAInfo.builder()
131+
.ldInst(bindingInfo.getLdInst())
132+
.lnClass(bindingInfo.getLnClass())
133+
.lnInst(bindingInfo.getLnInst())
134+
.prefix(bindingInfo.getPrefix())
135+
.doName(new DoTypeName(signalInfo.getPDO()))
136+
.daName(new DaTypeName(signalInfo.getPDA()))
137+
.build();
138+
return fcdaInfo.checkFCDACompatibilitiesForBinding(fcdaOfBinding);
139+
}
140+
121141
}

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

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
package org.lfenergy.compas.sct.commons.dto;
66

77
import com.fasterxml.jackson.annotation.JsonIgnore;
8-
import lombok.Getter;
9-
import lombok.NoArgsConstructor;
10-
import lombok.Setter;
8+
import lombok.*;
119
import org.apache.commons.lang3.StringUtils;
1210
import org.lfenergy.compas.scl2007b4.model.TFCDA;
1311
import org.lfenergy.compas.scl2007b4.model.TFCEnum;
1412

13+
import java.util.Objects;
14+
15+
import static org.lfenergy.compas.sct.commons.util.Utils.equalsOrBothBlank;
16+
1517
/**
1618
* A representation of the model object <em><b>FCDA</b></em>.
1719
*
@@ -33,7 +35,9 @@
3335
*/
3436
@Getter
3537
@Setter
38+
@AllArgsConstructor
3639
@NoArgsConstructor
40+
@Builder
3741
public class FCDAInfo {
3842

3943
private String dataSet;
@@ -53,7 +57,11 @@ public class FCDAInfo {
5357
* @param tfcda input
5458
*/
5559
public FCDAInfo(String dataSet, TFCDA tfcda) {
60+
this(tfcda);
5661
this.dataSet = dataSet;
62+
}
63+
64+
public FCDAInfo(TFCDA tfcda) {
5765
fc = tfcda.getFc();
5866
ldInst = tfcda.getLdInst();
5967
prefix = tfcda.getPrefix();
@@ -106,4 +114,18 @@ public TFCDA getFCDA(){
106114
public boolean isValid() {
107115
return doName != null && doName.isDefined();
108116
}
117+
118+
/**
119+
* Checks if two FCDAInfo object match for ldInst, lnInst, lnClass, lnPrefix doName and daName for search of binding control blocks
120+
* @param fcdaInfo FCDA to copare with
121+
* @return true if FCDAs match for binding, otherwise false
122+
*/
123+
public boolean checkFCDACompatibilitiesForBinding(FCDAInfo fcdaInfo) {
124+
return equalsOrBothBlank(getLdInst(), fcdaInfo.getLdInst())
125+
&& equalsOrBothBlank(getPrefix(), fcdaInfo.getPrefix())
126+
&& equalsOrBothBlank(getLnClass(), fcdaInfo.getLnClass())
127+
&& equalsOrBothBlank(getLnInst(), fcdaInfo.getLnInst())
128+
&& Objects.equals(getDoName(), fcdaInfo.getDoName())
129+
&& Objects.equals(getDaName(), fcdaInfo.getDaName());
130+
}
109131
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
import lombok.Getter;
88
import lombok.NoArgsConstructor;
99
import org.lfenergy.compas.sct.commons.scl.ied.IEDAdapter;
10-
import org.lfenergy.compas.sct.commons.scl.ied.LDeviceAdapter;
1110

1211
import java.util.HashSet;
13-
import java.util.List;
1412
import java.util.Optional;
1513
import java.util.Set;
1614
import java.util.stream.Collectors;
@@ -52,8 +50,7 @@ public IedDTO(String name){
5250
public static IedDTO from(IEDAdapter iedAdapter, LogicalNodeOptions options) {
5351
IedDTO iedDTO = new IedDTO();
5452
iedDTO.name = iedAdapter.getName();
55-
List<LDeviceAdapter> lDeviceAdapters = iedAdapter.getLDeviceAdapters();
56-
iedDTO.lDevices = lDeviceAdapters.stream()
53+
iedDTO.lDevices = iedAdapter.streamLDeviceAdapters()
5754
.map(lDeviceAdapter -> LDeviceDTO.from(lDeviceAdapter,options))
5855
.collect(Collectors.toUnmodifiableSet());
5956

0 commit comments

Comments
 (0)