List of usage examples for java.util SortedSet addAll
boolean addAll(Collection<? extends E> c);
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
private RegistrationState getFirstRegistrationState(final RegistrationStateType stateType) { final SortedSet<RegistrationState> states = new TreeSet<RegistrationState>( RegistrationState.DATE_COMPARATOR); states.addAll(getRegistrationStates(stateType)); return states.first(); }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
final public SortedSet<ExternalEnrolment> getSortedExternalEnrolments() { final SortedSet<ExternalEnrolment> result = new TreeSet<ExternalEnrolment>( ExternalEnrolment.COMPARATOR_BY_NAME); result.addAll(getExternalEnrolmentsSet()); return result; }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
final public SortedSet<ExecutionSemester> getSortedEnrolmentsExecutionPeriods() { final SortedSet<ExecutionSemester> result = new TreeSet<ExecutionSemester>( ExecutionSemester.COMPARATOR_BY_SEMESTER_AND_YEAR); result.addAll(getEnrolmentsExecutionPeriods()); return result; }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
public boolean isReingression(final ExecutionYear executionYear) { final SortedSet<RegistrationState> states = new TreeSet<RegistrationState>( RegistrationState.DATE_COMPARATOR); states.addAll(getRegistrationStatesSet()); Registration sourceRegistration = getSourceRegistration(); while (sourceRegistration != null) { states.addAll(sourceRegistration.getRegistrationStatesSet()); sourceRegistration = sourceRegistration.getSourceRegistration(); }// w w w .j av a 2 s . co m if (states.size() == 0) { return false; } RegistrationState previous = null; for (final RegistrationState registrationState : states) { if (previous != null) { if (registrationState.getExecutionYear() == executionYear && (registrationState.isActive() || registrationState.getStateType() == RegistrationStateType.TRANSITED) && (previous.getStateType() == RegistrationStateType.EXTERNAL_ABANDON || previous.getStateType() == RegistrationStateType.INTERRUPTED || previous.getStateType() == RegistrationStateType.FLUNKED)) { return true; } } previous = registrationState; } return false; }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
final public YearMonthDay getLastApprovedEnrolmentEvaluationDate() { final SortedSet<Enrolment> enrolments = new TreeSet<Enrolment>( Enrolment.COMPARATOR_BY_LATEST_ENROLMENT_EVALUATION_AND_ID); enrolments.addAll(getApprovedEnrolments()); YearMonthDay internalEnrolmentExamDate = enrolments.isEmpty() ? null : enrolments.last().getLatestEnrolmentEvaluation().getExamDateYearMonthDay(); YearMonthDay externalEnrolmentExamDate = getExternalEnrolmentsSet().isEmpty() ? null : getLastExternalApprovedEnrolmentEvaluationDate(); if (internalEnrolmentExamDate == null && externalEnrolmentExamDate == null) { return null; }/*from ww w .j a va 2 s.com*/ if (internalEnrolmentExamDate == null) { return externalEnrolmentExamDate; } if (externalEnrolmentExamDate == null) { return internalEnrolmentExamDate; } return internalEnrolmentExamDate.compareTo(externalEnrolmentExamDate) > 1 ? internalEnrolmentExamDate : externalEnrolmentExamDate; }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
public YearMonthDay getConclusionDateForBolonha() { if (isBolonha()) { if (hasConcluded()) { final SortedSet<CycleCurriculumGroup> concludeCycles = new TreeSet<CycleCurriculumGroup>( CycleCurriculumGroup.COMPARATOR_BY_CYCLE_TYPE_AND_ID); concludeCycles.addAll(getLastStudentCurricularPlan().getInternalCycleCurriculumGrops()); final CycleCurriculumGroup lastConcludedCycle = concludeCycles.last(); return (lastConcludedCycle.isConclusionProcessed() ? lastConcludedCycle.getConclusionDate() : lastConcludedCycle.calculateConclusionDate()); }//from w w w . j a v a2s .c om } else { return getConclusionDate(); } return null; }
From source file:org.sakaiproject.component.gradebook.GradebookServiceHibernateImpl.java
@Override @SuppressWarnings({ "rawtypes", "unchecked" }) public List<org.sakaiproject.service.gradebook.shared.Assignment> getViewableAssignmentsForCurrentUser( String gradebookUid) throws GradebookNotFoundException { List<Assignment> viewableAssignments = new ArrayList<>(); SortedSet<org.sakaiproject.service.gradebook.shared.Assignment> assignmentsToReturn = new TreeSet<>(); Gradebook gradebook = getGradebook(gradebookUid); // will send back all assignments if user can grade all if (getAuthz().isUserAbleToGradeAll(gradebookUid)) { viewableAssignments = getAssignments(gradebook.getId(), SortType.SORT_BY_SORTING, true); } else if (getAuthz().isUserAbleToGrade(gradebookUid)) { // if user can grade and doesn't have grader perm restrictions, they // may view all assigns if (!getAuthz().isUserHasGraderPermissions(gradebookUid)) { viewableAssignments = getAssignments(gradebook.getId(), SortType.SORT_BY_SORTING, true); } else {//from w w w. j a v a2 s.c o m // this user has grader perms, so we need to filter the items returned // if this gradebook has categories enabled, we need to check for category-specific restrictions if (gradebook.getCategory_type() == GradebookService.CATEGORY_TYPE_NO_CATEGORY) { assignmentsToReturn.addAll(getAssignments(gradebookUid)); } else { String userUid = getUserUid(); if (getGradebookPermissionService().getPermissionForUserForAllAssignment(gradebook.getId(), userUid)) { assignmentsToReturn.addAll(getAssignments(gradebookUid)); } // categories are enabled, so we need to check the category restrictions List allCategories = getCategoriesWithAssignments(gradebook.getId()); if (allCategories != null && !allCategories.isEmpty()) { List<Long> catIds = new ArrayList<Long>(); for (Category category : (List<Category>) allCategories) { catIds.add(category.getId()); } List<Long> viewableCategorieIds = getGradebookPermissionService() .getCategoriesForUser(gradebook.getId(), userUid, catIds); List<Category> viewableCategories = new ArrayList<Category>(); for (Category category : (List<Category>) allCategories) { if (viewableCategorieIds.contains(category.getId())) { viewableCategories.add(category); } } for (Iterator catIter = viewableCategories.iterator(); catIter.hasNext();) { Category cat = (Category) catIter.next(); if (cat != null) { List assignments = cat.getAssignmentList(); if (assignments != null && !assignments.isEmpty()) { viewableAssignments.addAll(assignments); } } } } } } } else if (getAuthz().isUserAbleToViewOwnGrades(gradebookUid)) { // if user is just a student, we need to filter out unreleased items List allAssigns = getAssignments(gradebook.getId(), null, true); if (allAssigns != null) { for (Iterator aIter = allAssigns.iterator(); aIter.hasNext();) { Assignment assign = (Assignment) aIter.next(); if (assign != null && assign.isReleased()) { viewableAssignments.add(assign); } } } } // Now we need to convert these to the assignment template objects if (viewableAssignments != null && !viewableAssignments.isEmpty()) { for (Iterator assignIter = viewableAssignments.iterator(); assignIter.hasNext();) { Assignment assignment = (Assignment) assignIter.next(); assignmentsToReturn.add(getAssignmentDefinition(assignment)); } } return new ArrayList<>(assignmentsToReturn); }
From source file:org.wso2.carbon.apimgt.impl.APIProviderImpl.java
/** * When enabled publishing to external APIStores support,get only the published external apistore details which are * stored in db//from w w w .j a v a 2s .co m * @param apiId The API Identifier which need to update in db * @throws org.wso2.carbon.apimgt.api.APIManagementException * If failed to update subscription status */ @Override public Set<APIStore> getPublishedExternalAPIStores(APIIdentifier apiId) throws APIManagementException { Set<APIStore> storesSet; SortedSet<APIStore> configuredAPIStores = new TreeSet<APIStore>(new APIStoreNameComparator()); configuredAPIStores.addAll(APIUtil.getExternalStores(tenantId)); if (APIUtil.isAPIsPublishToExternalAPIStores(tenantId)) { storesSet = apiMgtDAO.getExternalAPIStoresDetails(apiId); //Retains only the stores that contained in configuration storesSet.retainAll(configuredAPIStores); return storesSet; } else { return null; } }
From source file:org.wso2.carbon.apimgt.impl.APIProviderImpl.java
/** * When enabled publishing to external APIStores support,get all the external apistore details which are * published and stored in db and which are not unpublished * @param apiId The API Identifier which need to update in db * @throws org.wso2.carbon.apimgt.api.APIManagementException * If failed to update subscription status */// w w w. ja v a2s .c o m @Override public Set<APIStore> getExternalAPIStores(APIIdentifier apiId) throws APIManagementException { if (APIUtil.isAPIsPublishToExternalAPIStores(tenantId)) { SortedSet<APIStore> sortedApiStores = new TreeSet<APIStore>(new APIStoreNameComparator()); Set<APIStore> publishedStores = apiMgtDAO.getExternalAPIStoresDetails(apiId); sortedApiStores.addAll(publishedStores); return APIUtil.getExternalAPIStores(sortedApiStores, tenantId); } else { return null; } }
From source file:org.wso2.carbon.apimgt.impl.utils.APIUtil.java
public static Set<APIStore> getExternalAPIStores(int tenantId) throws APIManagementException { SortedSet<APIStore> apistoreSet = new TreeSet<APIStore>(new APIStoreNameComparator()); apistoreSet.addAll(getExternalStores(tenantId)); return apistoreSet; }