private string DetermineActualDataType(StandardDataType modelType, StandardDataType newType, bool isCdaR1, ErrorLogger errorLogger ) { StandardDataType convertedModelType = modelType; if (cdaR1MappingsToOld.ContainsKey(modelType)) { convertedModelType = cdaR1MappingsToOld.SafeGet(modelType); } string unspecializedModelType = convertedModelType.TypeName.UnspecializedName; string unspecializedNewType = newType.TypeName.UnspecializedName; // allow ANY handlers and collection handlers deal with type changes on their own if (StandardDataType.ANY.Type.Equals(unspecializedModelType) || StandardDataType.IsSetOrList(unspecializedModelType)) { return(modelType.Type); } if (IsValidTypeChange(unspecializedModelType, unspecializedNewType)) { return(MapCdaR1Type(newType, isCdaR1)); } else { string message = System.String.Format("Not able to handle type change from {0} to {1}. Type has been left unchanged.", convertedModelType .Type, newType.Type); errorLogger.LogError(Hl7ErrorCode.UNSUPPORTED_TYPE_CHANGE, ErrorLevel.WARNING, message); return(modelType.Type); } }
public virtual bool CanAdapt(Type fromDataType, string toDataTypeName) { if (IsCOLLECTIONType(fromDataType) && !StandardDataType.IsSetOrList(toDataTypeName)) { return(true); } return(false); }
public virtual string DetermineActualDataType(string modelType, StandardDataType newTypeEnum, bool isCda, bool isR1, ErrorLogger errorLogger) { StandardDataType modelTypeEnum = StandardDataType.GetByTypeName(modelType); if (!isCda || modelTypeEnum == null || newTypeEnum == null || StandardDataType.IsSetOrList(modelType) || NewTypeIsRootOfCurrent (modelTypeEnum, newTypeEnum)) { return(modelType); } return(DetermineActualDataType(modelTypeEnum, newTypeEnum, isCda && isR1, errorLogger)); }
public virtual bool CanAdapt(string fromDataTypeName, Type toDataType) { return(!StandardDataType.IsSetOrList(fromDataTypeName) && IsLISTType(toDataType)); }