Skip to content

Commit

Permalink
GEOS-8822 publishing tab cannot be submitted with hazelcast session
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsCharlier committed Jul 10, 2018
1 parent 445625c commit 1178730
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
* @author Andrea Aime - OpenGeo
*/
@SuppressWarnings("serial")
public class LayerModel implements IModel {
public class LayerModel implements IModel<LayerInfo> {
LayerInfo layerInfo;

public LayerModel(LayerInfo layerInfo) {
setObject(layerInfo);
}

public Object getObject() {
public LayerInfo getObject() {
if (layerInfo.getResource().getCatalog() == null)
new CatalogBuilder(GeoServerApplication.get().getCatalog()).attach(layerInfo);
return layerInfo;
}

public void setObject(Object object) {
public void setObject(LayerInfo object) {
// workaround for dbconfig, by "dettaching" we force hibernate to reload the object
// fully initialized with no lazy lists or proxies
this.layerInfo = GeoServerApplication.get().getCatalog().detach((LayerInfo) object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.geoserver.catalog.LayerInfo;
import org.geoserver.catalog.PublishedInfo;
import org.geoserver.web.ComponentAuthorizer;
import org.geoserver.web.GeoServerSecuredPage;
import org.geoserver.web.data.resource.LayerModel;
import org.geoserver.web.data.resource.ResourceConfigurationPanel;

/**
Expand Down Expand Up @@ -83,8 +85,12 @@ protected PublishedConfigurationPage(T info, boolean isNew) {
setupPublished(info);
}

@SuppressWarnings("unchecked")
protected void setupPublished(T info) {
setupPublished(new Model<T>(info));
setupPublished(
info instanceof LayerInfo
? (IModel<T>) new LayerModel((LayerInfo) info)
: new Model<T>(info));
}

protected void setupPublished(IModel<T> infoModel) {
Expand Down

0 comments on commit 1178730

Please sign in to comment.