@Override protected void onStyleFormSubmit() { // write out the file and save name modifications try { StyleInfo style = (StyleInfo) styleForm.getModelObject(); Version version = Styles.findVersion(new ByteArrayInputStream(rawSLD.getBytes())); style.setSLDVersion(version); // write out the SLD try { getCatalog().getResourcePool().writeStyle(style, new ByteArrayInputStream(rawSLD.getBytes())); } catch (IOException e) { throw new WicketRuntimeException(e); } getCatalog().save(style); doReturn( StylePage.class ); } catch( Exception e ) { LOGGER.log(Level.SEVERE, "Error occurred saving the style", e); styleForm.error( e ); } }
@Override protected void onStyleFormSubmit() { // add the style Catalog catalog = getCatalog(); StyleInfo s = (StyleInfo) styleForm.getModelObject(); // write out the SLD before creating the style try { if (s.getFilename() == null) { // TODO: check that this does not overriDe any existing files s.setFilename(s.getName() + ".sld"); } catalog.getResourcePool().writeStyle(s, new ByteArrayInputStream(rawSLD.getBytes())); } catch (IOException e) { throw new WicketRuntimeException(e); } // store in the catalog try { Version version = Styles.findVersion(new ByteArrayInputStream(rawSLD.getBytes())); s.setSLDVersion(version); getCatalog().add(s); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Error occurred saving the style", e); error(e); return; } doReturn(StylePage.class); }