Liferay - how to get assetentry subtype in velocity template? - templates

my asset publisher is displaying two types of Web Content Article Subtype (asset publisher->configuration->asset selection->asset type->web content article subtype->select more than one...).
I need to get subtype of asset entry to create a right structure based on entry subtype, something like:
#if (!$entries.isEmpty())
#foreach ($curEntry in $entries)
$curEntry.getSubtype()
#end
#end
Is it possible?
Thanks.

You can use liferay services in VM like example in below link
http://www.liferay.com/community/wiki/-/wiki/Main/Access+to+Liferay+services+in+Velocity
Go through Asset Publisher Portlet -> configuration_dynamic.jsp it has the code which gets the subType you require i.e. Structure created in webcontent.
Other way to get the structure for webcontent is using DDMStructureLocalService it has getStructures() method where you can pass webcontent (i.e. journal class id)
Hope it gives you the direction to achieve what you are looking for.

Related

Export CSV file in ServiceNow using URL containing personalized list columns

I'm trying to export a CSV file in ServiceNow using the URL. I've applied my various filters and I've personalized the list columns I need. The problem is, when I use the URL to obtain the records, I get ALL the columns and not my personalized list columns. Can anyone tell me why this is happening?
The URL I'm using is as follows (sample, not the real URL):
https://abc.service-now.com/incident_list.do?sysparm_query=xyz
Can someone guide me as to whats missing in the URL?
There's a URL parameter sysparm_view that you can add to specify the name of the view you want to use, but it sounds like you may still be missing something.
There's a difference between "Personalizing" a list layout and "Configuring" a list layout:
The former ("personalizing") is a layout that is visible only to you.
There's no way to give a URL to someone that will give them that
particular list layout.
The latter ("configuring") is what you'll
need to use to define list layout configuration that is accessible to
any user, and which can be targeted via the sysparm_view URL
parameter
This wiki article defines views:
http://wiki.servicenow.com/?title=View_Management#Creating_Views
If you follow the steps in "Creating Views", you'll end up with a view name (as specified by you when you created it, say you called it kage77. Then you'd be able to send someone a URL with sysparm_view=kage77 and they'd see the list layout you associated with that view:
https://abc.service-now.com/incident_list.do?sysparm_query=xyz&sysparm_view=kage77
You have to include the file type as well like CSV/ XLSX/PDF
https://instance.service-now.com/incident_list.do?CSV
you can add few parameters,
&sysparm_query=active=true
&sysparm_fields=number%2Cshort_description
&sysparm_orderby=sys_id
More reference: https://docs.servicenow.com/bundle/london-platform-administration/page/administer/exporting-data/task/t_ExportDirectlyFromTheURL.html

Posting a Custom Story to Facebook Open Graph

I'm trying to post a custom story to a proof of concept Facebook app, consisting of an object type "badge" and an action type "earn." When I "get code" for this in the Facebook Open Graph Types interface, the Graph Explorer example successfully posts the story to my timeline. However, the one parameter ("badge") is a URL reference to OG samples.
How can I post something directly, not as a reference to OG samples?
Using the C# SDK, I'm currently trying this:
var client = new FacebookClient();
client.AccessToken = tokenResult.access_token;
dynamic parameters = new ExpandoObject();
parameters.badge = #"
{
""app_id"" : [my app ID],
""title"" : ""Widget Badge"",
""image"" : ""[a public image URL]"",
""url"" : ""[a public website URL]"",
""type"" : ""[my custom namespace]:badge""
}
";
var result = client.Post("/me/[my custom namespace]:earn", parameters);
However, the exception I'm getting back from Facebook is:
"[the above JSON]" is an invalid value for property "badge" with type "Reference"
Following some code snippets I've found online, I tried changing the property "badge" above to a generic "post" (I would guess relying on the "type" value to know what it's posting), but then the error says that I'm missing the required parameter "badge."
I haven't found anything which tells me what a "Reference" type is in this case, though I could just be overlooking something. In the original example it was a URL to OG Samples, but I would assume we can post custom things and not just samples. Do I need to host some sort of "sample" page of my own with the values in meta tags like OG Samples, or can I just specify the values directly in the post somehow?
To post actions with an object, you need to provide the url of this object.
But in the case where you don't have this url on your own app (you app doesn't have a webpage for each object), then you can create objects hosted directly by facebook, and the url will use the generated id of this object.
To do that, you need to use the Object API : https://developers.facebook.com/docs/opengraph/using-object-api/
Providing the json data, it will create the object in facebook opengraph, returning its id (so you have the url) and then you'll be able to post your action

