public void renameEntity(String entityName, String newEntityName) { NamedNodeTemplate template = nodeTemplates.remove(entityName); if (template != null) { template.rename(newEntityName); nodeTemplates.put(newEntityName, template); } NamedNodeType nodeType = nodeTypes.remove(entityName); if (nodeType != null) { nodeType.rename(newEntityName); nodeTypes.put(newEntityName, nodeType); } NamedStruct struct = structTypes.remove(entityName); if (struct != null) { struct.rename(newEntityName); structTypes.put(newEntityName, struct); } }
public INamedEntity registerType(String name, IType type) { if (type instanceof ITypeStruct) { ITypeStruct struct = (ITypeStruct) type; final TypeStruct unnamed; if (nodeTypes.containsKey(name)) return null; if (struct instanceof TypeStruct) unnamed = (TypeStruct) struct; else { ITypeStruct parentType = struct.baseType(); if (parentType != null && !(parentType instanceof TypeStruct)) parentType = structTypes.get(((INamedEntity) parentType).name()); unnamed = new TypeStruct( (TypeStruct) parentType, struct.description(), struct.declaredProperties()); } NamedStruct t = new NamedStruct(name, unnamed); structTypes.put(name, t); return t; } else if (type instanceof ICoercedType) { coercedTypes.put(name, new NamedCoercedType(name, (ICoercedType) type)); } return null; }
public INamedEntity registerNodeTemplate(String name, INodeTemplate nodeType) { final NodeTemplate unnamed; if (nodeTypes.containsKey(name)) return null; if (nodeType instanceof NodeTemplate) unnamed = (NodeTemplate) nodeType; else { INodeType parentType = nodeType.baseType(); if (parentType != null && !(parentType instanceof NodeTemplate)) parentType = nodeTypes.get(((INamedEntity) parentType).name()); unnamed = new NodeTemplate( (NodeType) parentType, nodeType.description(), nodeType.declaredProperties(), nodeType.declaredAttributes()); } NamedNodeTemplate t = new NamedNodeTemplate(name, unnamed); nodeTemplates.put(name, t); return t; }