This commit is contained in:
Ralph Soika 2021-01-14 16:47:06 +01:00
parent bb5f453be8
commit cf9bfd952b

View file

@ -13,8 +13,8 @@ import org.imixs.workflow.exceptions.PluginException;
* Das InvoicePlugin prüft die Eingaben auf gültigkeit, so dass diese problemlos
* nach Cargosoft expoertier werden können.
* <p>
* Konkret geht es darum, das in den ChildItems keine leeren Zeilen vorkommen
* dürfen.
* Konkret geht es darum, das im Status 5200 in den ChildItems keine leeren
* Zeilen vorkommen dürfen.
*
* @author rsoika
* @version 1.0
@ -30,28 +30,32 @@ public class InvoicePlugin extends AbstractPlugin {
/**
* Test childworkitems for empty lines
*
* @throws PluginException - if txtCooperateSpace not filled.
* @throws PluginException - if data is missing
*
**/
@Override
public ItemCollection run(ItemCollection workitem, ItemCollection documentActivity) throws PluginException {
List<ItemCollection> childs = explodeChildList(workitem);
for (ItemCollection posItem : childs) {
if (posItem.getItemValueString("name").trim().isEmpty()) {
// throw a plugin exception - because name is missing!
throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA,
"Eingabefehler - Die Positionsnummer in Zeile " + posItem.getItemValueString("numpos")
+ " muss aufgefüllt sein!");
}
// die prüfung der positionsnummern erfolgt nur im Status 5200 !
if (workitem.getTaskID() == 5200) {
List<ItemCollection> childs = explodeChildList(workitem);
for (ItemCollection posItem : childs) {
if (posItem.getItemValueString("name").trim().isEmpty()) {
// throw a plugin exception - because name is missing!
throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA,
"Eingabefehler - Die Positionsnummer in Zeile " + posItem.getItemValueString("numpos")
+ " muss aufgefüllt sein!");
}
if (posItem.getItemValueFloat("amount") == 0) {
// throw a plugin exception - because name is missing!
throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA,
"Eingabefehler - Der Nettobetrag in in Zeile " + posItem.getItemValueString("numpos")
+ " darf nicht 0 sein!");
if (posItem.getItemValueFloat("amount") == 0) {
// throw a plugin exception - because name is missing!
throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA,
"Eingabefehler - Der Nettobetrag in in Zeile " + posItem.getItemValueString("numpos")
+ " darf nicht 0 sein!");
}
}
}
return workitem;
}