Beispiel #1
0
        internal static void MakeReferenceToValueFromOpResult(Dictionary <String, Object> map)
        {
            foreach (KeyValuePair <String, Object> kvp in map)
            {
                Dictionary <String, Object> entry = new Dictionary <String, Object>(map);

                if (entry[kvp.Key] is OpResult)
                {
                    if (OperationTypeUtil.supportIntResultType.Contains(((OpResult)kvp.Value).OperationType))
                    {
                        entry[kvp.Key] = ((OpResult)kvp.Value).MakeReference();
                    }
                    else
                    {
                        throw new ArgumentException(ExceptionMessage.OP_RESULT_FROM_THIS_OPERATION_NOT_SUPPORT_IN_THIS_PLACE);
                    }
                }

                if (entry[kvp.Key] is OpResultValueReference)
                {
                    OpResultValueReference reference = (OpResultValueReference)kvp.Value;

                    if (IsCreatedUpdatedPropName(reference) || IsCreatedBulkResultIndex(reference) || IsFoundPropNameResultIndex(reference))
                    {
                        entry[kvp.Key] = reference.MakeReference();
                    }
                    else
                    {
                        throw new ArgumentException(ExceptionMessage.OP_RESULT_FROM_THIS_OPERATION_NOT_SUPPORT_IN_THIS_PLACE);
                    }
                }
            }
        }
        public OpResult Update(OpResultValueReference result, Dictionary <String, Object> changes)
        {
            if (result == null)
            {
                throw new ArgumentException(ExceptionMessage.NULL_OP_RESULT);
            }

            if (result.ResultIndex == null || result.PropName != null)
            {
                throw new ArgumentException(ExceptionMessage.OP_RESULT_INDEX_YES_PROP_NAME_NOT);
            }

            if (OperationTypeUtil.supportCollectionEntityDescriptionType.Contains(result.OpResult.OperationType))
            {
                changes["objectId"] = result.ResolveTo("objectId").MakeReference();
            }
            else if (OperationTypeUtil.supportListIdsResultType.Contains(result.OpResult.OperationType))
            {
                changes["objectId"] = result.MakeReference();
            }
            else
            {
                throw new ArgumentException(ExceptionMessage.REF_TYPE_NOT_SUPPORT);
            }

            return(Update(result.OpResult.TableName, changes));
        }
Beispiel #3
0
        public OpResult AddOperation(OperationType operationType, OpResultValueReference parentObject, String columnName, String whereClauseForChildren)
        {
            Dictionary <String, Object> referenceToObjectId = GetReferenceToParentFromOpResultValue(parentObject);

            return(AddOperation(operationType, parentObject.OpResult.TableName, referenceToObjectId, columnName,
                                whereClauseForChildren, null));
        }
Beispiel #4
0
        internal static void MakeReferenceToObjectIdFromOpResult(List <Object> listObjectIds)
        {
            IEnumerator <Object> iterator = listObjectIds.GetEnumerator();

            while (iterator.MoveNext())
            {
                Object tempEntity = iterator.MoveNext();

                if (tempEntity is OpResult)
                {
                    throw new ArgumentException(ExceptionMessage.OP_RESULT_FROM_THIS_OPERATION_NOT_SUPPORT_IN_THIS_PLACE);
                }

                if (tempEntity is OpResultValueReference)
                {
                    OpResultValueReference reference = (OpResultValueReference)tempEntity;

                    if (IsCreatedUpdatedObjectId(reference) || IsCreatedBulkResultIndex(reference) || IsFoundPropNameResultIndex(reference))
                    {
                        tempEntity = reference.MakeReference();
                    }
                    else
                    {
                        throw new ArgumentException(ExceptionMessage.OP_RESULT_FROM_THIS_OPERATION_NOT_SUPPORT_IN_THIS_PLACE);
                    }
                }
            }
        }
        public OpResult Update(OpResultValueReference result, String propertyName, Object propertyValue)
        {
            Dictionary <String, Object> changes = new Dictionary <String, Object>();

            changes[propertyName] = propertyValue;

            return(Update(result, changes));
        }
