The type definition is now created for every type (for *TypeDefinition
too)
This commit is contained in:
parent
6354f99103
commit
da8082d55f
|
@ -6,12 +6,10 @@ import java.net.URL;
|
||||||
import java.security.Key;
|
import java.security.Key;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.gcube.common.encryption.SymmetricKey;
|
import org.gcube.common.encryption.SymmetricKey;
|
||||||
|
@ -225,33 +223,40 @@ public class DatabaseEnvironment {
|
||||||
|
|
||||||
schemaSecurityContext.create();
|
schemaSecurityContext.create();
|
||||||
|
|
||||||
SchemaAction schemaAction = new SchemaActionImpl();
|
|
||||||
schemaAction.managePropertyClass(BaseProperty.class);
|
|
||||||
schemaAction.managePropertyClass(Header.class);
|
|
||||||
schemaAction.managePropertyClass(PropertyDefinition.class);
|
|
||||||
schemaAction.managePropertyClass(PropertyTypeDefinition.class);
|
|
||||||
schemaAction.manageEntityClass(BaseEntity.class);
|
|
||||||
schemaAction.manageEntityClass(EntityTypeDefinition.class);
|
|
||||||
schemaAction.manageRelationClass(BaseRelation.class);
|
|
||||||
schemaAction.manageRelationClass(RelationTypeDefinition.class);
|
|
||||||
|
|
||||||
|
List<Class<? extends ISManageable>> definitionToBeCreated = new ArrayList<>();
|
||||||
Set<Class<? extends ISManageable>> definitionToBeCreated = new HashSet<>();
|
|
||||||
definitionToBeCreated.add(BaseProperty.class);
|
definitionToBeCreated.add(BaseProperty.class);
|
||||||
definitionToBeCreated.add(Header.class);
|
definitionToBeCreated.add(Header.class);
|
||||||
|
definitionToBeCreated.add(PropertyDefinition.class);
|
||||||
|
definitionToBeCreated.add(PropertyTypeDefinition.class);
|
||||||
definitionToBeCreated.add(BaseEntity.class);
|
definitionToBeCreated.add(BaseEntity.class);
|
||||||
|
definitionToBeCreated.add(EntityTypeDefinition.class);
|
||||||
definitionToBeCreated.add(BaseRelation.class);
|
definitionToBeCreated.add(BaseRelation.class);
|
||||||
|
definitionToBeCreated.add(RelationTypeDefinition.class);
|
||||||
|
|
||||||
|
SchemaAction schemaAction = new SchemaActionImpl();
|
||||||
|
|
||||||
|
for(Class<? extends ISManageable> clz : definitionToBeCreated) {
|
||||||
|
|
||||||
|
if(BaseProperty.class.isAssignableFrom(clz)) {
|
||||||
|
schemaAction.managePropertyClass((Class<? extends BaseProperty>) clz);
|
||||||
|
} else if(BaseEntity.class.isAssignableFrom(clz)) {
|
||||||
|
schemaAction.manageEntityClass((Class<? extends BaseEntity>) clz);
|
||||||
|
} else if(BaseRelation.class.isAssignableFrom(clz)) {
|
||||||
|
schemaAction.manageRelationClass((Class<? extends BaseRelation<? extends BaseEntity, ? extends BaseEntity>>) clz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(Class<? extends ISManageable> clz : definitionToBeCreated) {
|
for(Class<? extends ISManageable> clz : definitionToBeCreated) {
|
||||||
ERManagement<? extends OElement> erManagement = null;
|
ERManagement<? extends OElement> erManagement = null;
|
||||||
|
|
||||||
if(BaseEntity.class.isAssignableFrom(clz)) {
|
if(BaseProperty.class.isAssignableFrom(clz)) {
|
||||||
|
erManagement = new PropertyTypeDefinitionManagement();
|
||||||
|
} else if(BaseEntity.class.isAssignableFrom(clz)) {
|
||||||
erManagement = new EntityTypeDefinitionManagement();
|
erManagement = new EntityTypeDefinitionManagement();
|
||||||
} else if(BaseRelation.class.isAssignableFrom(clz)) {
|
} else if(BaseRelation.class.isAssignableFrom(clz)) {
|
||||||
erManagement = new RelationTypeDefinitionManagement();
|
erManagement = new RelationTypeDefinitionManagement();
|
||||||
} else if(BaseProperty.class.isAssignableFrom(clz)) {
|
}
|
||||||
erManagement = new PropertyTypeDefinitionManagement();
|
|
||||||
}
|
|
||||||
|
|
||||||
erManagement.setJson(TypeBinder.serializeType(clz));
|
erManagement.setJson(TypeBinder.serializeType(clz));
|
||||||
erManagement.create();
|
erManagement.create();
|
||||||
|
|
Loading…
Reference in New Issue