Redesigning E/R instance definition
This commit is contained in:
parent
5893cfd61a
commit
88fe4e3ff3
|
@ -71,7 +71,6 @@ import com.orientechnologies.orient.core.record.OElement;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class DatabaseEnvironment {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DatabaseEnvironment.class);
|
||||
|
|
|
@ -138,9 +138,12 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
|||
this.accessType = accessType;
|
||||
|
||||
this.ignoreKeys = new HashSet<String>();
|
||||
this.ignoreKeys.add(Element.CLASS_PROPERTY);
|
||||
this.ignoreKeys.add(Element.SUPERCLASSES_PROPERTY);
|
||||
this.ignoreKeys.add(IdentifiableElement.UUID_PROPERTY);
|
||||
this.ignoreKeys.add(IdentifiableElement.METADATA_PROPERTY);
|
||||
|
||||
this.ignoreStartWithKeys = new HashSet<String>();
|
||||
|
||||
this.ignoreStartWithKeys.add(ElementManagement.AT);
|
||||
this.ignoreStartWithKeys.add(ElementManagement.UNDERSCORE);
|
||||
|
||||
|
@ -433,11 +436,16 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
|||
try {
|
||||
setOperation(Operation.CREATE);
|
||||
|
||||
reallyCreate();
|
||||
UUIDManager uuidManager = UUIDManager.getInstance();
|
||||
|
||||
if(uuid == null) {
|
||||
uuid = UUIDManager.getInstance().generateValidRandomUUID();
|
||||
uuid = uuidManager.generateValidRandomUUID();
|
||||
}else {
|
||||
uuid = uuidManager.validateUUID(uuid);
|
||||
}
|
||||
|
||||
element = reallyCreate();
|
||||
|
||||
element.setProperty(IdentifiableElement.UUID_PROPERTY, uuid.toString());
|
||||
|
||||
MetadataUtility.addMetadata(element);
|
||||
|
@ -1071,17 +1079,6 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
|||
|
||||
for(String key : properties.keySet()) {
|
||||
try {
|
||||
|
||||
if(key.compareTo(IdentifiableElement.METADATA_PROPERTY)==0) {
|
||||
// We never update the metadata with the value provided
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key.compareTo(IdentifiableElement.UUID_PROPERTY)==0) {
|
||||
// We never update the uuid with the value provided
|
||||
continue;
|
||||
}
|
||||
|
||||
JsonNode value = properties.get(key);
|
||||
|
||||
OProperty oProperty = oClass.getProperty(key);
|
||||
|
|
|
@ -43,8 +43,6 @@ public abstract class EntityElementManagement<E extends EntityElement, ET extend
|
|||
protected EntityElementManagement(AccessType accessType) {
|
||||
super(accessType);
|
||||
|
||||
this.ignoreKeys.add(EntityElement.METADATA_PROPERTY);
|
||||
|
||||
this.ignoreStartWithKeys.add(IN_PREFIX.toLowerCase());
|
||||
this.ignoreStartWithKeys.add(OUT_PREFIX.toLowerCase());
|
||||
this.ignoreStartWithKeys.add(IN_PREFIX.toUpperCase());
|
||||
|
|
|
@ -513,9 +513,6 @@ public class TypeManagement {
|
|||
newTypeDefinition.getName());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(!(newTypeDefinition instanceof ResourceType)) {
|
||||
// A Resource cannot contains any properties.
|
||||
|
||||
|
|
Loading…
Reference in New Issue