Package net.opengis.cat.csw20.impl

Examples of net.opengis.cat.csw20.impl.TransactionSummaryTypeImpl


                kvp.put("distributedSearch", dst);
            }
        }

        // parse the query
        QueryType query = readQuery(kvp, request);
        kvp.put("query", query);

        return super.read(request, kvp, rawKvp);
    }
View Full Code Here


        return super.read(request, kvp, rawKvp);
    }

    private QueryType readQuery(Map kvp, Object request) throws Exception {
        Csw20Factory factory = Csw20Factory.eINSTANCE;
        QueryType query = factory.createQueryType();

        // parse the type names
        String typeNamesString = (String) kvp.get("typeNames");
        if(typeNamesString == null) {
            throw new ServiceException("Mandatory parameter typeNames is missing", ServiceException.MISSING_PARAMETER_VALUE, "typeNames");
        }
        NamespaceSupport namespaces = (NamespaceSupport) kvp.get("namespace");
        if (namespaces == null) {
            // by spec, "NAMSPACE, If not included, all qualified names are in default namespace"
            String outputSchema = (String) kvp.get("outputSchema");
            if (outputSchema == null || descriptors.get(outputSchema) == null) {
                outputSchema = CSW.NAMESPACE;
            }
            namespaces = descriptors.get( outputSchema).getNamespaceSupport();
        }
        List<QName> typeNames = resolver.parseQNames(typeNamesString, namespaces);
        query.setTypeNames(typeNames);
       
        // handle the element set
        ElementSetType elementSet = (ElementSetType) kvp.remove("ELEMENTSETNAME");
        if (elementSet != null) {
            ElementSetNameType esn = Csw20Factory.eINSTANCE.createElementSetNameType();
            esn.setValue(elementSet);
            esn.setTypeNames(typeNames);
            query.setElementSetName(esn);
        }
       
        // and the element names
        String elementNamesString = (String) kvp.remove("ELEMENTNAME");
        if(elementNamesString != null) {
            List<QName> elementNames = resolver.parseQNames(elementNamesString, namespaces);
            query.getElementName().addAll(elementNames);
        }

        // the filter
        if (kvp.get(CONSTRAINT) != null) {
            query.setConstraint(factory.createQueryConstraintType());
            Object language = kvp.get(CONSTRAINTLANGUAGE);
            String constraint = (String) kvp.get(CONSTRAINT);
            if (CQL_TEXT.equals(language) || language == null) {
                Filter filter = null;
                try {
                    filter = CQL.toFilter(constraint);
                } catch (Exception e) {
                    ServiceException se = new ServiceException("Invalid CQL expression: " + constraint,
                            ServiceException.INVALID_PARAMETER_VALUE, CONSTRAINT);
                    se.initCause(e);
                    throw se;
                }
                query.getConstraint().setCqlText(constraint);
                query.getConstraint().setFilter(filter);
            } else if (FILTER.equals(language)) {
                try {
                    Parser parser = new Parser(new OGCConfiguration());
                    parser.setFailOnValidationError(true);
                    parser.setValidating(true);
                    parser.getNamespaces().declarePrefix("ogc", OGC.NAMESPACE);
                    Filter filter = (Filter) parser.parse(new StringReader(constraint));
                    query.getConstraint().setFilter(filter);
                    query.getConstraint().setVersion("1.1.0");
                } catch(Exception e) {
                    ServiceException se = new ServiceException("Invalid FILTER 1.1 expression: " + constraint,
                            ServiceException.INVALID_PARAMETER_VALUE, CONSTRAINT);
                    se.initCause(e);
                    throw se;
                }
            } else {
                throw new ServiceException("Invalid constraint language: " + language
                        + ", valid values are " + CQL_TEXT + " and " + FILTER,
                        ServiceException.INVALID_PARAMETER_VALUE, CONSTRAINTLANGUAGE);
            }
        }
       
        // check if we have to sort the request
        if(kvp.get("SORTBY") != null) {
            query.setSortBy((SortBy[]) kvp.get("SORTBY"));
        }

        return query;
    }
View Full Code Here

        assertNotNull(gr.getDistributedSearch());
        assertEquals(new Integer(10), gr.getDistributedSearch().getHopCount());
        assertEquals("http://www.geoserver.org", gr.getResponseHandler());

        // now onto the query
        QueryType query = (QueryType) gr.getQuery();
        assertEquals("AnyText like '%pollution%'", query.getConstraint().getCqlText());
        assertEquals(2, query.getTypeNames().size());
        assertEquals(new QName("http://www.opengis.net/cat/csw/2.0.2", "Record"), query
                .getTypeNames().get(0));
        assertEquals(new QName("urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0", "RegistryPackage"),
                query.getTypeNames().get(1));
        assertEquals(2, query.getElementName().size());
        assertEquals(2, query.getElementName().size());
    }
