Skip to content

Commit

Permalink
Merge develop into main (#181)
Browse files Browse the repository at this point in the history
* 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 <aliou.diaite@rte-france.com>
Signed-off-by: massifben <105049157+massifben@users.noreply.github.com>
Signed-off-by: gleizesDor <115622893+gleizesDor@users.noreply.github.com>
Signed-off-by: SaintierFr  <99645240+SaintierFr@users.noreply.github.com>
Signed-off-by: SABATIER Philippe Ext <philippe.sabatier@rte-france.com>
Co-authored-by: massifben <105049157+massifben@users.noreply.github.com>
Co-authored-by: gleizesDor <115622893+gleizesdor@users.noreply.github.com>
Co-authored-by: SaintierFr <99645240+SaintierFr@users.noreply.github.com>
Co-authored-by: psabatierrte <98765347+psabatierrte@users.noreply.github.com>
  • Loading branch information
5 people authored Oct 24, 2022
1 parent 4c80b8c commit 8bf969b
Show file tree
Hide file tree
Showing 58 changed files with 2,742 additions and 771 deletions.
15 changes: 15 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<scl-extension.version>0.9.1</scl-extension.version>
<compas-scl-xsd.version>0.0.4</compas-scl-xsd.version>
<maven.plugin.javadoc>3.4.1</maven.plugin.javadoc>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -156,6 +157,20 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>

Expand Down
6 changes: 5 additions & 1 deletion sct-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package org.lfenergy.compas.sct.app;

import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.Pair;
import org.lfenergy.compas.scl2007b4.model.SCL;
import org.lfenergy.compas.sct.commons.dto.HeaderDTO;
Expand All @@ -26,7 +25,6 @@
* <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}
* </ul>
*/
@Slf4j
public class SclAutomationService {

/**
Expand Down
22 changes: 0 additions & 22 deletions sct-app/src/main/resources/logback.xml

This file was deleted.

5 changes: 4 additions & 1 deletion sct-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
Expand Down Expand Up @@ -43,7 +42,6 @@
*/
@Getter
@Setter
@Slf4j
@NoArgsConstructor
@EqualsAndHashCode
public class DataTypeName {
Expand All @@ -58,7 +56,7 @@ public class DataTypeName {
public DataTypeName(String dataName){
if(dataName == null) return;
String[] tokens = dataName.split("\\.");
name = tokens[0];
this.name = tokens[0];
if(tokens.length > 1){
structNames.addAll(List.of(tokens).subList(1, tokens.length));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.lfenergy.compas.scl2007b4.model.TLLN0Enum;
import org.lfenergy.compas.scl2007b4.model.TServiceType;

import java.util.Comparator;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -39,8 +40,12 @@
@Getter
@Setter
@NoArgsConstructor
public class ExtRefBindingInfo {
public class ExtRefBindingInfo implements Comparable<ExtRefBindingInfo> {

public static final Comparator<ExtRefBindingInfo> EXT_REF_BINDING_INFO_COMPARATOR = Comparator.comparing(ExtRefBindingInfo::getIedName)
.thenComparing(ExtRefBindingInfo::getLdInst)
.thenComparing(ExtRefBindingInfo::getLnClass)
.thenComparing(ExtRefBindingInfo::getLnInst);
private String iedName;
private String ldInst;
private String prefix;
Expand All @@ -53,23 +58,24 @@ public class ExtRefBindingInfo {

/**
* Constructor
*
* @param tExtRef input
*/
public ExtRefBindingInfo(TExtRef tExtRef){
public ExtRefBindingInfo(TExtRef tExtRef) {
iedName = tExtRef.getIedName();
ldInst = tExtRef.getLdInst();
prefix = tExtRef.getPrefix();
if(!tExtRef.getLnClass().isEmpty()) {
if (!tExtRef.getLnClass().isEmpty()) {
this.lnClass = tExtRef.getLnClass().get(0);
}
lnInst = tExtRef.getLnInst();
if(tExtRef.getDoName() != null) {
if (tExtRef.getDoName() != null) {
doName = new DoTypeName(tExtRef.getDoName());
}
if(tExtRef.getDaName() != null) {
if (tExtRef.getDaName() != null) {
daName = new DaTypeName(tExtRef.getDaName());
}
if(tExtRef.getServiceType() != null) {
if (tExtRef.getServiceType() != null) {
serviceType = tExtRef.getServiceType();
}
}
Expand Down Expand Up @@ -100,33 +106,35 @@ public int hashCode() {

/**
* Check validity of ExtRef binding information
*
* @return validity state
*/
public boolean isValid() {
final String validationRegex = DaTypeName.VALIDATION_REGEX;
String doRef = doName == null ? "" : doName.toString();

Pattern pattern = Pattern.compile(validationRegex,Pattern.MULTILINE);
Pattern pattern = Pattern.compile(validationRegex, Pattern.MULTILINE);
Matcher matcher = pattern.matcher(doRef);
matcher.find();

if(!StringUtils.isBlank(doRef) && doRef.length() != matcher.end()){
if (!StringUtils.isBlank(doRef) && doRef.length() != matcher.end()) {
return false;
}
return !StringUtils.isBlank(iedName) &&
!StringUtils.isBlank(ldInst) &&
!StringUtils.isBlank(lnClass) &&
(TLLN0Enum.LLN_0.value().equals(lnClass) || !StringUtils.isBlank(lnInst)) ;
(TLLN0Enum.LLN_0.value().equals(lnClass) || !StringUtils.isBlank(lnInst));
}

/**
* Check dependency between ExtRef binding information and ExtRef
*
* @param tExtRef object containing ExtRef data's'
* @return dependency state
*/
public boolean isWrappedIn(TExtRef tExtRef){
return Objects.equals(iedName,tExtRef.getIedName()) &&
Objects.equals(ldInst,tExtRef.getLdInst()) &&
public boolean isWrappedIn(TExtRef tExtRef) {
return Objects.equals(iedName, tExtRef.getIedName()) &&
Objects.equals(ldInst, tExtRef.getLdInst()) &&
Objects.equals(prefix, tExtRef.getPrefix()) &&
Objects.equals(lnInst, tExtRef.getLnInst()) &&
tExtRef.getLnClass().contains(lnClass) &&
Expand All @@ -135,9 +143,10 @@ public boolean isWrappedIn(TExtRef tExtRef){

/**
* Check nullability of ExtRef binding information
* @return nullability state
*
* @return nullability state
*/
public boolean isNull(){
public boolean isNull() {
return iedName == null &&
ldInst == null &&
prefix == null &&
Expand All @@ -149,19 +158,27 @@ public boolean isNull(){
}

/**
* Convert to string
* @return ExtRef binding information formatted to string
* Define the way to compare 2 objects ExtRefBindingInfo in order to allow sorting items
*
* @param o the object to be compared.
* @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)
*/
public int compareTo(ExtRefBindingInfo o) {
return EXT_REF_BINDING_INFO_COMPARATOR.compare(this, o);
}

@Override
public String toString() {
String sType = serviceType != null ? serviceType.value() : null;
return "ExtRefBindingInfo{" +
"iedName='" + iedName + '\'' +
", ldInst='" + ldInst + '\'' +
", prefix='" + prefix + '\'' +
", lnClass='" + lnClass + '\'' +
", lnInst='" + lnInst + '\'' +
", lnType='" + lnType + '\'' +
", serviceType=" + serviceType.value() +
", serviceType=" + sType +
'}';

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
package org.lfenergy.compas.sct.commons.dto;


import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.*;
import org.apache.commons.lang3.StringUtils;
import org.lfenergy.compas.scl2007b4.model.TExtRef;
import org.lfenergy.compas.scl2007b4.model.TFCDA;
Expand Down Expand Up @@ -38,6 +35,7 @@
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ExtRefInfo extends LNodeMetaDataEmbedder{

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

Expand Down Expand Up @@ -118,4 +117,25 @@ public boolean matchFCDA(@NonNull TFCDA tfcda){
}
return returnValue;
}
/**
* Check matching between FCDA and ExtRef information (for external binding)
* Check is done for parameter lDInst(mandatory), lNClass(mandatory), lNInst, prefix doName as pDO(mandatory) and daName as pDA
* present in ExtRef and FCDA
* @param tfcda FCDA data to check compatibilities with ExtRef
* @return true if ExtRef matches FCDA for parameters ahead false otherwise
*/
public boolean checkMatchingFCDA(@NonNull TFCDA tfcda){
if(bindingInfo == null || signalInfo == null) return false;
FCDAInfo fcdaInfo = new FCDAInfo(tfcda);
FCDAInfo fcdaOfBinding = FCDAInfo.builder()
.ldInst(bindingInfo.getLdInst())
.lnClass(bindingInfo.getLnClass())
.lnInst(bindingInfo.getLnInst())
.prefix(bindingInfo.getPrefix())
.doName(new DoTypeName(signalInfo.getPDO()))
.daName(new DaTypeName(signalInfo.getPDA()))
.build();
return fcdaInfo.checkFCDACompatibilitiesForBinding(fcdaOfBinding);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
package org.lfenergy.compas.sct.commons.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.*;
import org.apache.commons.lang3.StringUtils;
import org.lfenergy.compas.scl2007b4.model.TFCDA;
import org.lfenergy.compas.scl2007b4.model.TFCEnum;

import java.util.Objects;

import static org.lfenergy.compas.sct.commons.util.Utils.equalsOrBothBlank;

/**
* A representation of the model object <em><b>FCDA</b></em>.
*
Expand All @@ -33,7 +35,9 @@
*/
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class FCDAInfo {

private String dataSet;
Expand All @@ -53,7 +57,11 @@ public class FCDAInfo {
* @param tfcda input
*/
public FCDAInfo(String dataSet, TFCDA tfcda) {
this(tfcda);
this.dataSet = dataSet;
}

public FCDAInfo(TFCDA tfcda) {
fc = tfcda.getFc();
ldInst = tfcda.getLdInst();
prefix = tfcda.getPrefix();
Expand Down Expand Up @@ -106,4 +114,18 @@ public TFCDA getFCDA(){
public boolean isValid() {
return doName != null && doName.isDefined();
}

/**
* Checks if two FCDAInfo object match for ldInst, lnInst, lnClass, lnPrefix doName and daName for search of binding control blocks
* @param fcdaInfo FCDA to copare with
* @return true if FCDAs match for binding, otherwise false
*/
public boolean checkFCDACompatibilitiesForBinding(FCDAInfo fcdaInfo) {
return equalsOrBothBlank(getLdInst(), fcdaInfo.getLdInst())
&& equalsOrBothBlank(getPrefix(), fcdaInfo.getPrefix())
&& equalsOrBothBlank(getLnClass(), fcdaInfo.getLnClass())
&& equalsOrBothBlank(getLnInst(), fcdaInfo.getLnInst())
&& Objects.equals(getDoName(), fcdaInfo.getDoName())
&& Objects.equals(getDaName(), fcdaInfo.getDaName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.lfenergy.compas.sct.commons.scl.ied.IEDAdapter;
import org.lfenergy.compas.sct.commons.scl.ied.LDeviceAdapter;

import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -52,8 +50,7 @@ public IedDTO(String name){
public static IedDTO from(IEDAdapter iedAdapter, LogicalNodeOptions options) {
IedDTO iedDTO = new IedDTO();
iedDTO.name = iedAdapter.getName();
List<LDeviceAdapter> lDeviceAdapters = iedAdapter.getLDeviceAdapters();
iedDTO.lDevices = lDeviceAdapters.stream()
iedDTO.lDevices = iedAdapter.streamLDeviceAdapters()
.map(lDeviceAdapter -> LDeviceDTO.from(lDeviceAdapter,options))
.collect(Collectors.toUnmodifiableSet());

Expand Down
Loading

0 comments on commit 8bf969b

Please sign in to comment.