use of org.mozilla.jss.asn1.Tag in project requery by requery.
the class UpsertTest method testInsertOneToManyInsert.
@Test
public void testInsertOneToManyInsert() {
Event event = new Event();
UUID id = UUID.randomUUID();
event.setId(id);
event.setName("test");
Tag t1 = new Tag();
t1.setId(UUID.randomUUID());
Tag t2 = new Tag();
t2.setId(UUID.randomUUID());
event.getTags().add(t1);
event.getTags().add(t2);
data.insert(event);
HashSet<Tag> set = new HashSet<>(event.getTags());
assertEquals(2, set.size());
assertTrue(set.containsAll(Arrays.asList(t1, t2)));
assertSame(2, data.select(Tag.class).get().toList().size());
}
use of org.mozilla.jss.asn1.Tag in project bboxdb by jnidzwetzki.
the class OSMDataConverter method handleWay.
/**
* Handle a way
* @param entityContainer
*/
protected void handleWay(final Way way) {
try {
for (final Entry<OSMType, OSMTagEntityFilter> osm : filter.entrySet()) {
final OSMType osmType = osm.getKey();
final OSMTagEntityFilter entityFilter = osm.getValue();
if (entityFilter.match(way.getTags())) {
final GeoJsonPolygon geometricalStructure = new GeoJsonPolygon(way.getId());
for (final Tag tag : way.getTags()) {
geometricalStructure.addProperty(tag.getKey(), tag.getValue());
}
// Perform search async
for (final WayNode wayNode : way.getWayNodes()) {
final SerializableNode node = osmNodeStore.getNodeForId(wayNode.getNodeId());
// GeoJSON: [longitude, latitude]
geometricalStructure.addPoint(node.getLongitude(), node.getLatitude());
}
writePolygonToOutput(osmType, geometricalStructure);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.mozilla.jss.asn1.Tag in project bboxdb by jnidzwetzki.
the class OSMDataConverter method handleNode.
/**
* Handle a node
* @param entityContainer
*/
protected void handleNode(final Node node) {
try {
for (final Entry<OSMType, OSMTagEntityFilter> osm : filter.entrySet()) {
final OSMType osmType = osm.getKey();
final OSMTagEntityFilter entityFilter = osm.getValue();
if (entityFilter.match(node.getTags())) {
final GeoJsonPolygon geometricalStructure = new GeoJsonPolygon(node.getId());
// GeoJSON: [longitude, latitude]
geometricalStructure.addPoint(node.getLongitude(), node.getLatitude());
for (final Tag tag : node.getTags()) {
geometricalStructure.addProperty(tag.getKey(), tag.getValue());
}
writePolygonToOutput(osmType, geometricalStructure);
}
}
osmNodeStore.storeNode(node);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.mozilla.jss.asn1.Tag in project clinical_quality_language by cqframework.
the class CommentTests method testTags.
@Test
public void testTags() throws IOException {
CqlTranslator translator = TestUtils.runSemanticTest("TestTags.cql", 0);
CompiledLibrary library = translator.getTranslatedLibrary();
assertThat(library.getLibrary().getAnnotation(), notNullValue());
Annotation a = null;
for (Object o : library.getLibrary().getAnnotation()) {
if (o instanceof Annotation) {
a = (Annotation) o;
}
}
assertThat(a, notNullValue());
assertThat(a.getT(), notNullValue());
assertThat(a.getT().size(), equalTo(3));
for (int i = 0; i < a.getT().size(); i++) {
Tag t = a.getT().get(i);
switch(i) {
case 0:
assertThat(t.getName(), equalTo("author"));
assertThat(t.getValue(), equalTo("Frederic Chopin"));
break;
case 1:
assertThat(t.getName(), equalTo("description"));
assertThat(t.getValue(), equalTo("Test tags"));
break;
case 2:
assertThat(t.getName(), equalTo("allowFluent"));
assertThat(t.getValue(), equalTo("true"));
break;
}
}
ExpressionDef d = library.resolveExpressionRef("TestExpression");
assertThat(d.getAnnotation(), notNullValue());
for (Object o : d.getAnnotation()) {
if (o instanceof Annotation) {
a = (Annotation) o;
}
}
assertThat(a, notNullValue());
assertThat(a.getT(), notNullValue());
assertThat(a.getT().size(), equalTo(2));
for (int i = 0; i < a.getT().size(); i++) {
Tag t = a.getT().get(i);
switch(i) {
case 0:
assertThat(t.getName(), equalTo("author"));
assertThat(t.getValue(), equalTo("Frederic Chopin"));
break;
case 1:
assertThat(t.getName(), equalTo("description"));
assertThat(t.getValue(), equalTo("Test tags"));
break;
}
}
for (ExpressionDef e : library.getLibrary().getStatements().getDef()) {
if (e instanceof FunctionDef) {
d = e;
break;
}
}
assertThat(d.getAnnotation(), notNullValue());
for (Object o : d.getAnnotation()) {
if (o instanceof Annotation) {
a = (Annotation) o;
}
}
assertThat(a, notNullValue());
assertThat(a.getT(), notNullValue());
assertThat(a.getT().size(), equalTo(2));
for (int i = 0; i < a.getT().size(); i++) {
Tag t = a.getT().get(i);
switch(i) {
case 0:
assertThat(t.getName(), equalTo("author"));
assertThat(t.getValue(), equalTo("Frederic Chopin"));
break;
case 1:
assertThat(t.getName(), equalTo("description"));
assertThat(t.getValue(), equalTo("Test tags"));
break;
}
}
d = library.resolveExpressionRef("TestMultiline");
assertThat(d.getAnnotation(), notNullValue());
for (Object o : d.getAnnotation()) {
if (o instanceof Annotation) {
a = (Annotation) o;
}
}
assertThat(a, notNullValue());
assertThat(a.getT(), notNullValue());
assertThat(a.getT().size(), equalTo(3));
for (int i = 0; i < a.getT().size(); i++) {
Tag t = a.getT().get(i);
switch(i) {
case 0:
assertThat(t.getName(), equalTo("author"));
assertThat(t.getValue(), equalTo("Frederic Chopin"));
break;
case 1:
assertThat(t.getName(), equalTo("description"));
assertThat(t.getValue(), equalTo("This is a multi-line description that\n spans multiple lines."));
break;
case 2:
assertThat(t.getName(), equalTo("following"));
assertThat(t.getValue(), equalTo("true"));
break;
}
}
}
use of org.mozilla.jss.asn1.Tag in project clinical_quality_language by cqframework.
the class Cql2ElmVisitor method processTags.
private void processTags(ParseTree tree, Object o) {
if (libraryBuilder.isCompatibleWith("1.5")) {
if (o instanceof Element) {
Element element = (Element) o;
if (!(tree instanceof cqlParser.LibraryContext)) {
if (element instanceof UsingDef || element instanceof IncludeDef || element instanceof CodeSystemDef || element instanceof ValueSetDef || element instanceof CodeDef || element instanceof ConceptDef || element instanceof ParameterDef || element instanceof ContextDef || element instanceof ExpressionDef) {
List<Tag> tags = getTags(tree);
if (tags != null && tags.size() > 0) {
Annotation a = getAnnotation(element);
if (a == null) {
a = buildAnnotation();
element.getAnnotation().add(a);
}
// tags, and there is currently nothing that would add tags other than being processed from comments
if (a.getT().size() == 0) {
a.getT().addAll(tags);
}
}
}
} else {
if (libraryInfo.getDefinition() != null && libraryInfo.getHeaderInterval() != null) {
List<Tag> tags = getTags(libraryInfo.getHeader());
if (tags != null && tags.size() > 0) {
Annotation a = getAnnotation(libraryBuilder.getLibrary());
if (a == null) {
a = buildAnnotation();
libraryBuilder.getLibrary().getAnnotation().add(a);
}
a.getT().addAll(tags);
}
}
}
}
}
}
Aggregations