use of org.olat.modules.qpool.QuestionStatus in project OpenOLAT by OpenOLAT.
the class QItemQueriesDAOTest method shouldGetItemsFilteredByQuestionStatus.
@Test
public void shouldGetItemsFilteredByQuestionStatus() {
QuestionStatus status = QuestionStatus.revised;
QuestionItemImpl item11 = createRandomItem(createRandomIdentity());
item11.setQuestionStatus(status);
QuestionItemImpl item12 = createRandomItem(createRandomIdentity());
item12.setQuestionStatus(status);
QuestionItem item21 = createRandomItem(createRandomIdentity());
QuestionItem item22 = createRandomItem(createRandomIdentity());
QuestionItem item23 = createRandomItem(createRandomIdentity());
dbInstance.commitAndCloseSession();
SearchQuestionItemParams params = new SearchQuestionItemParams(createRandomIdentity(), null);
params.setQuestionStatus(status);
List<QuestionItemView> loadedItems = qItemQueriesDao.getItems(params, null, 0, -1);
assertThat(loadedItems).hasSize(2);
assertThat(keysOf(loadedItems)).containsOnlyElementsOf(keysOf(item11, item12)).doesNotContainAnyElementsOf(keysOf(item21, item22, item23));
int countItems = qItemQueriesDao.countItems(params);
assertThat(countItems).isEqualTo(2);
}
use of org.olat.modules.qpool.QuestionStatus in project OpenOLAT by OpenOLAT.
the class QuestionItemDetailsController method buildStatusDrowdown.
private Dropdown buildStatusDrowdown() {
QuestionStatus actualStatus = metadatasCtrl.getItem().getQuestionStatus();
Dropdown statusDropdown = new Dropdown("process.states", "lifecycle.status." + actualStatus.name(), false, getTranslator());
statusDropdown.setElementCssClass("o_qpool_tools_status o_qpool_status_" + actualStatus.name());
statusDropdown.setIconCSS("o_icon o_icon-fw o_icon_qitem_" + actualStatus.name());
statusDropdown.setOrientation(DropdownOrientation.normal);
statusDraftLink = LinkFactory.createToolLink("lifecycle.status.draft", translate("lifecycle.status.draft"), this);
statusDraftLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_draft");
statusDraftLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_draft");
statusDraftLink.setVisible(qItemSecurityCallback.canSetDraft() && !QuestionStatus.draft.equals(actualStatus));
statusDropdown.addComponent(statusDraftLink);
statusRevisedLink = LinkFactory.createToolLink("lifecycle.status.revised", translate("lifecycle.status.revised"), this);
statusRevisedLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_revised");
statusRevisedLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_revised");
statusRevisedLink.setVisible(qItemSecurityCallback.canSetRevised() && !QuestionStatus.revised.equals(actualStatus));
statusDropdown.addComponent(statusRevisedLink);
statusReviewLink = LinkFactory.createToolLink("lifecycle.status.review", translate("lifecycle.status.review"), this);
statusReviewLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_review");
statusReviewLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_review");
statusReviewLink.setVisible(qItemSecurityCallback.canSetReview() && !QuestionStatus.review.equals(actualStatus));
statusDropdown.addComponent(statusReviewLink);
statusFinalLink = LinkFactory.createToolLink("lifecycle.status.finalVersion", translate("lifecycle.status.finalVersion"), this);
statusFinalLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_finalVersion");
statusFinalLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_finalVersion");
statusFinalLink.setVisible(qItemSecurityCallback.canSetFinal() && !QuestionStatus.finalVersion.equals(actualStatus));
statusDropdown.addComponent(statusFinalLink);
statusEndOfLifeLink = LinkFactory.createToolLink("lifecycle.status.endOfLife", translate("lifecycle.status.endOfLife"), this);
statusEndOfLifeLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_endOfLife");
statusEndOfLifeLink.setElementCssClass("o_labeled o_qpool_status o_qpool_status_endOfLife");
statusEndOfLifeLink.setVisible(qItemSecurityCallback.canSetEndOfLife() && !QuestionStatus.endOfLife.equals(actualStatus));
statusDropdown.addComponent(statusEndOfLifeLink);
return statusDropdown;
}
use of org.olat.modules.qpool.QuestionStatus in project OpenOLAT by OpenOLAT.
the class QuestionListController method updateStatusFilter.
public void updateStatusFilter() {
if (getSource().isStatusFilterEnabled()) {
QuestionStatus actualStatus = getSource().getStatusFilter();
reloadStatusFilterTitle(statusDraftLink, "source.status.draft");
reloadStatusFilterTitle(statusReviewLink, "source.status.review");
reloadStatusFilterTitle(statusRevisedLink, "source.status.revised");
reloadStatusFilterTitle(statusFinalLink, "source.status.finalVersion");
reloadStatusFilterTitle(statusEndOfLifeLink, "source.status.endOfLife");
getSource().setStatusFilter(actualStatus);
}
}
use of org.olat.modules.qpool.QuestionStatus in project OpenOLAT by OpenOLAT.
the class QuestionPoolServiceImplTest method shouldSetNewStatusOnlyIfChanged.
@Test
public void shouldSetNewStatusOnlyIfChanged() {
QuestionStatus status = QuestionStatus.draft;
item.setQuestionStatus(status);
Float rating = new Float(RATING_FIVE);
ReviewDecision decision = new ReviewDecision(false, QuestionStatus.finalVersion);
when(reviewServiceMock.decideStatus(item, rating)).thenReturn(decision);
sut.rateItemInReview(item, identityDummy, rating, null);
assertThat(item.getQuestionStatus()).isEqualTo(status);
}
use of org.olat.modules.qpool.QuestionStatus in project OpenOLAT by OpenOLAT.
the class QuestionPoolServiceImplTest method shouldSetNewStatusIfChanged.
@Test
public void shouldSetNewStatusIfChanged() {
Float rating = new Float(RATING_FIVE);
QuestionStatus status = QuestionStatus.finalVersion;
ReviewDecision decision = new ReviewDecision(true, status);
when(reviewServiceMock.decideStatus(item, rating)).thenReturn(decision);
sut.rateItemInReview(item, identityDummy, rating, null);
assertThat(item.getQuestionStatus()).isEqualTo(status);
}
Aggregations