ServletContext context = getServlet().getServletContext();
DataConfig config = ConfigRequests.getDataConfig(request);
UserContainer user = Requests.getUserContainer(request);
FeatureTypeConfig type = user.getFeatureTypeConfig();
if (type == null) {
System.out.println("Type is not there");
// Not sure what to do, user must have bookmarked?
return; // Action should redirect to Select screen?
}
this.dataStoreId = type.getDataStoreId();
this.styleId = type.getDefaultStyle();
description = type.getAbstract();
Envelope bounds = type.getLatLongBBox();
if ((bounds == null) || bounds.isNull()) {
minX = "";
minY = "";
maxY = "";
maxX = "";
} else {
minX = Double.toString(bounds.getMinX());
minY = Double.toString(bounds.getMinY());
maxX = Double.toString(bounds.getMaxX());
maxY = Double.toString(bounds.getMaxY());
}
typeName = type.getName();
setSRS(Integer.toString(type.getSRS())); // doing it this way also sets SRSWKT
title = type.getTitle();
System.out.println("rest based on schemaBase: " + type.getSchemaBase());
// Generate ReadOnly list of Attributes
//
DataStoreConfig dataStoreConfig = config.getDataStore(dataStoreId);
FeatureType featureType = null;
try {
DataStore dataStore = dataStoreConfig.findDataStore(getServlet()
.getServletContext());
featureType = dataStore.getSchema(typeName);
} catch (IOException e) {
// DataStore unavailable!
}
if (((type.getSchemaBase() == null)
|| "--".equals(type.getSchemaBase()))
|| (type.getSchemaAttributes() == null)) {
//We are using the generated attributes
this.schemaBase = "--";
this.schemaName = typeName + "_Type";
this.attributes = new LinkedList();
// Generate ReadOnly list of Attributes
//
List generated = DataTransferObjectFactory.generateAttributes(featureType);
this.attributes = attributesDisplayList(generated);
addList = Collections.EMPTY_LIST;
} else {
this.schemaBase = type.getSchemaBase();
this.schemaName = type.getSchemaName();
this.attributes = new LinkedList();
//
// Need to add read only AttributeDisplay for each required attribute
// defined by schemaBase
//
List schemaAttributes = DataTransferObjectFactory
.generateRequiredAttributes(schemaBase);
attributes.addAll(attributesDisplayList(schemaAttributes));
attributes.addAll(attributesFormList(type.getSchemaAttributes(),
featureType));
addList = new ArrayList(featureType.getAttributeCount());
for (int i = 0; i < featureType.getAttributeCount(); i++) {
String attributeName = featureType.getAttributeType(i).getName();
if (lookUpAttribute(attributeName) == null) {
addList.add(attributeName);
}
}
}
StringBuffer buf = new StringBuffer();
for (Iterator i = type.getKeywords().iterator(); i.hasNext();) {
String keyword = (String) i.next();
buf.append(keyword);
if (i.hasNext()) {
buf.append(" ");