package org.netevolved.tincan; import org.ijsolutions.testbench.Test; import org.ijsolutions.testbench.TestBench; import org.openedit.Data; import org.openedit.ModuleManager; import org.openedit.WebPageRequest; import org.openedit.event.WebEvent; public class TinCanIDAssistant { protected TestBench fieldTestBench; protected ModuleManager fieldModuleManager; protected String fieldCatalogId; protected TinCan fieldTinCan; public TinCan getTinCan() { return fieldTinCan; } public void setTinCan(TinCan inTinCan) { fieldTinCan = inTinCan; } public String getCatalogId() { return fieldCatalogId; } public void setCatalogId(String inCatalogId) { fieldCatalogId = inCatalogId; } public ModuleManager getModuleManager() { return fieldModuleManager; } public void setModuleManager(ModuleManager inModuleManager) { fieldModuleManager = inModuleManager; } public void setTestBench(TestBench inBench) { fieldTestBench = inBench; } public TestBench getTestBench() { if (fieldTestBench == null) { fieldTestBench = (TestBench) getModuleManager().getBean(getCatalogId(), "testBench"); } return fieldTestBench; } public String createEventUri(WebEvent inEvent) { Object source = inEvent.getSource(); Data data = null; if(source instanceof Data) { data = (Data)source; } if(data == null) { return getTestBench().getSiteRoot() + "/" + getTestBench().getCatalogId()+"/tincan/event/"+ inEvent.getSearchType() + "/" + inEvent.getOperation(); }else { return getTestBench().getSiteRoot() + "/" + getTestBench().getCatalogId()+"/tincan/data/"+ inEvent.getSearchType() + "/"+ data.getId(); } } public void populateExtraData(WebPageRequest inReq, WebEvent inEvent) { inEvent.setProperty("ip", inReq.getRequest().getRemoteAddr()); //ip address of whoever is logging in inEvent.setProperty("user-agent", inReq.getRequest().getHeader("User-Agent")); //user's browser info... this could include type of device inEvent.setProperty("referringpage", inReq.getReferringPage()); //page that had the link that the user clicks... iow, where the user came from // TODO Auto-generated method stub } //TODO create more of these methods ie getCourseURI, getLearningGroupURI, getGenericURI... also for asset stuff! }