public Object parse(ElementInstance instance, Node node, Object value) throws Exception { ElementSetNameType result = (ElementSetNameType) createEObject(value); result.setValue(ElementSetType.get((String) value)); Node typeNames = node.getAttribute("typeNames"); if (typeNames != null) { result.setTypeNames((List<QName>) typeNames.getValue()); } return result; } }
private ElementSetType getElementSetName(GetRecordByIdType request) { ElementSetType elementSet = request.getElementSetName() != null ? request.getElementSetName().getValue() : null; if (elementSet == null) { // the default is "summary" elementSet = ElementSetType.SUMMARY; } return elementSet; }
@Test public void testXMLReaderParameter() throws Exception { CSWXmlReader reader = new CSWXmlReader("GetRecords", "2.0.2", new CSWConfiguration()); GetRecordsType gr = (GetRecordsType) reader.read(null, getResourceAsReader("GetRecordsBrief.xml"), (Map) null); // check the attributes assertEquals("application/xml", gr.getOutputFormat()); assertEquals("urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0", gr.getOutputSchema()); // the query QueryType query = (QueryType) gr.getQuery(); List<QName> expected = new ArrayList<QName>(); String rimNamespace = "urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"; expected.add(new QName(rimNamespace, "Service")); expected.add(new QName(rimNamespace, "Classification")); expected.add(new QName(rimNamespace, "Association")); assertEquals(expected, query.getTypeNames()); // the element set name ElementSetNameType esn = query.getElementSetName(); expected.clear(); expected.add(new QName(rimNamespace, "Service")); assertEquals(expected, esn.getTypeNames()); assertEquals(ElementSetType.BRIEF, esn.getValue()); }
@Override public Object read(Object request, Map kvp, Map rawKvp) throws Exception { ElementSetType ent = (ElementSetType) kvp.get("elementsetname"); if (ent != null) { ElementSetNameType esnt = Csw20Factory.eINSTANCE.createElementSetNameType(); esnt.setValue(ent); kvp.put("elementsetname", esnt); } List<URI> idsuri = new ArrayList<URI>(); String rawId = (String) kvp.get("id"); if(rawId == null) { throw new ServiceException("Missing required parameter id", ServiceException.MISSING_PARAMETER_VALUE, "id"); } String[] ids = rawId.split("\\s*,\\s*"); for (String id: ids) { idsuri.add(new URI(id)); } kvp.put("id", idsuri); // proceed with the normal reflective setup return super.read(request, kvp, rawKvp); }
private ElementSetType getElementSetName(GetRecordByIdType request) { ElementSetType elementSet = request.getElementSetName() != null ? request .getElementSetName().getValue() : null; if (elementSet == null) { // the default is "summary" elementSet = ElementSetType.SUMMARY; } return elementSet; }
@Override public Object read(Object request, Map kvp, Map rawKvp) throws Exception { ElementSetType ent = (ElementSetType) kvp.get("elementsetname"); if (ent != null) { ElementSetNameType esnt = Csw20Factory.eINSTANCE.createElementSetNameType(); esnt.setValue(ent); kvp.put("elementsetname", esnt); } List<URI> idsuri = new ArrayList<URI>(); String rawId = (String) kvp.get("id"); if (rawId == null) { throw new ServiceException( "Missing required parameter id", ServiceException.MISSING_PARAMETER_VALUE, "id"); } String[] ids = rawId.split("\\s*,\\s*"); for (String id : ids) { idsuri.add(new URI(id)); } kvp.put("id", idsuri); // proceed with the normal reflective setup return super.read(request, kvp, rawKvp); } }
public Object parse(ElementInstance instance, Node node, Object value) throws Exception { ElementSetNameType result = (ElementSetNameType) createEObject(value); result.setValue(ElementSetType.get((String) value)); Node typeNames = node.getAttribute("typeNames"); if (typeNames != null) { result.setTypeNames((List<QName>) typeNames.getValue()); } return result; } }
private ElementSetType getElementSet(QueryType query) { if(query.getElementName() != null && query.getElementName().size() > 0) { return ElementSetType.FULL; } ElementSetType elementSet = query.getElementSetName() != null ? query.getElementSetName().getValue() : null; if(elementSet == null) { // the default is "summary" elementSet = ElementSetType.SUMMARY; } return elementSet; }
if (elementSet != null) { ElementSetNameType esn = Csw20Factory.eINSTANCE.createElementSetNameType(); esn.setValue(elementSet); esn.setTypeNames(typeNames); query.setElementSetName(esn);
private ElementSetType getElementSet(QueryType query) { if (query.getElementName() != null && query.getElementName().size() > 0) { return ElementSetType.FULL; } ElementSetType elementSet = query.getElementSetName() != null ? query.getElementSetName().getValue() : null; if (elementSet == null) { // the default is "summary" elementSet = ElementSetType.SUMMARY; } return elementSet; }
if (elementSet != null) { ElementSetNameType esn = Csw20Factory.eINSTANCE.createElementSetNameType(); esn.setValue(elementSet); esn.setTypeNames(typeNames); query.setElementSetName(esn);
private void assertGetRecordByIdValid(GetRecordByIdType dr) { assertEquals("CSW", dr.getService()); assertEquals("2.0.2", dr.getVersion()); assertEquals(ElementSetType.SUMMARY, dr.getElementSetName().getValue()); assertEquals("REC-10", dr.getId().get(0).toString()); assertEquals("REC-11", dr.getId().get(1).toString()); assertEquals("REC-12", dr.getId().get(2).toString()); }
assertEquals(new QName("http://www.opengis.net/cat/csw/2.0.2", "Record"), query .getTypeNames().get(0)); assertEquals(ElementSetType.BRIEF, query.getElementSetName().getValue());