protected static IStorageLinks GetStorageLinks(Response response, Action sendLinkAction) { Interop.Logging.Logger.LogInfo("GetStorageLinks"); if (sendLinkAction == null) { throw new NullReferenceException("Failed to get the SendLink action"); } string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar; path += sendLinkAction.Assembly; Assembly sendLinkAssembly = Assembly.LoadFrom(path); Type[] types = sendLinkAssembly.GetExportedTypes(); IStorageLinks storagelinks = null; foreach (Type type in types) { if (typeof (IStorageLinks).IsAssignableFrom(type)) { storagelinks = (IStorageLinks) sendLinkAssembly.CreateInstance(type.FullName); Interop.Logging.Logger.LogInfo(string.Format("Cloud Storage assembly type is {0}", type.FullName)); break; } } if (storagelinks == null) { throw new NullReferenceException("Failed to find or create a valid storagelinks object"); } return storagelinks; }
internal List<SendLinkInfo> RetrieveLinks(string defaultEmailAddress, IStorageLinks storageLinks, Action sendLinkAction, Response response, List<SendLinkInfo> files, List<string> emailAddresses, string subject, string id, string prSearchKey = "") { Interop.Logging.Logger.LogInfo("Retrieve Links"); try { List<IActionProperty> actionProperties = GetActionProperties(sendLinkAction); int count = files.Count; string workingDirectory = GetWorkingDirectory(id); storageLinks.PrSearchKey = prSearchKey; storageLinks.GetLinks(defaultEmailAddress, files, emailAddresses, subject, actionProperties, workingDirectory, id); if (files.Count != count) { throw new ArgumentException("The number of items returned are invalid. The number of items retured should match the input number."); } if (!ContainsLinks(files)) { throw new ArgumentException("Failed to retreive any links."); } return files; } catch (Exception ex) { Interop.Logging.Logger.LogError(ex); throw; } finally { Interop.Logging.Logger.LogInfo("Exit Retrieve Links"); } }
internal List<IActionProperty> GetActionProperties(Action sendLinkAction) { List<IActionProperty> actionProperties = new List<IActionProperty>(); foreach (ActionProperty property in sendLinkAction.ActionProperties) { Policy.Action.ActionProperty prop = new Policy.Action.ActionProperty(property.Name, property.Value); actionProperties.Add(prop); } return actionProperties; }
public UIContentItem(ContentItem contentItem, Workshare.PolicyContent.Action action, bool container) { if (contentItem == null) { throw new ArgumentNullException("contentItem"); } m_protectAction = action; m_container = container; m_contentItem = contentItem; m_rating = RatingEnum.Low; m_childContentItems = new Dictionary<string, UIContentItem>(); m_policies = new Dictionary<string, UIPolicy>(); m_selected = true; }
internal static Workshare.PolicyContent.Action GetAction(IPolicyResponseAction pra) { if (null == pra) throw new ArgumentException("pra"); Workshare.PolicyContent.Action action = new Workshare.PolicyContent.Action(); action.ExecutedSequence = 0; action.Name = pra.Name; action.Overriden = pra.Overridden; action.Processed = pra.Processed; action.Type = pra.Type; action.ActionProperties = new Workshare.PolicyContent.ActionProperty[0]; Collection<IActionPropertyResponse> actionProps = pra.ActionPropertyCollection; if (actionProps != null && actionProps.Count > 0) { List<Workshare.PolicyContent.ActionProperty> props = new List<Workshare.PolicyContent.ActionProperty>(); foreach ( IActionPropertyResponse apr in actionProps) { props.Add(ActionPropertyAdaptor.GetActionProperty(apr)); } action.ActionProperties = props.ToArray(); } action.SystemProperties = new Workshare.PolicyContent.ActionProperty[0]; Collection<IActionPropertyResponse> sysProps = pra.SystemPropertyCollection; if ( sysProps != null && sysProps.Count > 0) { List<Workshare.PolicyContent.ActionProperty> props = new List<Workshare.PolicyContent.ActionProperty>(); foreach (IActionPropertyResponse prop in sysProps) { props.Add(ActionPropertyAdaptor.GetActionProperty(prop)); } action.SystemProperties = props.ToArray(); } action.Properties = new CustomProperty[0]; if (pra.Properties != null && pra.Properties.Count > 0) { List<CustomProperty> custProps = new List<CustomProperty>(); foreach (string key in pra.Properties.Keys) { custProps.Add(new CustomProperty(key, pra.Properties[key])); } action.Properties = custProps.ToArray(); } PolicyResponseAction policyResponseAction = pra as PolicyResponseAction; if ( policyResponseAction != null) { action.Assembly = policyResponseAction.Assembly; action.ClassName = policyResponseAction.ClassName; action.Precedence = policyResponseAction.Precedence; if (policyResponseAction.SupersededByAction != null) { action.SupersededByAction = GetAction(policyResponseAction.SupersededByAction); } } return action; }