/** * @param parametro di tipo stringa contenente lo username dell'utente che * richiede i metadati al servizio KPeople * @return oggetto di tipo MetadataSet contenete le informazioni strutturate * circa i metadati */ public MetadataSet retriveAvailableMetadataSetXml(string username) { string pos = "ConnectionManager.retriveAvailableMetadataSetXml - "; log.Info(pos + "INIT"); MetadataSet metadataSet= null; int counter = 0; while (counter <= Constants.KP_METADATA_SERVICE_RETRY_COUNT) { try { ProcessMetadataService.ProcessMetadataServicePortTypeClient req = new ProcessMetadataServicePortTypeClient(Constants.KP_METADATA_SERVICE_CONFIGURATION); log.Info(pos + "Endpoint:" + req.Endpoint.Address); User user = new User(); user.hpmUserId = username; req.Open(); ProcessMetadataSet retrivedAvailableMetadataSetXml = req.getMetadataProcessV1(user); req.Close(); MetadataParser parser = new MetadataParser(); metadataSet = parser.metadataSetXml(retrivedAvailableMetadataSetXml); counter = Constants.KP_METADATA_SERVICE_RETRY_COUNT; } catch (Exception ex) { log.Error(pos + "Exception:" + ex.Message); if (counter == Constants.KP_METADATA_SERVICE_RETRY_COUNT) { throw new Exception(Localize.LocalizeString("networkError")); } } finally { counter++; } } log.Info(pos + "END"); return metadataSet; }
public void Populate(KPOutlookAddIn.ThisAddIn.RIBBON_TYPE showRibbon, Outlook.MailItem mail) { log = new Logger(); currMailItem = mail; const string pos = "RibbonMailRiceved.RibbonMailRiceved_Load - "; log.Info(pos + "INIT"); string pathWorkFolder = Constants.getWorkFolder(); string attachmentName = Constants.KP_ATTACHMENT_NAME; log.Info(pos + "pathWorkFolder:" + pathWorkFolder); log.Info(pos + "attachmentName:" + attachmentName); try { if (showRibbon == ThisAddIn.RIBBON_TYPE.Read) { //Disabilito il pulsante kpeople this.button1.Enabled = false; //Leggo le informazioni dall'attachment Outlook.Attachment attach = mail.Attachments[attachmentName]; if (attach != null) { //Salvo temporaneamente il file TemporaryStorage storage = new TemporaryStorage(); XmlDocument docXml = new XmlDocument(); MetadataParser parser = new MetadataParser(); docXml.Load(storage.Save(attach)); createDinamicallyRibbonFromMetadata(parser.parserMetadataSetFromXML(docXml)); storage.DeleteFolder(); } } else if (showRibbon == ThisAddIn.RIBBON_TYPE.Reply) { //Disabilito il pulsante kpeople this.button1.Enabled = true; //Leggo le informazioni dall'attachment Outlook.Attachment attach = mail.Attachments[attachmentName]; if (attach != null) { //Salvo temporaneamente il file TemporaryStorage storage = new TemporaryStorage(); XmlDocument docXml = new XmlDocument(); MetadataParser parser = new MetadataParser(); docXml.Load(storage.Save(attach)); createDinamicallyRibbonFromMetadata(parser.parserMetadataSetFromXML(docXml)); storage.DeleteFolder(); } } else { this.button1.Enabled = true; } } catch (Exception ex) { log.Error(pos + "Ex:" + ex.ToString()); } log.Info(pos + "END"); }
/** * @return un oggetto di tipo MetadataSet contenente le informazioni * strutturate relative all'insieme dei metadati salvati sul File System. * Il metodo, carica il file dal File System, se presente, contenente l'elenco * dei metadati. Dopo di che passa il file alla classe MetadataParser che * ne effettua il parser. */ public MetadataSet getMetadataSetFromFileSystem() { metadataSet = null; if (File.Exists(Constants.getMetadatasetFullName())) { docXml.Load(Constants.getMetadatasetFullName()); metadataParser = new MetadataParser(); metadataSet = metadataParser.parserMetadataSetFromXML(docXml); } return metadataSet; }