public void addItem(ItemFacade itemFacade) { addItem(itemFacade.getData()); }
public SectionFacade getSection(Long sectionId) { SectionData section = (SectionData) getHibernateTemplate().load( SectionData.class, sectionId); return new SectionFacade(section); }
/** * Update section from the extracted properties. * Note: you need to do a save when you are done. * @param section the section, which will be persisted * @param sectionMap the extracted properties */ public void updateSection(SectionFacade section, Map sectionMap) { section.setTitle(TextFormat.convertPlaintextToFormattedTextNoHighUnicode((String) sectionMap.get("title"))); section.setDescription(makeFCKAttachment((String) sectionMap.get("description"))); // Add Section MetaData section.addSectionMetaData(SectionMetaDataIfc.KEYWORDS, (String) sectionMap.get("keyword")); section.addSectionMetaData(SectionMetaDataIfc.OBJECTIVES, (String) sectionMap.get("objective")); section.addSectionMetaData(SectionMetaDataIfc.RUBRICS, (String) sectionMap.get("rubric")); // SAM-2781: if you are importing from before Sakai 11, this will be null String qorderString = (String) sectionMap.get("questions-ordering"); if (StringUtils.isNotBlank(qorderString) && StringUtils.isNumeric(qorderString)) { section.addSectionMetaData(SectionDataIfc.QUESTIONS_ORDERING, qorderString); } else { section.addSectionMetaData(SectionDataIfc.QUESTIONS_ORDERING, SectionDataIfc.AS_LISTED_ON_ASSESSMENT_PAGE.toString()); } }
List<ItemDataIfc> items = null; if (section != null) { if (section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE) == null || StringUtils.equals(section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE), SectionDataIfc.QUESTIONS_AUTHORED_ONE_BY_ONE.toString())) items = section.getItemArray(); else if (StringUtils.equals(section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE), SectionDataIfc.RANDOM_DRAW_FROM_QUESTIONPOOL.toString())) Long qpId = Long.valueOf(section.getSectionMetaDataByLabel(SectionDataIfc.POOLID_FOR_RANDOM_DRAW)); items = qpService.getAllItems(qpId); } catch (NumberFormatException e) { log.error("NumberFormatException converting to Long: " + section.getSectionMetaDataByLabel(SectionDataIfc.POOLID_FOR_RANDOM_DRAW)); log.info("Items for assessment {} section {} is null in isExportable", assessment.getAssessmentId(), section.getSectionId());
SectionFacade section = new SectionFacade(); section.setTypeId(Long.valueOf(21)); section.setCreatedBy(SessionManager.getCurrentSessionUserId()); section.setCreatedDate(new Date()); section.setLastModifiedBy(SessionManager.getCurrentSessionUserId()); section.setLastModifiedDate(new Date()); section.setStatus(Integer.valueOf(1)); section.setSequence(Integer.valueOf(1)); section.setAssessmentId(assessment.getAssessmentId()); section.setAssessment(assessment); as.saveOrUpdateSection(section); item.setSequence(Integer.valueOf(i + 1)); item.setSection(section); section.addItem(itemService.saveItem(item)); EventTrackingService.post(EventTrackingService.newEvent(SamigoConstants.EVENT_ASSESSMENT_SAVEITEM, "/sam/" + AgentFacade.getCurrentSiteId() + "/saved itemId=" + item.getItemId().toString(), true));
exHelper.updateSection(section, sectionMap); section.setCreatedBy(me); section.setCreatedDate(assessment.getCreatedDate()); section.setLastModifiedBy(me); section.setLastModifiedDate(assessment.getCreatedDate()); section.setTypeId(TypeIfc.DEFAULT_SECTION); section.setStatus( Integer.valueOf(1)); section.setSequence(Integer.valueOf(sec + 1)); item.addItemMetaData(ItemMetaData.PARTID, section.getSectionId().toString()); section.addItem(item); // many to one itemService.saveItem(item); EventTrackingService.post(EventTrackingService.newEvent(SamigoConstants.EVENT_ASSESSMENT_SAVEITEM, "/sam/" + AgentFacade.getCurrentSiteId() + "/saved itemId=" + item.getItemId().toString(), true));
public int updateRandomPoolQuestions(SectionFacade section, boolean publishing){ if (section != null && section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE) != null && StringUtils.equals(section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE), SectionDataIfc.RANDOM_DRAW_FROM_QUESTIONPOOL.toString())) { .getSectionMetaDataByLabel(SectionDataIfc.POOLID_FOR_RANDOM_DRAW))); if(verifyItemsDrawSize(itemlist.size(), section.getSectionMetaDataByLabel(SectionDataIfc.NUM_QUESTIONS_DRAWN))){ removeAllItems(section.getSectionId().toString()); Iterator itemIter = section.getItemSet().iterator(); while (itemIter.hasNext()) { ItemDataIfc item = (ItemDataIfc) itemIter.next(); section = getSection(section.getSectionId().toString()); String requestedScore = (section.getSectionMetaDataByLabel(SectionDataIfc.POINT_VALUE_FOR_QUESTION) != null) ? section.getSectionMetaDataByLabel(SectionDataIfc.POINT_VALUE_FOR_QUESTION) : ""; String requestedDiscount = (section.getSectionMetaDataByLabel(SectionDataIfc.DISCOUNT_VALUE_FOR_QUESTION) != null) ? section.getSectionMetaDataByLabel(SectionDataIfc.DISCOUNT_VALUE_FOR_QUESTION) : ""; section.addItem(item); EventTrackingService.post(EventTrackingService.newEvent(SamigoConstants.EVENT_ASSESSMENT_SAVEITEM, "/sam/" + AgentFacade.getCurrentSiteId() + "/saved itemId=" + item.getItemId().toString(), true)); i = i + 1; section.addSectionMetaData(SectionDataIfc.QUESTIONS_RANDOM_DRAW_DATE, df.format(new Date()));
public void setSectionSet(Set sectionSet) { this.sectionSet = sectionSet; HashSet set = new HashSet(); Iterator iter = sectionSet.iterator(); while (iter.hasNext()){ SectionFacade sf = (SectionFacade)iter.next(); set.add(sf.getData()); } this.data.setSectionSet(set); }
for(int i = 0; i < sectionList.size(); i++){ SectionFacade section = (SectionFacade) sectionList.get(i); String sectionDesc = section.getDescription(); if(sectionDesc != null){ sectionDesc = org.sakaiproject.util.cover.LinkMigrationHelper.migrateAllLinks(entrySet, sectionDesc); if(!sectionDesc.equals(section.getDescription())){ section.setDescription(sectionDesc); List itemList = section.getItemArray(); for(int j = 0; j < itemList.size(); j++){ ItemData item = (ItemData) itemList.get(j);
ContentResource contentResource = attachmentHelper.createContentResource(fullFilePath, filename, attachmentInfo[2]); sectionAttachment = assessmentService.createSectionAttachment(section, contentResource.getId(), filename, ServerConfigurationService.getServerUrl()); sectionAttachment.setSection(section.getData()); set.add(sectionAttachment); section.setSectionAttachmentSet(set);
exHelper.updateSection(section, sectionMap); section.setCreatedBy(me); section.setCreatedDate(assessment.getCreatedDate()); section.setLastModifiedBy(me); section.setLastModifiedDate(assessment.getCreatedDate()); section.setTypeId(TypeIfc.DEFAULT_SECTION); section.setStatus( Integer.valueOf(1)); section.setSequence(Integer.valueOf(sec + 1)); item.addItemMetaData(ItemMetaData.PARTID, section.getSectionId().toString()); section.addItem(item); // many to one itemService.saveItem(item); EventTrackingService.post(EventTrackingService.newEvent(SamigoConstants.EVENT_ASSESSMENT_SAVEITEM, "/sam/" + AgentFacade.getCurrentSiteId() + "/saved itemId=" + item.getItemId().toString(), true));
public int updateRandomPoolQuestions(SectionFacade section, boolean publishing){ if (section != null && section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE) != null && StringUtils.equals(section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE), SectionDataIfc.RANDOM_DRAW_FROM_QUESTIONPOOL.toString())) { .getSectionMetaDataByLabel(SectionDataIfc.POOLID_FOR_RANDOM_DRAW))); if(verifyItemsDrawSize(itemlist.size(), section.getSectionMetaDataByLabel(SectionDataIfc.NUM_QUESTIONS_DRAWN))){ removeAllItems(section.getSectionId().toString()); Iterator itemIter = section.getItemSet().iterator(); while (itemIter.hasNext()) { ItemDataIfc item = (ItemDataIfc) itemIter.next(); section = getSection(section.getSectionId().toString()); String requestedScore = (section.getSectionMetaDataByLabel(SectionDataIfc.POINT_VALUE_FOR_QUESTION) != null) ? section.getSectionMetaDataByLabel(SectionDataIfc.POINT_VALUE_FOR_QUESTION) : ""; String requestedDiscount = (section.getSectionMetaDataByLabel(SectionDataIfc.DISCOUNT_VALUE_FOR_QUESTION) != null) ? section.getSectionMetaDataByLabel(SectionDataIfc.DISCOUNT_VALUE_FOR_QUESTION) : ""; section.addItem(item); EventTrackingService.post(EventTrackingService.newEvent(SamigoConstants.EVENT_ASSESSMENT_SAVEITEM, "/sam/" + AgentFacade.getCurrentSiteId() + "/saved itemId=" + item.getItemId().toString(), true)); i = i + 1; section.addSectionMetaData(SectionDataIfc.QUESTIONS_RANDOM_DRAW_DATE, df.format(new Date()));
public void setSectionSet(Set sectionSet) { this.sectionSet = sectionSet; HashSet set = new HashSet(); Iterator iter = sectionSet.iterator(); while (iter.hasNext()){ SectionFacade sf = (SectionFacade)iter.next(); set.add(sf.getData()); } this.data.setSectionSet(set); }
List<ItemDataIfc> items = null; if (section != null) { if (section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE) == null || StringUtils.equals(section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE), SectionDataIfc.QUESTIONS_AUTHORED_ONE_BY_ONE.toString())) items = section.getItemArray(); else if (StringUtils.equals(section.getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE), SectionDataIfc.RANDOM_DRAW_FROM_QUESTIONPOOL.toString())) Long qpId = Long.valueOf(section.getSectionMetaDataByLabel(SectionDataIfc.POOLID_FOR_RANDOM_DRAW)); items = qpService.getAllItems(qpId); } catch (NumberFormatException e) { log.error("NumberFormatException converting to Long: " + section.getSectionMetaDataByLabel(SectionDataIfc.POOLID_FOR_RANDOM_DRAW)); log.info("Items for assessment {} section {} is null in isExportable", assessment.getAssessmentId(), section.getSectionId());
for(int i = 0; i < sectionList.size(); i++){ SectionFacade section = (SectionFacade) sectionList.get(i); String sectionDesc = section.getDescription(); if(sectionDesc != null){ sectionDesc = org.sakaiproject.util.cover.LinkMigrationHelper.migrateAllLinks(entrySet, sectionDesc); if(!sectionDesc.equals(section.getDescription())){ section.setDescription(sectionDesc); List itemList = section.getItemArray(); for(int j = 0; j < itemList.size(); j++){ ItemData item = (ItemData) itemList.get(j);
ContentResource contentResource = attachmentHelper.createContentResource(fullFilePath, filename, attachmentInfo[2]); sectionAttachment = assessmentService.createSectionAttachment(section, contentResource.getId(), filename, ServerConfigurationService.getServerUrl()); sectionAttachment.setSection(section.getData()); set.add(sectionAttachment); section.setSectionAttachmentSet(set);
public SectionFacade getSection(Long sectionId) { SectionData section = (SectionData) getHibernateTemplate().load( SectionData.class, sectionId); return new SectionFacade(section); }
/** * Update section from the extracted properties. * Note: you need to do a save when you are done. * @param section the section, which will be persisted * @param sectionMap the extracted properties */ public void updateSection(SectionFacade section, Map sectionMap) { section.setTitle(TextFormat.convertPlaintextToFormattedTextNoHighUnicode((String) sectionMap.get("title"))); section.setDescription(makeFCKAttachment((String) sectionMap.get("description"))); // Add Section MetaData section.addSectionMetaData(SectionMetaDataIfc.KEYWORDS, (String) sectionMap.get("keyword")); section.addSectionMetaData(SectionMetaDataIfc.OBJECTIVES, (String) sectionMap.get("objective")); section.addSectionMetaData(SectionMetaDataIfc.RUBRICS, (String) sectionMap.get("rubric")); // SAM-2781: if you are importing from before Sakai 11, this will be null String qorderString = (String) sectionMap.get("questions-ordering"); if (StringUtils.isNotBlank(qorderString) && StringUtils.isNumeric(qorderString)) { section.addSectionMetaData(SectionDataIfc.QUESTIONS_ORDERING, qorderString); } else { section.addSectionMetaData(SectionDataIfc.QUESTIONS_ORDERING, SectionDataIfc.AS_LISTED_ON_ASSESSMENT_PAGE.toString()); } }
public void setSection(SectionDataIfc section) { this.section = (SectionFacade) section; if (this.section != null) { this.data.setSection(this.section.getData()); } else { this.data.setSection(null); } }
public void addItem(ItemFacade itemFacade) { addItem(itemFacade.getData()); }