liferay 6.2 addDLFolder fail - web-services

I tried to build a webservice for external system to upload documents.
Each user create a unique folder to store the documents himself uploaded.
In order to that,I was thinking to create different folder with unique name.
I looked up API and find a DLFolderLocalServiceUtil.addFolder(parameter list is way too long to type) method.
The param serviceContext is required and I can't seem to find a way to retrieve it.
So, I put NULL instead. After I build and deploy, I call the method which contains addFolder() from client, NullPointerException occurs on server and an axis exception occurs on client.
faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException, faultString: java.rmi.RemoteException.
Is it because I put NULL as a parameter instead of an instance of serviceContext?
If so,how can I get the instance of serviceContext? If I can not, where else could be the problem?
Here's my paramlist:
DLFolderLocalServiceUtil.addFolder(user.getUserId(), user.getGroupId(), user.getGroupId(), true, 10157, "test", "description", false, null);

You could also give DLAppLocalServiceUtil.addFolder a try.
Similarly, the Service Context is a parameter, but I'm able to create a folder with the following
final Folder folder = DLAppLocalServiceUtil.addFolder(
getThemeDisplay().getUserId(),
getThemeDisplay().getScopeGroupId(),
DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
"Folder Name",
"Folder Description",
new ServiceContext());
In my particular use case, I use the ThemeDisplay from the request object to organize my Document Media elements:
(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY)
Note: Also in my particular usage, the user that triggers the folder creation will have elevated permissions, as such permissioning may be an issue for non-admin users.

Related

How to embed parameters into AWS Lambda GET request?

So say my request url to get all the Users at Location 4 is something like
./Location/Users?locationId=4 or ./Location/Users/4
but we would of course prefer to structure the request url like this:
./Location/4/Users
however, every single AWS help document and help question I can find on here uses the first syntax, so I am unsure how to proceed. It seems like there should be a way to do this, as it is a very common design pattern, but AWS seems to lock you in to only being able to append to the ./Users path instead of being able to prepend the argument.
To be clear, the first request syntax is working, but I'm not sure how to adjust the syntax to a more industry-standard way of doing it since embedding the parameter in the middle of the url instead of at the end would fundamentally change the Amazon Resource Name.
There's probably something simple that I'm missing here though.
Api gateway indeed supports URl like Location/{locationId}/Users. You first need to create locationId as a child resource and then create users as a child resource under that.
Steps
Click Location, and goto actions and click create resource.
fill the details of your new resource
resource name - give a meaningful name
resource path - {locationId}
repeat the same to add Users under LocationId

How to make a web service call to Salesforce from jitterbit

I am new to Jitterbit and i want to update records in salesforce based on a condition but need to do this using a web service.
Using web service i want to get the id of the record from salesforce as a response then that response will be used as a source to other operations.
But i dont know how to make a request call to salesforce using Jitterbit.
Please help me on this.
I don't know if you still need this but here it goes how I'd do it. You might want to create a script and run the operation to SF.
Any operation (that is successful) will be able to return an ID, if you analyze the response object (double click on the Web Service Response object), then on the target panel, expand TARGET:NameOfResponse -> flat -> response.
If you open the response, Jitterbit will open using formula builder and here you will find a script:
<trans>
// This mapping is part of a Salesforce wizard.
// Modifying it may cause the wizard to malfunction.
If(root$transaction.response$body$createResponse$result.success$ == false,
WriteToOperationLog(SumString(root$transaction.response$body$createResponse$result.errors#.message$, ". ", false)))
</trans>
Since this is just another script, you can add a global variable and retrieve the ID ($MyGlobalVariable):
<trans>
// This mapping is part of a Salesforce wizard.
// Modifying it may cause the wizard to malfunction.
If(root$transaction.response$body$createResponse$result.success$ == false,
WriteToOperationLog(SumString(root$transaction.response$body$createResponse$result.errors#.message$, ". ", false))
,
$MyGlobalVariable = root$transaction.response$body$createResponse$result.id$)
</trans>
So in script, you reference the ID after running the operation:
<trans>
RunOperation("<TAG>Operations/TheOperation</TAG>");
WriteToOperationLog($MyGlobalVariable);
</trans>

Creating new Resource by Copying Existing resource

In WSO2 gov. registry 4.6.0 I have a resource called 'Project' which has many fields and a lot of data. I want to create multiple projects most of which have the same data as my first project but a few fields change.
I copied the resource using the 'resources->Browse' option and then renamed and moved the copied project under the projects location. I thought this would do the job but I noticed that the resource name is not the new name. It still shows the old project name as the resource name which I cannot edit as I get error (Exception occurred while trying to invoke service method editArtifact).
I also noticed that while using the 'resources->Browse' option the new project name shows up in the browsed directory but not in the actual project when I navigate to the project using the project link.
Is there a way to copy, duplicate and modify an existing resource without having to manually redo all fields in an existing resource again?
Thanks
You should be able to use the Check-in Client provided by WSO2 Governance Registry.
You can checkout the registry to your file system, do changes and check-in those back to the registry.
I hope this helps.

WSO2 GR: add application artifact and lifecyle when defining new application in the GR

I have a WSO2 Goverance Registry setup conformant to this blog post http://blog.shelan.org/2013/02/application-governance-with-wso2-greg.html.
When defining a new application in the WSO2 GR using the menu: Metadata > Add > Application I would like to be able to directly add the actual application artifact (war/car file).
The selected file should then by placed in the SVN location conforming to the initial state of the lifecycle to which I will bind the application. This of course implies that I would also need to be able to directly add the lifecycle when defining a new application.
The new application form would then be something like this:
Name: ExampleApplication-1.0.0
Type: .war (is now redundant)
Description: My Example Application Artifact: Selected file
ExampleApplication-1.0.0.war Lifecyle: MyDTAP-Lifecycle_v1
Does anybody know a good starting point for adding this functionality in terms of code hooks or extension points?
If I have understood you correctly, what you need to do is basically provide an file upload option in your "Application" RXT (Governance Artifact Configuration) which will upload what ever your file type and based on that you want to fill the derivable information to the meta data of the artifact. And also to attach a selected/pre defined life cycle to it at artifact creation. What you are looking for is Registry Handlers [1]. You can achieve all aforementioned tasks probably through a single handler.
[1] - http://docs.wso2.org/wiki/display/Governance453/Handlers

How to get all the Open Graph Beta actions generated by an app?

It is already possible to get all actions for custom app actions and objects:
https://graph.facebook.com/me/{appNameSpace}:{action}/{object}
This will list all the actions generated by an app, but only for a given user...
How do I get all the actions generated by an app (for all its users)?
I've tried this request with an app access token :
https://graph.facebook.com/{appId}/{appNameSpace}:{action}/{object}
But it does not work...
I was also looking for an activities or actions FQL table, since each action has an id, they should be accessible somewhere.
Any suggestions?
AFAIK there is no way to get all actions published by application via OpenGraph, but your application creates those actions, why just not record results of this operation?
Then you create action you should get response like this:
{
id: “{action-instance-id}”
}
Later you may read this action:
GET https://graph.facebook.com/{action-instance-id}
You for sure may benefit from doing request to get multiple actions like this:
GET https://graph.facebook.com/?ids={action-id1},{action-id2},{action-idn}
And even batch those requests