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="UpdateAnfrageUpdateBestellung", description="UpdateAnfrageUpdateBestellung")
public class UpdateAnfrageUpdateBestellung implements UpdateRule {
    public void update(UpdateContext context) throws BusinessException { 
        Bestellung curBestellung = context.getBusinessObject(Bestellung.class);
        List<Bestellposition> lstPositionen = curBestellung.getPositionen();
        
        double gesamteArtikelAnzahl = 0d;
        
        for (Bestellposition curPos : lstPositionen) {
            gesamteArtikelAnzahl += curPos.getAnzahlArtikel();
        }
        
        curBestellung.setKurzbeschreibung("Bestellung " + curBestellung.getNummer() + " umfasst insgesamt " + gesamtArtikelAnzahl + "Artikel.");
    }
}