View Javadoc
1   package de.dlr.shepard.neo4Core.dao;
2   
3   import java.util.Map;
4   
5   import de.dlr.shepard.mongoDB.StructuredData;
6   import de.dlr.shepard.util.CypherQueryHelper;
7   
8   public class StructuredDataDAO extends GenericDAO<StructuredData> {
9   
10  	/**
11  	 * Find a structuredData by oid
12  	 *
13  	 * @param containerId StructuredDataContainer ID
14  	 * @param oid         Identifies the structuredData
15  	 *
16  	 * @return the found structuredData or null
17  	 */
18  	public StructuredData find(long containerId, String oid) {
19  		var query = String.format(
20  				"MATCH (c:StructuredDataContainer)-[:structureddata_in_container]->(s:StructuredData {oid: $oid}) WHERE ID(c)=%d %s",
21  				containerId, CypherQueryHelper.getReturnPart("s"));
22  		var results = findByQuery(query, Map.of("oid", oid));
23  		return results.iterator().hasNext() ? results.iterator().next() : null;
24  	}
25  
26  	@Override
27  	public Class<StructuredData> getEntityType() {
28  		return StructuredData.class;
29  	}
30  }