Setting the author field of the OData Provider Toolkit response - odata

We are using the OData Provider Toolkit to expose custom data as an OData feed. We have noticed that the author field is always unset:
<entry>
<id>http://localhost/sample.svc/Entity</id>
<title type="text"/>
<updated>2013-01-30T01:02:28Z</updated>
<author>
<name/>
</author>
Is there a way to set the author programmatically using this toolkit? We haven't been able to find a way to access the SyndicationItems of the associated Atom feed that generates the result.

Depending on which version of WCF Data Services (ie System.Data.Services.DataService) you are using with that toolkit, you have two options here:
1) Use so-called 'Entity Property Mapping' to tell the system to put a specific property's value into the Author field. This functionality has been present since .NET 4.0 (and available through an update to 3.5SP1 as well). To turn this on, look into the ResourceType.AddEntityPropertyMappingAttribute API (http://msdn.microsoft.com/en-us/library/system.data.services.providers.resourcetype.addentitypropertymappingattribute.aspx).
2) Customize the instances of ODataEntry being written out using the recently added support for wrapping the ODataWriter being used by the data service. This is only available in versions 5.1 and later, which can be found at NuGet (http://nuget.org/packages/Microsoft.Data.Services/). To wrap the writer, you will need to hook up to the DataService.CreateODataWriter delegate property. You can see an example of how to use this here: http://odatasamples.codeplex.com/SourceControl/changeset/view/be77d3cacb2c#WcfDataServices101/WcfDataServices101.CustomizedEntityLinks/CustomizedEntityLinksService.svc.cs. Once you are in the WriteStart method, you can use the ODataEntry.Atom() extension method to get access to the atom-specific metadata like authors, contributors, etc.
Hope that helps, I can provide more exact code examples as needed.

Related

SAPUI5: ODatav4 add static data to data downloaded from API

Let's say we have some list of items that are automatically downloaded from API
<ComboBox items="{'model>Users'}">
<c:Item
key="{model>Id}"
text="{model>FirstName} {model>LastName}"
/>
</ComboBox>
Works really well. But how can I now expand the data downloaded with oData by adding some more objects?
The things that I've tried:
Trying to find some sort of "onDownloadCompleate" function so that when the users are downloaded I can attach some more. I couldn't find such function in oData v4.
Getting the data from the model and attaching additional objects to it. I couldn't found how I can do this.
The only solution I see is to not use oData at all and just download the users using normal API call.

On blackboard is it possible to open multiple scorms?

I'm having difficulty finding way to open multiple scorms simultaneously..
Is there a setting that I need to change or blackboard does not allow multiple scorms to be opened?
So commonly with SCORM you have a Runtime API that is nested somewhere on the LMS web page. This API is directly flavored for the SCO that was requested. So having multiples trying to talk to the same API would lead to data corruption. The only way to extend the capability for multiple shareable content objects would require more IFRAMEs. You'd need to nest the runtime in the first IFRAME, then the Content in a sub IFRAME. I've accomplished this with another client and it was done mainly to represent single page SCOs stacked on top of each other as a Q and A style homework display.
Is it optimal? Probably not. Does it work? Totally. The SCORM Runtime is a JavaScript based API which is populated with a CMI object. Namespaces within that CMI Object (get / set) from the content, however the LMS is responsible for populating its base values as well as maintaining whats allowed and not allowed. Hope that helps, but based on your question Blackboard would have to implement that sort of module support to do it.

Swagger UI for messaging API

I'd like to know if the following is possible.
Swagger is almost what I need to document a Message based API. For instance for a Command Message I'd like to say "Command" instead of "Post", and instead of "path" I'd like to have the name of the Command.
The spec mentions that Vendor Extensions are possible using "x-" properties but I am 1) not finding any examples of how to do this and 2) not sure if the use of these properties would help me meet my goals.
Might anyone be able to point me to some resources that can help me move along?
Swagger is designed to document REST APIs which are based on HTTP verbs. You can't replace verbs or invent new ones.
Vendor extensions are there to allow adding additional information that the specification does not allow, but ultimately, it is still intended for REST APIs.
From what I gather, you're trying to describe something different.
We do welcome suggestions for additional roads for Swagger (that is, cover non-REST APIs), and in order to do that, I'd suggest opening an issue on the swagger-spec repository.

Lack of access to all functions in exposed interfaces?

I have a rather fundamental issue with coding in OpenOffice/LibreOffice Basic that I can't seem to figure out. I don't always have access to all the functions I'm supposed to. Here's an example:
Sub TestSub
Dim doc As Object
doc = ThisComponent 'Note that we're in LibreOffice Writer
MsgBox(doc.Text.Dbg_SupportedInterfaces)
doc.Text.finishParagraph(Array()) 'Works OK
doc.Text.appendParagraph(Array()) 'Error, property or method not found
End Sub
The doc.Text.Dbg_SupportedInterfaces property tells me that one of the interfaces that I am supposed to have access to is com.sun.star.text.XParagraphAppend, which is meant to expose both finishParagraph and appendParagraph, yet I only seem to have access to finishParagraph. Why is this? This isn't an isolated case - all over the place I see that I am meant to have access to functions that I don't have access to.
Openoffice and Libreoffice are different projects. That's why they will be developed different and they will become much more different in the future. With your example Libreoffice has no more appendParagraph but finishParagraphInsert. See: http://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1text_1_1XParagraphAppend.html
For BASIC development I recommend to use a debugging tool like XRAY. See: https://wiki.documentfoundation.org/Macros This tool will show only the properties and methods which are really there. Unfortunately there is even no more global index in API documentation of Libreoffice. So XRAY cannot link directly to the Libreoffice API documentation. Therefore at the moment I use the https://www.openoffice.org/api/docs/common/ref/index-files/index-1.html for both Openoffice and Libreoffice and check manually the Libreoffice API http://api.libreoffice.org/ if I am working on a macro for Libreoffice.

How do I access Personas theme data on addons.mozilla.org

addons.mozilla.org comes with an XML API that you could fetch any public data from it's database:
For example, information about this Personas:
https://addons.mozilla.org/en-US/firefox/addon/this-blue-planet/
can be accessed as XML:
https://services.addons.mozilla.org/zh-TW/firefox/api/1.5/addon/this-blue-planet
The only problem is, unlike extensions, where the URL of XPI and the file hash is all you need to initiate an off-site install, Personas is represented as a JSON object in data-browsertheme property of the mouseover-able and click-able preview button; the content of JSON object cannot be found within the XML representation.
I've think of fetch the HTML page and parse the content, but I need a robust method that doesn't break with an AMO version update. Anyone can answer my question or point me a person that could answer the question is greatly appreciated.
PS: I am making a Firefox promotion website that work with these data, if you are interested you could check it out (in Traditional Chinese): http://gfx.tw/
The addons.mozilla.org API doesn't currently support Personas. The primary home of Personas is getpersonas.com, and it doesn't have an API.
You can file a bug for Persona support at bugzilla.mozilla.org, but it likely won't be integrated until much later in the year.

Resources