Wie kann ich in AJO ein Infosystem parallel zur geöffneten Maske starten?

Dieses Codebeispiel zeigt, wie ein Infosystem mit AJO-Mitteln parallel zu einer bereits geöffneten Maske in der graphischen Benutzeroberfläche gestartet werden kann.

@Override
public void after(ButtonEvent<ProductEditor> event) throws EventException {
   super.after(event);
   // Artikeldatensatz holen:
   ProductEditor sourceRecord = event.getSourceRecord();
   // Datenbank-Kontext holen
   DbContext dbContext = getContext();
   // Mithilfe des des Datenbank-Kontextes wird ein CommandFactory-Object erzeugt
   CommandFactory commandFactory = AppContext.createFor(dbContext).getCommandFactory();
   // scrParamBuilder-Object für das Infosystem PLANKARTE (PlanChart) erzeugen
   FieldManipulator<PlanChart> scrParamBuilder = commandFactory.getScrParamBuilder(PlanChart.class);
   // Eintragen des Artikels (id) in das Verweisfeld 'Artikel' des Infosystems
   scrParamBuilder.setReference(PlanChart.META.kart, sourceRecord);
   // Klicken des Start-Buttons des Infosystems
   scrParamBuilder.pressButton(PlanChart.META.start);
   // Starten des Infosystems
   commandFactory.startInfosystem(PlanChart.class, scrParamBuilder);
}

Wie kann ich über AJO das Tippkommando zum Buchen von offenen Posten starten?

Datenbankkommandos werden in AJO über die Methode

  EditorCommand EditorCommandFactory.create(EditorAction action, String databaseName, String groupName, String reference, String menuChoice)

erstellt. Diese können dann per

DbContext.openEditor(EditorCommand command)

ausgeführt werden, was eine entsprechende Editor-Instanz zurückliefert.

Im konkreten Fall sieht die Anwendung wie folgt aus:

EditorCommand command = EditorCommandFactory.create(EditorAction.PAYMENT, "3", "", "", "offene Posten ausbuchen");
EditorObject editor = getContext().openEditor(command);
if (editor instanceof OutstandingPaymentsEditor) {
   OutstandingPaymentsEditor outstandingPayments = (OutstandingPaymentsEditor) editor;
   for (OutstandingPaymentsEditor.Row item : outstandingPayments.table().getEditableRows()) {
      // die offenen Posten in der Tabelle entsprechend bearbeiten
      item.setDataRecIdOI(...);
   }
}
Design a site like this with WordPress.com
Get started