Hi All,
I'm new to custom building blocks, but have gotten a decent amount of examples to work with. I'm trying to create a building block that, in essence, creates a web-link exactly like the built in function does, but has a prepopulated URL. The URL is "../courseID/term".
Now, my problem is that I can get the building block to create the item using the following class:
public class ContentCreator {public static void createContent(String title, String inputHtml, String sCourseId, String sParentId) throws PersistenceException, ValidationException {
// retrieve the Db persistence manager from the persistence serviceBbPersistenceManager bbPm = PersistenceServiceFactory.getInstance().getDbPersistenceManager();
// create a course document and set all desired attributesContent content = new Content();content.setContentHandler("resource/x-bb-externallink");content.setLaunchInNewWindow(true);content.setTitle(title);content.setUrl("http://www.google.com");
// set additional attributesId courseId = bbPm.generateId(Course.DATA_TYPE, sCourseId);Id parentId = bbPm.generateId(Course.DATA_TYPE, sParentId);content.setCourseId(courseId);content.setParentId(parentId);
// retrieve content persister and persist the content itemContentDbPersister persister = (ContentDbPersister) bbPm.getPersister(ContentDbPersister.TYPE);persister.persist(content);
}
try this instead:
ExternalLink content = new ExternalLink();content.setLaunchInNewWindow(true);content.setTitle(title);contnet.setUrl("http://www.google.com");
Worked like a charm. Thanks!
Just in case anyone else tries this, I did also have to include blackboard.data.content.ExternalLink; at the top of the class.