@Override
 @Transactional(
     readOnly = false,
     propagation = Propagation.REQUIRED,
     rollbackFor = Exception.class)
 public void deleteCollection(
     String courseId, String unitId, String lessonId, String collectionId, User user) {
   CollectionItem collection =
       this.getCollectionDao().getCollectionItem(lessonId, collectionId, user.getPartyUid());
   rejectIfNull(collection, GL0056, 404, COLLECTION);
   reject(
       this.getOperationAuthorizer().hasUnrestrictedContentAccess(collectionId, user),
       GL0099,
       403,
       COLLECTION);
   Collection lesson = getCollectionDao().getCollectionByType(lessonId, LESSON_TYPE);
   rejectIfNull(lesson, GL0056, 404, LESSON);
   Collection course = getCollectionDao().getCollectionByType(courseId, COURSE_TYPE);
   rejectIfNull(course, GL0056, 404, COURSE);
   Collection unit = getCollectionDao().getCollectionByType(unitId, UNIT_TYPE);
   rejectIfNull(unit, GL0056, 404, UNIT);
   this.resetSequence(lessonId, collection.getCollectionItemId(), user.getPartyUid(), COLLECTION);
   this.deleteCollection(collectionId);
   this.updateContentMetaDataSummary(
       lesson.getContentId(), collection.getContent().getContentType().getName(), DELETE);
   collection.getContent().setIsDeleted((short) 1);
   this.getCollectionDao().save(collection);
   getCollectionEventLog()
       .collectionEventLog(courseId, unitId, lessonId, collection, user, null, DELETE);
 }
 private String moveCollection(String collectionId, Collection targetCollection, User user) {
   CollectionItem sourceCollectionItem =
       getCollectionDao().getCollectionItemById(collectionId, user);
   rejectIfNull(sourceCollectionItem, GL0056, 404, COLLECTION);
   // need to put validation for collaborator
   CollectionItem collectionItem = new CollectionItem();
   if (sourceCollectionItem.getItemType() != null) {
     collectionItem.setItemType(sourceCollectionItem.getItemType());
   }
   String collectionType =
       getParentCollection(
           sourceCollectionItem.getContent().getContentId(),
           sourceCollectionItem.getContent().getContentType().getName(),
           collectionId,
           targetCollection);
   String contentType = null;
   if (collectionType.equalsIgnoreCase(LESSON)) {
     contentType = sourceCollectionItem.getContent().getContentType().getName();
   }
   createCollectionItem(collectionItem, targetCollection, sourceCollectionItem.getContent(), user);
   resetSequence(
       sourceCollectionItem.getCollection().getGooruOid(),
       sourceCollectionItem.getCollectionItemId(),
       user.getPartyUid(),
       COLLECTION);
   getCollectionDao().remove(sourceCollectionItem);
   getAsyncExecutor().deleteFromCache(V2_ORGANIZE_DATA + user.getPartyUid() + "*");
   return contentType;
 }
 @Override
 @Transactional(
     readOnly = false,
     propagation = Propagation.REQUIRED,
     rollbackFor = Exception.class)
 public void updateResource(
     String collectionId,
     String collectionResourceItemId,
     CollectionItem newCollectionItem,
     User user) {
   final CollectionItem collectionItem =
       this.getCollectionDao().getCollectionItem(collectionResourceItemId);
   rejectIfNull(collectionItem, GL0056, 404, _COLLECTION_ITEM);
   this.getResourceBoService()
       .updateResource(
           collectionItem.getContent().getGooruOid(), newCollectionItem.getResource(), user);
   Map<String, Object> data =
       generateResourceMetaData(
           collectionItem.getContent(), newCollectionItem.getResource(), user);
   if (data != null && data.size() > 0) {
     ContentMeta contentMeta =
         this.getContentRepository().getContentMeta(collectionItem.getContent().getContentId());
     updateContentMeta(contentMeta, data);
   }
 }
 protected void lessonCopyItems(String lessonId, Collection newLesson, User user) {
   List<CollectionItem> collectionItems =
       this.getCollectionDao().getCollectionItems(lessonId, false);
   for (CollectionItem sourceLessonItem : collectionItems) {
     getCollectionCopyService()
         .collectionCopy(newLesson, sourceLessonItem.getContent().getGooruOid(), user);
   }
 }
 @Override
 @Transactional(
     readOnly = false,
     propagation = Propagation.REQUIRED,
     rollbackFor = Exception.class)
 public void updateQuestion(
     String collectionId, String collectionQuestionItemId, String data, User user) {
   final CollectionItem collectionItem =
       this.getCollectionDao().getCollectionItem(collectionQuestionItemId);
   rejectIfNull(collectionItem, GL0056, 404, _COLLECTION_ITEM);
   AssessmentQuestion newAssessmentQuestion =
       this.getQuestionService()
           .updateQuestion(collectionItem.getContent().getGooruOid(), data, user);
   Map<String, Object> metaData =
       generateQuestionMetaData(collectionItem.getContent(), newAssessmentQuestion, user);
   if (metaData != null && metaData.size() > 0) {
     ContentMeta contentMeta =
         this.getContentRepository().getContentMeta(collectionItem.getContent().getContentId());
     updateContentMeta(contentMeta, metaData);
   }
 }
 @Override
 @Transactional(
     readOnly = false,
     propagation = Propagation.REQUIRED,
     rollbackFor = Exception.class)
 public void deleteCollectionItem(String collectionId, String collectionItemId, String userUid) {
   CollectionItem collectionItem = this.getCollectionDao().getCollectionItem(collectionItemId);
   rejectIfNull(collectionItem, GL0056, 404, _COLLECTION_ITEM);
   Resource resource =
       this.getResourceBoService().getResource(collectionItem.getContent().getGooruOid());
   rejectIfNull(resource, GL0056, 404, RESOURCE);
   String contentType = resource.getContentType().getName();
   Long collectionContentId = collectionItem.getCollection().getContentId();
   this.resetSequence(
       collectionId, collectionItem.getCollectionItemId(), userUid, COLLECTION_ITEM);
   getCollectionEventLog()
       .collectionItemEventLog(collectionId, collectionItem, userUid, contentType, null, DELETE);
   if (contentType.equalsIgnoreCase(QUESTION)) {
     getCollectionDao().remove(resource);
   } else {
     getCollectionDao().remove(collectionItem);
   }
   updateCollectionMetaDataSummary(collectionContentId, RESOURCE, contentType);
 }