*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
+
package org.onap.aai.schemaif.oxm;
+import com.google.common.collect.Multimap;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.onap.aai.schemaif.SchemaProviderException;
import org.onap.aai.schemaif.SchemaProviderMsgs;
-import com.google.common.collect.Multimap;
-
-
public class RelationshipSchema {
-
public static final String SCHEMA_SOURCE_NODE_TYPE = "from";
public static final String SCHEMA_TARGET_NODE_TYPE = "to";
public static final String SCHEMA_RELATIONSHIP_TYPE = "label";
// A map storing the list of valid edge types for a source/target pair
private Map<String, Set<String>> edgeTypesForNodePair = new HashMap<>();
-
- public RelationshipSchema(Multimap<String, EdgeRule> rules, String props) throws SchemaProviderException, IOException {
+ public RelationshipSchema(Multimap<String, EdgeRule> rules, String props)
+ throws SchemaProviderException, IOException {
HashMap<String, String> properties = new ObjectMapper().readValue(props, HashMap.class);
- // hold the true values of the edge rules by key
+ // hold the true values of the edge rules by key
for (EdgeRule rule : rules.values()) {
String nodePairKey = buildNodePairKey(rule.getFrom(), rule.getTo());
if (edgeTypesForNodePair.get(nodePairKey) == null) {
Set<String> typeSet = new HashSet<String>();
typeSet.add(rule.getLabel());
edgeTypesForNodePair.put(nodePairKey, typeSet);
- }
- else {
+ } else {
edgeTypesForNodePair.get(nodePairKey).add(rule.getLabel());
}
});
}
-
-
public Map<String, Class<?>> lookupRelation(String key) {
return this.relations.get(key);
}
return relationTypes.containsKey(type);
}
-
private String buildRelation(String source, String target, String relation) {
return source + ":" + target + ":" + relation;
}
return source + ":" + target;
}
-
private Class<?> resolveClass(String type) throws SchemaProviderException, ClassNotFoundException {
Class<?> clazz = Class.forName(type);
validateClassTypes(clazz);
}
}
}
-
-