@Override public Object getProperty(Object object, QName name) throws Exception { if ("InsertResult".equals(name.getLocalPart())) { return ((TransactionResponseType) object).getInsertResults(); } if ("TransactionResult".equals(name.getLocalPart())) { return ((TransactionResponseType) object).getTransactionResults(); } return super.getProperty(object, name); } }
@Override public void addAction(String code, String locator, String message) { // transaction failed, rollback ActionType action = ((WfsFactory) getFactory()).createActionType(); action.setCode(code); action.setLocator(locator); action.setMessage(message); ((TransactionResponseType) adaptee).getTransactionResults().getAction().add(action); }
public void v_1_0(TransactionResponseType response, OutputStream output, Operation operation) throws IOException, ServiceException { TransactionResultsType result = response.getTransactionResults();
public void v_1_1(TransactionResponseType response, OutputStream output, Operation operation) throws IOException, ServiceException { if (!response.getTransactionResults().getAction().isEmpty()) { // since we do atomic transactions, an action failure means all we rolled back // spec says to throw exception ActionType action = (ActionType) response.getTransactionResults().getAction().iterator().next(); throw new WFSException(action.getMessage(), action.getCode(), action.getLocator()); } Encoder encoder = new Encoder(configuration, configuration.schema()); encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset())); TransactionType req = (TransactionType) operation.getParameters()[0]; encoder.setSchemaLocation( org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE, buildSchemaURL(req.getBaseUrl(), "wfs/1.1.0/wfs.xsd")); encoder.encode(response, org.geoserver.wfs.xml.v1_1_0.WFS.TRANSACTIONRESPONSE, output); } }