/// <summary> /// Retrieve an resource from the registry by ctid and do import /// </summary> /// <param name="ctid"></param> /// <param name="status"></param> /// <returns></returns> public bool ImportByCtid(string ctid, SaveStatus status) { if (string.IsNullOrWhiteSpace(ctid)) { status.AddError(thisClassName + ".ImportByCtid - a valid ctid must be provided"); return(false); } //this is currently specific, assumes envelop contains a credential //can use the hack for GetResourceType to determine the type, and then call the appropriate import method string statusMessage = ""; EntityServices mgr = new EntityServices(); string ctdlType = ""; try { //probably always want to get by envelope ReadEnvelope envelope = RegistryServices.GetEnvelopeByCtid(ctid, ref statusMessage, ref ctdlType); if (envelope != null && !string.IsNullOrWhiteSpace(envelope.EnvelopeIdentifier)) { return(CustomProcessEnvelope(envelope, status)); } else { return(false); } //string payload = RegistryServices.GetResourceByCtid( ctid, ref ctdlType, ref statusMessage ); //if ( !string.IsNullOrWhiteSpace( payload ) ) //{ // input = JsonConvert.DeserializeObject<InputEntity>( payload.ToString() ); // //ctdlType = RegistryServices.GetResourceType( payload ); // return Import( mgr, input, "", status ); //} //else // return false; } catch (Exception ex) { LoggingHelper.LogError(ex, thisClassName + string.Format(".ImportByCtid(). CTID: {0}", ctid)); status.AddError(ex.Message); if (ex.Message.IndexOf("Path '@context', line 1") > 0) { status.AddWarning("The referenced registry document is using an old schema. Please republish it with the latest schema!"); } return(false); } }