コード例 #1
0
        private void addValueInFirstPass(XElement parent, IValue value, ICompositeMapperBuilder currentMapper, string entityName,
                                         EntityXmlMappingData xmlMappingData, PropertyAuditingData propertyAuditingData,
                                         bool insertable, bool processModifiedFlag)
        {
            var type = value.Type;

            if (BasicMetadataGenerator.AddBasic(parent, propertyAuditingData, value, currentMapper, insertable, false))
            {
                // The property was mapped by the basic generator.
            }
            else if (type is ComponentType)
            {
                componentMetadataGenerator.AddComponent(parent, propertyAuditingData, value, currentMapper, entityName,
                                                        xmlMappingData, true, insertable);
            }
            else
            {
                if (!processedInSecondPass(type))
                {
                    // If we got here in the first pass, it means the basic mapper didn't map it, and none of the
                    // above branches either.
                    ThrowUnsupportedTypeException(type, entityName, propertyAuditingData.Name);
                }
                return;
            }
            addModifiedFlagIfNeeded(parent, propertyAuditingData, processModifiedFlag);
        }
コード例 #2
0
 public AuditMetadataGenerator(IMetaDataStore metaDataStore,
                               Cfg.Configuration cfg,
                               GlobalConfiguration globalCfg,
                               AuditEntitiesConfiguration verEntCfg,
                               XElement revisionInfoRelationMapping,
                               AuditEntityNameRegister auditEntityNameRegister)
 {
     Cfg            = cfg;
     GlobalCfg      = globalCfg;
     VerEntCfg      = verEntCfg;
     _metaDataStore = metaDataStore;
     this.revisionInfoRelationMapping = revisionInfoRelationMapping;
     BasicMetadataGenerator           = new BasicMetadataGenerator();
     componentMetadataGenerator       = new ComponentMetadataGenerator(this);
     idMetadataGenerator              = new IdMetadataGenerator(this);
     toOneRelationMetadataGenerator   = new ToOneRelationMetadataGenerator(this);
     AuditEntityNameRegister          = auditEntityNameRegister;
     EntitiesConfigurations           = new Dictionary <string, EntityConfiguration>();
     NotAuditedEntitiesConfigurations = new Dictionary <string, EntityConfiguration>();
     entitiesJoins = new Dictionary <string, IDictionary <Join, XElement> >();
 }
コード例 #3
0
        public AuditMetadataGenerator(Cfg.Configuration cfg, 
										GlobalConfiguration globalCfg,
										AuditEntitiesConfiguration verEntCfg,
										IAuditStrategy auditStrategy,
										XmlElement revisionInfoRelationMapping,
										AuditEntityNameRegister auditEntityNameRegister)
        {
            Cfg = cfg;
            GlobalCfg = globalCfg;
            VerEntCfg = verEntCfg;
            AuditStrategy = auditStrategy;
            this.revisionInfoRelationMapping = revisionInfoRelationMapping;
            BasicMetadataGenerator = new BasicMetadataGenerator();
            componentMetadataGenerator = new ComponentMetadataGenerator(this);
            idMetadataGenerator = new IdMetadataGenerator(this);
            toOneRelationMetadataGenerator = new ToOneRelationMetadataGenerator(this);
            AuditEntityNameRegister = auditEntityNameRegister;
            EntitiesConfigurations = new Dictionary<string, EntityConfiguration>();
            NotAuditedEntitiesConfigurations = new Dictionary<string, EntityConfiguration>();
            entitiesJoins = new Dictionary<string, IDictionary<Join, XmlElement>>();
        }
コード例 #4
0
        //@SuppressWarnings({"unchecked"})
        public void AddValue(XmlElement parent, IValue value, ICompositeMapperBuilder currentMapper, String entityName,
                      EntityXmlMappingData xmlMappingData, PropertyAuditingData propertyAuditingData,
                      bool insertable, bool firstPass)
        {
            IType type = value.Type;

            // only first pass
            if (firstPass)
            {
                if (BasicMetadataGenerator.AddBasic(parent, propertyAuditingData, value, currentMapper,
                        insertable, false))
                {
                    // The property was mapped by the basic generator.
                    return;
                }
            }

            if (type is ComponentType)
            {
                // both passes
                componentMetadataGenerator.AddComponent(parent, propertyAuditingData, value, currentMapper,
                        entityName, xmlMappingData, firstPass);
            }
            else if (type is ManyToOneType)
            {
                // only second pass
                if (!firstPass)
                {
                    toOneRelationMetadataGenerator.AddToOne(parent, propertyAuditingData, value, currentMapper,
                            entityName, insertable);
                }
            }
            else if (type is OneToOneType)
            {
                // only second pass
                if (!firstPass)
                {
                    toOneRelationMetadataGenerator.AddOneToOneNotOwning(propertyAuditingData, value,
                            currentMapper, entityName);
                }
            }
            else if (type is CollectionType)
            {
                // only second pass
                if (!firstPass)
                {
                    CollectionMetadataGenerator collectionMetadataGenerator = new CollectionMetadataGenerator(this,
                            (Mapping.Collection)value, currentMapper, entityName, xmlMappingData,
                            propertyAuditingData);
                    collectionMetadataGenerator.AddCollection();
                }
            }
            else
            {
                if (firstPass)
                {
                    // If we got here in the first pass, it means the basic mapper didn't map it, and none of the
                    // above branches either.
                    ThrowUnsupportedTypeException(type, entityName, propertyAuditingData.Name);
                }
            }
        }