use of org.olat.course.tree.CourseEditorTreeNode in project openolat by klemens.
the class PublishProcess method checkRefs.
/**
* Checks references of coursenodes.
*
* @param courseEditorTreeNodes
* @return boolean
*/
private List<StatusDescription> checkRefs(List<CourseEditorTreeNode> courseEditorTreeNodes) {
// course Editor Nodes With Damaged Reference
List<StatusDescription> cetnDamaged = new ArrayList<StatusDescription>();
for (Iterator<CourseEditorTreeNode> iter = courseEditorTreeNodes.iterator(); iter.hasNext(); ) {
CourseEditorTreeNode cetn = iter.next();
CourseNode cn = cetn.getCourseNode();
/*
* for those coursenodes which need a reference to a repository entry to
* function properly, check that the reference is valid
*/
if (cn.needsReferenceToARepositoryEntry()) {
RepositoryEntry referencedEntry = cn.getReferencedRepositoryEntry();
if (referencedEntry == null) {
cetnDamaged.add(new StatusDescription(ValidationStatus.ERROR, "pbl.error.refs", "pbl.error.refs", new String[] { cetn.getTitle() + "(id:" + cetn.getIdent() + " )" }, PACKAGE));
}
}
}
return cetnDamaged;
}
use of org.olat.course.tree.CourseEditorTreeNode in project openolat by klemens.
the class PublishProcess method createPublishSetFor.
/**
* first step in publishing course editor nodes.<br>
* next step is testPublishSet, see method for more details.
* @param nodeIdsToPublish
*/
public void createPublishSetFor(List<String> nodeIdsToPublish) {
this.originalNodeIdsToPublish = nodeIdsToPublish;
// append new nodes' subnodes
int selectCount = nodeIdsToPublish.size();
for (int i = 0; i < selectCount; i++) {
// avoid using iterator here so we can modify the Collection
String nodeId = nodeIdsToPublish.get(i);
CourseEditorTreeNode cetn = editorTreeModel.getCourseEditorNodeById(nodeId);
if (cetn.isNewnode() || cetn.isDeleted() || publishTreeModel.isMoved(cetn))
appendPublishableSubnodeIds(cetn, nodeIdsToPublish);
}
/*
* generatePublishSet, testPublishSet, applyPublishSet
*/
/*
* several book keeping lists which are also used to modify the course
* editor model after the new runstructure is generated into ram.
*/
editorModelDeletedNodes = new ArrayList<CourseEditorTreeNode>();
editorModelInsertedNodes = new ArrayList<CourseEditorTreeNode>();
editorModelModifiedNodes = new ArrayList<CourseEditorTreeNode>();
resultingCourseRun = new Structure();
// has side effect on the above editorModelxxxNodes and the
// resultingCourseRun;
calculatePublishSet(nodeIdsToPublish);
}
use of org.olat.course.tree.CourseEditorTreeNode in project openolat by klemens.
the class PublishProcess method convertInCourseEditorTreeNode.
/**
* Convert all CourseNodes into CourseEditorTreeNode
*
* @param courseEditorTreeNode Parent CourseEditorTreeNode
* @param node Current course node which will be converted
*/
private void convertInCourseEditorTreeNode(CourseEditorTreeNode courseEditorTreeNode, CourseNode node) {
int childCnt = node.getChildCount();
for (int i = 0; i < childCnt; i++) {
CourseNode childNode = (CourseNode) node.getChildAt(i);
CourseEditorTreeNode newEditorNode = new CourseEditorTreeNode(childNode);
courseEditorTreeNode.addChild(newEditorNode);
convertInCourseEditorTreeNode(newEditorNode, childNode);
// remove all children after calling convertInCourseEditorTreeNode
childNode.removeAllChildren();
}
}
use of org.olat.course.tree.CourseEditorTreeNode in project openolat by klemens.
the class PublishProcess method checkUpdates.
private List<StatusDescription> checkUpdates(List<CourseEditorTreeNode> courseEditorTreeNodes, CourseEditorEnv cev) {
List<StatusDescription> notifications = new ArrayList<StatusDescription>();
for (Iterator<CourseEditorTreeNode> iter = courseEditorTreeNodes.iterator(); iter.hasNext(); ) {
CourseEditorTreeNode cetn = iter.next();
CourseNode cn = cetn.getCourseNode();
List<StatusDescription> nodeNotes = cn.publishUpdatesExplanations(cev);
if (nodeNotes != null && nodeNotes.size() > 0) {
notifications.addAll(nodeNotes);
}
}
return notifications;
}
use of org.olat.course.tree.CourseEditorTreeNode in project openolat by klemens.
the class PublishProcess method appendPublishableSubnodeIds.
/**
* starting from each user selected to-publish node all also affected nodes
* are added to the list of nodes to be published.
*
* @param cetn
* @param nodesToPublish
*/
private void appendPublishableSubnodeIds(CourseEditorTreeNode cetn, List<String> nodesToPublish) {
for (int i = 0; i < cetn.getChildCount(); i++) {
CourseEditorTreeNode child = (CourseEditorTreeNode) cetn.getChildAt(i);
if (child.hasPublishableChanges())
nodesToPublish.add(child.getIdent());
appendPublishableSubnodeIds(child, nodesToPublish);
}
}
Aggregations