Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java =================================================================== diff -u -rbc65717cc947dfd5b941ab4ac8f31a59c8f68bf4 -rc2bfdabe240b93d6bdd8dd9aa84b274570eb0ae7 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (.../ScratchieServiceImpl.java) (revision bc65717cc947dfd5b941ab4ac8f31a59c8f68bf4) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (.../ScratchieServiceImpl.java) (revision c2bfdabe240b93d6bdd8dd9aa84b274570eb0ae7) @@ -1144,91 +1144,6 @@ * Import the data for a 1.0.2 Noticeboard or HTMLNoticeboard */ public void import102ToolContent(Long toolContentId, UserDTO user, Hashtable importValues) { - Date now = new Date(); - Scratchie toolContentObj = new Scratchie(); - - try { - toolContentObj.setTitle((String) importValues.get(ToolContentImport102Manager.CONTENT_TITLE)); - toolContentObj.setContentId(toolContentId); - toolContentObj.setContentInUse(Boolean.FALSE); - toolContentObj.setCreated(now); - toolContentObj.setDefineLater(Boolean.FALSE); - toolContentObj.setInstructions(WebUtil.convertNewlines((String) importValues - .get(ToolContentImport102Manager.CONTENT_BODY))); - toolContentObj.setOfflineInstructions(null); - toolContentObj.setOnlineInstructions(null); - toolContentObj.setRunOffline(Boolean.FALSE); - toolContentObj.setUpdated(now); - toolContentObj.setReflectOnActivity(Boolean.FALSE); - toolContentObj.setExtraPoint(Boolean.FALSE); - toolContentObj.setShowResultsPage(Boolean.TRUE); - toolContentObj.setReflectInstructions(null); - - // leave as empty, no need to set them to anything. - // toolContentObj.setAttachments(attachments); - - /* - * unused entries from 1.0.2 [directoryName=] no equivalent in 2.0 [runtimeSubmissionStaffFile=true] no - * equivalent in 2.0 [contentShowUser=false] no equivalent in 2.0 [isHTML=false] no equivalent in 2.0 - * [showbuttons=false] no equivalent in 2.0 [isReusable=false] not used in 1.0.2 (would be lock when - * finished) - */ - ScratchieUser ruser = new ScratchieUser(); - ruser.setUserId(new Long(user.getUserID().longValue())); - ruser.setFirstName(user.getFirstName()); - ruser.setLastName(user.getLastName()); - ruser.setLoginName(user.getLogin()); - createUser(ruser); - toolContentObj.setCreatedBy(ruser); - - // Scratchie Items. They are ordered on the screen by create date so they need to be saved in the right - // order. - // So read them all in first, then go through and assign the dates in the correct order and then save. - Vector urls = (Vector) importValues.get(ToolContentImport102Manager.CONTENT_URL_URLS); - SortedMap items = new TreeMap(); - if (urls != null) { - Iterator iter = urls.iterator(); - while (iter.hasNext()) { - Hashtable urlMap = (Hashtable) iter.next(); - Integer itemOrder = WDDXProcessor.convertToInteger(urlMap, - ToolContentImport102Manager.CONTENT_URL_URL_VIEW_ORDER); - ScratchieItem item = new ScratchieItem(); - //TODO check if this right? - item.setDescription((String) urlMap.get(ToolContentImport102Manager.CONTENT_TITLE)); - item.setCreateBy(ruser); - item.setCreateByAuthor(true); - - items.put(itemOrder, item); - } - } - - Iterator iter = items.values().iterator(); - Date itemDate = null; - while (iter.hasNext()) { - if (itemDate != null) { - try { - Thread.sleep(1000); - } catch (Exception e) { - } - } - itemDate = new Date(); - - ScratchieItem item = (ScratchieItem) iter.next(); - item.setCreateDate(itemDate); - toolContentObj.getScratchieItems().add(item); - } - - } catch (WDDXProcessorConversionException e) { - ScratchieServiceImpl.log.error("Unable to content for activity " + toolContentObj.getTitle() - + "properly due to a WDDXProcessorConversionException.", e); - throw new ToolException( - "Invalid import data format for activity " - + toolContentObj.getTitle() - + "- WDDX caused an exception. Some data from the design will have been lost. See log for more details."); - } - - scratchieDao.saveObject(toolContentObj); - } /** Set the description, throws away the title value as this is not supported in 2.0 */