diff --git a/java/bundles/org.eclipse.set.feature.plazmodel/OSGI-INF/l10n/bundle.properties b/java/bundles/org.eclipse.set.feature.plazmodel/OSGI-INF/l10n/bundle.properties index 08cf7e3713..bc741d2cb7 100644 --- a/java/bundles/org.eclipse.set.feature.plazmodel/OSGI-INF/l10n/bundle.properties +++ b/java/bundles/org.eclipse.set.feature.plazmodel/OSGI-INF/l10n/bundle.properties @@ -41,6 +41,7 @@ PlazReportColumns_Severity = Schweregrad PlazReportColumns_ProblemType = Problemart PlazReportColumns_LineNumber = Zeilennummer PlazReportColumns_ObjectType = Objektart +PlazReportColumns_ObjectDesignation=Objektbezeichnung PlazReportColumns_AttributeGroup = Attribut/-Gruppe PlazReportColumns_ObjectScope = Bereich PlazReportColumns_ObjectState = Zustand diff --git a/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/Messages.java b/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/Messages.java index 2f6f633225..80c6d2836d 100644 --- a/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/Messages.java +++ b/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/Messages.java @@ -84,6 +84,11 @@ public class Messages { */ public String PlazReportColumns_ObjectType; + /** + * Objectbezeichnung + */ + public String PlazReportColumns_ObjectDesignation; + /** * Lfd. */ @@ -103,4 +108,5 @@ public class Messages { * Die topologischen Koordinaten können nicht exportieren werden */ public String PlazExport_ExportProcess_ErrorDialog_Message; + } diff --git a/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/PlazModelPart.java b/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/PlazModelPart.java index 471f756c09..707cd7091c 100644 --- a/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/PlazModelPart.java +++ b/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/PlazModelPart.java @@ -43,6 +43,7 @@ import org.eclipse.set.utils.events.ContainerDataChanged; import org.eclipse.set.utils.events.ProjectDataChanged; import org.eclipse.set.utils.table.menu.TableMenuService; +import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; @@ -139,6 +140,7 @@ protected void createFormsView(final Composite parent) if (getModelSession().isDirty()) { setOutdated(true); } + parent.addListener(SWT.RESIZE, e -> parent.layout(true)); // export action getBanderole().setEnableExport(true); diff --git a/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/service/PlazModelServiceImpl.xtend b/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/service/PlazModelServiceImpl.xtend index dc081c93c4..a9cf62a0dd 100644 --- a/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/service/PlazModelServiceImpl.xtend +++ b/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/service/PlazModelServiceImpl.xtend @@ -28,6 +28,8 @@ import org.osgi.service.component.annotations.ReferencePolicy import org.slf4j.Logger import org.slf4j.LoggerFactory +import static extension org.eclipse.set.ppmodel.extensions.utils.LSTObjectDesignationExtensions.getLSTObjectDesignation + @Component class PlazModelServiceImpl implements PlazModelService { @Reference(cardinality=ReferenceCardinality. @@ -106,6 +108,7 @@ class PlazModelServiceImpl implements PlazModelService { entry.type = error.type entry.severity = error.severity entry.generalMsg = generalErroMsg + entry.objectDesignation = error.object.getLSTObjectDesignation if (node !== null) { var line = 0 try { diff --git a/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/table/PlazModelTableTransformator.xtend b/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/table/PlazModelTableTransformator.xtend index 3bba3524c5..152cad1389 100644 --- a/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/table/PlazModelTableTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/table/PlazModelTableTransformator.xtend @@ -33,7 +33,7 @@ class PlazModelTableTransformator extends AbstractValidationProblemTransformator this.columns = columns this.enumTranslationService = enumTranslationService excludeColumns = newArrayList(columns.RowIndex, columns.Message, - columns.LineNumber) + columns.LineNumber, columns.ObjectDesignation) } override fillProblem(TableRow instance, ValidationProblem problem) { @@ -46,6 +46,7 @@ class PlazModelTableTransformator extends AbstractValidationProblemTransformator fillNumeric(instance, columns.LineNumber, problem, [lineNumber]) } fill(instance, columns.ObjectType, problem, [objectArt]) + fill(instance, columns.ObjectDesignation, problem, [objectDesignation]) fill(instance, columns.AttributeGroup, problem, [attributeName]) fill(instance, columns.ObjectScope, problem, [objectScope?.literal]) fill(instance, columns.ObjectState, problem, [objectState?.literal]) diff --git a/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/table/PlazModelTableView.java b/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/table/PlazModelTableView.java index 2ff3be4f93..2e45fc1dc7 100644 --- a/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/table/PlazModelTableView.java +++ b/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/table/PlazModelTableView.java @@ -39,7 +39,7 @@ public class PlazModelTableView extends AbstractTreeLayerTable { Werkzeugkofferversion: %s - "Lfd. Nr.";"Schweregrad";"Problemart";"Zeilennummer";"Objektart";"Attribut/-gruppe";"Bereich";"Zustand";"Meldung" + "Lfd. Nr.";"Schweregrad";"Problemart";"Zeilennummer";"Objektart";"Objekbezeichnung";"Attribut/-gruppe";"Bereich";"Zustand";"Meldung" """; private final Messages messages; @@ -95,7 +95,6 @@ public Control create(final Composite parent, tableMenuService.addMenuItem(createJumpToTextViewMenuItem(part)); tableMenuService.addMenuItem(createJumpToSiteplanMenuItem()); natTable = createTable(parent, table); - return natTable; } diff --git a/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/table/PlazReportColumns.xtend b/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/table/PlazReportColumns.xtend index f301defe32..4ff5006ee1 100644 --- a/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/table/PlazReportColumns.xtend +++ b/java/bundles/org.eclipse.set.feature.plazmodel/src/org/eclipse/set/feature/plazmodel/table/PlazReportColumns.xtend @@ -29,6 +29,7 @@ class PlazReportColumns extends AbstractColumns { public final ColumnDescriptor ObjectScope; public final ColumnDescriptor ObjectState; public final ColumnDescriptor Message; + public final ColumnDescriptor ObjectDesignation; /** * @param messages the messages @@ -40,6 +41,7 @@ class PlazReportColumns extends AbstractColumns { ProblemType = createNew(messages.PlazReportColumns_ProblemType) LineNumber = createNew(messages.PlazReportColumns_LineNumber) ObjectType = createNew(messages.PlazReportColumns_ObjectType) + ObjectDesignation = createNew(messages.PlazReportColumns_ObjectDesignation) AttributeGroup = createNew(messages.PlazReportColumns_AttributeGroup) ObjectScope = createNew(messages.PlazReportColumns_ObjectScope) ObjectState = createNew(messages.PlazReportColumns_ObjectState) @@ -49,15 +51,16 @@ class PlazReportColumns extends AbstractColumns { def ColumnDescriptor fillHeaderDescriptions( ColumnDescriptorModelBuilder builder) { val GroupBuilder root = builder.createRootColumn() - root.add(RowIndex).width(1.25f) - root.add(Severity).width(2.1f) - root.add(ProblemType).width(3.5f) - root.add(LineNumber).width(2.2f) - root.add(ObjectType).width(3) - root.add(AttributeGroup).width(3) - root.add(ObjectScope).width(2) - root.add(ObjectState).width(1.5f) - root.add(Message).width(8.5f) + root.add(RowIndex).widthPercent(5) + root.add(Severity).widthPercent(5) + root.add(ProblemType).widthPercent(8) + root.add(LineNumber).widthPercent(5) + root.add(ObjectType).widthPercent(8) + root.add(ObjectDesignation).widthPercent(10) + root.add(AttributeGroup).widthPercent(8) + root.add(ObjectScope).widthPercent(5) + root.add(ObjectState).widthPercent(4) + root.add(Message).widthPercent(20) return root.getGroupRoot() } } diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskp/SskpTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskp/SskpTransformator.xtend index 5b0bf0840f..7d2764bfc1 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskp/SskpTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskp/SskpTransformator.xtend @@ -113,7 +113,7 @@ class SskpTransformator extends AbstractPlanPro2TableModelTransformator { instance, cols.getColumn(Bezugselement), pzb, - [PZBElementBezugspunkt.filterNull.map[fillBezugsElement]], + [bezugsElementBezeichnungen], MIXED_STRING_COMPARATOR ) @@ -615,21 +615,6 @@ class SskpTransformator extends AbstractPlanPro2TableModelTransformator { } - static dispatch def String fillBezugsElement(Basis_Objekt object) { - throw new IllegalArgumentException(object.class.simpleName) - } - - static dispatch def String fillBezugsElement(W_Kr_Gsp_Element object) { - return object?.bezeichnung?.bezeichnungTabelle?.wert - } - - static dispatch def String fillBezugsElement(Signal object) { - return object?.signalReal?.signalFunktion?.wert === - ENUMSignalFunktion.ENUM_SIGNAL_FUNKTION_BUE_UEBERWACHUNGSSIGNAL - ? '''BÜ-K «object?.bezeichnung?.bezeichnungTabelle?.wert»''' - : object?.bezeichnung?.bezeichnungTabelle?.wert - } - private dispatch def String getDistanceSignalTrackSwitch(PZB_Element pzb, Basis_Objekt object, int scaleValue) { throw new IllegalArgumentException(object.class.simpleName) diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskx/SskxTransformator.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskx/SskxTransformator.java index 8ae62387b7..64df0398ff 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskx/SskxTransformator.java +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sskx/SskxTransformator.java @@ -10,19 +10,7 @@ */ package org.eclipse.set.feature.table.pt1.sskx; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_ARBEITSBUEHNE; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_DACH_DECKE; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_OL_MAST; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_PFOSTEN_HOCH; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_PFOSTEN_NIEDRIG; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_REGELANORDNUNG_MAST_HOCH; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_REGELANORDNUNG_MAST_NIEDRIG; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_REGELANORDNUNG_SONSTIGE_HOCH; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_REGELANORDNUNG_SONSTIGE_NIEDRIG; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_SCHIENENFUSS; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_SONDERANORDNUNG_MAST_HOCH; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_SONDERANORDNUNG_MAST_NIEDRIG; -import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.ENUM_BEFESTIGUNG_ART_WAND; +import static org.eclipse.set.model.planpro.Signale.ENUMBefestigungArt.*; import java.util.LinkedList; import java.util.List; @@ -60,12 +48,12 @@ import org.eclipse.set.model.planpro.Verweise.ID_Regelzeichnung_TypeClass; import org.eclipse.set.model.tablemodel.ColumnDescriptor; import org.eclipse.set.model.tablemodel.TableRow; -import org.eclipse.set.model.tablemodel.extensions.FootnoteExtensions; import org.eclipse.set.ppmodel.extensions.BasisAttributExtensions; import org.eclipse.set.ppmodel.extensions.BereichObjektExtensions; import org.eclipse.set.ppmodel.extensions.EObjectExtensions; import org.eclipse.set.ppmodel.extensions.SignalExtensions; import org.eclipse.set.ppmodel.extensions.SignalRahmenExtensions; +import org.eclipse.set.ppmodel.extensions.SignalbegriffExtensions; import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup; import org.eclipse.set.utils.table.TMFactory; import org.osgi.service.event.EventAdmin; @@ -357,7 +345,8 @@ private static List> signalbegriffB selectBezeichnungFuncs .add(Signalbegriff_ID_TypeClass::getLangbezeichnung); - selectBezeichnungFuncs.add(FootnoteExtensions::getSignalBregiffIDName); + selectBezeichnungFuncs + .add(SignalbegriffExtensions::getSignalBegriffIDName); return selectBezeichnungFuncs; } @@ -370,8 +359,8 @@ private static List getSignalbegriffeBezeichnung( .map(signalBegriffe -> { if (SPEICAL_BEZEICHNUNG_HANDLE_BEGRIFFE.stream() .anyMatch(c -> c.isInstance(signalBegriffe))) { - return FootnoteExtensions - .getSignalBregiffIDName(signalBegriffe); + return SignalbegriffExtensions + .getSignalBegriffIDName(signalBegriffe); } for (final Function function : selectBezeichnungFunc) { final String bezeichnung = function diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssza/SszaTransformator.xtend b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssza/SszaTransformator.xtend index d0a9a1e2a1..073cb3ed57 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssza/SszaTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/ssza/SszaTransformator.xtend @@ -44,7 +44,6 @@ import org.eclipse.set.utils.table.RowFactory import org.eclipse.set.utils.table.TMFactory import org.osgi.service.event.EventAdmin -import static org.eclipse.set.feature.table.pt1.sskp.SskpTransformator.* import static org.eclipse.set.feature.table.pt1.ssza.SszaColumns.* import static extension org.eclipse.set.ppmodel.extensions.BasisAttributExtensions.* @@ -54,6 +53,7 @@ import static extension org.eclipse.set.ppmodel.extensions.DatenpunktExtensions. import static extension org.eclipse.set.ppmodel.extensions.FmaAnlageExtensions.* import static extension org.eclipse.set.ppmodel.extensions.PunktObjektExtensions.* import static extension org.eclipse.set.ppmodel.extensions.PunktObjektTopKanteExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.PZBElementExtensions.* import static extension org.eclipse.set.ppmodel.extensions.TopKanteExtensions.* import static extension org.eclipse.set.ppmodel.extensions.utils.IterableExtensions.* import static extension org.eclipse.set.utils.math.BigDecimalExtensions.* @@ -173,7 +173,7 @@ class SszaTransformator extends AbstractPlanPro2TableModelTransformator { bezugspunktCase( PZB_Element, [ - '''GM «PZBArt?.translate» «IDPZBElementZuordnung?.value?.PZBElementZuordnungBP?.map[fillBezugsElement(IDPZBElementBezugspunkt?.value)].join»''' + '''GM «PZBArt?.translate» «IDPZBElementZuordnung?.value?.PZBElementZuordnungBP?.map[getBezugElementBezeichnung(IDPZBElementBezugspunkt?.value)].join»''' ] ), bezugspunktCase( @@ -578,7 +578,8 @@ class SszaTransformator extends AbstractPlanPro2TableModelTransformator { topKante.isInRouteDirection(IDStrecke.value) ] return isTopKanteRouteSameDirection === - (direction === ENUMAusrichtung.ENUM_AUSRICHTUNG_IN) ? lange : "-" + - lange + (direction === ENUMAusrichtung.ENUM_AUSRICHTUNG_IN) + ? lange + : "-" + lange } } diff --git a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sxxx/SxxxTransformator.java b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sxxx/SxxxTransformator.java index 62c168c449..be0dea0725 100644 --- a/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sxxx/SxxxTransformator.java +++ b/java/bundles/org.eclipse.set.feature.table.pt1/src/org/eclipse/set/feature/table/pt1/sxxx/SxxxTransformator.java @@ -11,7 +11,7 @@ package org.eclipse.set.feature.table.pt1.sxxx; import static org.eclipse.set.feature.table.pt1.sxxx.SxxxColumns.*; -import static org.eclipse.set.ppmodel.extensions.EObjectExtensions.getNullableObject; +import static org.eclipse.set.ppmodel.extensions.utils.LSTObjectDesignationExtensions.getLSTObjectDesignation; import java.util.List; import java.util.Set; @@ -19,22 +19,13 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; import org.eclipse.set.feature.table.pt1.AbstractPlanPro2TableModelTransformator; -import org.eclipse.set.model.planpro.Ansteuerung_Element.Aussenelementansteuerung; -import org.eclipse.set.model.planpro.Ansteuerung_Element.ESTW_Zentraleinheit; import org.eclipse.set.model.planpro.BasisTypen.BasisAttribut_AttributeGroup; import org.eclipse.set.model.planpro.BasisTypen.ID_Bearbeitungsvermerk_TypeClass; import org.eclipse.set.model.planpro.Basisobjekte.Bearbeitungsvermerk; -import org.eclipse.set.model.planpro.Bedienung.Bedien_Einrichtung_Oertlich; -import org.eclipse.set.model.planpro.Ortung.FMA_Anlage; -import org.eclipse.set.model.planpro.Ortung.FMA_Komponente; -import org.eclipse.set.model.planpro.Ortung.Zugeinwirkung; -import org.eclipse.set.model.planpro.Signale.Signal; import org.eclipse.set.model.tablemodel.ColumnDescriptor; import org.eclipse.set.model.tablemodel.Table; import org.eclipse.set.model.tablemodel.TableRow; -import org.eclipse.set.ppmodel.extensions.AussenelementansteuerungExtensions; import org.eclipse.set.ppmodel.extensions.EObjectExtensions; -import org.eclipse.set.ppmodel.extensions.UrObjectExtensions; import org.eclipse.set.ppmodel.extensions.container.MultiContainer_AttributeGroup; import org.eclipse.set.utils.EnumeratorExtensions; import org.eclipse.set.utils.table.RowFactory; @@ -119,7 +110,7 @@ public Table transformTableContent( // C: Referenziert von Objects fill(row, getColumn(cols, Reference_Object), bv, - note -> getReferenceObjDesignation(referencedBy)); + note -> getLSTObjectDesignation(referencedBy)); // D: Ausgabe in Plan // Will fill later in TableService @@ -151,40 +142,4 @@ private void fillBearbeitungsvermerkContent(final TableRow row, .getWert()) .orElse("")); //$NON-NLS-1$ } - - @SuppressWarnings("nls") - private static String getReferenceObjDesignation(final EObject refObj) { - final String typeName = UrObjectExtensions.getTypeName(refObj) - .replace("_TypeClass", ""); - final String objDesignation = switch (refObj) { - case final Aussenelementansteuerung aussenelement -> AussenelementansteuerungExtensions - .getElementBezeichnung(aussenelement); - case final Bedien_Einrichtung_Oertlich beo -> getNullableObject(beo, - e -> e.getBezeichnung() - .getBedienEinrichtOertlBez() - .getWert()).orElse(""); - case final ESTW_Zentraleinheit estwZentral -> AussenelementansteuerungExtensions - .getElementBezeichnung(estwZentral); - case final FMA_Anlage fmaAnlage -> getNullableObject(fmaAnlage, - fma -> fma.getFMAAnlageKaskade() - .getFMAKaskadeBezeichnung() - .getWert()).orElse(""); - case final FMA_Komponente fmaKomponent -> getNullableObject( - fmaKomponent, - fma -> fma.getBezeichnung() - .getBezeichnungTabelle() - .getWert()).orElse(""); - case final Signal signal -> getNullableObject(signal, - s -> s.getBezeichnung().getBezeichnungTabelle().getWert()) - .orElse(""); - case final Zugeinwirkung ein -> getNullableObject(ein, - e -> e.getBezeichnung().getBezeichnungTabelle().getWert()) - .orElse(""); - default -> ""; - }; - if (objDesignation != null && !objDesignation.isEmpty()) { - return typeName + " " + objDesignation; - } - return typeName; - } } diff --git a/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties b/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties index a1edf57cfc..c9cfa19e20 100644 --- a/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties +++ b/java/bundles/org.eclipse.set.feature.validation/OSGI-INF/l10n/bundle.properties @@ -43,6 +43,7 @@ ValidationTableColumns_Severity=Schweregrad ValidationTableColumns_ProblemType=Problemart ValidationTableColumns_LineNumber=Zeilennummer ValidationTableColumns_ObjectType=Objektart +ValidationTableColumns_ObjectDesignation=Objectbezeichnung ValidationTableColumns_AttributeGroup=Attribut/-gruppe ValidationTableColumns_ObjectScope=Bereich ValidationTableColumns_ObjectState=Zustand diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java index 02701ae232..610cb1dfd3 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/Messages.java @@ -196,6 +196,11 @@ public class Messages { */ public String ValidationTableColumns_ObjectType; + /** + * Objectbezeichnung + */ + public String ValidationTableColumns_ObjectDesignation; + /** * Attribut/-gruppe */ diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/report/SessionToValidationReportTransformation.xtend b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/report/SessionToValidationReportTransformation.xtend index ca507238b4..669bd6f196 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/report/SessionToValidationReportTransformation.xtend +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/report/SessionToValidationReportTransformation.xtend @@ -14,24 +14,30 @@ import java.util.Comparator import java.util.List import java.util.Set import org.eclipse.emf.common.util.Enumerator +import org.eclipse.emf.ecore.EObject import org.eclipse.emf.ecore.xmi.XMIException import org.eclipse.set.basis.IModelSession +import org.eclipse.set.basis.constants.ContainerType import org.eclipse.set.basis.constants.ValidationResult import org.eclipse.set.basis.constants.ValidationResult.Outcome import org.eclipse.set.basis.exceptions.CustomValidationProblem import org.eclipse.set.basis.files.ToolboxFile import org.eclipse.set.core.services.enumtranslation.EnumTranslationService import org.eclipse.set.core.services.version.PlanProVersionService +import org.eclipse.set.feature.validation.LayoutInfoRequired import org.eclipse.set.feature.validation.Messages import org.eclipse.set.feature.validation.utils.FileInfoReader import org.eclipse.set.model.planpro.Layoutinformationen.PlanPro_Layoutinfo import org.eclipse.set.model.planpro.PlanPro.PlanPro_Schnittstelle import org.eclipse.set.model.validationreport.ObjectScope +import org.eclipse.set.model.validationreport.ObjectState import org.eclipse.set.model.validationreport.ValidationProblem import org.eclipse.set.model.validationreport.ValidationReport import org.eclipse.set.model.validationreport.ValidationSeverity import org.eclipse.set.model.validationreport.ValidationreportFactory + import org.eclipse.set.utils.ToolboxConfiguration +import org.eclipse.set.utils.xml.NodeAttributeNameProvider import org.eclipse.set.utils.xml.XMLNodeFinder import org.xml.sax.SAXParseException @@ -41,7 +47,11 @@ import static java.util.Comparator.nullsLast import static extension org.eclipse.set.basis.extensions.IModelSessionExtensions.* import static extension org.eclipse.set.utils.xml.ObjectMetadataXMLReader.* -import org.eclipse.set.feature.validation.LayoutInfoRequired +import static extension org.eclipse.set.utils.xml.XMLNodeFinder.* +import static extension org.eclipse.set.ppmodel.extensions.MultiContainer_AttributeGroupExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.utils.LSTObjectDesignationExtensions.* +import static extension org.eclipse.set.ppmodel.extensions.PlanProSchnittstelleExtensions.* +import org.eclipse.set.model.planpro.Basisobjekte.Ur_Objekt /** * Transforms a {@link IModelSession} into a {@link ValidationReport}. @@ -81,12 +91,13 @@ class SessionToValidationReportTransformation { report.problems.clear val problems = newLinkedList problems.addAll( - session.getValidationResult(PlanPro_Schnittstelle).transform( - session?.toolboxFile, session?.toolboxFile?.modelPath)) + session.getValidationResult(PlanPro_Schnittstelle). + transform(session, session?.toolboxFile, + session?.toolboxFile?.modelPath)) val layoutValidation = session.getValidationResult(PlanPro_Layoutinfo) if (layoutValidation !== null) { problems.addAll( - layoutValidation.transform(session?.toolboxFile, + layoutValidation.transform(session, session?.toolboxFile, session?.toolboxFile?.layoutPath).filter [ !problems.contains(it) ] @@ -107,44 +118,44 @@ class SessionToValidationReportTransformation { } def Set transform(ValidationResult validationResult, - ToolboxFile toolboxFile, Path sourcePath) { + IModelSession session, ToolboxFile toolboxFile, Path sourcePath) { val problems = newLinkedList xmlNodeFinder = new XMLNodeFinder() xmlNodeFinder.read(toolboxFile, sourcePath) validationSourceClass = validationResult.validatedSourceClass problems.addAll( validationResult.xsdErrors.transform(messages.XsdProblemMsg, - ValidationSeverity.ERROR, messages.XsdErrorSuccessMsg)) + session, ValidationSeverity.ERROR, messages.XsdErrorSuccessMsg)) // transform the XSD problems problems.addAll( validationResult.xsdWarnings.transform(messages.XsdWarningMsg, - ValidationSeverity.WARNING, messages.XsdSuccessMsg)) + session, ValidationSeverity.WARNING, messages.XsdSuccessMsg)) problems.addAll( - validationResult.ioErrors.transform(messages.IoProblemMsg, + validationResult.ioErrors.transform(messages.IoProblemMsg, session, ValidationSeverity.ERROR, messages.IoSuccessMsg)) // transform custom problems validationResult.customProblems.forEach [ problems.add( - transform + it.transform(session) ) ] return problems.toSet } private def List transform( - List errors, String type, ValidationSeverity severity, - String successMessage) { + List errors, String type, IModelSession session, + ValidationSeverity severity, String successMessage) { val result = newLinkedList if (errors.empty) { result.add( - type.transform(successMessage) + type.transform(successMessage, session) ) } else { errors.forEach [ result.add( - transform(type, severity) + transform(type, session, severity) ) ] } @@ -191,23 +202,25 @@ class SessionToValidationReportTransformation { private def ValidationProblem transform( Exception exception, String type, + IModelSession session, ValidationSeverity severity ) { val cause = exception.cause if (cause instanceof XMIException) { - return cause.transformException(type, severity) + return cause.transformException(type, session, severity) } if (cause instanceof SAXParseException) { - return cause.transformException(type, severity) + return cause.transformException(type, session, severity) } - return exception.transformException(type, severity) + return exception.transformException(type, session, severity) } private def dispatch ValidationProblem create ValidationreportFactory.eINSTANCE.createValidationProblem transformException( XMIException exception, String type, + IModelSession session, ValidationSeverity severity ) { it.type = type @@ -221,6 +234,10 @@ class SessionToValidationReportTransformation { objectScope = xmlNode.objectScope objectState = xmlNode.objectState attributeName = xmlNode.attributeName + val guid = xmlNode.findNearestNodeGUID [ + nodeName !== NodeAttributeNameProvider.CONTAINER_NODE + ] + objectDesignation = session.getObjectDesignation(guid, objectState) } if (objectScope === null || objectScope === ObjectScope.UNKNOWN) { @@ -237,6 +254,7 @@ class SessionToValidationReportTransformation { transformException( SAXParseException exception, String type, + IModelSession session, ValidationSeverity severity ) { it.type = type @@ -250,6 +268,10 @@ class SessionToValidationReportTransformation { objectScope = xmlNode.objectScope objectState = xmlNode.objectState attributeName = xmlNode.attributeName + val guid = findNearestNodeGUID(xmlNode, [ + nodeName != NodeAttributeNameProvider.CONTAINER_NODE + ]) + objectDesignation = session.getObjectDesignation(guid, objectState) } if (objectScope === null || objectScope === ObjectScope.UNKNOWN) { @@ -266,6 +288,7 @@ class SessionToValidationReportTransformation { transformException( Exception exception, String type, + IModelSession session, ValidationSeverity severity ) { it.type = type @@ -275,6 +298,7 @@ class SessionToValidationReportTransformation { message = exception.transformToMessage objectArt = "" attributeName = "" + objectDesignation = "" if (validationSourceClass == PlanPro_Layoutinfo) { objectScope = ObjectScope.LAYOUT @@ -286,7 +310,8 @@ class SessionToValidationReportTransformation { private def ValidationProblem create ValidationreportFactory.eINSTANCE.createValidationProblem transform( - CustomValidationProblem problem + CustomValidationProblem problem, + IModelSession session ) { type = problem.type severity = problem.severity @@ -297,6 +322,13 @@ class SessionToValidationReportTransformation { objectScope = problem.objectScope objectState = problem.objectState attributeName = problem.attributeName + if (objectState !== ObjectState.NONE) { + val node = xmlNodeFinder.findNodeByLineNumber(lineNumber) + val guid = node.findNearestNodeGUID [ + nodeName !== NodeAttributeNameProvider.CONTAINER_NODE + ] + objectDesignation = session.getObjectDesignation(guid, objectState) + } if (objectScope === null || objectScope === ObjectScope.UNKNOWN) { if (validationSourceClass == PlanPro_Layoutinfo || @@ -311,7 +343,8 @@ class SessionToValidationReportTransformation { private def ValidationProblem transform( String errorType, - String message + String message, + IModelSession session ) { val it = ValidationreportFactory.eINSTANCE.createValidationProblem type = errorType @@ -387,4 +420,20 @@ class SessionToValidationReportTransformation { } return enumService.translate(enumerator).alternative } + + def static String getObjectDesignation(IModelSession session, + String objGuid, ObjectState objState) { + val containerType = switch (objState) { + case FINAL: ContainerType.FINAL + case INITIAL: ContainerType.INITIAL + case INFO: ContainerType.SINGLE + default: null + } + if (containerType === null || objGuid.nullOrEmpty) { + return "" + } + val container = session.planProSchnittstelle.getContainer(containerType) + val EObject obj = container.getObject(Ur_Objekt, objGuid) + return obj.getLSTObjectDesignation() + } } diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/table/ValidationReportTableTransformator.xtend b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/table/ValidationReportTableTransformator.xtend index 38c990a691..3a23c8df5a 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/table/ValidationReportTableTransformator.xtend +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/table/ValidationReportTableTransformator.xtend @@ -28,7 +28,7 @@ class ValidationReportTableTransformator extends AbstractValidationProblemTransf super() this.columns = columns; excludeColumns = newArrayList(columns.RowIndex, columns.Message, - columns.LineNumber) + columns.ObjectDesignation, columns.LineNumber) } override getProblems(ValidationReport report) { @@ -43,16 +43,18 @@ class ValidationReportTableTransformator extends AbstractValidationProblemTransf fillNumeric(instance, columns.LineNumber, problem, [lineNumber]) } fill(instance, columns.ObjectType, problem, [objectArt]) + fill(instance, columns.ObjectDesignation, problem, [objectDesignation]) fill(instance, columns.AttributeGroup, problem, [attributeName]) fill(instance, columns.ObjectScope, problem, [objectScope?.toString]) fill(instance, columns.ObjectState, problem, [objectState?.literal]) fill(instance, columns.Message, problem, [message]) } - override createGroupAbstractRow(TMFactory factory, List groupRows) { + override createGroupAbstractRow(TMFactory factory, + List groupRows) { val rootRow = super.createGroupAbstractRow(factory, groupRows) val allMsg = groupRows.map [ - //Replace specific value like attribute name in report message + // Replace specific value like attribute name in report message getPlainStringValue(messagesColumn)?.replaceAll( SPECIFIC_VALUE_REGEX, "...") ].filterNull.toSet diff --git a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/table/ValidationTableColumns.xtend b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/table/ValidationTableColumns.xtend index 4155f2f378..cf8be2a2f6 100644 --- a/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/table/ValidationTableColumns.xtend +++ b/java/bundles/org.eclipse.set.feature.validation/src/org/eclipse/set/feature/validation/table/ValidationTableColumns.xtend @@ -25,6 +25,7 @@ class ValidationTableColumns extends AbstractColumns { public final ColumnDescriptor ProblemType; public final ColumnDescriptor LineNumber; public final ColumnDescriptor ObjectType; + public final ColumnDescriptor ObjectDesignation; public final ColumnDescriptor AttributeGroup; public final ColumnDescriptor ObjectScope; public final ColumnDescriptor ObjectState; @@ -42,6 +43,7 @@ class ValidationTableColumns extends AbstractColumns { ObjectType = createNew(messages.ValidationTableColumns_ObjectType) AttributeGroup = createNew( messages.ValidationTableColumns_AttributeGroup) + ObjectDesignation = createNew(messages.ValidationTableColumns_ObjectDesignation) ObjectScope = createNew(messages.ValidationTableColumns_ObjectScope) ObjectState = createNew(messages.ValidationTableColumns_ObjectState) Message = createNew(messages.ValidationTableColumns_Message) @@ -50,15 +52,16 @@ class ValidationTableColumns extends AbstractColumns { def ColumnDescriptor fillHeaderDescriptions( ColumnDescriptorModelBuilder builder) { val GroupBuilder root = builder.createRootColumn() - root.add(RowIndex).width(1.25f) - root.add(Severity).width(2.1f) - root.add(ProblemType).width(3.5f) - root.add(LineNumber).width(2.2f) - root.add(ObjectType).width(3) - root.add(AttributeGroup).width(3) - root.add(ObjectScope).width(2) - root.add(ObjectState).width(1.5f) - root.add(Message).width(8f) + root.add(RowIndex).widthPercent(5) + root.add(Severity).widthPercent(5) + root.add(ProblemType).widthPercent(8) + root.add(LineNumber).widthPercent(5) + root.add(ObjectType).widthPercent(8) + root.add(ObjectDesignation).widthPercent(10) + root.add(AttributeGroup).widthPercent(8) + root.add(ObjectScope).widthPercent(5) + root.add(ObjectState).widthPercent(4) + root.add(Message).widthPercent(20) return root.getGroupRoot() } } diff --git a/java/bundles/org.eclipse.set.model.tablemodel.extensions/META-INF/MANIFEST.MF b/java/bundles/org.eclipse.set.model.tablemodel.extensions/META-INF/MANIFEST.MF index 72584ed24c..67fe89ac5f 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel.extensions/META-INF/MANIFEST.MF +++ b/java/bundles/org.eclipse.set.model.tablemodel.extensions/META-INF/MANIFEST.MF @@ -11,7 +11,8 @@ Require-Bundle: com.google.guava, org.eclipse.xtend.lib.macro, org.eclipse.set.model.planpro Export-Package: org.eclipse.set.model.tablemodel.extensions -Import-Package: org.eclipse.emf.common.util, +Import-Package: org.apache.commons.lang3, + org.eclipse.emf.common.util, org.eclipse.emf.ecore, org.eclipse.emf.ecore.resource, org.eclipse.emf.ecore.resource.impl, @@ -25,5 +26,4 @@ Import-Package: org.eclipse.emf.common.util, org.eclipse.set.ppmodel.extensions, org.eclipse.set.ppmodel.extensions.utils, org.eclipse.set.utils, - org.eclipse.set.utils.math, - org.apache.commons.lang3 + org.eclipse.set.utils.math diff --git a/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/FootnoteExtensions.java b/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/FootnoteExtensions.java index 588ab6f9a4..c961321f08 100644 --- a/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/FootnoteExtensions.java +++ b/java/bundles/org.eclipse.set.model.tablemodel.extensions/src/org/eclipse/set/model/tablemodel/extensions/FootnoteExtensions.java @@ -19,7 +19,6 @@ import java.util.function.UnaryOperator; import java.util.stream.Collectors; -import org.eclipse.emf.ecore.util.ExtendedMetaData; import org.eclipse.set.core.services.Services; import org.eclipse.set.core.services.enumtranslation.EnumTranslationService; import org.eclipse.set.model.planpro.BasisTypen.BasisTypenFactory; @@ -42,6 +41,7 @@ import org.eclipse.set.model.tablemodel.TableRow; import org.eclipse.set.model.tablemodel.TablemodelFactory; import org.eclipse.set.ppmodel.extensions.SignalRahmenExtensions; +import org.eclipse.set.ppmodel.extensions.SignalbegriffExtensions; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.Pair; @@ -299,31 +299,14 @@ private static Pair getPrefix( } final Signalbegriff_ID_TypeClass signalBegriffId = signalBegriff .getSignalbegriffID(); - final String prefix = getSignalBregiffIDName(signalBegriffId); + final String prefix = SignalbegriffExtensions + .getSignalBegriffIDName(signalBegriffId); if (withSymbol && signalBegriffId.getSymbol() != null) { return new Pair<>(prefix, signalBegriffId.getSymbol()); } return new Pair<>(prefix, null); } - /** - * @param signalBegriffId - * the {@link Signalbegriff_ID_TypeClass} - * @return the name of this signalbegriff - */ - public static String getSignalBregiffIDName( - final Signalbegriff_ID_TypeClass signalBegriffId) { - try { - return signalBegriffId.eClass() - .getEAnnotation(ExtendedMetaData.ANNOTATION_URI) - .getDetails() - .get("name") //$NON-NLS-1$ - .replace("_", " "); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (final Exception e) { - return signalBegriffId.eClass().getName(); - } - } - /** * Adds the given prefix to all the footnotes. Bearbeitungsvermerke of * footnotes are cloned so that the original bearbeitungsvermerke stay diff --git a/java/bundles/org.eclipse.set.model.validationreport.edit/plugin.properties b/java/bundles/org.eclipse.set.model.validationreport.edit/plugin.properties index f54d9e7170..bedbe4c302 100644 --- a/java/bundles/org.eclipse.set.model.validationreport.edit/plugin.properties +++ b/java/bundles/org.eclipse.set.model.validationreport.edit/plugin.properties @@ -74,3 +74,4 @@ _UI_ObjectScope_Content_literal = Fachdaten _UI_VersionInfo_planProVersions_feature = PlanPro _UI_VersionInfo_signalbegriffeVersions_feature = Signalbegriffe +_UI_ValidationProblem_objectDesignation_feature = Object Designation diff --git a/java/bundles/org.eclipse.set.model.validationreport.edit/src/org/eclipse/set/model/validationreport/provider/ValidationProblemItemProvider.java b/java/bundles/org.eclipse.set.model.validationreport.edit/src/org/eclipse/set/model/validationreport/provider/ValidationProblemItemProvider.java index f1ca619230..a083ed0876 100644 --- a/java/bundles/org.eclipse.set.model.validationreport.edit/src/org/eclipse/set/model/validationreport/provider/ValidationProblemItemProvider.java +++ b/java/bundles/org.eclipse.set.model.validationreport.edit/src/org/eclipse/set/model/validationreport/provider/ValidationProblemItemProvider.java @@ -68,6 +68,7 @@ public List getPropertyDescriptors(Object object) { addLineNumberPropertyDescriptor(object); addMessagePropertyDescriptor(object); addObjectArtPropertyDescriptor(object); + addObjectDesignationPropertyDescriptor(object); addAttributeNamePropertyDescriptor(object); addObjectScopePropertyDescriptor(object); addObjectStatePropertyDescriptor(object); @@ -216,6 +217,26 @@ protected void addObjectArtPropertyDescriptor(Object object) { null, null)); } + /** + * This adds a property descriptor for the Object Designation feature. + * + * @generated + */ + protected void addObjectDesignationPropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory) adapterFactory) + .getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ValidationProblem_objectDesignation_feature"), + getString("_UI_PropertyDescriptor_description", + "_UI_ValidationProblem_objectDesignation_feature", + "_UI_ValidationProblem_type"), + ValidationreportPackage.Literals.VALIDATION_PROBLEM__OBJECT_DESIGNATION, + true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, null)); + } + /** * This adds a property descriptor for the Attribute Name feature. @@ -341,6 +362,7 @@ public void notifyChanged(Notification notification) { case ValidationreportPackage.VALIDATION_PROBLEM__LINE_NUMBER: case ValidationreportPackage.VALIDATION_PROBLEM__MESSAGE: case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_ART: + case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_DESIGNATION: case ValidationreportPackage.VALIDATION_PROBLEM__ATTRIBUTE_NAME: case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_SCOPE: case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_STATE: diff --git a/java/bundles/org.eclipse.set.model.validationreport/model/validationreport.ecore b/java/bundles/org.eclipse.set.model.validationreport/model/validationreport.ecore index 1074b71842..1224d66022 100644 --- a/java/bundles/org.eclipse.set.model.validationreport/model/validationreport.ecore +++ b/java/bundles/org.eclipse.set.model.validationreport/model/validationreport.ecore @@ -25,6 +25,7 @@ + diff --git a/java/bundles/org.eclipse.set.model.validationreport/model/validationreport.genmodel b/java/bundles/org.eclipse.set.model.validationreport/model/validationreport.genmodel index c3bb4d1f0b..0c735fd314 100644 --- a/java/bundles/org.eclipse.set.model.validationreport/model/validationreport.genmodel +++ b/java/bundles/org.eclipse.set.model.validationreport/model/validationreport.genmodel @@ -52,6 +52,7 @@ + diff --git a/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/ValidationProblem.java b/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/ValidationProblem.java index 3cf8a3f249..3af72380db 100644 --- a/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/ValidationProblem.java +++ b/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/ValidationProblem.java @@ -32,6 +32,8 @@ * Message} *
  • {@link org.eclipse.set.model.validationreport.ValidationProblem#getObjectArt * Object Art}
  • + *
  • {@link org.eclipse.set.model.validationreport.ValidationProblem#getObjectDesignation + * Object Designation}
  • *
  • {@link org.eclipse.set.model.validationreport.ValidationProblem#getAttributeName * Attribute Name}
  • *
  • {@link org.eclipse.set.model.validationreport.ValidationProblem#getObjectScope @@ -254,6 +256,31 @@ public interface ValidationProblem extends EObject { */ void setObjectArt(String value); + /** + * Returns the value of the 'Object Designation' attribute. + * + * + * @return the value of the 'Object Designation' attribute. + * @see #setObjectDesignation(String) + * @see org.eclipse.set.model.validationreport.ValidationreportPackage#getValidationProblem_ObjectDesignation() + * @model + * @generated + */ + String getObjectDesignation(); + + /** + * Sets the value of the + * '{@link org.eclipse.set.model.validationreport.ValidationProblem#getObjectDesignation + * Object Designation}' attribute. + * + * @param value + * the new value of the 'Object Designation' attribute. + * @see #getObjectDesignation() + * @generated + */ + void setObjectDesignation(String value); + /** * Returns the value of the 'Attribute Name' attribute. diff --git a/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/ValidationreportPackage.java b/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/ValidationreportPackage.java index d7ec5e8a16..bd2fd493eb 100644 --- a/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/ValidationreportPackage.java +++ b/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/ValidationreportPackage.java @@ -256,6 +256,15 @@ public interface ValidationreportPackage extends EPackage { */ int VALIDATION_PROBLEM__OBJECT_ART = 6; + /** + * The feature id for the 'Object Designation' attribute. + * + * + * @generated + * @ordered + */ + int VALIDATION_PROBLEM__OBJECT_DESIGNATION = 7; + /** * The feature id for the 'Attribute Name' attribute. @@ -263,7 +272,7 @@ public interface ValidationreportPackage extends EPackage { * @generated * @ordered */ - int VALIDATION_PROBLEM__ATTRIBUTE_NAME = 7; + int VALIDATION_PROBLEM__ATTRIBUTE_NAME = 8; /** * The feature id for the 'Object Scope' attribute. + * + * @return the meta object for the attribute 'Object Designation'. + * @see org.eclipse.set.model.validationreport.ValidationProblem#getObjectDesignation() + * @see #getValidationProblem() + * @generated + */ + EAttribute getValidationProblem_ObjectDesignation(); + /** * Returns the meta object for the attribute * '{@link org.eclipse.set.model.validationreport.ValidationProblem#getAttributeName @@ -1140,6 +1162,15 @@ interface Literals { EAttribute VALIDATION_PROBLEM__OBJECT_ART = eINSTANCE .getValidationProblem_ObjectArt(); + /** + * The meta object literal for the 'Object Designation' + * attribute feature. + * + * @generated + */ + EAttribute VALIDATION_PROBLEM__OBJECT_DESIGNATION = eINSTANCE + .getValidationProblem_ObjectDesignation(); + /** * The meta object literal for the 'Attribute Name' * attribute feature. diff --git a/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/impl/ValidationProblemImpl.java b/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/impl/ValidationProblemImpl.java index cb42e24ce2..39670aed97 100644 --- a/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/impl/ValidationProblemImpl.java +++ b/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/impl/ValidationProblemImpl.java @@ -42,6 +42,8 @@ * Message}
  • *
  • {@link org.eclipse.set.model.validationreport.impl.ValidationProblemImpl#getObjectArt * Object Art}
  • + *
  • {@link org.eclipse.set.model.validationreport.impl.ValidationProblemImpl#getObjectDesignation + * Object Designation}
  • *
  • {@link org.eclipse.set.model.validationreport.impl.ValidationProblemImpl#getAttributeName * Attribute Name}
  • *
  • {@link org.eclipse.set.model.validationreport.impl.ValidationProblemImpl#getObjectScope @@ -196,6 +198,28 @@ public class ValidationProblemImpl extends MinimalEObjectImpl.Container */ protected String objectArt = OBJECT_ART_EDEFAULT; + /** + * The default value of the '{@link #getObjectDesignation() Object + * Designation}' attribute. + * + * @see #getObjectDesignation() + * @generated + * @ordered + */ + protected static final String OBJECT_DESIGNATION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getObjectDesignation() Object + * Designation}' attribute. + * + * @see #getObjectDesignation() + * @generated + * @ordered + */ + protected String objectDesignation = OBJECT_DESIGNATION_EDEFAULT; + /** * The default value of the '{@link #getAttributeName() Attribute * Name}' attribute. @@ -469,6 +493,31 @@ public void setObjectArt(String newObjectArt) { oldObjectArt, objectArt)); } + /** + * + * + * @generated + */ + @Override + public String getObjectDesignation() { + return objectDesignation; + } + + /** + * + * + * @generated + */ + @Override + public void setObjectDesignation(String newObjectDesignation) { + String oldObjectDesignation = objectDesignation; + objectDesignation = newObjectDesignation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, + ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_DESIGNATION, + oldObjectDesignation, objectDesignation)); + } + /** * * @@ -593,6 +642,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return getMessage(); case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_ART: return getObjectArt(); + case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_DESIGNATION: + return getObjectDesignation(); case ValidationreportPackage.VALIDATION_PROBLEM__ATTRIBUTE_NAME: return getAttributeName(); case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_SCOPE: @@ -634,6 +685,9 @@ public void eSet(int featureID, Object newValue) { case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_ART: setObjectArt((String) newValue); return; + case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_DESIGNATION: + setObjectDesignation((String) newValue); + return; case ValidationreportPackage.VALIDATION_PROBLEM__ATTRIBUTE_NAME: setAttributeName((String) newValue); return; @@ -679,6 +733,9 @@ public void eUnset(int featureID) { case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_ART: setObjectArt(OBJECT_ART_EDEFAULT); return; + case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_DESIGNATION: + setObjectDesignation(OBJECT_DESIGNATION_EDEFAULT); + return; case ValidationreportPackage.VALIDATION_PROBLEM__ATTRIBUTE_NAME: setAttributeName(ATTRIBUTE_NAME_EDEFAULT); return; @@ -722,6 +779,11 @@ public boolean eIsSet(int featureID) { case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_ART: return OBJECT_ART_EDEFAULT == null ? objectArt != null : !OBJECT_ART_EDEFAULT.equals(objectArt); + case ValidationreportPackage.VALIDATION_PROBLEM__OBJECT_DESIGNATION: + return OBJECT_DESIGNATION_EDEFAULT == null + ? objectDesignation != null + : !OBJECT_DESIGNATION_EDEFAULT + .equals(objectDesignation); case ValidationreportPackage.VALIDATION_PROBLEM__ATTRIBUTE_NAME: return ATTRIBUTE_NAME_EDEFAULT == null ? attributeName != null : !ATTRIBUTE_NAME_EDEFAULT.equals(attributeName); @@ -761,6 +823,8 @@ public String toString() { result.append(message); result.append(", objectArt: "); result.append(objectArt); + result.append(", objectDesignation: "); + result.append(objectDesignation); result.append(", attributeName: "); result.append(attributeName); result.append(", objectScope: "); diff --git a/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/impl/ValidationreportPackageImpl.java b/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/impl/ValidationreportPackageImpl.java index 912c4582ee..637f6f941c 100644 --- a/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/impl/ValidationreportPackageImpl.java +++ b/java/bundles/org.eclipse.set.model.validationreport/src/org/eclipse/set/model/validationreport/impl/ValidationreportPackageImpl.java @@ -375,7 +375,7 @@ public EAttribute getValidationProblem_ObjectArt() { * @generated */ @Override - public EAttribute getValidationProblem_AttributeName() { + public EAttribute getValidationProblem_ObjectDesignation() { return (EAttribute) validationProblemEClass.getEStructuralFeatures() .get(7); } @@ -386,7 +386,7 @@ public EAttribute getValidationProblem_AttributeName() { * @generated */ @Override - public EAttribute getValidationProblem_ObjectScope() { + public EAttribute getValidationProblem_AttributeName() { return (EAttribute) validationProblemEClass.getEStructuralFeatures() .get(8); } @@ -397,7 +397,7 @@ public EAttribute getValidationProblem_ObjectScope() { * @generated */ @Override - public EAttribute getValidationProblem_ObjectState() { + public EAttribute getValidationProblem_ObjectScope() { return (EAttribute) validationProblemEClass.getEStructuralFeatures() .get(9); } @@ -408,11 +408,22 @@ public EAttribute getValidationProblem_ObjectState() { * @generated */ @Override - public EAttribute getValidationProblem_GeneralMsg() { + public EAttribute getValidationProblem_ObjectState() { return (EAttribute) validationProblemEClass.getEStructuralFeatures() .get(10); } + /** + * + * + * @generated + */ + @Override + public EAttribute getValidationProblem_GeneralMsg() { + return (EAttribute) validationProblemEClass.getEStructuralFeatures() + .get(11); + } + /** * * @@ -611,6 +622,8 @@ public void createPackageContents() { createEAttribute(validationProblemEClass, VALIDATION_PROBLEM__MESSAGE); createEAttribute(validationProblemEClass, VALIDATION_PROBLEM__OBJECT_ART); + createEAttribute(validationProblemEClass, + VALIDATION_PROBLEM__OBJECT_DESIGNATION); createEAttribute(validationProblemEClass, VALIDATION_PROBLEM__ATTRIBUTE_NAME); createEAttribute(validationProblemEClass, @@ -759,6 +772,11 @@ public void initializePackageContents() { ValidationProblem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getValidationProblem_ObjectDesignation(), + ecorePackage.getEString(), "objectDesignation", null, 0, 1, + ValidationProblem.class, !IS_TRANSIENT, !IS_VOLATILE, + IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, + IS_ORDERED); initEAttribute(getValidationProblem_AttributeName(), ecorePackage.getEString(), "attributeName", null, 0, 1, ValidationProblem.class, !IS_TRANSIENT, !IS_VOLATILE, diff --git a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/PZBElementExtensions.xtend b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/PZBElementExtensions.xtend index 3eda85e1d7..9fb02ff504 100644 --- a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/PZBElementExtensions.xtend +++ b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/PZBElementExtensions.xtend @@ -25,6 +25,7 @@ import org.eclipse.set.model.planpro.Weichen_und_Gleissperren.W_Kr_Gsp_Element import static extension org.eclipse.set.ppmodel.extensions.AussenelementansteuerungExtensions.* import static extension org.eclipse.set.ppmodel.extensions.BereichObjektExtensions.* import static extension org.eclipse.set.ppmodel.extensions.FstrFahrwegExtensions.getFstrDweg +import org.eclipse.set.model.planpro.Signale.ENUMSignalFunktion /** * Extensions for {@link PZB_Element}. @@ -98,6 +99,30 @@ class PZBElementExtensions extends BasisObjektExtensions { return pzb?.PZBElementBezugspunkt?.map[stellelement] } + def static Iterable getBezugsElementBezeichnungen(PZB_Element pzb) { + return pzb?.PZBElementBezugspunkt.filterNull.map [ + getBezugElementBezeichnung + ] + } + + static dispatch def String getBezugElementBezeichnung( + Basis_Objekt object) { + throw new IllegalArgumentException(object.class.simpleName) + } + + static dispatch def String getBezugElementBezeichnung( + W_Kr_Gsp_Element object) { + return object?.bezeichnung?.bezeichnungTabelle?.wert + } + + static dispatch def String getBezugElementBezeichnung( + Signal object) { + return object?.signalReal?.signalFunktion?.wert === + ENUMSignalFunktion.ENUM_SIGNAL_FUNKTION_BUE_UEBERWACHUNGSSIGNAL + ? '''BÜ-K «object?.bezeichnung?.bezeichnungTabelle?.wert»''' : object?. + bezeichnung?.bezeichnungTabelle?.wert + } + private def static dispatch Stellelement getStellelement( Basis_Objekt object) { throw new IllegalArgumentException() diff --git a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/SignalbegriffExtensions.xtend b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/SignalbegriffExtensions.xtend index 9e42e5cc97..0dbb585840 100644 --- a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/SignalbegriffExtensions.xtend +++ b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/SignalbegriffExtensions.xtend @@ -12,6 +12,7 @@ import org.eclipse.set.model.planpro.Signalbegriffe_Struktur.Signalbegriff_ID_Ty import org.eclipse.set.model.planpro.Signale.Signal_Rahmen import org.eclipse.set.model.planpro.Signale.Signal_Signalbegriff import java.util.Collection +import org.eclipse.emf.ecore.util.ExtendedMetaData /** * This class extends {@link Signal_Signalbegriff}. @@ -49,4 +50,25 @@ class SignalbegriffExtensions extends BasisObjektExtensions { Collection signalBegriffe, Class type) { return signalBegriffe.exists[hasSignalbegriffID(type)] } + + def static String getSignalBegriffIDName( + Signal_Signalbegriff signalSignalBegriff) { + return signalSignalBegriff?.signalbegriffID?.signalBegriffIDName + } + + /** + * @param signalBegriffId + * the {@link Signalbegriff_ID_TypeClass} + * @return the name of this signalbegriff + */ + def static String getSignalBegriffIDName( + Signalbegriff_ID_TypeClass signalBegriffID) { + try { + return signalBegriffID.eClass.getEAnnotation( + ExtendedMetaData.ANNOTATION_URI).details.get("name"). + replace("_", " ") + } catch (Exception e) { + return signalBegriffID.eClass.name + } + } } diff --git a/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/utils/LSTObjectDesignationExtensions.java b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/utils/LSTObjectDesignationExtensions.java new file mode 100644 index 0000000000..74b7cd33c6 --- /dev/null +++ b/java/bundles/org.eclipse.set.ppmodel.extensions/src/org/eclipse/set/ppmodel/extensions/utils/LSTObjectDesignationExtensions.java @@ -0,0 +1,384 @@ +/** + * Copyright (c) 2026 DB InfraGO AG and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v2.0 which is available at + * https://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + */ +package org.eclipse.set.ppmodel.extensions.utils; + +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.set.model.planpro.Ansteuerung_Element.Aussenelementansteuerung; +import org.eclipse.set.model.planpro.Ansteuerung_Element.ESTW_Zentraleinheit; +import org.eclipse.set.model.planpro.Ansteuerung_Element.Stellelement; +import org.eclipse.set.model.planpro.Ansteuerung_Element.Technik_Standort; +import org.eclipse.set.model.planpro.Ansteuerung_Element.Uebertragungsweg; +import org.eclipse.set.model.planpro.Bedienung.Bedien_Einrichtung_Oertlich; +import org.eclipse.set.model.planpro.Block.Block_Element; +import org.eclipse.set.model.planpro.Fahrstrasse.Fstr_Aneinander; +import org.eclipse.set.model.planpro.Fahrstrasse.Fstr_DWeg; +import org.eclipse.set.model.planpro.Fahrstrasse.Fstr_Fahrweg; +import org.eclipse.set.model.planpro.Fahrstrasse.Fstr_Zug_Rangier; +import org.eclipse.set.model.planpro.Fahrstrasse.Markanter_Punkt; +import org.eclipse.set.model.planpro.Flankenschutz.Fla_Zwieschutz; +import org.eclipse.set.model.planpro.Gleis.Gleis_Bezeichnung; +import org.eclipse.set.model.planpro.Nahbedienung.NB_Zone; +import org.eclipse.set.model.planpro.Ortung.FMA_Anlage; +import org.eclipse.set.model.planpro.Ortung.FMA_Komponente; +import org.eclipse.set.model.planpro.Ortung.Zugeinwirkung; +import org.eclipse.set.model.planpro.PZB.PZB_Element; +import org.eclipse.set.model.planpro.PlanPro.Container_AttributeGroup; +import org.eclipse.set.model.planpro.Schluesselabhaengigkeiten.Schloss; +import org.eclipse.set.model.planpro.Signale.Signal; +import org.eclipse.set.model.planpro.Signale.Signal_Signalbegriff; +import org.eclipse.set.model.planpro.Weichen_und_Gleissperren.W_Kr_Gsp_Element; +import org.eclipse.set.model.planpro.Weichen_und_Gleissperren.W_Kr_Gsp_Komponente; +import org.eclipse.set.ppmodel.extensions.AussenelementansteuerungExtensions; +import org.eclipse.set.ppmodel.extensions.DwegExtensions; +import org.eclipse.set.ppmodel.extensions.EObjectExtensions; +import org.eclipse.set.ppmodel.extensions.FahrwegExtensions; +import org.eclipse.set.ppmodel.extensions.FstrAneinanderExtensions; +import org.eclipse.set.ppmodel.extensions.FstrZugRangierExtensions; +import org.eclipse.set.ppmodel.extensions.NbZoneExtensions; +import org.eclipse.set.ppmodel.extensions.PZBElementExtensions; +import org.eclipse.set.ppmodel.extensions.SignalbegriffExtensions; + +import com.google.common.collect.Streams; + +/** + * Extensions for determine the LST Object designation + * + * @author Truong + */ +public class LSTObjectDesignationExtensions { + /** + * @param obj + * the LST Object + * @return the object designation + */ + public static String getLSTObjectDesignation(final EObject obj) { + final EObject lstObjectFromChild = getLSTObjectFromChild(obj); + if (lstObjectFromChild == null) { + return ""; //$NON-NLS-1$ + } + return switch (lstObjectFromChild) { + case final Aussenelementansteuerung aea -> getLSTObjectDesignation( + aea); + case final Bedien_Einrichtung_Oertlich beo -> getLSTObjectDesignation( + beo); + case final Block_Element blockElement -> getLSTObjectDesignation( + blockElement); + case final ESTW_Zentraleinheit estw -> getLSTObjectDesignation( + estw); + case final FMA_Anlage anlage -> getLSTObjectDesignation(anlage); + case final FMA_Komponente fmaKomponent -> getLSTObjectDesignation( + fmaKomponent); + case final Fla_Zwieschutz fla -> getLSTObjectDesignation(fla); + case final Fstr_Aneinander fstrAneiander -> getLSTObjectDesignation( + fstrAneiander); + case final Fstr_DWeg dweg -> getLSTObjectDesignation(dweg); + case final Fstr_Zug_Rangier fstrZR -> getLSTObjectDesignation( + fstrZR); + case final Gleis_Bezeichnung gleis -> getLSTObjectDesignation( + gleis); + case final Markanter_Punkt markanter -> getLSTObjectDesignation( + markanter); + case final NB_Zone nbZone -> getLSTObjectDesignation(nbZone); + case final Schloss schloss -> getLSTObjectDesignation(schloss); + case final Signal signal -> getLSTObjectDesignation(signal); + case final Signal_Signalbegriff signalbegriff -> getLSTObjectDesignation( + signalbegriff); + case final Stellelement stellelement -> getLSTObjectDesignation( + stellelement); + case final Technik_Standort ts -> getLSTObjectDesignation(ts); + case final Uebertragungsweg uebertragungsweg -> getLSTObjectDesignation( + uebertragungsweg); + case final PZB_Element pzb -> getLSTObjectDesignation(pzb); + case final W_Kr_Gsp_Element gspElement -> getLSTObjectDesignation( + gspElement); + case final W_Kr_Gsp_Komponente gspKomponent -> getLSTObjectDesignation( + gspKomponent); + case final Zugeinwirkung ein -> getLSTObjectDesignation(ein); + default -> ""; //$NON-NLS-1$ + }; + } + + /** + * @param aea + * the {@link Aussenelementansteuerung} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final Aussenelementansteuerung aea) { + return AussenelementansteuerungExtensions.getElementBezeichnung(aea); + } + + /** + * @param beo + * the {@link Bedien_Einrichtung_Oertlich} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final Bedien_Einrichtung_Oertlich beo) { + return getEmptyStringWhenNull(beo, + b -> b.getBezeichnung().getBedienEinrichtOertlBez().getWert()); + } + + /** + * @param blockElement + * the {@link Block_Element} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final Block_Element blockElement) { + // TODO + return ""; //$NON-NLS-1$ + } + + /** + * @param estw + * the {@link ESTW_Zentraleinheit} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final ESTW_Zentraleinheit estw) { + return AussenelementansteuerungExtensions.getElementBezeichnung(estw); + } + + /** + * @param anlage + * the {@link FMA_Anlage} + * @return the object designation + */ + public static String getLSTObjectDesignation(final FMA_Anlage anlage) { + return getEmptyStringWhenNull(anlage, + a -> a.getFMAAnlageKaskade() + .getFMAKaskadeBezeichnung() + .getWert()); + } + + /** + * @param fmaKomponent + * the {@link FMA_Komponente} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final FMA_Komponente fmaKomponent) { + return getEmptyStringWhenNull(fmaKomponent, + f -> f.getBezeichnung().getBezeichnungTabelle().getWert()); + } + + /** + * @param fla + * the {@link Fla_Zwieschutz} + * @return the object designation + */ + public static String getLSTObjectDesignation(final Fla_Zwieschutz fla) { + // TODO + return ""; //$NON-NLS-1$ + } + + /** + * @param fstrAneiander + * the {@link Fstr_Aneinander} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final Fstr_Aneinander fstrAneiander) { + return FstrAneinanderExtensions.getTableDescription(fstrAneiander); + } + + /** + * @param dweg + * the {@link Fstr_DWeg} + * @return the start and end designation of the DWeg + */ + public static String getLSTObjectDesignation(final Fstr_DWeg dweg) { + final Fstr_Fahrweg fstrFahrweg = DwegExtensions.getFstrFahrweg(dweg); + final String startBezeichnung = getLSTObjectDesignation( + FahrwegExtensions.getStart(fstrFahrweg)); + final String zielBezeichnung = getLSTObjectDesignation( + FahrwegExtensions.getZielPunkt(fstrFahrweg)); + + if (!startBezeichnung.isEmpty() && !zielBezeichnung.isEmpty()) { + return startBezeichnung + "/" + zielBezeichnung; //$NON-NLS-1$ + } + return ""; //$NON-NLS-1$ + } + + /** + * @param fstrZR + * the {@link Fstr_Zug_Rangier} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final Fstr_Zug_Rangier fstrZR) { + return getEmptyStringWhenNull(fstrZR, f -> FstrZugRangierExtensions + .getFstrZugRangierBezeichnung(fstrZR)); + } + + /** + * @param gleis + * the {@link Gleis_Bezeichnung} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final Gleis_Bezeichnung gleis) { + // TODO + return ""; //$NON-NLS-1$ + } + + /** + * @param markanter + * the {@link Markanter_Punkt} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final Markanter_Punkt markanter) { + return getEmptyStringWhenNull(markanter, + m -> m.getBezeichnung() + .getBezeichnungMarkanterPunkt() + .getWert()); + } + + /** + * @param nbZone + * the {@link NB_Zone} + * @return the object designation + */ + public static String getLSTObjectDesignation(final NB_Zone nbZone) { + return NbZoneExtensions.getBezeichnung(nbZone); + } + + /** + * @param schloss + * the {@link Schloss} + * @return the object designation + */ + public static String getLSTObjectDesignation(final Schloss schloss) { + return getEmptyStringWhenNull(schloss, + s -> s.getBezeichnung().getBezeichnungSchloss().getWert()); + } + + /** + * @param signal + * the {@link Signal} + * @return the object designation + */ + public static String getLSTObjectDesignation(final Signal signal) { + return getEmptyStringWhenNull(signal, + s -> s.getBezeichnung().getBezeichnungTabelle().getWert()); + } + + /** + * @param signalbegriff + * the {@link Signal_Signalbegriff} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final Signal_Signalbegriff signalbegriff) { + return getEmptyStringWhenNull(signalbegriff, + s -> SignalbegriffExtensions + .getSignalBegriffIDName(s.getSignalbegriffID())); + } + + /** + * @param stellelement + * the {@link Stellelement} + * @return the designation of the {@link Stellelement#getIDInformation()} + */ + public static String getLSTObjectDesignation( + final Stellelement stellelement) { + return getEmptyStringWhenNull(stellelement, + s -> getLSTObjectDesignation(s.getIDInformation().getValue())); + } + + /** + * @param ts + * the {@link Technik_Standort} + * @return the object designation + */ + public static String getLSTObjectDesignation(final Technik_Standort ts) { + return getEmptyStringWhenNull(ts, + t -> t.getBezeichnung().getBezeichnungTSO().getWert()); + } + + /** + * @param uebertragungsweg + * the {@link Uebertragungsweg} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final Uebertragungsweg uebertragungsweg) { + // TODO + return ""; //$NON-NLS-1$ + } + + /** + * @param pzb + * the {@link PZB_Element} + * @return the designation of the PZB Bezugspunkte + */ + public static String getLSTObjectDesignation(final PZB_Element pzb) { + return Streams + .stream(PZBElementExtensions.getBezugsElementBezeichnungen(pzb)) + .filter(Objects::nonNull) + .collect(Collectors.joining(System.lineSeparator())); + } + + /** + * @param gspElement + * the {@link W_Kr_Gsp_Element} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final W_Kr_Gsp_Element gspElement) { + return getEmptyStringWhenNull(gspElement, + gsp -> gsp.getBezeichnung().getBezeichnungTabelle().getWert()); + } + + /** + * @param gspKomponent + * the {@link W_Kr_Gsp_Komponente} + * @return the object designation + */ + public static String getLSTObjectDesignation( + final W_Kr_Gsp_Komponente gspKomponent) { + // TODO + return ""; //$NON-NLS-1$ + } + + /** + * @param ein + * the {@link Zugeinwirkung} + * @return the object designation + */ + public static String getLSTObjectDesignation(final Zugeinwirkung ein) { + return getEmptyStringWhenNull(ein, + e -> e.getBezeichnung().getBezeichnungTabelle().getWert()); + } + + private static EObject getLSTObjectFromChild(final EObject child) { + if (child == null) { + return null; + } + if (child.eContainer() instanceof Container_AttributeGroup) { + return child; + } + return getLSTObjectFromChild(child.eContainer()); + } + + private static String getEmptyStringWhenNull(final T obj, + final Function getDesignationFunc) { + return EObjectExtensions + .getNullableObject(obj, getDesignationFunc::apply) + .orElse(""); //$NON-NLS-1$ + } +} diff --git a/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/NodeAttributeNameProvider.java b/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/NodeAttributeNameProvider.java index 00f4720ef9..b0ac5d7535 100644 --- a/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/NodeAttributeNameProvider.java +++ b/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/NodeAttributeNameProvider.java @@ -21,10 +21,16 @@ public class NodeAttributeNameProvider { private static final String TEXT_NODE = "#text"; //$NON-NLS-1$ private static final String DOCUMENT_NODE = "#document"; //$NON-NLS-1$ - private static final String CONTAINER_NODE = "Container"; //$NON-NLS-1$ + /** + * The container node name + */ + public static final String CONTAINER_NODE = "Container"; //$NON-NLS-1$ private static final String IDENTITY_ATTRIBUTE_NAME = "Identitaet"; //$NON-NLS-1$ - private static final String VALUE_ATTRIBUTE_NAME = "Wert"; //$NON-NLS-1$ + /** + * value node name + */ + public static final String VALUE_ATTRIBUTE_NAME = "Wert"; //$NON-NLS-1$ /** * @param node diff --git a/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/NodeObjectScopeProvider.java b/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/NodeObjectScopeProvider.java index bea05bc88b..4bf5c50961 100644 --- a/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/NodeObjectScopeProvider.java +++ b/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/NodeObjectScopeProvider.java @@ -24,7 +24,10 @@ public class NodeObjectScopeProvider { private static final String NODE_AUSGABE_FACHDATEN = "Ausgabe_Fachdaten"; //$NON-NLS-1$ - private static final String NODE_CONTAINER = "Container"; //$NON-NLS-1$ + /** + * Container node name + */ + public static final String NODE_CONTAINER = "Container"; //$NON-NLS-1$ private static final String XPATH_PLANUNGSBEREICH = "//LST_Planung_Gruppe/LST_Planung_Einzel/LST_Objekte_Planungsbereich/ID_LST_Objekt_Planungsbereich/Wert"; //$NON-NLS-1$ diff --git a/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/NodeObjectTypeProvider.java b/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/NodeObjectTypeProvider.java index a35f68d836..5d4d29ceab 100644 --- a/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/NodeObjectTypeProvider.java +++ b/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/NodeObjectTypeProvider.java @@ -44,4 +44,30 @@ public String getObjectType(final PlanProXMLNode node) { return getObjectType(node.getParent()); } + /** + * @param node + * the XML node to find the LST object identity + * @return the LST object identity + */ + public String getLSTObjectIdentitaet(final PlanProXMLNode node) { + if (node == null || node.getNodeName() + .equals(NodeObjectScopeProvider.NODE_CONTAINER)) { + return null; + } + + final List children = node.getChildren(); + for (final PlanProXMLNode child : children) { + if (child.getNodeName().equals(IDENTITY_ATTRIBUTE_NAME)) { + if (!child.getChildren().isEmpty() && child.getChildren() + .getFirst() + .getNodeName() + .equals(NodeAttributeNameProvider.VALUE_ATTRIBUTE_NAME)) { + return child.getChildren().getFirst().getTextValue(); + } + break; + } + } + return getLSTObjectIdentitaet(node.getParent()); + } + } diff --git a/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/XMLNodeFinder.java b/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/XMLNodeFinder.java index b55fdf6137..72a60d2e4c 100644 --- a/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/XMLNodeFinder.java +++ b/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/xml/XMLNodeFinder.java @@ -11,6 +11,7 @@ import java.io.IOException; import java.nio.file.Path; import java.util.List; +import java.util.function.Predicate; import javax.xml.parsers.ParserConfigurationException; @@ -135,7 +136,20 @@ public void read(final ToolboxFile toolboxfile, final Path docPath) { * @return guid of the object contain this node */ public static String findNearestNodeGUID(final PlanProXMLNode node) { - if (node == null) { + // Walk up the XML tree + return findNearestNodeGUID(node.getParent(), n -> true); + } + + /** + * @param node + * the node + * @param predicate + * the predicate for relevant node + * @return guid of the object contain this node + */ + public static String findNearestNodeGUID(final PlanProXMLNode node, + final Predicate predicate) { + if (node == null || !predicate.test(node)) { return null; } // Try to find [GUID] @@ -152,7 +166,7 @@ public static String findNearestNodeGUID(final PlanProXMLNode node) { } // Walk up the XML tree - return findNearestNodeGUID(node.getParent()); + return findNearestNodeGUID(node.getParent(), predicate); } private static PlanProXMLNode getChildNodeByName(final PlanProXMLNode node,