Friday 9 October 2015

HttpConnector in mulesoft

This is my first program and first blog in mule soft.

I am sharing the configuration code also

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
        <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081"  doc:name="HTTP Listener Configuration"/>

      <flow name="cookbook-helloworldFlow">
         <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
          <component class="com.enkindle.Greeting" doc:name="Java"/>
      </flow>

</mule>

Wednesday 30 September 2015

How to get the dataList Items in alfresco using java

public NodeRef getDataListItem(NodeRef actionedUponNodeRef) {
NodeRef vendorItem = null;
String siteShortName = siteService.getSiteShortName(actionedUponNodeRef);
String targetedDataListName = "Vendor";
NodeRef dataListContainer = SiteServiceImpl.getSiteContainer(siteShortName, DATALIST_CONTAINER_ID, true,
siteService, transactionService, taggingService);
List<ChildAssociationRef> dataListsNodes = nodeService.getChildAssocs(dataListContainer);

for (ChildAssociationRef dataList : dataListsNodes) {
if (dataList.getTypeQName().isMatch(ContentModel.ASSOC_CONTAINS)) {
if (nodeService.getProperty(dataList.getChildRef(), ContentModel.PROP_TITLE) != null && nodeService.getProperty(dataList.getChildRef(), ContentModel.PROP_TITLE).toString().equals(targetedDataListName)) {
List<ChildAssociationRef> itemsNodes = nodeService.getChildAssocs(dataList.getChildRef(), ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
   for (ChildAssociationRef item : itemsNodes) {
    System.out.println("ads:" + item.getQName());
    vendorItem = item.getChildRef();
   }
}
}
}
//System.out.println("The dataLists" + dataListNodeRef.);
return vendorItem;
}

How to create Document management and record management site in Alfresco using Java program

How to create DM site in Alfresco using Java program

1. Use the repo tier webscript to invoke siteService to actually create the site.

SiteInfo dmSite = siteService.createSite("site-dashboard", "DM",  " Document Management",  "Document Management", SiteVisibility.PUBLIC);


2. To initialize the site dashboard, use Share tier webscript that uses a remote call to repo tier webscript to creates the site.

ApplicationContext applicationContext = null;
ScriptSiteData scriptSiteData = new ScriptSiteData(requestContext, applicationContext);
Scriptable dmToken = new BaseFunction();

Response response = remoteClient.call("http://localhost:8080/alfresco/s/"); 

dmToken.put("siteid", dmToken, dmShortName); //get dmShortName from response.
dmSiteCreation = scriptSiteData.newPreset("site-dashboard", dmToken);
 

How to create Record management site in Alfresco using java program

It is same way as DM site creation, except initialize the site-dash board

1. Use the repo tier webscript to invoke siteService to actually create the site.

SiteInfo rmSite = siteService.createSite("site-dashboard", "RM",  " Record Management",  "Record Management", SiteVisibility.PUBLIC);


2. To initialize the site dashboard, use Share tier webscript that uses a remote call to repo tier webscript to creates the site.

ApplicationContext applicationContext = null;
ScriptSiteData scriptSiteData = new ScriptSiteData(requestContext, applicationContext);
Scriptable rmToken = new BaseFunction();

Response response = remoteClient.call("http://localhost:8080/alfresco/s/"); 

rmToken.put("siteid", rmToken, rmShortName); //get rmShortName from response.
rmSiteCreation = scriptSiteData.newPreset("rm-site-dashboard", rmToken);