io.yawp.servlet.rest.CreateRestAction Maven / Gradle / Ivy
package io.yawp.servlet.rest;
import io.yawp.repository.FutureObject;
import java.util.ArrayList;
import java.util.List;
public class CreateRestAction extends RestAction {
public CreateRestAction() {
super("create");
}
@Override
public void shield() {
shield.protectCreate();
}
@Override
public Object action() {
if (isRequestBodyJsonArray()) {
return createFromArray(getObjects());
}
return createFromObject(getObject());
}
private Object createFromObject(Object object) {
return saveObject(object);
}
private Object createFromArray(List> objects) {
return saveObjecs(objects);
}
private Object saveObjecs(List> objects) {
List> futures = new ArrayList<>();
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy