Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
Signed-off-by: Franck LECUYER <[email protected]>
  • Loading branch information
FranckLecuyer committed Mar 14, 2024
1 parent 6afbc5e commit f01c3bd
Show file tree
Hide file tree
Showing 63 changed files with 8,683 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push:
branches:
- 'main'
tags:
- 'v[0-9]*'
pull_request:

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17

- name: Checkout sources
uses: actions/checkout@v1

- name: Build with Maven
run: mvn --batch-mode -P jacoco verify

- name: Run SonarCloud analysis
run: >
mvn --batch-mode sonar:sonar
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=gridsuite
-Dsonar.projectKey=org.gridsuite:filter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Broadcast update event
if: github.ref == 'refs/heads/main'
uses: gridsuite/broadcast-event@main
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: filter_updated
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# VSCode
/.vscode
/.settings
.classpath
.factorypath
.project

target/

# IntelliJ
/.idea
*.iml
Empty file added .mvn/lombok-config-copy.marker
Empty file.
1 change: 1 addition & 0 deletions lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import target/configs/powsybl-build-tools.jar!powsybl-build-tools/lombok.config
173 changes: 173 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2024, RTE (http://www.rte-france.com)
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-parent</artifactId>
<version>18</version>
<relativePath/>
</parent>

<groupId>org.gridsuite</groupId>
<artifactId>gridsuite-filter</artifactId>
<version>1.0.0-SNAPSHOT</version>

<packaging>jar</packaging>
<name>Filter library</name>
<description>A library to evaluate a filter on a network</description>
<url>http://www.gridsuite.org/</url>

<scm>
<connection>scm:git:https://github.com/gridsuite/filter.git</connection>
<developerConnection>scm:git:https://github.com/gridsuite/filter.git</developerConnection>
<url>https://github.com/gridsuite/filter</url>
</scm>

<developers>
<developer>
<name>Franck Lecuyer</name>
<email>[email protected]</email>
<organization>RTE</organization>
<organizationUrl>http://www.rte-france.com</organizationUrl>
</developer>
</developers>

<properties>
<powsybl-ws-dependencies.version>2.7.0</powsybl-ws-dependencies.version>
<swagger-annotations.version>2.2.9</swagger-annotations.version>
<spring-core.version>6.0.11</spring-core.version>
<org-apache-commons.version>4.4</org-apache-commons.version>
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<classpathDependencyExcludes>
<classpathDependencyExclude>com.powsybl:powsybl-config-classic</classpathDependencyExclude>
</classpathDependencyExcludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>

<dependencyManagement>
<dependencies>
<!-- overrides of imports -->

<!-- imports -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring-core.version}</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>${org-apache-commons.version}</version>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-ws-dependencies</artifactId>
<version>${powsybl-ws-dependencies.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- Compilation dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-contingency-api</artifactId>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-ws-commons</artifactId>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-impl</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

<!-- Runtime dependencies -->
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-config-classic</artifactId>
<scope>runtime</scope>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-config-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
61 changes: 61 additions & 0 deletions src/main/java/org/gridsuite/filter/AbstractFilter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* Copyright (c) 2021, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.filter;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.gridsuite.filter.criteriafilter.CriteriaFilter;
import org.gridsuite.filter.expertfilter.ExpertFilter;
import org.gridsuite.filter.identifierlistfilter.FilterEquipments;
import org.gridsuite.filter.identifierlistfilter.IdentifiableAttributes;
import org.gridsuite.filter.identifierlistfilter.IdentifierListFilter;
import org.gridsuite.filter.scriptfilter.ScriptFilter;
import org.gridsuite.filter.utils.EquipmentType;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
* @author Jacques Borsenberger <jacques.borsenberger at rte-france.com>
* @author Franck Lecuyer <franck.lecuyer at rte-france.com>
*/
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
property = "type",
include = JsonTypeInfo.As.EXISTING_PROPERTY,
visible = true
)
@JsonSubTypes({//Below, we define the names and the binding classes.
@JsonSubTypes.Type(value = CriteriaFilter.class, name = "CRITERIA"),
@JsonSubTypes.Type(value = IdentifierListFilter.class, name = "IDENTIFIER_LIST"),
@JsonSubTypes.Type(value = ExpertFilter.class, name = "EXPERT"),
@JsonSubTypes.Type(value = ScriptFilter.class, name = "SCRIPT")
})
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@ToString
public abstract class AbstractFilter implements IFilterAttributes {

UUID id;

Date modificationDate;

EquipmentType equipmentType;

public FilterEquipments getFilterEquipments(List<IdentifiableAttributes> identifiableAttributes) {
return FilterEquipments.builder()
.filterId(id)
.identifiableAttributes(identifiableAttributes)
.build();
}
}
17 changes: 17 additions & 0 deletions src/main/java/org/gridsuite/filter/FilterLoader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) 2021, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.filter;

import java.util.List;
import java.util.UUID;

/**
* @author Franck Lecuyer <franck.lecuyer at rte-france.com>
*/
public interface FilterLoader {
List<AbstractFilter> getFilters(List<UUID> uuids);
}
24 changes: 24 additions & 0 deletions src/main/java/org/gridsuite/filter/IFilterAttributes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2021, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.gridsuite.filter;

import org.gridsuite.filter.utils.EquipmentType;
import org.gridsuite.filter.utils.FilterType;

/**
* @author Jacques Borsenberger <jacques.borsenberger at rte-france.com>
*/
public interface IFilterAttributes {
java.util.UUID getId();

java.util.Date getModificationDate();

FilterType getType();

EquipmentType getEquipmentType();
}
23 changes: 23 additions & 0 deletions src/main/java/org/gridsuite/filter/IdsByGroup.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright (c) 2023, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.filter;

import lombok.Builder;
import lombok.Data;

import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
* @author Ghazwa Rehili <ghazwa.rehili at rte-france.com>
*/
@Data
@Builder
public class IdsByGroup {
Map<String, List<UUID>> ids;
}
Loading

0 comments on commit f01c3bd

Please sign in to comment.