use of org.geosdi.geoplatform.connector.wfs.response.AttributeDTO in project geo-platform by geosdi.
the class AbstractFeatureStreamWriter method writeFeature.
/**
* @param request
* @throws XMLStreamException
* @throws Exception
*/
private void writeFeature(WFSTransactionRequest request) throws XMLStreamException, Exception {
QName typeName = request.getTypeName();
writer().writeStartElement(typeName.getLocalPart());
List<AttributeDTO> attributes = request.getAttributes();
for (AttributeDTO attributeDTO : attributes) {
if (attributeDTO instanceof GeometryAttributeDTO) {
writeGeometryAttribute((GeometryAttributeDTO) attributeDTO, typeName);
} else {
writeAttribute(attributeDTO, typeName);
}
}
writer().writeEndElement();
}
use of org.geosdi.geoplatform.connector.wfs.response.AttributeDTO in project geo-platform by geosdi.
the class FeatureAttributeConditionField method getQueryRestriction.
@Override
public QueryRestrictionDTO getQueryRestriction() {
QueryRestrictionDTO queryRestriction = null;
AttributeDetail attributeDetail = this.nameAttributeCombo.getValue();
String operator = this.operatorCombo.getValue().getValue();
String restriction = this.conditionAttributeField.getValue();
if ((attributeDetail != null) && (operator != null) && (this.conditionAttributeField.isValid()) && (restriction != null)) {
AttributeDTO attributeDTO = FeatureConverter.convert(attributeDetail);
queryRestriction = new QueryRestrictionDTO(attributeDTO, OperatorType.fromSymbol(operator), restriction);
}
return queryRestriction;
}
use of org.geosdi.geoplatform.connector.wfs.response.AttributeDTO in project geo-platform by geosdi.
the class FeatureAttributesWidget method prepareColumnModel.
private ColumnModel prepareColumnModel() {
List<AttributeDTO> attributesDTO = this.layerSchemaBinder.getLayerSchemaDTO().getAttributes();
List<ColumnConfig> configs = Lists.<ColumnConfig>newArrayListWithCapacity(attributesDTO.size());
for (final AttributeDTO att : attributesDTO) {
final GPSecureStringTextField valueTextField = new GPSecureStringTextField();
valueTextField.setValidator(AttributeCustomFieldsMap.getValidatorForAttributeType(att.getType()));
valueTextField.setAutoValidate(true);
if (att.isDateType()) {
FocusHandler focusHandler = new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
dataAttributeName = att.getName();
timeInputWidget.show();
}
};
valueTextField.addHandler(focusHandler, FocusEvent.getType());
}
ColumnConfig valueColumn = new ColumnConfig();
String name = att.getName();
valueColumn.setId(name);
valueColumn.setHeaderHtml(name);
valueColumn.setEditor(buildCellEditor(valueTextField));
valueColumn.setWidth((name.length() + 1) * 10);
valueColumn.setToolTip("Datatype: " + att.getType());
configs.add(valueColumn);
}
return new ColumnModel(configs);
}
use of org.geosdi.geoplatform.connector.wfs.response.AttributeDTO in project geo-platform by geosdi.
the class FeatureReaderTest method testFeature.
@Test
public void testFeature() throws Exception {
FileInputStream ff = null;
try {
File dftFile = new File(fileDFT);
ff = new FileInputStream(dftFile);
List<LayerSchemaDTO> schemas = featureReaderXSD.read(ff);
Assert.assertNotNull(schemas);
Assert.assertEquals(1, schemas.size());
LayerSchemaDTO layerSchema = schemas.get(0);
Assert.assertNotNull(layerSchema.getTypeName());
String name = layerSchema.getTypeName().substring(layerSchema.getTypeName().indexOf(":") + 1);
Assert.assertNotNull(layerSchema.getTargetNamespace());
Assert.assertNotNull(layerSchema.getGeometry());
List<AttributeDTO> attributes = layerSchema.getAttributes();
Assert.assertNotNull(attributes);
Assert.assertEquals(numAttributes, attributes.size());
for (AttributeDTO att : attributes) {
Assert.assertTrue(att.getMinOccurs() >= 0);
Assert.assertTrue(att.getMaxOccurs() > att.getMinOccurs());
Assert.assertNotNull(att.getName());
Assert.assertNotNull(att.getType());
}
logger.debug("@@@@@@@@@@@@@@@@@@@@LAYER_SCHEMA : {}", layerSchema);
WFSGetFeatureStaxReader featureReader = new WFSGetFeatureStaxReader(layerSchema);
FeatureCollectionDTO fc = featureReader.read(new File(fileGF));
Assert.assertNotNull(fc);
Assert.assertNotNull(fc.getTimeStamp());
Assert.assertEquals(numFeatures, fc.getNumberOfFeatures());
List<FeatureDTO> features = fc.getFeatures();
Assert.assertNotNull(features);
Assert.assertEquals(numFeatures, features.size());
for (FeatureDTO feature : features) {
Assert.assertNotNull(feature.getFID());
Assert.assertTrue(feature.getFID().contains(name));
Assert.assertNotNull(feature.getGeometry());
if (numAttributes == 0) {
Assert.assertTrue(feature.getAttributes().getAttributesMap().isEmpty());
} else {
Assert.assertNotNull(feature.getAttributes());
Map<String, String> fMap = feature.getAttributes().getAttributesMap();
Assert.assertNotNull(fMap);
logger.debug("#################FMAP_SIZE : {}\n", fMap.size());
Assert.assertEquals(numAttributes, fMap.size());
}
logger.debug("@@@@@@@@@@@@@@@@@@@@ {} - {}", feature.getFID(), feature.getAttributes());
logger.debug("GEOMETRY @@@@@@@@@@@@@@@@ : {}", feature.getGeometry());
}
} finally {
if (ff != null) {
ff.close();
}
}
}
use of org.geosdi.geoplatform.connector.wfs.response.AttributeDTO in project geo-platform by geosdi.
the class WFSTransactionUpdateTest method polyLandmarks.
@Test
public void polyLandmarks() throws Exception {
WFSTransactionRequest<TransactionResponseType> request = super.serverConnector.createTransactionRequest();
request.setOperation(TransactionOperation.UPDATE);
QName name = new QName(POLY_LANDMARKS.getLocalPart());
request.setTypeName(name);
request.setFID("poly_landmarks.1");
AttributeDTO att = new AttributeDTO();
att.setMaxOccurs(1);
att.setMinOccurs(0);
att.setName("LANAME");
att.setNillable(true);
att.setType("string");
att.setValue("Washington Square Park.");
request.setAttributes(Arrays.asList(att));
// We must avoid transactions on the server,
// but show only the requests generated
logger.info("\n\nHERE THE REQUEST ########################## \n {}", request.showRequestAsString());
// TransactionResponseType response = request.getResponse();
// logger.info("\n*** {}", response.getTransactionResults());
//
// TransactionSummaryType transactionSummary = response.getTransactionSummary();
// Assert.assertEquals(0, transactionSummary.getTotalDeleted().intValue());
// Assert.assertEquals(0, transactionSummary.getTotalInserted().intValue());
// Assert.assertEquals(1, transactionSummary.getTotalUpdated().intValue());
// Assert.assertEquals("1.1.0", response.getVersion());
// HERE THE CODE TO TEST THE TRANSACTION RESULT WITH A SPECIFIC GET_FEATURE
// WFSGetFeatureRequest<FeatureCollectionType> requestGet =
// super.serverConnector.createGetFeatureRequest();
//
// requestGet.setResultType(ResultTypeType.RESULTS.value());
// requestGet.setTypeName(POLY_LANDMARKS);
//
// requestGet.setFeatureIDs(Arrays.asList("poly_landmarks.1"));
//
// logger.info("\n\n\nRESPONSE @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ {}",
// requestGet.getResponseAsString());
}
Aggregations