implemented GUI update on cloning items
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
description = "Umbrella : Stock"
|
||||
|
||||
dependencies{
|
||||
implementation(project(":bus"))
|
||||
implementation(project(":core"))
|
||||
implementation("de.srsoftware:configuration.json:1.0.3")
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import static de.srsoftware.umbrella.core.constants.Module.USER;
|
||||
import static de.srsoftware.umbrella.core.constants.Path.*;
|
||||
import static de.srsoftware.umbrella.core.constants.Path.PROPERTY;
|
||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
|
||||
import static de.srsoftware.umbrella.messagebus.MessageBus.messageBus;
|
||||
import static de.srsoftware.umbrella.stock.Constants.*;
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
import static java.util.Comparator.comparing;
|
||||
@@ -26,13 +27,18 @@ import de.srsoftware.umbrella.core.*;
|
||||
import de.srsoftware.umbrella.core.api.Owner;
|
||||
import de.srsoftware.umbrella.core.api.StockService;
|
||||
import de.srsoftware.umbrella.core.constants.Field;
|
||||
import de.srsoftware.umbrella.core.constants.Module;
|
||||
import de.srsoftware.umbrella.core.constants.Path;
|
||||
import de.srsoftware.umbrella.core.constants.Text;
|
||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||
import de.srsoftware.umbrella.core.model.*;
|
||||
import de.srsoftware.umbrella.core.model.Location;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import de.srsoftware.umbrella.messagebus.events.Event;
|
||||
import de.srsoftware.umbrella.messagebus.events.ItemEvent;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class StockModule extends BaseHandler implements StockService {
|
||||
@@ -350,7 +356,9 @@ public class StockModule extends BaseHandler implements StockService {
|
||||
if (!assigned(owner,user)) throw forbidden("You are not allowed to add items to \"{location}\"!", Text.LOCATION,location.name());
|
||||
var newItem = new Item(0,owner,0,location,item.code(),item.name(),item.description());
|
||||
for (var property : item.properties()) newItem.properties().add(property);
|
||||
return sendContent(ex,stockDb.save(newItem));
|
||||
newItem = stockDb.save(newItem);
|
||||
messageBus().dispatch(new ItemEvent(user, Module.STOCK, newItem, Event.EventType.CREATE));
|
||||
return sendContent(ex,newItem);
|
||||
}
|
||||
|
||||
private boolean postItem(UmbrellaUser user, HttpExchange ex) throws IOException {
|
||||
@@ -362,8 +370,10 @@ public class StockModule extends BaseHandler implements StockService {
|
||||
var location = stockDb.loadLocation(locationData.getLong(ID));
|
||||
var owner = location.owner().resolve();
|
||||
if (!assigned(owner,user)) throw forbidden("You are not allowed to add items to {location}!", Field.LOCATION,location);
|
||||
var newItem = new Item(0,owner,0,location,code,name,description);
|
||||
return sendContent(ex,stockDb.save(newItem));
|
||||
var newItem = stockDb.save(new Item(0,owner,0,location,code,name,description));
|
||||
messageBus().dispatch(new ItemEvent(user, Module.STOCK, newItem, Event.EventType.CREATE));
|
||||
return sendContent(ex,newItem);
|
||||
|
||||
}
|
||||
|
||||
private boolean postItemList(UmbrellaUser user, de.srsoftware.tools.Path path, HttpExchange ex) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user