ISORecord implements MetadataRecord { @Override public boolean eval( Filter filter ) throws FilterEvaluationException { return filter.evaluate( this, new ISORecordEvaluator() ); } ISORecord( XMLStreamReader xmlStream );  ISORecord( OMElement root ); @Override QName getName(); @Override boolean eval( Filter filter ); @Override String[] getAbstract(); @Override Envelope[] getBoundingBox(); @Override String[] getFormat(); @Override String getIdentifier(); @Override Date getModified(); @Override String[] getRelation(); @Override Object[] getSpatial(); @Override String[] getTitle(); @Override String getType(); @Override String[] getSubject(); XMLStreamReader getAsXMLStream(); @Override OMElement getAsOMElement(); byte[] getAsByteArray(); @Override void serialize( XMLStreamWriter writer, ReturnableElement returnType ); @Override void serialize( XMLStreamWriter writer, String[] elementNames ); @Override DCRecord toDublinCore(); boolean isHasSecurityConstraints(); @Override String getContributor(); @Override String getPublisher(); @Override String[] getRights(); @Override String getSource(); @Override String getCreator(); @Override String getLanguage(); String getParentIdentifier(); ParsedProfileElement getParsedElement(); String getStringFromXPath( XPath xpath ); OMElement getNodeFromXPath( XPath xpath ); String[] getStringsFromXPath( XPath xpath ); @Override void update( ValueReference propName, String s ); @Override void update( ValueReference propName, OMElement newEl ); @Override void removeNode( ValueReference propName ); boolean isServiceRecord(); @Override String toString(); static String ISO_RECORD_NS; static final String SCHEMA_URL_GMD; static final String SCHEMA_URL_SRV; }
@Test public void testEvalFilterSubject() throws Exception { InputStream is = ISORecordTest.class.getResourceAsStream( "datasetRecord.xml" ); XMLStreamReader xmlStream = XMLInputFactory.newInstance().createXMLStreamReader( is ); ISORecord record = new ISORecord( xmlStream ); Literal<PrimitiveValue> literal = new Literal<PrimitiveValue>( "Hydrography" ); Operator operator = new PropertyIsEqualTo( new ValueReference( "Subject", nsContext ), literal, true, null ); Filter filter = new OperatorFilter( operator ); boolean isMatching = record.eval( filter ); assertTrue( isMatching ); }
@Test public void testEvalFilterSubjectUnmatching() throws Exception { InputStream is = ISORecordTest.class.getResourceAsStream( "datasetRecord.xml" ); XMLStreamReader xmlStream = XMLInputFactory.newInstance().createXMLStreamReader( is ); ISORecord record = new ISORecord( xmlStream ); Literal<PrimitiveValue> literal = new Literal<PrimitiveValue>( "NotAKeywordInRecord" ); Operator operator = new PropertyIsEqualTo( new ValueReference( "Subject", nsContext ), literal, true, null ); Filter filter = new OperatorFilter( operator ); boolean isMatching = record.eval( filter ); Assert.assertFalse( isMatching ); }
@Test public void testEvalFilterBbox() throws Exception { InputStream is = ISORecordTest.class.getResourceAsStream( "datasetRecord.xml" ); XMLStreamReader xmlStream = XMLInputFactory.newInstance().createXMLStreamReader( is ); ISORecord record = new ISORecord( xmlStream ); GeometryFactory geomFactory = new GeometryFactory(); ValueReference reference = new ValueReference( "apiso:BoundingBox", nsContext ); Operator operator = new BBOX( reference, geomFactory.createEnvelope( 7.2, 49.30, 10.70, 53.70, CRSUtils.EPSG_4326 ) ); Filter filter = new OperatorFilter( operator ); boolean isMatching = record.eval( filter ); assertTrue( isMatching ); }
@Test(expected = FilterEvaluationException.class) public void testEvalFilterUnknownPropertyName() throws Exception { InputStream is = ISORecordTest.class.getResourceAsStream( "datasetRecord.xml" ); XMLStreamReader xmlStream = XMLInputFactory.newInstance().createXMLStreamReader( is ); ISORecord record = new ISORecord( xmlStream ); Literal<PrimitiveValue> literal = new Literal<PrimitiveValue>( "Hydrography" ); Operator operator = new PropertyIsEqualTo( new ValueReference( "Unknown", nsContext ), literal, true, null ); Filter filter = new OperatorFilter( operator ); boolean isMatching = record.eval( filter ); assertTrue( isMatching ); }