This time will tell how you can create a content using WCM API. Before I want you to see my sample code I would like to show the WCM API method to get what is required to create content into Web content management through WCM API.
JavaDoc description for Create Content method in WCM API:
createContent (In API JavaDoc)
Content createContent(DocumentId authoringTemplateId,
DocumentId parentSiteAreaId,
DocumentId siblingId,
int position)
throws DocumentCreationException,
AuthorizationException,
IllegalDocumentTypeException
Creates a new Content object, based on an AuthoringTemplate in the parent SiteArea. The template ID that is specified must be for a template that already exists in the WCM system.
If the ChildPosition is ChildPosition.PREVIOUS or ChildPosition.NEXT, then the siblingId parameter must be specified. If it is not, then an IllegalArgumentException will be thrown. If the ChildPosition is ChildPosition.START or ChildPosition.END then the siblingId parameter, if it is not null, will be ignored.
Parameters:
authoringTemplateId - the authoring template ID
parentSiteAreaId - the parent site area ID
siblingId - the DocumentId of the sibling document, if any. May be null, according to the rules stated
position - the position of the child (docId)
Returns:
a new Content object based on the specified template
Throws:
DocumentCreationException - if the object cannot be created
AuthorizationException - if the user does not have access
IllegalDocumentTypeException - if specified template is not an AuthoringTemplate, the parentSiteArea is not a SiteArea, or the sibling is not a Content or ContentLink.
**** MY SAMPLE CODE STARTS HERE *****
String userName = USER_BALA;
String password = PASS_BALA;
String wcmLibraryName= LBRY_Test;
String contentName = CNTNT_Test;
String contentTitle = CNTNT_Test_Title;
String siteArea= SA_Test;
String authoringTemplate= AT_Test;
// Getting workspace object.
Workspace oWorkspace = WCM_API.getRepository().getWorkspace(username, password);
// Setting current document library
oWorkspace.setCurrentDocumentLibrary(oWorkspace.getDocumentLibrary(wcmLibraryName));
DocumentId oDocumentIdContent = Util.getDocumentId(oWorkspace, DocumentTypes.
Content, contentName);
// Check whether content is already existing or not
if( oDocumentIdContent==null){
/*
* Getting Site Area document id.
*/
DocumentId oDocumentIdSiteArea = Util.getDocumentId(oWorkspace, DocumentTypes.
SiteArea, siteArea);
if(oDocumentIdSiteArea!=null){
// Get the authoring template document id.
DocumentId oDocumentIdAuthoringTemplate = Util.getDocumentId(oWorkspace, DocumentTypes.AuthoringTemplate, authoringTemplate);
if(oDocumentIdAuthoringTemplate!=null){
// Creating content here ...
oContent = oWorkspace.createContent(oDocumentIdAuthoringTemplate, oDocumentIdSiteArea, null, ChildPosition.END);
oContent.setName(contentName);
oContent.setTitle(contentTitle );
}
}
}
String errors[] = oWorkspace.save(oContent);
for(int x=0;x LessThan errors.length;x++) {
System.
out.println("Errors while saving the content into workspace "+errors[x]);
}
**** UTIL METHODS STARTS HERE ****
public static DocumentId getDocumentId(Workspace oWorkspace, DocumentType oDocumentType, String fileName) throws Exception{
DocumentId oDocumentID = null;
DocumentIdIterator oDocumentIdIteratorContents = oWorkspace.findByName(oDocumentType,fileName);
if(oDocumentIdIteratorContents.hasNext()){
oDocumentID= (DocumentId) oDocumentIdIteratorContents.next();
}
return oDocumentID;
}
**** UTIL METHODS ENDS HERE ****
**** MY SAMPLE CODE ENDS HERE ****
I hope this will give clear idea about how to add a content into IBM Web Content Management System using WCM API.
Wednesday, April 15, 2009
Monday, April 13, 2009
Tracing errors while saving content in to Workspace object using WCM API
This time would like to share my experience with issues which I faced & how I solved that while working with WCM API.
I have written code to upload an image into content management system using WCM API.
Due to missing of file extension I could not able to upload an image into content management system using WCM API.
The following code was very useful to find errors while saving a content into workspace object..
String errors[] = oWorkspace.save(oContent);
for(int x=0;x LessThan errors.length;x++)
{System.out.println("Errors while saving content into workspace object using WCM API"+errors[x]);
}
I hope this will help for the people who works with WCM API to write data into content management system.
I have written code to upload an image into content management system using WCM API.
Due to missing of file extension I could not able to upload an image into content management system using WCM API.
The following code was very useful to find errors while saving a content into workspace object..
String errors[] = oWorkspace.save(oContent);
for(int x=0;x LessThan errors.length;x++)
{System.out.println("Errors while saving content into workspace object using WCM API"+errors[x]);
}
I hope this will help for the people who works with WCM API to write data into content management system.
Labels:
IWWCM - WCM API
Thursday, March 19, 2009
Navigating to other page in Portal from any portlet
The following steps will be used to navigate control from any portlet to any page/ any portlet in other page. Also this can be used to pass parameter to other portlet.
1> Keep the wp[1].l2.urlhelper.jar file under WEB-INF/lib folder.
2> Add the following code in your JSP to achieve the same.
String homeURL = PortletURLHelper.generateUrl(PAGE_UNIQUE_NAME, Portlet Name, null, true, renderRequest, renderResponse);
Use the value of homeURL in href attribute.
3> Download the jar from the following location.
http://www-01.ibm.com/support/docview.wss?rs=688&context=SSHRKX&dc=DB520&uid=swg21265900&loc=en_US&cs=UTF-8&lang=en&rss=ct688websphere
1> Keep the wp[1].l2.urlhelper.jar file under WEB-INF/lib folder.
2> Add the following code in your JSP to achieve the same.
String homeURL = PortletURLHelper.generateUrl(PAGE_UNIQUE_NAME, Portlet Name, null, true, renderRequest, renderResponse);
Use the value of homeURL in href attribute.
3> Download the jar from the following location.
http://www-01.ibm.com/support/docview.wss?rs=688&context=SSHRKX&dc=DB520&uid=swg21265900&loc=en_US&cs=UTF-8&lang=en&rss=ct688websphere
Labels:
IBM Websphere Portal
Thursday, August 02, 2007
Transforming UML Activity Diagrams to WebSphere Business Modeler processes
UML (Unified Modeling Language)
* An object-oriented analysis and design language from the Object Management Group (OMG).
* There are twelve diagrams supported under UML. Four are structural(class, object, component and deployment), five are behavioral(use case, sequence, activity, collaboration and state chart) and three are used for model management(packages, subsystems and models)
Will explain more detail about the above topics in my coming posts.
This article shows how to automatically transform UML activity diagrams (One of the Behavioral Diagram)into WebSphere Business Modeler processes.
Click here for more details.
* An object-oriented analysis and design language from the Object Management Group (OMG).
* There are twelve diagrams supported under UML. Four are structural(class, object, component and deployment), five are behavioral(use case, sequence, activity, collaboration and state chart) and three are used for model management(packages, subsystems and models)
Will explain more detail about the above topics in my coming posts.
This article shows how to automatically transform UML activity diagrams (One of the Behavioral Diagram)into WebSphere Business Modeler processes.
Click here for more details.
Labels:
UML Related
Tuesday, July 24, 2007
Enterprise Java Research Library in TSS
Browse lots of white papers by author, keyword, topics, most popular, and most recent white paper related to JAVA,J2EE,Webservices,XML. e.t.c
Click here to visit Enterprise JAVA Research Library in TSS.
Click here to visit Enterprise JAVA Research Library in TSS.
Labels:
JAVA Related
Friday, June 22, 2007
Working with LDAP & AD
PART 1 : (Getting a connection between AD,IplanetLDAP & openLDAP)
Now this time i am planning to share my knowledge about getting a connection between LDAP/AD to your JAVA based Web Application.
Let me tell the requirements first.. You need to have ldapjdk.jar you can download from the following location http://www.ktauber.com/downloads/ldap.html .
Code snippet for getting connection
netscape.ldap.LDAPConnection ldapconnection = new netscape.ldap.LDAPConnection();
ldapconnection.connect(3,hostname,portnumber,adminDN,password);
ldapconnection.authenticate(3,adminDN,password);
Now this time i am planning to share my knowledge about getting a connection between LDAP/AD to your JAVA based Web Application.
Let me tell the requirements first.. You need to have ldapjdk.jar you can download from the following location http://www.ktauber.com/downloads/ldap.html .
Code snippet for getting connection
netscape.ldap.LDAPConnection ldapconnection = new netscape.ldap.LDAPConnection();
ldapconnection.connect(3,hostname,portnumber,adminDN,password);
ldapconnection.authenticate(3,adminDN,password);
By using the above three lines you can get the connection from LDAP/AD.Where the adminDN will change from LDAP& AD. {Where DN represents Distinguished Name}
Let us see sample adminDN for the above all..
adminDN format for AD ==>"cn=administrator,cn=users,dc=balamurugans,dc=com"
adminDN format for IPlanetLDAP ==>"uid=admin,ou=administrators,ou=topologymanagement,o=netscaperoot"
adminDN format for openLDAP ==>"cn=Bala,dc=balamurugans,dc=com"
Note default port number is "389" for all LDAP.
let us see how to fetch the data from the above LDAP's in my next post.
Labels:
LDAP Related
Using Spring and Hibernate with WebSphere Application Server
Now a days spring & hibernate has became more popular & it saves lots of development time for web application devlopment.Due to that, there is an increase in target users for Spring Framework .Where this article explains how to configure these frameworks for various scenarios with WebSphere Application Server.Note this is updated for Spring Framework 2.1
Click here for more details .
Click here for more details .
Labels:
IBM Websphere Related
Monday, June 04, 2007
New Innovative Business Portal Solutions: IBM Websphere Portal Strategy
IBM has introduced an exciting new set of WebSphere Portal offerings. Where Larry Bowden, VP of Portals and Web Interaction Services, will review IBM's portal strategy and how customers can augment their existing IT initiatives and investments with a new set of prepackaged portal solutions that address specific business needs. Learn how company can leverage these new offerings to help shorten implementation time and achieve return on investment (ROI) faster.
Click here to see his webcast event.
Click here to see his webcast event.
Labels:
IBM Websphere Portal
10g Oracle Development Kit for Spring
Oracle has come up with their own devlopment kit for Spring devlopment.
These are the benefits from the contents of Oracle Devlopment Kit
- A comprehensive set of How-To examples illustrating Spring-OC4J integration.
- The Oracle Developer Depot Web application, which enables you to deploy and run the How-To projects on OC4J
- A Spring extension to JDeveloper, Oracle's free Java IDE
- Supporting documentation and white papers
Hope this will be good news for oracle devlopers.Please share with me if you find any materials related to the same .
Click here to get more details
Labels:
Oracle Related
Saturday, June 02, 2007
Using RAD V7 to create & deploy JSR 168 cooperative Portlets
Learn about the cooperative portlet tools available in IBM Rational Application Developer V7 while you create a simple cooperative application and deploy it onto an IBM WebSphere Portal 6.0 server. The focus is on JSR 168 JavaServer Faces portlets, but the authors also briefly discuss Basic and Struts portlets.
Click Here For More Info
Click Here For More Info
Labels:
IBM Websphere Portal
Subscribe to:
Posts (Atom)