generating thumbnails in Alfresco 4.0.d

I am using the Java web services in Alfresco Community 4.0.d and currently looking to add thumbnail functionality to my site. I noticed the thumbnails are not available immediately after posting a new image; I was wondering if someone can recommend a good approach to have the generation triggered manually?
Answered your question in the forums as well. Using the JavaScript API you can ask a document to generate its thumbnail, like this:
document.createThumbnail("doclib");
In this case, "doclib" is the name of the thumbnail configuration for the document library thumbnails in Share, but this could be any thumbnail definition you've created.
Docs live at http://docs.alfresco.com/4.0/topic/com.alfresco.enterprise.doc/references/API-JS-Thumbnail-createThumbnail.html
For Java, look at the org.alfresco.repo.thumbnail.CreateThumbnailActionExecuter class source. In your own class you could do something similar. Or, better yet, use the actionService to invoke the create-thumbnail action.
To use the Action Service, all you need is the name of the action and the parameters it expects. For example, here's what it looks like when you use the mail action:
ActionService actionService = getServiceRegistry().getActionService();
Action mailAction = actionService.createAction(MailActionExecuter.NAME);
mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, ExternalReviewNotification.SUBJECT);
mailAction.setParameterValue(MailActionExecuter.PARAM_TO, recipient);
mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, ExternalReviewNotification.FROM_ADDRESS);
mailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, sb.toString());
actionService.executeAction(mailAction, null);
To do this for thumbnails, you'll use "create-thumbnail" for the name (or CreateThumbnailActionExecuter.NAME). Looking at the source for that class I see that it takes two parameters, PARAM_CONTENT_PROPERTY, which would be "cm:content", and PARAM_THUMBNAIL_NAME which would be "doclib" for the normal document library thumbnail or your thumbnail name if you've defined your own.
One thing to note, in the executeAction call, that second argument is the "actioned upon noderef". In your case, you'll want that to be the node you are generating the thumbnail for.

Retrieving Enterprise Project Types using Project Server Interface

I am currently building an app to programatically create projects in Microsoft Project Server using the web services exposed through the Project Server Interface (PSI).
I am able to create a project with an Enterprise Project Type using the QueueCreateProject method, however, I need to specify the GUID of the EPT which I don't want to hard code into the code.
Is there another web service or way to get the GUID of a specific EPT found by its name?
Also, can the same be done for custom fields in the same way?
I think what you're looking for is PSI Filter parameters. Check out this post for an example of retrieving the Guid of a custom field.
Really, I think the key is setting the filter criteria:
cfFilter.Criteria = new PSLibrary.Filter.FieldOperator(equal, nameColumn, customFieldName);
Where nameColumn is cfDataSet.CustomFields.MD_PROP_NAMEColumn.ColumnName and customFieldName is a value you pass in.
If you are like me, you want to do this for a lot of fields. I used a filter to query all the field names and MD_PROP_UID's and then just put it in a hashtable so I don't have to keep making PSI calls.
Disclaimer: I use 2007 but I'm assuming it is mostly the same for custom fields (not for the EPT part which I didn't include).
Here is an answer: https://stackoverflow.com/a/12267251/1594383
In short: the methods are available from Workflow service.

Entity framework using Data Repository pattern - DeepLoading

I have been implementing a new project which I have decided to use the repository pattern and Entity Framework.
I have sucessfuly implemented basic CRUD methods and I have no moved onto my DeepLoads.
From all the examples and documentation I can find to do this I need to call something like this:
public Foo DeepLoadFoo()
{
return (from foobah in Context.Items.Include("bah").Include("foo").Include("foofoo") select foo).Single();
}
This doesnt work for me, maybe I am trying to be too lazy but what I would like to achieve would be something along the lines of this:
public Foo DeepLoadFoo(Foo entity, Type[] childTypes)
{
return (from foobah in Context.Items.Include(childTypes).Single();
}
Is anything like this possible, or am I stuck with include.include.include.include?
Thanks
This blog post mentions that the Entity Framework ObjectContext has all the metadata about entities and their properties. So maybe you can use that metadata to walk the properties of your entity, and their child properties, etc.
In other words, I believe you should be able to use the metadata to automatically compose Include calls on your query.