Sample entry preview extension point in Java™ API

The following sample code shows how to use the entry preview extension point.

The entry preview extension point is an entry script that you can use to create custom previews of entries. A preview can be in HTML format, a CSV file, or any form of data writable.

You can query an item, category, or workflow information when appropriate, preview your entries, and write your output.

Sample code for the entry preview extension point

public class UserCode implements EntryPreviewFunction {
	public UserCode() {
	}

	public void entryPreview(ItemPreviewFunctionArguments inArgs) {
		PIMCollection<Item> items = inArgs.getItems();
		PrintWriter out = inArgs.getOutput();

		if (items != null)
			out.println("<html><body>the count of entry:" + items.size() + "</body></html>");

	}

	public void entryPreview(CollaborationItemPreviewFunctionArguments inArgs) {
		PIMCollection<CollaborationItem> items = inArgs.getCollaborationItems();
		PrintWriter out = inArgs.getOutput();

		if (items != null)
			out.println("<html><body>the count of entry:" + items.size() + "</body></html>");

	}

	public void entryPreview(CategoryPreviewFunctionArguments inArgs) {
		PIMCollection<Category> categories = inArgs.getCategories();
		PrintWriter out = inArgs.getOutput();

		if (categories != null)
			out.println("<html><body>the count of entry:" + categories.size()
					+ "</body></html>");

	}

	public void entryPreview(
			CollaborationCategoryPreviewFunctionArguments inArgs) {
		PIMCollection<CollaborationCategory> categories = inArgs
				.getCollaborationCategories();
		PrintWriter out = inArgs.getOutput();

		if (categories != null)
			out.println("<html><body>the count of entry:" + categories.size()
					+ "</body></html>");
	}
}
Note: IBM® Product Master does not support the use of frames in scripting.