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