Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class SskoTransformator extends AbstractPlanPro2TableModelTransformator {
instance,
cols.getColumn(Schluessel_Bezeichnung),
schloss,
[schluesel?.bezeichnung?.bezeichnungSchluessel?.wert]
[schluessel?.bezeichnung?.bezeichnungSchluessel?.wert]
)

// E: Ssko.Schluessel.Bartform
Expand All @@ -108,7 +108,7 @@ class SskoTransformator extends AbstractPlanPro2TableModelTransformator {
cols.getColumn(Schluessel_Bartform),
schloss,
[
schluesel?.schluesselAllg?.schluesselBartform?.translate
schluessel?.schluesselAllg?.schluesselBartform?.translate
]
)

Expand All @@ -118,7 +118,7 @@ class SskoTransformator extends AbstractPlanPro2TableModelTransformator {
cols.getColumn(Schluessel_Gruppe),
schloss,
[
schluesel?.schluesselAllg?.schluesselGruppe?.translate
schluessel?.schluesselAllg?.schluesselGruppe?.translate
]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.eclipse.set.model.planpro.Ansteuerung_Element.Stell_Bereich

import static extension org.eclipse.set.ppmodel.extensions.SchluesselExtensions.*
import static extension org.eclipse.set.ppmodel.extensions.SchlosskombinationExtensions.*
import static extension org.eclipse.set.ppmodel.extensions.StellelementExtensions.*
import static extension org.eclipse.set.ppmodel.extensions.StellBereichExtensions.*

/**
Expand Down Expand Up @@ -49,7 +50,7 @@ class SchlossExtensions extends BasisObjektExtensions {
*
* @returns the Schluessel
*/
def static Schluessel getSchluesel(Schloss schloss) {
def static Schluessel getSchluessel(Schloss schloss) {
return schloss.IDSchluessel?.value
}

Expand Down Expand Up @@ -89,53 +90,39 @@ class SchlossExtensions extends BasisObjektExtensions {
return schloss?.schlossSonderanlage?.IDSonderanlage?.value
}

def static Iterable<Schloss> filterObjectsIsBelongToControlArea(
Iterable<Schloss> schlosses, Stell_Bereich controlArea) {
if (controlArea === null || schlosses.nullOrEmpty) {
return schlosses;
}

val result = newHashSet
val container = schlosses?.head?.container
// 1. Condition
// IMPROVE: Not completely, because the requirements for this case aren't clear
val stellelements = container.stellelement.map[IDInformation?.value].
filterNull.filter [
AussenelementansteuerungExtensions.
isBelongToControlArea(it, controlArea)
]
val ssp = container.schluesselsperre.filter [ ssp |
stellelements.exists[it === ssp.IDStellelement.value]
]
val schluessels = schlosses.filter [ schloss |
ssp.exists[it === schloss.schlossSsp.IDSchluesselsperre.value]
].map[schluesel].filterNull
result.addAll(schluessels.flatMap[schloesser])

// 2.Condition
result.filter[schlossSk?.hauptschloss.wert].flatMap [ schloss |
schloss.schlossSk.IDSchlosskombination?.value.schloesser.filter [
it.schlossSk !== null && !it.schlossSk.hauptschloss.wert
]
].filterNull.map[schluesel].flatMap[schloesser].forEach[result.add(it)]

// 3. Condition
schlosses.filter [ schloss |
controlArea.wkrGspElement.exists [ gspElement |
schloss.schlossW?.IDWKrElement?.value === gspElement ||
schloss.schlossGsp?.IDGspElement?.value === gspElement ||
schloss.schlossSonderanlage?.IDSonderanlage?.value ==
gspElement
]
].map[schluesel].flatMap[schloesser].toSet.filter [
technischBerechtigter?.wert
].forEach[result.add(it)]
return result
}

def static boolean isBelongToControlArea(Stell_Bereich controlArea,
Schloss schloss) {
return Arrays.asList(schloss).
filterObjectsIsBelongToControlArea(controlArea).length > 0
if (schloss.schluesselsperre?.IDStellelement?.value.
isBelongToControlArea(controlArea)) {
return true;
}
val currentSchluessel = schloss.schluessel;
// When exist one Schloss, which has same Schluessel and this Stellelement belong to control area
if (schloss.container.schloss.filter[it !== schloss]. //
filter[schluessel === currentSchluessel]. //
exists [
schluesselsperre?.IDStellelement?.value.
isBelongToControlArea(controlArea)
]) {
return true
}

if (schloss.schlossSk?.hauptschloss?.wert === Boolean.TRUE) {
return schloss.schlossSk.IDSchlosskombination?.value?.schloesser.
filter[schlossSk?.hauptschloss?.wert == Boolean.FALSE]. //
exists[schluessel === currentSchluessel]
}

if (controlArea.wkrGspElement.exists [ gspElement |
schloss.schlossW?.IDWKrElement?.value === gspElement ||
schloss.schlossGsp?.IDGspElement?.value === gspElement ||
schloss.schlossSonderanlage?.IDSonderanlage?.value == gspElement
]) {
return schloss.container.schloss.filter[it !== schloss].filter [
schluessel === currentSchluessel
].exists[technischBerechtigter?.wert === Boolean.TRUE]
}
return false
}
}
Loading