public static string GetResourceType(string payload) { string ctdlType = ""; RegistryObject ro = new RegistryObject(payload); ctdlType = ro.CtdlType; //ctdlType = ctdlType.Replace( "ceterms:", "" ); return(ctdlType); }
public static string GetCtidFromUnknownEnvelope(ReadEnvelope item) { string ctid = ""; //string envelopeId = ""; try { RegistryObject ro = new RegistryObject(item.DecodedResource.ToString()); ctid = ro.Ctid; //TODO - this will have to change for type of @graph //envelopeId = item.EnvelopeIdentifier; //ctid = item.EnvelopeCetermsCtid ?? ""; //if ( !string.IsNullOrWhiteSpace( ctid ) ) // return ctid; //string payload = item.DecodedResource.ToString(); //if ( payload.IndexOf( "@graph" ) > -1 ) //{ // UnknownPayload input = JsonConvert.DeserializeObject<UnknownPayload>( item.DecodedResource.ToString() ); // //extract from the @id // if ( !string.IsNullOrWhiteSpace( input.Ctid ) ) // { // ctid = input.Ctid; // } // else if ( !string.IsNullOrWhiteSpace( input.CtdlId ) ) // { // int pos = input.CtdlId.LastIndexOf( "/" ); // ctid = input.CtdlId.Substring( pos ); // } //} //else //{ // UnknownPayload input = JsonConvert.DeserializeObject<UnknownPayload>( item.DecodedResource.ToString() ); // ctid = input.Ctid; //} } catch (Exception ex) { LoggingHelper.DoTrace(2, "GetCtidFromUnknownEnvelope - unable to extract ctid from envelope"); } return(ctid); }