View Full Code Here

        // basic checks
        assertEquals("CSW", gr.getService());
        assertEquals("2.0.2", gr.getVersion());

        // now onto the query
        QueryType query = (QueryType) gr.getQuery();
       
        // checking the filter is structured as expected, with the proper namespace support
        Filter filter = query.getConstraint().getFilter();
        assertTrue(filter instanceof Not);
        Filter negated = ((Not) filter).getFilter();
        assertTrue(negated instanceof PropertyIsEqualTo);
        PropertyName pname = (PropertyName) ((PropertyIsEqualTo) negated).getExpression1();
        assertEquals("dc:title", pname.getPropertyName());
       
        assertEquals("1.1.0", query.getConstraint().getVersion());
        assertEquals(1, query.getTypeNames().size());
        assertEquals(new QName("http://www.opengis.net/cat/csw/2.0.2", "Record"), query
                .getTypeNames().get(0));
        assertEquals(ElementSetType.BRIEF, query.getElementSetName().getValue());
    }
View Full Code Here

        // 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());
    }
View Full Code Here

        Date timestamp = new Date();

        try {
            // build the queries           
          RecordDescriptor outputRd = getRecordDescriptor(request);
            QueryType cswQuery = (QueryType) request.getQuery();
            List<Query> queries = toGtQueries(outputRd, cswQuery, request);
            // see how many records we have to return
            int maxRecords;
            if(request.getMaxRecords() == null) {
                maxRecords = 10;
View Full Code Here

     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public NotificationChain basicSetRangeOfValues(RangeOfValuesType newRangeOfValues, NotificationChain msgs) {
        RangeOfValuesType oldRangeOfValues = rangeOfValues;
        rangeOfValues = newRangeOfValues;
        if (eNotificationRequired()) {
            ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Csw20Package.DOMAIN_VALUES_TYPE__RANGE_OF_VALUES, oldRangeOfValues, newRangeOfValues);
            if (msgs == null) msgs = notification; else msgs.add(notification);
        }
View Full Code Here

        GetRecordByIdResponseType response = (GetRecordByIdResponseType) parser.parse(getClass().getResourceAsStream(
                "GetRecordByIdResponse.xml"));
        assertNotNull(response);
        EList<AbstractRecordType> records = response.getAbstractRecord();
        assertEquals(1, records.size());
        RecordType record = (RecordType) records.get(0);
    }
View Full Code Here

        assertTrue(EMFUtils.emfEquals(sr, reparsed));
    }
   
    @Test
    public void testParseRecord() throws Exception {
        RecordType record = (RecordType) parser.parse(getClass().getResourceAsStream("Record.xml"));
        BoundingBoxType bbox = record.getBoundingBox().get(0);
        assertEquals(14.05, bbox.getLowerCorner().get(0));
        assertEquals(46.46, bbox.getLowerCorner().get(1));
        assertEquals(17.24, bbox.getUpperCorner().get(0));
        assertEquals(48.42, bbox.getUpperCorner().get(1));
       
        EList<SimpleLiteral> dcElements = record.getDCElement();
        assertEquals(11, dcElements.size());
       
        assertEquals("00180e67-b7cf-40a3-861d-b3a09337b195", getValue(dcElements, "identifier"));
        assertEquals("Image2000 Product 1 (at1) Multispectral", getValue(dcElements, "title"));
        assertEquals("dataset", getValue(dcElements, "type"));
View Full Code Here

        super(Csw20Factory.eINSTANCE, CSW.RecordType);
    }
   
    @Override
    public List getProperties(Object object, XSDElementDeclaration element) throws Exception {
        RecordType record = (RecordType) object;
       
        List result = new ArrayList();
        XSDParticle previous = null;
        String previousName = null;
        for (SimpleLiteral sl : record.getDCElement()) {
            XSDSchema dctSchema = DCT.getInstance().getSchema();
            XSDElementDeclaration declaration = dctSchema.resolveElementDeclaration(sl.getName());
            if(declaration.getTypeDefinition() == null) {
                XSDSchema dcSchema = DC.getInstance().getSchema();
                declaration = dcSchema.resolveElementDeclaration(sl.getName());
            }
            if(declaration != null) {
                XSDParticle particle;
                if(previousName != null && sl.getName().equals(previousName)) {
                    particle = previous;
                } else {
                    particle = buildParticle(declaration);
                    previous = particle;
                    previousName = sl.getName();
                }
                result.add(new Object[] {particle, sl});
            }
        }
       
        if(record.getBoundingBox() != null && record.getBoundingBox().size() > 0) {
            for (Object box : record.getBoundingBox()) {
                XSDElementDeclaration bboxElement;
                if(box instanceof WGS84BoundingBoxType) {
                    bboxElement = OWS.getInstance().getSchema().resolveElementDeclaration("WGS84BoundingBox");
                } else {
                    bboxElement = OWS.getInstance().getSchema().resolveElementDeclaration("BoundingBox");
View Full Code Here

TOP

Related Classes of net.opengis.cat.csw20.impl.TransactionSummaryTypeImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.