public void addState(StudentState state) { if (null == states) { states = CollectUtils.newHashSet(); } state.setStd(this); states.add(state); }
public void addState(StudentState state) { if (null == states) { states = CollectUtils.newHashSet(); } state.setStd(this); states.add(state); }
@Override public Set<?> keys() { return CollectUtils.newHashSet(context.getBeanDefinitionNames()); }
/** * 获得一个课程组中,到term为止需要上的所有PlanCourse * * @param courseGroup * @param term * @return */ public static List<PlanCourse> getPlanCoursesUntilTerm(CourseGroup courseGroup, int term) { Set<PlanCourse> result = CollectUtils.newHashSet(); for (int i = 1; i <= term; i++) { result.addAll(getPlanCourses(courseGroup, i)); } return new ArrayList<PlanCourse>(result); } }
/** * is Multiple schema for entity * */ public boolean isMultiSchema() { Set<String> schemas = CollectUtils.newHashSet(); for (TableNamePattern pattern : patterns) { schemas.add((null == pattern.getSchema()) ? "" : pattern.getSchema()); } return schemas.size() > 1; }
public Set<String> getResourceNamesByRole(String roleId) { String url = Urp.Instance.getApi() + "/platform/security/func/" + UrpApp.getName() + "/permissions/role/" + roleId + ".json"; String resources = HttpUtils.getResponseText(url); List rs = new Gson().fromJson(resources, List.class); Set<String> s = CollectUtils.newHashSet(); for (Object o : rs) { Map<String, Object> m = (Map<String, Object>) o; s.add(m.get("name").toString()); } return s; }
public Set<Department> getDepartments() { Set<Department> departs = CollectUtils.newHashSet(); for (MajorJournal md : getJournals()) { departs.add(md.getDepart()); } return departs; }
public Set<Department> getDepartments() { Set<Department> departs = CollectUtils.newHashSet(); for (MajorJournal md : getJournals()) { departs.add(md.getDepart()); } return departs; }
/** * Update persistentclass and collection's schema. * * @see #addClass(Class) */ @Override protected void secondPassCompile() throws MappingException { super.secondPassCompile(); configSchema(); // remove duplicated persistentClass register in classes map. // see addClass Set<String> hackedEntityNames = CollectUtils.newHashSet(); for (Map.Entry<String, PersistentClass> entry : classes.entrySet()) { if (!entry.getKey().equals(entry.getValue().getEntityName())) hackedEntityNames.add(entry.getKey()); } for (String entityName : hackedEntityNames) { classes.remove(entityName); } }
/** * 返回正常参加上课的上课名单CourseTaker * * @return */ public Set<CourseTaker> getNormalCourseTakers() { Set<CourseTaker> normalTakers = CollectUtils.newHashSet(); if (CollectUtils.isNotEmpty(courseTakers)) { for (CourseTaker courseTaker : courseTakers) { if (!courseTaker.isFreeListening()) { normalTakers.add(courseTaker); } } } return normalTakers; }
public Set<String> getResourceNamesByScope(Scope scope) { String url = Urp.Instance.getApi() + "/platform/security/func/" + UrpApp.getName() + "/resources.json?scope=" + scope.toString(); try { String resources = HttpUtils.getResponseText(url); List rs = new Gson().fromJson(resources, List.class); Set<String> s = CollectUtils.newHashSet(); for (Object o : rs) { Map<String, Object> m = (Map<String, Object>) o; s.add(m.get("name").toString()); } return s; } catch (Exception e) { logger.error("Cannot access {}", url); return Collections.emptySet(); } }
public List<PlanCourse> getPlanCourses(String terms) { if (Strings.isEmpty(terms)) { return new ArrayList<PlanCourse>(getPlanCourses()); } Set<PlanCourse> result = CollectUtils.newHashSet(); Integer[] termSeq = Strings.splitToInt(terms); for (int i = 0; i < termSeq.length; i++) { result.addAll(PlanUtils.getPlanCourses(this, termSeq[i])); } return new ArrayList<PlanCourse>(result); }
public Set<Department> getValidDepartments() { Set<Department> departs = CollectUtils.newHashSet(); Date now = new Date(); for (MajorJournal md : getJournals()) { if (now.after(md.getBeginOn()) && ((md.getEndOn() != null && now.before(md.getEndOn())) || (md.getEndOn() == null))) { departs.add(md.getDepart()); } } return departs; }
public Set<Department> getValidDepartments() { Set<Department> departs = CollectUtils.newHashSet(); Date now = new Date(); for (MajorJournal md : getJournals()) { if (now.after(md.getBeginOn()) && ((md.getEndOn() != null && now.before(md.getEndOn())) || (md.getEndOn() == null))) { departs.add(md.getDepart()); } } return departs; }
@SuppressWarnings("unchecked") public <T> List<T> getData(Dimension field, String source, Object... keys) { Map<String, Object> params = CollectUtils.newHashMap(); if (keys.length > 0) { String lowerSourse = source.toLowerCase(); int index = lowerSourse.indexOf("order "); if (-1 == index) index = source.length(); boolean hasCondition = lowerSourse.contains(" where "); source = source.substring(0, index) + (hasCondition ? " and " : " where ") + field.getKeyName() + " in (:ids)"; Set<Object> newIds = CollectUtils.newHashSet(keys); Class<?> keyType = PropertyUtils.getPropertyType(ClassLoaders.loadClass(field.getTypeName()), field.getKeyName()); if (!keys[0].getClass().equals(keyType)) { newIds = CollectUtils.newHashSet(); for (Object key : keys) newIds.add(DefaultConversion.Instance.convert(key, keyType)); } params.put("ids", newIds); } return (List<T>) entityDao.search(source, params); }
public Set<Department> getValidDepartments(Date time) { Set<Department> departs = CollectUtils.newHashSet(); for (MajorJournal md : getJournals()) { if (time.after(md.getBeginOn()) && ((md.getEndOn() != null && time.before(md.getEndOn())) || (md.getEndOn() == null))) { departs.add(md.getDepart()); } } return departs; }
public Set<Department> getValidDepartments(Date time) { Set<Department> departs = CollectUtils.newHashSet(); for (MajorJournal md : getJournals()) { if (time.after(md.getBeginOn()) && ((md.getEndOn() != null && time.before(md.getEndOn())) || (md.getEndOn() == null))) { departs.add(md.getDepart()); } } return departs; }
public void exchange() { Set<Course> olds = CollectUtils.newHashSet(getSubstitutes()); getSubstitutes().clear(); addSubstitutes(getOrigins()); getOrigins().clear(); addOrigins(olds); }
private void validateColumns(Table table, Dialect dialect, Mapping mapping, TableMetadata tableInfo) { Iterator<?> iter = table.getColumnIterator(); Set<ColumnMetadata> processed = CollectUtils.newHashSet(); String tableName = Table.qualify(tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()); while (iter.hasNext()) { Field field = tableInfo.getClass().getField("columns"); @SuppressWarnings("unchecked") Set<ColumnMetadata> allColumns = CollectUtils.newHashSet(((Map<String, ColumnMetadata>) field .get(tableInfo)).values()); allColumns.removeAll(processed);
private void reconfig(BeanDefinitionRegistry registry, BindRegistry bindRegistry) { Stopwatch watch = new Stopwatch(true); if (null == reconfigResources || reconfigResources.isEmpty()) return; Set<String> beanNames = CollectUtils.newHashSet(); BeanDefinitionReader reader = new BeanDefinitionReader(); for (URL url : reconfigResources.getAllPaths()) {