@Override public IndexValue createIndexValue(Reference value) { if (value == null || value.getReference() == null || value.getReference().isEmpty()) { return null; } return new IndexValue(value.getReference(), INDEX_TYPE); }
@Override public IndexValue createIndexValue(Reference value) { if (value == null || value.getReference() == null || value.getReference().isEmpty()) { return null; } return new IndexValue(value.getReference(), INDEX_TYPE); }
@Override public boolean equals(Object obj) { return obj instanceof Reference && getReference().equals(((Reference)obj).getReference()); }
@Override public boolean equals(Object obj) { return obj instanceof Reference && getReference().equals(((Reference)obj).getReference()); }
@Override public boolean equals(Object obj) { return obj instanceof Reference && uri.getUnicodeString().equals(((Reference)obj).getReference()); } @Override
@Override public boolean equals(Object obj) { return obj instanceof Reference && uri.getUnicodeString().equals(((Reference)obj).getReference()); } @Override
@Override public boolean equals(Object obj) { return obj instanceof Reference && getReference().equals(((Reference)obj).getReference()); }
@Override public boolean equals(Object obj) { return obj instanceof Reference && getReference().equals(((Reference)obj).getReference()); }
@Override public Representation process(Representation source) { if(includeAll && exclude.isEmpty()){ return source; //filter inactive } Iterator<Reference> refs = source.getReferences(field); if(!refs.hasNext()){ //no values and includeNull return (includeAll && !exclude.contains("")) || //include and empty not excluded (!includeAll && included.contains("")) ? //empty is included source : null; } while(refs.hasNext()){ String value = refs.next().getReference(); if((includeAll && !exclude.contains(value)) || //include and empty not excluded (!includeAll && included.contains(value))){ //empty is included return source; } } //not found -> filter return null; }
@Override public Representation process(Representation source) { if(includeAll && exclude.isEmpty()){ return source; //filter inactive } Iterator<Reference> refs = source.getReferences(field); if(!refs.hasNext()){ //no values and includeNull return (includeAll && !exclude.contains("")) || //include and empty not excluded (!includeAll && included.contains("")) ? //empty is included source : null; } while(refs.hasNext()){ String value = refs.next().getReference(); if((includeAll && !exclude.contains(value)) || //include and empty not excluded (!includeAll && included.contains(value))){ //empty is included return source; } } //not found -> filter return null; }
/** * Getter for the state of this symbol * @return the state */ public final ManagedEntityState getState() { Reference stateUri = metadata.getFirstReference(STATE); if(stateUri != null){ if(ManagedEntityState.isState(stateUri.getReference())){ return ManagedEntityState.getState(stateUri.getReference()); } else { log.warn("Value {} for field {} is not a valied SymbolState! -> return null", stateUri,STATE); return null; } } else { return null; } }
/** * Getter for the state of this symbol * @return the state */ public final ManagedEntityState getState() { Reference stateUri = metadata.getFirstReference(STATE); if(stateUri != null){ if(ManagedEntityState.isState(stateUri.getReference())){ return ManagedEntityState.getState(stateUri.getReference()); } else { log.warn("Value {} for field {} is not a valied SymbolState! -> return null", stateUri,STATE); return null; } } else { return null; } }
@Test public void testIRIerence() throws URISyntaxException { URI refObject = new URI("http://www.test.org/uriTest"); Reference ref = testRef(refObject); assertEquals(ref.getReference(), refObject.toString()); }
@Test public void testURLReference() throws MalformedURLException { URL refObject = new URL("http://www.test.org/urlTest"); Reference ref = testRef(refObject); assertEquals(ref.getReference(), refObject.toString()); }
/** * The state of this mapping * @return the state */ public final MappingState getState() { Reference stateUri = wrappedEntity.getRepresentation().getFirstReference(STATE); if(stateUri != null){ if(MappingState.isState(stateUri.getReference())){ return MappingState.getState(stateUri.getReference()); } else { log.warn("Value {} for field {} is not a valied MappingState! -> return null", stateUri,STATE); return null; } } else { return null; } }
/** * The state of this mapping * @return the state */ public final MappingState getState() { Reference stateUri = wrappedEntity.getRepresentation().getFirstReference(STATE); if(stateUri != null){ if(MappingState.isState(stateUri.getReference())){ return MappingState.getState(stateUri.getReference()); } else { log.warn("Value {} for field {} is not a valied MappingState! -> return null", stateUri,STATE); return null; } } else { return null; } }
/** * Getter for the ID of the Entity (and the Representation) this metadata * are about * @return the id of the entity this metadata are about */ public final String getEntityId(){ Reference ref = wrappedEntity.getRepresentation().getFirstReference( RdfResourceEnum.aboutRepresentation.getUri()); return ref == null ? null : ref.getReference(); } }
@Test public void testStringReference() { Object refObject = "urn:test.1"; Reference ref = testRef(refObject); assertEquals(ref.getReference(), refObject); }
/** * Getter for the ID of the Entity (and the Representation) this metadata * are about * @return the id of the entity this metadata are about */ public final String getEntityId(){ Reference ref = wrappedEntity.getRepresentation().getFirstReference( RdfResourceEnum.aboutRepresentation.getUri()); return ref == null ? null : ref.getReference(); } }
@Test public void testReferences() { String field = "urn:the.field:used.for.this.Test"; Set<String> refs = new HashSet<String>(Arrays.asList("http://www.test.org/test1", "urn:test.org:test.1")); Representation rep = createRepresentation(null); for (String ref : refs) { rep.addReference(field, ref); } Iterator<Reference> refIterator = rep.getReferences(field); assertNotNull(refIterator); while (refIterator.hasNext()) { Reference ref = refIterator.next(); assertTrue(refs.remove(ref.getReference())); } assertTrue(refs.isEmpty()); }