Beispiel #6
0
        public OpResult AddOperation(OperationType operationType, OpResultValueReference parentObject, String columnName, OpResult children)
        {
            Dictionary <String, Object> referenceToObjectId = GetReferenceToParentFromOpResultValue(parentObject);

            CheckOpResultForChildren(children);

            return(AddOperation(operationType, parentObject.OpResult.TableName, referenceToObjectId, columnName,
                                null, children.MakeReference()));
        }
Beispiel #7
0
        public OpResult AddOperation(OperationType operationType, OpResultValueReference parentObject, String columnName,
                                     List <Dictionary <String, Object> > childrenMaps)
        {
            Dictionary <String, Object> referenceToObjectId = GetReferenceToParentFromOpResultValue(parentObject);
            List <Object> childrenIds = GetChildrenFromListMap(childrenMaps);

            return(AddOperation(operationType, parentObject.OpResult.TableName, referenceToObjectId, columnName,
                                null, childrenIds));
        }
Beispiel #8
0
        public OpResult AddOperation(OperationType operationType, OpResultValueReference parentObject, String columnName, String[] childrenObjectIds)
        {
            Dictionary <String, Object> referenceToObjectId = GetReferenceToParentFromOpResultValue(parentObject);

            if (childrenObjectIds == null || childrenObjectIds.Length == 0)
            {
                throw new ArgumentException(ExceptionMessage.NULL_BULK);
            }

            return(AddOperation(operationType, parentObject.OpResult.TableName, referenceToObjectId, columnName,
                                null, childrenObjectIds));
        }
Beispiel #9
0
        public OpResult AddOperation <E>(OperationType operationType, OpResultValueReference parentObject, String columnName,
                                         List <E> childrenInstances)
        {
            if (childrenInstances == null || childrenInstances.Count == 0)
            {
                throw new ArgumentException(ExceptionMessage.NULL_BULK);
            }

            Dictionary <String, Object> referenceToObjectId = GetReferenceToParentFromOpResultValue(parentObject);
            List <String> childrenIds = GetChildrenFromArrayInstances(childrenInstances);

            return(AddOperation(operationType, parentObject.OpResult.TableName, referenceToObjectId, columnName,
                                null, childrenIds));
        }
Beispiel #10
0
        private Dictionary <String, Object> GetReferenceToParentFromOpResultValue(OpResultValueReference parentObject)
        {
            if (parentObject == null)
            {
                throw new ArgumentException(ExceptionMessage.NULL_OP_RESULT_VALUE_REFERENCE);
            }

            if (parentObject.ResultIndex == null || parentObject.PropName == null)
            {
                throw new ArgumentException(ExceptionMessage.OP_RESULT_INDEX_YES_PROP_NAME_NOT);
            }

            return(TransactionHelper.ConvertCreateBulkOrFindResultIndexToObjectId(parentObject));
        }
        public OpResult Delete(OpResultValueReference resultIndex)
        {
            if (resultIndex == null)
            {
                throw new ArgumentException(ExceptionMessage.NULL_OP_RESULT_VALUE_REFERENCE);
            }

            if (resultIndex.ResultIndex == null || resultIndex.PropName != null)
            {
                throw new ArgumentException(ExceptionMessage.OP_RESULT_INDEX_YES_PROP_NAME_NOT);
            }

            Dictionary <String, Object> referenceToObjectId = TransactionHelper.ConvertCreateBulkOrFindResultIndexToObjectId(resultIndex);
            String          operationResultId = opResultIdGenerator.GenerateOpResultId(OperationType.DELETE, resultIndex.OpResult.TableName);
            OperationDelete operationDelete   = new OperationDelete(OperationType.DELETE, resultIndex.OpResult.TableName,
                                                                    operationResultId, referenceToObjectId);

            operations.AddLast(operationDelete);
            return(TransactionHelper.MakeOpResult(resultIndex.OpResult.TableName, operationResultId, OperationType.DELETE));
        }
 public OpResult DeleteRelation(OpResultValueReference parentObject, String columnName, List <Dictionary <String, Object> > childrenMaps)
 {
     return(relationOperation.AddOperation(OperationType.DELETE_RELATION, parentObject, columnName, childrenMaps));
 }
 public OpResult DeleteRelation(OpResultValueReference parentObject, String columnName, String whereClauseForChildren)
 {
     return(relationOperation.AddOperation(OperationType.DELETE_RELATION, parentObject, columnName, whereClauseForChildren));
 }
