/// <summary>Creates a new, empty Entity object of the type specified</summary> /// <param name="entityTypeToCreate">The entity type to create.</param> /// <returns>A new, empty Entity object.</returns> public static IEntity Create(policyDB.EntityType entityTypeToCreate) { IEntityFactory factoryToUse = null; switch (entityTypeToCreate) { case policyDB.EntityType.AttributeEntity: factoryToUse = new AttributeEntityFactory(); break; case policyDB.EntityType.AttributeTypeEntity: factoryToUse = new AttributeTypeEntityFactory(); break; case policyDB.EntityType.AttributeValueEntity: factoryToUse = new AttributeValueEntityFactory(); break; case policyDB.EntityType.CombineModeEntity: factoryToUse = new CombineModeEntityFactory(); break; case policyDB.EntityType.ContextEntity: factoryToUse = new ContextEntityFactory(); break; case policyDB.EntityType.DecisionNodeEntity: factoryToUse = new DecisionNodeEntityFactory(); break; case policyDB.EntityType.EffectEntity: factoryToUse = new EffectEntityFactory(); break; case policyDB.EntityType.LibraryEntity: factoryToUse = new LibraryEntityFactory(); break; case policyDB.EntityType.PolicyEntity: factoryToUse = new PolicyEntityFactory(); break; case policyDB.EntityType.PolicyDocumentEntity: factoryToUse = new PolicyDocumentEntityFactory(); break; case policyDB.EntityType.PolicyLinkEntity: factoryToUse = new PolicyLinkEntityFactory(); break; case policyDB.EntityType.QueryEntity: factoryToUse = new QueryEntityFactory(); break; case policyDB.EntityType.QueryValueEntity: factoryToUse = new QueryValueEntityFactory(); break; case policyDB.EntityType.RuleEntity: factoryToUse = new RuleEntityFactory(); break; case policyDB.EntityType.TargetEntity: factoryToUse = new TargetEntityFactory(); break; case policyDB.EntityType.TargetConditionEntity: factoryToUse = new TargetConditionEntityFactory(); break; case policyDB.EntityType.UriComponentEntity: factoryToUse = new UriComponentEntityFactory(); break; } IEntity toReturn = null; if (factoryToUse != null) { toReturn = factoryToUse.Create(); } return(toReturn); }
/// <summary>Creates a new, empty Entity object of the type specified</summary> /// <param name="entityTypeToCreate">The entity type to create.</param> /// <returns>A new, empty Entity object.</returns> public static IEntity Create(policyDB.EntityType entityTypeToCreate) { IEntityFactory factoryToUse = null; switch(entityTypeToCreate) { case policyDB.EntityType.AttributeEntity: factoryToUse = new AttributeEntityFactory(); break; case policyDB.EntityType.AttributeTypeEntity: factoryToUse = new AttributeTypeEntityFactory(); break; case policyDB.EntityType.AttributeValueEntity: factoryToUse = new AttributeValueEntityFactory(); break; case policyDB.EntityType.CombineModeEntity: factoryToUse = new CombineModeEntityFactory(); break; case policyDB.EntityType.ContextEntity: factoryToUse = new ContextEntityFactory(); break; case policyDB.EntityType.DecisionNodeEntity: factoryToUse = new DecisionNodeEntityFactory(); break; case policyDB.EntityType.EffectEntity: factoryToUse = new EffectEntityFactory(); break; case policyDB.EntityType.LibraryEntity: factoryToUse = new LibraryEntityFactory(); break; case policyDB.EntityType.PolicyEntity: factoryToUse = new PolicyEntityFactory(); break; case policyDB.EntityType.PolicyDocumentEntity: factoryToUse = new PolicyDocumentEntityFactory(); break; case policyDB.EntityType.PolicyLinkEntity: factoryToUse = new PolicyLinkEntityFactory(); break; case policyDB.EntityType.QueryEntity: factoryToUse = new QueryEntityFactory(); break; case policyDB.EntityType.QueryValueEntity: factoryToUse = new QueryValueEntityFactory(); break; case policyDB.EntityType.RuleEntity: factoryToUse = new RuleEntityFactory(); break; case policyDB.EntityType.TargetEntity: factoryToUse = new TargetEntityFactory(); break; case policyDB.EntityType.TargetConditionEntity: factoryToUse = new TargetConditionEntityFactory(); break; case policyDB.EntityType.UriComponentEntity: factoryToUse = new UriComponentEntityFactory(); break; } IEntity toReturn = null; if(factoryToUse != null) { toReturn = factoryToUse.Create(); } return toReturn; }