Inheritance: SenseNet.ContentRepository.Storage.NodeSaveSettings
Beispiel #1
0
        public virtual void Reject()
        {
            var action = SavingAction.Create(this);

            action.Reject();
            action.Execute();
        }
Beispiel #2
0
        public virtual void Publish()
        {
            var action = SavingAction.Create(this);

            action.Publish();
            action.Execute();
        }
Beispiel #3
0
        public virtual void Approve()
        {
            var action = SavingAction.Create(this);

            action.Approve();
            action.Execute();
        }
Beispiel #4
0
        public virtual void CheckIn()
        {
            var action = SavingAction.Create(this);

            action.CheckIn();
            action.Execute();
        }
Beispiel #5
0
        public void UndoCheckOut(bool forceRefresh = true)
        {
            var action = SavingAction.Create(this);

            action.UndoCheckOut(forceRefresh);
            action.Execute();
        }
Beispiel #6
0
        public virtual void SaveSameVersion()
        {
            var action = SavingAction.Create(this);

            action.SaveSameVersion();
            action.Execute();
        }
Beispiel #7
0
        public static Node CreateFromTemplate(Node target, Node template, string name)
        {
            var           newNode = template.MakeTemplatedCopy(target, name);
            VersionNumber version = null;

            //compute new version number according to the versioning
            //and approving settings in the target folder
            var gc = newNode as GenericContent;

            if (gc != null)
            {
                version = SavingAction.ComputeNewVersion(gc.ApprovingMode == ApprovingType.True, gc.VersioningMode);
            }
            else
            {
                //TODO: handle non-GenericContent scenarios
            }

            if (version != null)
            {
                newNode.Version = version;
            }

            newNode.Template = template;

            return(newNode);
        }
Beispiel #8
0
        //==================================================== Versioning & Approving ====================================================

        private void VersionSetup()
        {
            if (this.Id == 0)
            {
                this.Version = SavingAction.ComputeNewVersion(this.HasApproving, this.VersioningMode);
            }
        }
        private static SavingAction CreateForNode(Node node)
        {
            var savingAction = new SavingAction
            {
                Node           = node,
                VersioningMode = VersioningMode.None,
                HasApproving   = false
            };

            return(savingAction);
        }
        public static bool HasUndoCheckOut(GenericContent node)
        {
            if (HasForceUndoCheckOutRight(node))
            {
                return(false);
            }

            var s = SavingAction.Create(node);

            return(s.ValidateAction(StateAction.UndoCheckOut) == ActionValidationResult.Valid);
        }
Beispiel #11
0
        private static SavingAction CreateForNode(Node node)
        {
            var savingAction = new SavingAction
            {
                Node = node,
                VersioningMode = VersioningMode.None,
                HasApproving = false
            };

            return savingAction;
        }
Beispiel #12
0
        private static SavingAction CreateForGenericContent(GenericContent genericContent)
        {
            var mode = VersioningMode.None;
            switch (genericContent.VersioningMode)
            {
                case VersioningType.MajorOnly: mode = VersioningMode.Major; break;
                case VersioningType.MajorAndMinor: mode = VersioningMode.Full; break;
            }
            var savingAction = new SavingAction
            {
                Node = genericContent,
                VersioningMode = mode,
                HasApproving = genericContent.HasApproving
            };

            return savingAction;
        }
        private static SavingAction CreateForGenericContent(GenericContent genericContent)
        {
            var mode = VersioningMode.None;

            switch (genericContent.VersioningMode)
            {
            case VersioningType.MajorOnly: mode = VersioningMode.Major; break;

            case VersioningType.MajorAndMinor: mode = VersioningMode.Full; break;
            }
            var savingAction = new SavingAction
            {
                Node           = genericContent,
                VersioningMode = mode,
                HasApproving   = genericContent.HasApproving
            };

            return(savingAction);
        }
Beispiel #14
0
        public virtual void Save(SavingMode mode)
        {
            var action = SavingAction.Create(this);

            switch (mode)
            {
            case SavingMode.RaiseVersion:
                action.CheckOutAndSaveAndCheckIn();
                break;

            case SavingMode.RaiseVersionAndLock:
                action.CheckOutAndSave();
                break;

            case SavingMode.KeepVersion:
                action.SaveSameVersion();
                break;

            default:
                throw new NotImplementedException("Unknown SavingMode: " + mode);
            }
            action.Execute();
        }
        public static bool HasReject(GenericContent node)
        {
            var s = SavingAction.Create(node);

            return(s.ValidateAction(StateAction.Reject) == ActionValidationResult.Valid);
        }
        public static bool HasCheckIn(Node node)
        {
            var s = SavingAction.Create(node);

            return(s.ValidateAction(StateAction.CheckIn) == ActionValidationResult.Valid);
        }