use of org.olat.course.assessment.model.EnhancedStatus in project OpenOLAT by OpenOLAT.
the class AssessmentModeListModel method getValueAt.
@Override
public Object getValueAt(AssessmentMode mode, int col) {
switch(Cols.values()[col]) {
case status:
{
List<String> warnings = null;
Status status = mode.getStatus();
try {
if (StringHelper.containsNonWhitespace(mode.getStartElement())) {
ICourse course = CourseFactory.loadCourse(mode.getRepositoryEntry());
CourseNode node = course.getRunStructure().getNode(mode.getStartElement());
if (node == null) {
warnings = new ArrayList<>(2);
warnings.add(translator.translate("warning.missing.start.element"));
}
}
if (StringHelper.containsNonWhitespace(mode.getElementList())) {
ICourse course = CourseFactory.loadCourse(mode.getRepositoryEntry());
String elements = mode.getElementList();
for (String element : elements.split(",")) {
CourseNode node = course.getRunStructure().getNode(element);
if (node == null) {
if (warnings == null) {
warnings = new ArrayList<>(2);
}
warnings.add(translator.translate("warning.missing.element"));
break;
}
}
}
} catch (CorruptedCourseException e) {
log.error("", e);
if (warnings == null) {
warnings = new ArrayList<>(2);
}
warnings.add(translator.translate("cif.error.corrupted"));
}
return new EnhancedStatus(status, warnings);
}
case course:
return mode.getRepositoryEntry().getDisplayname();
case externalId:
return mode.getRepositoryEntry().getExternalId();
case externalRef:
return mode.getRepositoryEntry().getExternalRef();
case name:
return mode.getName();
case begin:
return mode.getBegin();
case end:
return mode.getEnd();
case leadTime:
return mode.getLeadTime();
case followupTime:
return mode.getFollowupTime();
case target:
return mode.getTargetAudience();
case start:
{
boolean canStart = mode.isManualBeginEnd();
if (canStart) {
canStart = coordinationService.canStart(mode);
}
return canStart;
}
case stop:
{
boolean canStop = mode.isManualBeginEnd();
if (canStop) {
canStop = coordinationService.canStop(mode);
}
return canStop;
}
}
return null;
}
use of org.olat.course.assessment.model.EnhancedStatus in project OpenOLAT by OpenOLAT.
the class ModeStatusCellRenderer method render.
@Override
public void render(Renderer renderer, StringOutput sb, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator translator) {
if (cellValue instanceof Status) {
Status status = (Status) cellValue;
renderStatus(status, sb);
} else if (cellValue instanceof EnhancedStatus) {
EnhancedStatus enStatus = (EnhancedStatus) cellValue;
renderWarning(enStatus.getWarnings(), sb);
renderStatus(enStatus.getStatus(), sb);
}
}
use of org.olat.course.assessment.model.EnhancedStatus in project openolat by klemens.
the class AssessmentModeListModel method getValueAt.
@Override
public Object getValueAt(AssessmentMode mode, int col) {
switch(Cols.values()[col]) {
case status:
{
List<String> warnings = null;
Status status = mode.getStatus();
try {
if (StringHelper.containsNonWhitespace(mode.getStartElement())) {
ICourse course = CourseFactory.loadCourse(mode.getRepositoryEntry());
CourseNode node = course.getRunStructure().getNode(mode.getStartElement());
if (node == null) {
warnings = new ArrayList<>(2);
warnings.add(translator.translate("warning.missing.start.element"));
}
}
if (StringHelper.containsNonWhitespace(mode.getElementList())) {
ICourse course = CourseFactory.loadCourse(mode.getRepositoryEntry());
String elements = mode.getElementList();
for (String element : elements.split(",")) {
CourseNode node = course.getRunStructure().getNode(element);
if (node == null) {
if (warnings == null) {
warnings = new ArrayList<>(2);
}
warnings.add(translator.translate("warning.missing.element"));
break;
}
}
}
} catch (CorruptedCourseException e) {
log.error("", e);
if (warnings == null) {
warnings = new ArrayList<>(2);
}
warnings.add(translator.translate("cif.error.corrupted"));
}
return new EnhancedStatus(status, warnings);
}
case course:
return mode.getRepositoryEntry().getDisplayname();
case externalId:
return mode.getRepositoryEntry().getExternalId();
case externalRef:
return mode.getRepositoryEntry().getExternalRef();
case name:
return mode.getName();
case begin:
return mode.getBegin();
case end:
return mode.getEnd();
case leadTime:
return mode.getLeadTime();
case followupTime:
return mode.getFollowupTime();
case target:
return mode.getTargetAudience();
case start:
{
boolean canStart = mode.isManualBeginEnd();
if (canStart) {
canStart = coordinationService.canStart(mode);
}
return canStart;
}
case stop:
{
boolean canStop = mode.isManualBeginEnd();
if (canStop) {
canStop = coordinationService.canStop(mode);
}
return canStop;
}
}
return null;
}
use of org.olat.course.assessment.model.EnhancedStatus in project openolat by klemens.
the class ModeStatusCellRenderer method render.
@Override
public void render(Renderer renderer, StringOutput sb, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator translator) {
if (cellValue instanceof Status) {
Status status = (Status) cellValue;
renderStatus(status, sb);
} else if (cellValue instanceof EnhancedStatus) {
EnhancedStatus enStatus = (EnhancedStatus) cellValue;
renderWarning(enStatus.getWarnings(), sb);
renderStatus(enStatus.getStatus(), sb);
}
}
Aggregations