Create Site in Alfresco using the Apache Chemistry - java

Greetings to the community! I am using alfresco Community Edition 6.0.0 with the Apache Chemistry API. I have successfully managed so far to create/fetch content from the alfresco repository through it (Folder and Document files).
Now what I would like to do is use the Apache Chemistry API to create an alfresco site (like I would do using the alfresco/api/-default-/public/alfresco/versions/1/sites POST method in the Alfresco REST API).
Is that feasible?? What I have done following the way I already created folders in the repository is:
Folder folder = retrieveSitesFolder(); // this returns the folder object using the node id of the "Sites" node
Map<String, Object> props = new HashMap<String, Object>();
props.put(PropertyIds.OBJECT_TYPE_ID, "F:st:site"); //this is recognized fine
props.put("st:siteVisibility", "PUBLIC");
props.put("st:sitePreset", "something");
props.put("cmis:name", "something");
Folder subFolder = folder.createFolder(props);
I am following the site model from here concerning the properties I add
https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V4.2a/root/projects/repository/config/alfresco/model/siteModel.xml
Unfortunately, when I run this piece of code I get the following error:
Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: 10290059 Site something does not exist.
which seems to me very strange as what I expect my code to do is create that site not search for it in anyway.
What makes this more strange is when I created a site with name "something" via the REST API and re-run the code, the code run successfully, but I did not get any extra site in the alfresco/api/-default-/public/alfresco/versions/1/sites endpoint of the REST API.
Could anyone shed some light on this please? Any help would be greatly appreciated!

As Gagravarr says the API hasn't supported creating functional sites until, as Billerby pointed out, the REST API made some improvements.
Apache Chemistry has no idea what a site is, but, as you've discovered, an st:site is just a child type of cm:folder.
Despite that this is most likely not going to work via CMIS, I wanted to point out that you are using "something" for site preset. That is not going to work unless you've defined a new site preset called "something".
By default, there is a single out-of-the-box site preset called "site-dashboard" which is the ID for the "Collaboration Site" preset.
You might change your st:sitePreset to "site-dashboard" and see if you get any further.

Related

Calling a REST service using business central and JBPM

We're trying to do a POC showing we can call an external REST service using JBPM in business-central.
We've created a new BPM, then added a REST service task. We notice at this point that a WID file is created that has REST definition. Inside the WID file, it defines things like URL, Method, and authentication.
We've sifted through all the 7.2 docs, but for the life of us, we cannot figure out how to actually set those parameters and do something useful. Does anyone have a simple "Hello World" using business central 7.2 calling out to an external process?
We see there's a predefinied REST handler: https://github.com/kiegroup/jbpm/blob/master/jbpm-workitems/jbpm-workitems-rest/src/main/java/org/jbpm/process/workitem/rest/RESTWorkItemHandler.java
We're lacking how to assemble all of this; we can't find documentation or examples on something that seems so simple.
Thank you!
If you're using Busines Central, you can edit the process model and check the data assignments for the specific REST node. In there you can set the values of the variables or use some process variable to map dynamic values. Hope it helps.

Getting OpenStack Server's Tags

I'm using jclouds Java SDK, i search in the documentation and in the jclouds examples for how to get the tags of a Nova server, but i didn't find any mention of it. i found some other function to get the instance name, instance metadata and so on in the following code
NovaApi novaApi = computeServiceContext.unwrapApi(NovaApi.class);
String region = novaApi.getConfiguredRegions().iterator().next();
ServerApi serverApi = novaApi.getServerApi(region);
Server instance = serverApi.get(TEMP_SERVERNAME);
in the variable instance i can get information about the instance such as metadata for example, but not the tags.
my question is this OpenStack API implemented in the jclouds SDKs? if yes how can i call it?
Thanks
That API call is not yet implemented in the jclouds Server API. However, it should be pretty easy and straightforward to add that method. Would you be willing to contribute to the project and add it? I would be more than happy to help you get that done!

AWS Elastic Beanstalk "Impaired services on all instances."

I have a spring service that I'm trying to load load into AWS Beanstalk. When i create the environment and upload my .war file it just stays stuck on degraded. When i look through the logs for errors i cannot see any errors. Also when try and connect to my url, for example http://something.us-east-1.elasticbeanstalk.com/, i get a 502 error. I've already looked at the documentation provided by amazon that states the red degraded message means that all/most of the requests to you page are failing. Any idea how i can find the issue? See the screenshot below for the Enhanced Health Overview.
So, it turned out that i was getting an error in my logs but i was not able to see them. I had to ignore all of the eb-something log files. I needed to be looking at the web-1.log. This file may be named different depending on your instance and your environment but this is where i could actually see my error.
people who are finding their actual log can look up for this section in their EB log file.
/var/log/web.stdout.log
I had the same problem, with "Impaired services on all instances."
As suggested above, I ssh'd into the elastic beanstalk instance and looked at /var/log/web.stdout.log.
As I found there, my problem was that I was following a django tutorial and created a django config file with the WSGIPath pointing to the project name that was in the tutorial, but my actual project had a different name.
I corrected the mistake, wiped the elastic beanstalk instance and set up the environment again from scratch.
No problems at all this time, everything turned green immediately.

Grab XML from WSO2 governance

I'm in the final stages of a project to allow users to use the Management Console to upload services to WSO2 governance. Once a month, we want to grab all info from WSO2 and transform into HTML and post to a wiki.
At the moment, I haven't found a convient way to export all XML from WSO2 governance through Java. The only solution I found was to grab all services with a certain tag. This is not going to work well if there are other users that do not know to add this tag.
Does any one have any ideas on how I can export the XML from all services on my WSO2 instance?
Thanks!
You have to simply call Registry.getResource() method to retrieve resources..Check the Governance Registry API for available methods..So, you can use any of them which suits to your need..
Found the answer in code here: http://ajithvblogs.blogspot.com/2013/02/how-to-invoke-custom-artifacts-using.html#!/2013/02/how-to-invoke-custom-artifacts-using.html
I needed to get the info from the artifact, not the individual resources.
GenericArtifactManager artifactManager = new GenericArtifactManager(registry, "applications");

creating Sites using java

i developed one application used to create google sites by referring the developer guide in which i don't know what are the three parameters in this is particular line
SitesService client = new SitesService("yourCo-yourAppName-v1").
This is my problem. help me
There is only one parameter in your example, it is the application name.
What you have in your example is an example of an application name composed from a company name (yourCo) a name for the application (yourAppName) and a version for your application (v1).
Does this help you ?

Categories