separating fields from other constants
This commit is contained in:
@@ -5,6 +5,7 @@ import static de.srsoftware.tools.Optionals.is0;
|
||||
import static de.srsoftware.tools.Optionals.nullIfEmpty;
|
||||
import static de.srsoftware.umbrella.core.ConnectionProvider.connect;
|
||||
import static de.srsoftware.umbrella.core.Constants.*;
|
||||
import static de.srsoftware.umbrella.core.Field.ITEM;
|
||||
import static de.srsoftware.umbrella.core.ModuleRegistry.companyService;
|
||||
import static de.srsoftware.umbrella.core.ModuleRegistry.userService;
|
||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
|
||||
@@ -311,7 +312,7 @@ public class StockModule extends BaseHandler implements StockService {
|
||||
|
||||
private boolean postProperty(UmbrellaUser user, HttpExchange ex) throws IOException {
|
||||
var json = json(ex);
|
||||
if (!(json.get(FIELD_ITEM) instanceof JSONObject itemData)) throw missingFieldException(FIELD_ITEM);
|
||||
if (!(json.get(ITEM) instanceof JSONObject itemData)) throw missingFieldException(ITEM);
|
||||
if (!(itemData.get(ID) instanceof Number itemId)) throw missingFieldException(ID);
|
||||
if (!(json.get("add_prop") instanceof JSONObject propData)) throw missingFieldException("add_prop");
|
||||
if (!propData.has(VALUE)) throw missingFieldException(VALUE);
|
||||
|
||||
Reference in New Issue
Block a user