Beispiel #14
0
 public OpResult AddToRelation(OpResultValueReference parentObject, string columnName, string whereClauseForChildren)
 {
     return(relationOperation.AddOperation(OperationType.ADD_RELATION, parentObject, columnName, whereClauseForChildren));
 }
Beispiel #15
0
 public OpResult AddToRelation(OpResultValueReference parentObject, string columnName, List <Dictionary <string, object> > childrenMaps)
 {
     return(relationOperation.AddOperation(OperationType.ADD_RELATION, parentObject, columnName, childrenMaps));
 }
Beispiel #16
0
 public OpResult DeleteRelation(OpResultValueReference parentObject, String columnName, List <Dictionary <String, Object> > childrenMaps)
 {
     return(unitOfWorkDeleteRelation.DeleteRelation(parentObject, columnName, childrenMaps));
 }
Beispiel #17
0
 public OpResult DeleteRelation(OpResultValueReference parentObject, String columnName, String[] childrenObjectIds)
 {
     return(unitOfWorkDeleteRelation.DeleteRelation(parentObject, columnName, childrenObjectIds));
 }
Beispiel #18
0
 public OpResult Update(OpResultValueReference result, String propertyName, Object propertyValue)
 {
     return(unitOfWorkUpdate.Update(result, propertyName, propertyValue));
 }
Beispiel #19
0
 public OpResult Delete(OpResultValueReference resultIndex)
 {
     return(unitOfWorkDelete.Delete(resultIndex));
 }
 public OpResult DeleteRelation(OpResultValueReference parentObject, String columnName, String[] childrenObjectIds)
 {
     return(relationOperation.AddOperation(OperationType.DELETE_RELATION, parentObject, columnName, childrenObjectIds));
 }
 public OpResult DeleteRelation <E>(OpResultValueReference parentObject, String columnName, List <E> childrenInstances)
 {
     return(relationOperation.AddOperation(OperationType.DELETE_RELATION, parentObject, columnName, childrenInstances));
 }
Beispiel #22
0
 private static Boolean IsCreatedUpdatedPropName(OpResultValueReference reference)
 {
     return(OperationTypeUtil.supportEntityDescriptionResultType.Contains(reference.OpResult.OperationType) &&
            reference.PropName == null &&
            reference.ResultIndex != null);
 }
Beispiel #23
0
 public OpResult Update(OpResultValueReference result, Dictionary <String, Object> changes)
 {
     return(unitOfWorkUpdate.Update(result, changes));
 }
Beispiel #24
0
 private static Boolean IsCreatedBulkResultIndex(OpResultValueReference reference)
 {
     return(OperationType.CREATE_BULK.Equals(reference.OpResult.OperationType) &&
            reference.PropName == null &&
            reference.ResultIndex != null);
 }
Beispiel #25
0
 public OpResult SetRelation(OpResultValueReference parentObject, String columnName, OpResult children)
 {
     return(unitOfWorkSetRelation.SetRelation(parentObject, columnName, children));
 }
Beispiel #26
0
 private static Boolean IsFoundResultIndexObjectId(OpResultValueReference reference)
 {
     return(IsFoundPropNameResultIndex(reference) && reference.PropName.Equals("objectId"));
 }
Beispiel #27
0
 public OpResult DeleteRelation <E>(OpResultValueReference parentObject, String columnName, List <E> childrenInstances)
 {
     return(unitOfWorkDeleteRelation.DeleteRelation(parentObject, columnName, childrenInstances));
 }
Beispiel #28
0
 private static Boolean IsFoundPropNameResultIndex(OpResultValueReference reference)
 {
     return(OperationType.FIND.Equals(reference.OpResult.OperationType) &&
            reference.PropName != null &&
            reference.ResultIndex != null);
 }
Beispiel #29
0
 public OpResult DeleteRelation(OpResultValueReference parentObject, String columnName, String whereClauseForChildren)
 {
     return(unitOfWorkDeleteRelation.DeleteRelation(parentObject, columnName, whereClauseForChildren));
 }
Beispiel #30
0
 public OpResult AddToRelation(OpResultValueReference parentObject, string columnName, string[] childrenObjectIds)
 {
     return(relationOperation.AddOperation(OperationType.ADD_RELATION, parentObject, columnName, childrenObjectIds));
 }