/// <summary> /// Performs the <see cref="IWorkspaceItem.Action" /> on the specified workspace item. /// </summary> /// <param name="workspaceItem">The workspace item to be actioned.</param> /// <param name="isLocalSave">if set to <c>true</c> [is local save].</param> /// <param name="roles">The roles.</param> /// <exception cref="System.ArgumentNullException">workspaceItem</exception> public void Update(IWorkspaceItem workspaceItem, bool isLocalSave, string roles = null) { if(workspaceItem == null) { throw new ArgumentNullException("workspaceItem"); } if(roles == null) { roles = string.Empty; } switch(workspaceItem.Action) { case WorkspaceItemAction.None: break; case WorkspaceItemAction.Discard: // overwrite workspace item with copy of server item case WorkspaceItemAction.Edit: // create copy of the server item in this workspace //06.03.2013: Ashley Lewis - PBI 8720 if(workspaceItem.ServiceType != enDynamicServiceObjectType.Source.ToString()) { Copy(WorkspaceRepository.Instance.ServerWorkspace, this, workspaceItem, roles); } else { Copy(this, WorkspaceRepository.Instance.ServerWorkspace, workspaceItem, roles); } break; case WorkspaceItemAction.Commit: // overwrite server item with workspace item break; } }
/// <summary> /// Initialize a new instance of the ViewDrawWorkspaceSeparator class. /// </summary> /// <param name="workspace">Associated workspace instance.</param> /// <param name="workspaceItem">Associated workspace item.</param> /// <param name="orientation">Visual orientation of the content.</param> public ViewDrawWorkspaceSeparator(KryptonWorkspace workspace, IWorkspaceItem workspaceItem, Orientation orientation) : base(workspace.StateDisabled.Separator, workspace.StateNormal.Separator, workspace.StateTracking, workspace.StatePressed, workspace.StateDisabled.Separator, workspace.StateNormal.Separator, workspace.StateTracking, workspace.StatePressed, CommonHelper.SeparatorStyleToMetricPadding(workspace.SeparatorStyle), orientation) { _workspace = workspace; _workspaceItem = workspaceItem; }
static void Copy(IWorkspace source, IWorkspace destination, IWorkspaceItem workspaceItem, string roles) { if(source.Equals(destination)) { return; } enDynamicServiceObjectType serviceType; if(!Enum.TryParse(workspaceItem.ServiceType, out serviceType)) { serviceType = enDynamicServiceObjectType.DynamicService; } #region TODO: Fix Map ResourceType from workspaceItem.ServiceType // TODO: FIX mapping ResourceType from workspaceItem.ServiceType switch(serviceType) { case enDynamicServiceObjectType.BizRule: break; case enDynamicServiceObjectType.DynamicService: break; case enDynamicServiceObjectType.ServiceAction: break; case enDynamicServiceObjectType.ServiceActionCase: break; case enDynamicServiceObjectType.ServiceActionCases: break; case enDynamicServiceObjectType.ServiceActionInput: break; case enDynamicServiceObjectType.Source: break; case enDynamicServiceObjectType.Validator: break; case enDynamicServiceObjectType.WorkflowActivity: break; case enDynamicServiceObjectType.UnitTest: break; default: throw new ArgumentOutOfRangeException(); } #endregion ResourceCatalog.Instance.CopyResource(workspaceItem.ID, source.ID, destination.ID, roles); }
public bool Equals(IWorkspaceItem other) { if (other == null) { return false; } return ID == other.ID && EnvironmentID == other.EnvironmentID; }