-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add intention related methods and qualification checker
- Loading branch information
Showing
10 changed files
with
926 additions
and
42 deletions.
There are no files selected for viewing
680 changes: 640 additions & 40 deletions
680
....e3.app.demo/src/ch/sbb/scion/rcp/microfrontend/e3/app/demo/view/ManifestServicePart.java
Large diffs are not rendered by default.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
...bb/scion/rcp/microfrontend/e3/app/demo/view/model/ApplicationQualificationCheckModel.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,32 @@ | ||
package ch.sbb.scion.rcp.microfrontend.e3.app.demo.view.model; | ||
|
||
import org.eclipse.core.databinding.observable.value.IObservableValue; | ||
import org.eclipse.core.databinding.observable.value.WritableValue; | ||
|
||
public class ApplicationQualificationCheckModel { | ||
|
||
private final IObservableValue<String> capabilityId = new WritableValue<>("", String.class); | ||
|
||
private final IObservableValue<String> appSymbolicName = new WritableValue<>("", String.class); | ||
|
||
public IObservableValue<String> getCapabilityId() { | ||
return capabilityId; | ||
} | ||
|
||
public IObservableValue<String> getAppSymbolicName() { | ||
return appSymbolicName; | ||
} | ||
|
||
public void clearValues() { | ||
capabilityId.setValue(""); | ||
appSymbolicName.setValue(""); | ||
} | ||
|
||
public AppSymbolicNameAndCapabilityId getAppSymbolicNameAndCapabilityId() { | ||
return new AppSymbolicNameAndCapabilityId(appSymbolicName.getValue(), capabilityId.getValue()); | ||
} | ||
|
||
public record AppSymbolicNameAndCapabilityId(String appSymbolicName, String capabilityId) { | ||
|
||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...e3.app.demo/src/ch/sbb/scion/rcp/microfrontend/e3/app/demo/view/model/IntentionModel.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,41 @@ | ||
package ch.sbb.scion.rcp.microfrontend.e3.app.demo.view.model; | ||
|
||
import java.util.Map.Entry; | ||
|
||
import org.eclipse.core.databinding.observable.list.IObservableList; | ||
import org.eclipse.core.databinding.observable.list.WritableList; | ||
import org.eclipse.core.databinding.observable.value.IObservableValue; | ||
import org.eclipse.core.databinding.observable.value.WritableValue; | ||
|
||
import ch.sbb.scion.rcp.microfrontend.model.Intention; | ||
import ch.sbb.scion.rcp.microfrontend.model.Qualifier; | ||
|
||
public class IntentionModel { | ||
|
||
private final IObservableValue<String> type = new WritableValue<>("", String.class); | ||
|
||
private final IObservableList<Entry<String, String>> qualifiers = new WritableList<>(); | ||
|
||
public IObservableValue<String> getType() { | ||
return type; | ||
} | ||
|
||
public IObservableList<Entry<String, String>> getQualifiers() { | ||
return qualifiers; | ||
} | ||
|
||
public void clearValues() { | ||
type.setValue(""); | ||
qualifiers.clear(); | ||
} | ||
|
||
public Intention getIntention() { | ||
var intentionBuilder = Intention.builder().type(type.getValue()); | ||
if (!qualifiers.isEmpty()) { | ||
var qualifier = new Qualifier(); | ||
qualifiers.stream().forEach(x -> qualifier.set(x.getKey(), x.getValue())); | ||
intentionBuilder.qualifier(qualifier); | ||
} | ||
return intentionBuilder.build(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
ch.sbb.scion.rcp.microfrontend/js/sci-manifest-service/is-application-qualified.iife.js
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,12 @@ | ||
(() => { | ||
// ======= SCRIPT PLACEHOLDERS BEGIN ======= | ||
const helpers = {fromJson: /@@helpers.fromJson@@/}; | ||
const refs = {ManifestService: /@@refs.ManifestService@@/}; | ||
const appSymbolicName = helpers.fromJson('/@@appSymbolicName@@/') | ||
const qualifiedFor = { | ||
capabilityId: helpers.fromJson('/@@qualifiedFor.capabilityId@@/'), | ||
}; | ||
// ======= SCRIPT PLACEHOLDERS END ======= | ||
|
||
return refs.ManifestService.isApplicationQualified$(appSymbolicName, qualifiedFor); | ||
})() |
19 changes: 19 additions & 0 deletions
19
ch.sbb.scion.rcp.microfrontend/js/sci-manifest-service/lookup-intentions.iife.js
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,19 @@ | ||
(() => { | ||
// ======= SCRIPT PLACEHOLDERS BEGIN ======= | ||
const helpers = {fromJson: /@@helpers.fromJson@@/}; | ||
const refs = {ManifestService: /@@refs.ManifestService@@/}; | ||
const filter = { | ||
id: helpers.fromJson('/@@filter.id@@/'), | ||
type: helpers.fromJson('/@@filter.type@@/'), | ||
qualifier: helpers.fromJson('/@@filter.qualifier@@/'), | ||
appSymbolicName: helpers.fromJson('/@@filter.appSymbolicName@@/'), | ||
}; | ||
// ======= SCRIPT PLACEHOLDERS END ======= | ||
|
||
return refs.ManifestService.lookupIntentions$({ | ||
id: filter.id ?? undefined, | ||
type: filter.type ?? undefined, | ||
qualifier: filter.qualifier ?? undefined, | ||
appSymbolicName: filter.appSymbolicName ?? undefined, | ||
}); | ||
})() |
14 changes: 14 additions & 0 deletions
14
ch.sbb.scion.rcp.microfrontend/js/sci-manifest-service/register-intention.js
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,14 @@ | ||
// ======= SCRIPT PLACEHOLDERS BEGIN ======= | ||
const helpers = {fromJson: /@@helpers.fromJson@@/}; | ||
const callback = window['/@@callback@@/']; | ||
const intention = helpers.fromJson('/@@intention@@/'); | ||
const refs = {ManifestService: /@@refs.ManifestService@@/}; | ||
// ======= SCRIPT PLACEHOLDERS END ======= | ||
|
||
try { | ||
const id = await refs.ManifestService.registerIntention(intention); | ||
callback(null, id); | ||
} | ||
catch (error) { | ||
callback(error.message || `${error}` || 'ERROR'); | ||
} |
24 changes: 24 additions & 0 deletions
24
ch.sbb.scion.rcp.microfrontend/js/sci-manifest-service/unregister-intentions.js
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,24 @@ | ||
// ======= SCRIPT PLACEHOLDERS BEGIN ======= | ||
const helpers = {fromJson: /@@helpers.fromJson@@/}; | ||
const callback = window['/@@callback@@/']; | ||
const refs = {ManifestService: /@@refs.ManifestService@@/}; | ||
const filter = { | ||
id: helpers.fromJson('/@@filter.id@@/'), | ||
type: helpers.fromJson('/@@filter.type@@/'), | ||
qualifier: helpers.fromJson('/@@filter.qualifier@@/'), | ||
appSymbolicName: helpers.fromJson('/@@filter.appSymbolicName@@/'), | ||
}; | ||
// ======= SCRIPT PLACEHOLDERS END ======= | ||
|
||
try { | ||
await refs.ManifestService.unregisterIntentions({ | ||
id: filter.id ?? undefined, | ||
type: filter.type ?? undefined, | ||
qualifier: filter.qualifier ?? undefined, | ||
appSymbolicName: filter.appSymbolicName ?? undefined, | ||
}); | ||
callback(null); | ||
} | ||
catch (error) { | ||
callback(error.message || `${error}` || 'ERROR'); | ||
} |
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
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
17 changes: 17 additions & 0 deletions
17
...cion.rcp.microfrontend/src/ch/sbb/scion/rcp/microfrontend/model/CapabilityIdentifier.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 @@ | ||
/* | ||
* Project: RCS - Rail Control System | ||
* | ||
* © Copyright by SBB AG, Alle Rechte vorbehalten | ||
*/ | ||
package ch.sbb.scion.rcp.microfrontend.model; | ||
|
||
/** | ||
* Identifies a capability | ||
*/ | ||
public interface CapabilityIdentifier { | ||
|
||
/** | ||
* @return the id of the represented capability, not null | ||
*/ | ||
String capabilityId(); | ||
} |