Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

...

Codeblock
package org.nuclet.company; 

import java.util.List;
import org.nuclos.api.rule.UpdateRule; 
import org.nuclos.api.context.UpdateContext; 
import org.nuclos.api.annotation.Rule; 
import org.nuclos.api.exception.BusinessException; 

/** @name        
  * @description 
  * @usage       
  * @change      
*/
@Rule(name="UpdateAnfrage", description="UpdateAnfrage")
public class UpdateAnfrage implements UpdateRule {
    public void update(UpdateContext context) throws BusinessException { 
        Anfrage curAnfrage = context.getBusinessObject(Anfrage.class);
        List<Anfrageposition> anfrageposition = curAnfrage.getAnfragepositiongetPosition();
        
        double gesamtArtikelAnzahl = 0d;
        
        for (Anfrageposition curPos : anfrageposition) {
            gesamtArtikelAnzahl += curPos.getAnzahlgetAnzahlArtikel();
        }
        
        curAnfrage.setKurzbeschreibung("Bestellung " + curAnfrage.getNrgetNummer() + " umfasst insgesamt " + gesamtArtikelAnzahl + " Artikel.");
    }
}