public lr_Verb_complex() { measure = new lr_Measure(); context = new lr_Context(); date = DateTime.Now; action = ""; }
public static String ModelDownloadedInternal(ContentObject co) { lr_Envelope env = new lr_Envelope(); lr_document doc = new lr_document(); //Add the keys from the contentobject to the keys for the document doc.keys.Add("3DR"); string[] keywords = co.Keywords.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string key in keywords) doc.keys.Add(key); //This is the URI of the resource this data describes doc.resource_locator = LR_Integration_APIBaseURL() + co.PID + "/Format/dae?ID=00-00-00"; //Submitted by the ADL3DR agent doc.identity.submitter = LR_Integration_SubmitterName(); doc.identity.signer = LR_Integration_SignerName(); doc.identity.submitter_type = new lr_submitter_type.agent(); //The data is paradata doc.resource_data_type = new lr_resource_data_type.paradata(); //Set ActivityStream as the paradata schema doc.payload_schema.Add(new lr_schema_value.paradata.LR_Paradata_1_0()); Paradata.lr_Activity activity = new lr_Activity(); //Create a paradata object Paradata.lr_Paradata pd = activity.activity; //Set the paradata actor pd.actor = null; //Create a complex verb type lr_Verb.lr_Verb_complex verb = new lr_Verb.lr_Verb_complex(); verb.action = "Downloaded"; verb.context.id = ""; verb.date = DateTime.Now; lr_Measure measure = new lr_Measure(); measure.measureType = "count"; measure.value = co.Downloads.ToString(); verb.measure = measure; //Set the paradata verb pd.verb = verb; //Create a complex object type lr_Object.lr_Object_complex _object = new lr_Object.lr_Object_complex(); _object.id = co.PID; //Set the paradata object pd._object = _object; //A human readable description for the paradata pd.content = "The a user downloaded this model from the ADL 3DR."; //The resource_data of this Resource_data_description_document is the inline paradata doc.resource_data = activity; env.documents.Add(doc); //sign the envelope env.Sign(LR_Integration_KeyPassPhrase(), LR_Integration_KeyID(), LR_Integration_PublicKeyURL()); //Serialize and publish return env.Publish(); }
static public String ModelRatedInternal(ContentObject co) { lr_Envelope env = new lr_Envelope(); lr_document doc = new lr_document(); //Add the keys from the contentobject to the keys for the document doc.keys.Add("3DR"); string[] keywords = co.Keywords.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string key in keywords) { doc.keys.Add(key); } //This is the URI of the resource this data describes doc.resource_locator = LR_Integration_APIBaseURL() + co.PID + "/Format/dae?ID=00-00-00"; //Submitted by the ADL3DR agent doc.identity.submitter = LR_Integration_SubmitterName(); doc.identity.signer = LR_Integration_SignerName(); doc.identity.submitter_type = new lr_submitter_type.agent(); //The data is paradata doc.resource_data_type = new lr_resource_data_type.paradata(); //Set ActivityStream as the paradata schema doc.payload_schema.Add(new lr_schema_value.paradata.LR_Paradata_1_0()); Paradata.lr_Activity activity = new lr_Activity(); //Create a paradata object Paradata.lr_Paradata pd = activity.activity; //Set the paradata actor pd.actor = null; //Create a complex verb type lr_Verb.lr_Verb_complex verb = new lr_Verb.lr_Verb_complex(); verb.action = "Rated"; verb.context.id = ""; verb.date = DateTime.Now; lr_Measure measure = new lr_Measure(); measure.measureType = "value"; float reviewtotal = 0; foreach (Review r in co.Reviews) { reviewtotal += r.Rating; } measure.value = (reviewtotal / co.Reviews.Count).ToString(); verb.measure = measure; if (measure.value == "NaN") { return(""); } //Set the paradata verb pd.verb = verb; //Create a complex object type lr_Object.lr_Object_complex _object = new lr_Object.lr_Object_complex(); _object.id = co.PID; //Set the paradata object pd._object = _object; //A human readable description for the paradata pd.content = "Users on the ADL 3DR rated this model with this average rating."; //The resource_data of this Resource_data_description_document is the inline paradata doc.resource_data = activity; env.documents.Add(doc); //sign the envelope env.Sign(LR_Integration_KeyPassPhrase(), LR_Integration_KeyID(), LR_Integration_PublicKeyURL()); //Serialize and publish return(env.Publish()); }