Example #1
0
        internal string GetFieldType(Field salesForceField, string objectName = "Not specified")
        {
            var valueFound = FieldDictionary.TryGetValue(salesForceField.type, out var value);

            if (valueFound)
            {
                return(value);
            }
            Log.Logger.Fatal($"ObjectName: {objectName} Field Type: {salesForceField.type} Field Name : {salesForceField.name} Field Length: {salesForceField.length}");
            return("string");
        }
Example #2
0
        private string GetField(Field salesForceField)
        {
            var valueFound = FieldDictionary.TryGetValue(salesForceField.type, out var value);

            if (valueFound)
            {
                return(value);
            }
            Log.Logger.Error($"Field Type: {salesForceField.type} Field Name : {salesForceField.name} Field Length: {salesForceField.length}");
            return("NOT FOUND");
        }
Example #3
0
        protected virtual bool IsFieldMatch(string sourceFieldValue, FieldDictionary targetFields, string fieldId)
        {
            // note that returning "true" means the values DO NOT MATCH EACH OTHER.

            if (sourceFieldValue == null)
            {
                return(false);
            }

            // it's a "match" if the target item does not contain the source field
            string targetFieldValue;

            if (!targetFields.TryGetValue(fieldId, out targetFieldValue))
            {
                return(true);
            }

            return(!sourceFieldValue.Equals(targetFieldValue));
        }
Example #4
0
        protected virtual bool AnyFieldMatch(FieldDictionary sourceFields, FieldDictionary targetFields, ISourceItem existingItem, ISerializedItem serializedItem, DeferredLogWriter <ISerializedAsMasterEvaluatorLogger> deferredUpdateLog, ItemVersion version = null)
        {
            if (sourceFields == null)
            {
                return(false);
            }

            return(sourceFields.Any(x =>
            {
                if (!_fieldPredicate.Includes(x.Key).IsIncluded)
                {
                    return false;
                }

                if (!existingItem.IsFieldComparable(x.Key))
                {
                    return false;
                }

                bool isMatch = IsFieldMatch(x.Value, targetFields, x.Key);
                if (isMatch)
                {
                    deferredUpdateLog.AddEntry(logger =>
                    {
                        string sourceFieldValue;
                        targetFields.TryGetValue(x.Key, out sourceFieldValue);

                        if (version == null)
                        {
                            logger.IsSharedFieldMatch(serializedItem, x.Key, x.Value, sourceFieldValue);
                        }
                        else
                        {
                            logger.IsVersionedFieldMatch(serializedItem, version, x.Key, x.Value, sourceFieldValue);
                        }
                    });
                }
                return isMatch;
            }));
        }