/** * Copies the given property data, except the name. * @param newName New name. * @param propertyData Property data to copy the rest of properties from. */ public PropertyData(String newName, PropertyData propertyData) { this.Name = newName; this.BeanName = propertyData.BeanName; this.AccessType = propertyData.AccessType; this.Store = propertyData.Store; }
/// <summary> /// Copies the given property data, except the name. /// </summary> /// <param name="newName">New name</param> /// <param name="propertyData">Property data to copy the rest of properties from.</param> public PropertyData(string newName, PropertyData propertyData) { Name = newName; BeanName = propertyData.BeanName; AccessType = propertyData.AccessType; store = propertyData.store; }
public RevisionInfoConfiguration() { revisionInfoEntityName = "NHibernate.Envers.DefaultRevisionEntity, Envers.NET"; revisionInfoIdData = new PropertyData("id", "id", "field", ModificationStore._NULL); revisionInfoTimestampData = new PropertyData("RevisionDate", "RevisionDate", "field", ModificationStore._NULL); revisionInfoTimestampType = new DateTimeType(); //ORIG: LongType(); revisionPropType = "integer"; }
public DefaultTrackingModifiedEntitiesRevisionInfoGenerator(string revisionInfoEntityName, System.Type revisionInfoType, IRevisionListener revisionListener, PropertyData revisionInfoTimestampData, bool timestampAsDate, PropertyData modifiedEntityNamesData) : base(revisionInfoEntityName, revisionInfoType, revisionListener, revisionInfoTimestampData, timestampAsDate) { modifiedEntityTypesGetter = ReflectionTools.GetGetter(revisionInfoType, modifiedEntityNamesData); modifiedEntityTypesSetter = ReflectionTools.GetSetter(revisionInfoType, modifiedEntityNamesData); }
public DefaultRevisionInfoGenerator(string revisionInfoEntityName, System.Type revisionInfoType, IRevisionListener revisionListener, PropertyData revisionInfoTimestampData, bool timestampAsDate) { _revisionInfoEntityName = revisionInfoEntityName; _revisionInfoType = revisionInfoType; _timestampAsDate = timestampAsDate; _revisionTimestampSetter = ReflectionTools.GetSetter(revisionInfoType, revisionInfoTimestampData); _listener = revisionListener; }
public DefaultRevisionInfoGenerator(String revisionInfoEntityName, System.Type revisionInfoT, //Class<? extends RevisionListener> listenerClass, PropertyData revisionInfoTimestampData /*, bool timestampAsDate */) { this.revisionInfoEntityName = revisionInfoEntityName; this.revisionInfoType = revisionInfoT; this.revisionInfoTimestampData = revisionInfoTimestampData; //if (!listenerClass.equals(RevisionListener.class)) { // // This is not the default value. // try { // evtDelegate = listenerClass.newInstance(); // } catch (InstantiationException e) { // throw new MappingException(e); // } catch (IllegalAccessException e) { // throw new MappingException(e); // } //} else { // Default evtDelegate - none newRevisionDelegate = null; //} }
public void Add(PropertyData propertyData) { ids.Add(propertyData, new SingleIdMapper(propertyData)); }
/// <summary> /// Copies the given property data, except the name. /// </summary> /// <param name="newName">New name</param> /// <param name="propertyData">Property data to copy the rest of properties from.</param> public PropertyData(string newName, PropertyData propertyData) { Name = newName; BeanName = propertyData.BeanName; AccessType = propertyData.AccessType; }
private void searchForRevisionInfoCfgInProperties(System.Type t, ref bool revisionNumberFound, ref bool revisionTimestampFound, String accessType) { foreach (PropertyInfo property in t.GetProperties()) { //RevisionNumber revisionNumber = property.getAnnotation(RevisionNumber.class); RevisionNumberAttribute revisionNumber = (RevisionNumberAttribute)Attribute.GetCustomAttribute(property, typeof(RevisionNumberAttribute)); RevisionTimestampAttribute revisionTimestamp = (RevisionTimestampAttribute)Attribute.GetCustomAttribute(property, typeof(RevisionTimestampAttribute)); if (revisionNumber != null) { if (revisionNumberFound) { throw new MappingException("Only one property may have the attribute [RevisionNumber]!"); } System.Type revNrType = property.PropertyType; if (revNrType.Equals( typeof(int)) || revNrType.Equals( typeof(Int16)) || revNrType.Equals( typeof(Int32)) || revNrType.Equals( typeof(Int64))) { revisionInfoIdData = new PropertyData(property.Name, property.Name, accessType, ModificationStore._NULL); revisionNumberFound = true; } else if (revNrType.Equals(typeof(long))) { revisionInfoIdData = new PropertyData(property.Name, property.Name, accessType, ModificationStore._NULL); revisionNumberFound = true; // The default is integer revisionPropType = "long"; } else { throw new MappingException("The field decorated with [RevisionNumberAttribute] must be of type " + "int, Int16, Int32, Int64 or long"); } // Getting the @Column definition of the revision number property, to later use that info to // generate the same mapping for the relation from an audit table's revision number to the // revision entity revision number. ColumnAttribute revisionPropColumn = (ColumnAttribute)Attribute.GetCustomAttribute(property,typeof(ColumnAttribute)); if (revisionPropColumn != null) { revisionPropSqlType = revisionPropColumn.columnDefinition; } } if (revisionTimestamp != null) { if (revisionTimestampFound) { throw new MappingException("Only one property may be decorated with [RevisionTimestampAttribute]!"); } System.Type revisionTimestampType = property.GetType(); if (typeof(DateTime).Equals(revisionTimestampType)) { revisionInfoTimestampData = new PropertyData(property.Name, property.Name, accessType, ModificationStore._NULL); revisionTimestampFound = true; } else { throw new MappingException("The field decorated with @RevisionTimestamp must be of type DateTime"); } } } }
public static ISetter GetSetter(System.Type cls, PropertyData propertyData) { return GetSetter(cls, propertyData.BeanName, propertyData.AccessType); }
public RevisionInfoNumberReader(System.Type revisionInfoType, PropertyData revisionInfoIdData) { this.revisionIdType = revisionInfoType; this.pd = revisionInfoIdData; // ReflectionTools.getGetter(revisionInfoClass, revisionInfoIdData); }