Friday, December 17, 2010

Creating a New Site Area using the IBM WCM API

<%@ page import="com.ibm.workplace.wcm.api.*"%>
<%@ page import="java.util.*"%>
<% // retrieve repository Repository repository = WCM_API.getRepository(); // get workspace for current user Workspace workspace = repository.getWorkspace(request.getUserPrincipal()); // Set library workspace.setCurrentDocumentLibrary(workspace.getDocumentLibrary("WebContent")); DocumentId documentId = null; Site parentSite = null; String parentSiteName = "Site"; DocumentId siblingId = null; // find parent site DocumentIdIterator siteIterator = workspace.findByName(DocumentTypes.Site,parentSiteName); if (siteIterator.hasNext()){ documentId = siteIterator.nextId(); parentSite = (Site) workspace.getById(documentId); // create new sitearea SiteArea newSiteArea = workspace.createSiteArea((DocumentId)parentSite.getId(),siblingId,ChildPosition.END); newSiteArea.setName("NewSiteArea"); newSiteArea.setTitle("NewSiteArea"); newSiteArea.setDescription("New Sitearea Created using WCM API String[] saveMessage = workspace.save((Document)newSiteArea); if (saveMessage.length==0) { out.println ("
Created new Sitearea under " + parentSiteName );
}
} else {
out.println ("
Could not find parent Site " + parentSiteName + ". Could not create a
new Sitearea." );
}
%>

New Site Creation

Create a new Website using the IBM WCM API

<%@ page import="com.ibm.workplace.wcm.api.*"%>
<%@ page import="java.util.*"%>
<% // retrieve repository Repository repository = WCM_API.getRepository(); // get workspace for current user Workspace workspace = repository.getWorkspace(request.getUserPrincipal()); // Set library workspace.setCurrentDocumentLibrary(workspace.getDocumentLibrary("WebContent")); // create new site Site newSite = workspace.createSite(); newSite.setName("Jerome"); newSite.setTitle("JeromeSlinger"); newSite.setDescription("New Site Created using WCM API"); String[] saveMessage = workspace.save((Document)newSite); if (saveMessage.length==0){ out.println("Could not create new Site..
");
}else{
out.println("New Site created successfully.");
}
%>

Thursday, December 2, 2010

Creating a Default Portal Search Service Collection and Content Source

Step One - Log in to Portal / WCM Design



Now navigate to Administration



1.Click on Search Administration > Manage Search
2.Click on Search Collections



3.Click on New Collection
4.Add Search Collection detail and click OK



N.B.The red areas are where you enter your own Collection details

5.Check that the Search Collection was created successfully
6.Click on Log Out



OK, we are not done yet!So now.....

Create the Portal Search Content Source

1. Log into IBM WCM
2. You will now go to the Web Content and NOT the admin console
3. Select the library you wish to add to your collection
4. Select Site Areas>By SITE>Click Edit

N.B.You need to select the tick box next to the site on the right hand-side and click edit.

5.Select Search>Tick Searchable
6.From the Drop-down select your Search Service
7.Select your Search collection
8.Set User ID and Password and Click on Save

OK, Now we are making progress....but we are not done YET!

Ok Here we go....

1. Click Launch (Top left Corner)
2. Select Administration from the Drop-down
3. Select Manage Search
4. Click on Search Collections
5. Click on the collection you want to add the Content Source too
6 Click on Edit Content Source of the Content Source that was created

Now this part is extremely important!

1. Change General Parameters
> Stop collecting after (min) to Unlimited
General Parameters > Stop fetching a document after (sec) to Unlimited

2. Change Schedulers > Define Schedule > At to 22 00
Change Schedulers > Define Schedule > Update every to 1 day(s) and click Create
Select Scheduled Updates > Schedule that was created by default and click Delete
> CLICK SAVE!
>Check that the Content source was created without errors
>The crawler will run with the next run date and time

N.B. I was using 22 00 as an example so please amend this to your own requirements.


Now I am going to share a secret with you that will save you a lot of time....come closer....this is serious....you will thank me later.

On the left hand side of your admin console do the following:

1.Click on Access > Resource Permissions > PSE Sources
2.Click on Assign Access for your collection
3.Click on Edit Role for the User role
4.Add anonymous Portal user

Well Done!!

We will make you a WebSphere guru yet!