-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): refactor DTT - manage DO and DA in DataTypeTemplate / DOI, SD…
…I and DAI in LN Signed-off-by: Samir Romdhani <[email protected]>
- Loading branch information
1 parent
7529951
commit 60af373
Showing
9 changed files
with
816 additions
and
16 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/BDAService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-FileCopyrightText: 2024 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.TBDA; | ||
import org.lfenergy.compas.scl2007b4.model.TDAType; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class BDAService { | ||
|
||
public Stream<TBDA> getBDAs(TDAType tdaType) { | ||
return tdaType.getBDA().stream(); | ||
} | ||
|
||
public Stream<TBDA> getFilteredSDOOrDAs(TDAType tdaType, Predicate<TBDA> tTBDAPredicate) { | ||
return getBDAs(tdaType).filter(tTBDAPredicate); | ||
} | ||
|
||
public Optional<TBDA> findBDA(TDAType tdaType, Predicate<TBDA> tBDAPredicate) { | ||
return getFilteredSDOOrDAs(tdaType, tBDAPredicate).findFirst(); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DaTypeService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-FileCopyrightText: 2024 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.TDAType; | ||
import org.lfenergy.compas.scl2007b4.model.TDataTypeTemplates; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class DaTypeService { | ||
|
||
public Stream<TDAType> getDaTypes(TDataTypeTemplates tDataTypeTemplates) { | ||
return tDataTypeTemplates.getDAType().stream(); | ||
} | ||
|
||
public Stream<TDAType> getFilteredDaTypes(TDataTypeTemplates tDataTypeTemplates, Predicate<TDAType> tdaTypePredicate) { | ||
return getDaTypes(tDataTypeTemplates).filter(tdaTypePredicate); | ||
} | ||
|
||
public Optional<TDAType> findDaType(TDataTypeTemplates tDataTypeTemplates, Predicate<TDAType> tdaTypePredicate) { | ||
return getFilteredDaTypes(tDataTypeTemplates, tdaTypePredicate).findFirst(); | ||
} | ||
|
||
} |
231 changes: 224 additions & 7 deletions
231
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/DataTypeTemplatesService.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/SDOOrDAService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-FileCopyrightText: 2024 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.*; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Stream; | ||
|
||
public class SDOOrDAService { | ||
|
||
public <T> Stream<T> getSDOOrDAs(TDOType tdoType, Class<T> clazz) { | ||
return tdoType.getSDOOrDA().stream() | ||
.filter(unNaming -> unNaming.getClass().equals(clazz)) | ||
.map(clazz::cast); | ||
} | ||
|
||
public <T> Stream<T> getFilteredSDOOrDAs(TDOType tdoType, Class<T> clazz, Predicate<T> tSDOOrDAPredicate) { | ||
return getSDOOrDAs(tdoType, clazz).filter(tSDOOrDAPredicate); | ||
} | ||
|
||
public <T> Optional<T> findSDOOrDA(TDOType tdoType, Class<T> clazz, Predicate<T> tSDOOrDAPredicate) { | ||
return getFilteredSDOOrDAs(tdoType, clazz, tSDOOrDAPredicate).findFirst(); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/DataTypeTemplateReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-FileCopyrightText: 2024 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons.api; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.TDataTypeTemplates; | ||
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.SclReportItem; | ||
|
||
import java.util.List; | ||
|
||
public interface DataTypeTemplateReader { | ||
|
||
boolean isDoModAndDaStValExist(TDataTypeTemplates dtt, String lNodeTypeId); | ||
|
||
List<SclReportItem> isDataObjectsAndDataAttributesExists(TDataTypeTemplates dtt, String lNodeTypeId, String dataRef); | ||
|
||
List<SclReportItem> verifyDataObjectsAndDataAttributes(TDataTypeTemplates dtt, String lNodeTypeId, DoTypeName doTypeName, DaTypeName daTypeName); | ||
|
||
DataAttributeRef getDataObjectsAndDataAttributes(TDataTypeTemplates dtt, String lNodeTypeId, String dataRef); | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
sct-commons/src/main/java/org/lfenergy/compas/sct/commons/api/LNEditor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SPDX-FileCopyrightText: 2024 RTE FRANCE | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.lfenergy.compas.sct.commons.api; | ||
|
||
import org.lfenergy.compas.scl2007b4.model.TAnyLN; | ||
import org.lfenergy.compas.sct.commons.dto.DaTypeName; | ||
import org.lfenergy.compas.sct.commons.dto.DataAttributeRef; | ||
import org.lfenergy.compas.sct.commons.dto.DoTypeName; | ||
|
||
public interface LNEditor { | ||
|
||
boolean isDoObjectsInstanceAndDataAttributesInstanceExists(TAnyLN tAnyLN, DoTypeName doTypeName, DaTypeName daTypeName); | ||
|
||
void updateOrCreateDoObjectsAndDataAttributesInstances(TAnyLN tAnyLN, DataAttributeRef dataAttributeRef); | ||
} |
Oops, something went wrong.