org.apache.commons.collections4.list.SetUniqueList Java Examples

The following examples show how to use org.apache.commons.collections4.list.SetUniqueList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorkLogFactory.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
private void listWithFromActivityTokenForward(String activityToken, List<String> results) throws Exception {
	List<String> arrived = SetUniqueList.setUniqueList(new ArrayList<String>());
	List<String> ids = this.listWithFromActivityToken(activityToken);
	if (!ids.isEmpty()) {
		for (WorkLog o : this.entityManagerContainer().fetch(ids, WorkLog.class,
				ListTools.toList(WorkLog.arrivedActivityToken_FIELDNAME, WorkLog.connected_FIELDNAME))) {
			if (!results.contains(o.getId())) {
				results.add(o.getId());
				if ((o.getConnected()) && (StringUtils.isNotEmpty(o.getArrivedActivityToken()))) {
					arrived.add(o.getArrivedActivityToken());
				}
			}
		}
		if (!arrived.isEmpty()) {
			for (String str : arrived) {
				this.listWithFromActivityTokenForward(str, results);
			}
		}
	}
}
 
Example #2
Source File: DescribeBuilder.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
private List<Class<?>> scanJaxrsClass() throws Exception {
	try (ScanResult scanResult = new ClassGraph().disableJarScanning().enableAnnotationInfo().scan()) {
		SetUniqueList<Class<?>> classes = SetUniqueList.setUniqueList(new ArrayList<Class<?>>());
		for (ClassInfo info : scanResult.getClassesWithAnnotation(ApplicationPath.class.getName())) {
			Class<?> applicationPathClass = ClassUtils.getClass(info.getName());
			for (Class<?> o : (Set<Class<?>>) MethodUtils.invokeMethod(applicationPathClass.newInstance(),
					"getClasses")) {
				Path path = o.getAnnotation(Path.class);
				JaxrsDescribe jaxrsDescribe = o.getAnnotation(JaxrsDescribe.class);
				if (null != path && null != jaxrsDescribe) {
					classes.add(o);
				}
			}
		}
		return classes;
	}
}
 
Example #3
Source File: WorkLogFactory.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
private void listWithFromActivityTokenBackward(String activityToken, List<String> results) throws Exception {
	List<String> from = SetUniqueList.setUniqueList(new ArrayList<String>());
	List<String> ids = this.listWithArrivedActivityToken(activityToken);
	if (!ids.isEmpty()) {
		for (WorkLog o : this.entityManagerContainer().fetch(ids, WorkLog.class,
				ListTools.toList(WorkLog.fromActivityToken_FIELDNAME, WorkLog.connected_FIELDNAME))) {
			if (!results.contains(o.getId())) {
				results.add(o.getId());
				if ((o.getConnected()) && (StringUtils.isNotEmpty(o.getFromActivityToken()))) {
					from.add(o.getFromActivityToken());
				}
			}
		}
		if (!from.isEmpty()) {
			for (String str : from) {
				this.listWithFromActivityTokenBackward(str, results);
			}
		}
	}
}
 
Example #4
Source File: Describe.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
private List<Class<?>> scanJaxrsClass(String name) throws Exception {
	// String pack = "com." + name.replaceAll("_", ".");
	String pack = "";
	if (StringUtils.startsWith(name, "o2_")) {
		pack = name.replaceAll("_", ".");
	} else {
		pack = "com." + name.replaceAll("_", ".");
	}
	try (ScanResult scanResult = new ClassGraph().whitelistPackages(pack).enableAllInfo().scan()) {
		SetUniqueList<Class<?>> classes = SetUniqueList.setUniqueList(new ArrayList<Class<?>>());
		for (ClassInfo info : scanResult.getClassesWithAnnotation(ApplicationPath.class.getName())) {
			Class<?> applicationPathClass = ClassUtils.getClass(info.getName());
			for (Class<?> o : (Set<Class<?>>) MethodUtils.invokeMethod(applicationPathClass.newInstance(),
					"getClasses")) {
				Path path = o.getAnnotation(Path.class);
				JaxrsDescribe jaxrsDescribe = o.getAnnotation(JaxrsDescribe.class);
				if (null != path && null != jaxrsDescribe) {
					classes.add(o);
				}
			}
		}
		return classes;
	}
}
 
Example #5
Source File: WorkLogFactory.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
private void listWithArrivedActivityTokenBackward(String activityToken, List<String> results) throws Exception {
	List<String> from = SetUniqueList.setUniqueList(new ArrayList<String>());
	List<String> ids = this.listWithArrivedActivityToken(activityToken);
	if (!ids.isEmpty()) {
		for (WorkLog o : this.entityManagerContainer().fetch(ids, WorkLog.class,
				ListTools.toList(WorkLog.fromActivityToken_FIELDNAME, WorkLog.connected_FIELDNAME))) {
			if (!results.contains(o.getId())) {
				results.add(o.getId());
				if ((o.getConnected()) && (StringUtils.isNotEmpty(o.getFromActivityToken()))) {
					from.add(o.getFromActivityToken());
				}
			}
		}
		if (!from.isEmpty()) {
			for (String str : from) {
				this.listWithArrivedActivityTokenBackward(str, results);
			}
		}
	}
}
 
Example #6
Source File: ApiBuilder.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
private List<Class<?>> scanJaxrsClass() throws Exception {
	try (ScanResult scanResult = new ClassGraph().disableJarScanning().enableAnnotationInfo().scan()) {
		SetUniqueList<Class<?>> classes = SetUniqueList.setUniqueList(new ArrayList<Class<?>>());
		for (ClassInfo info : scanResult.getClassesWithAnnotation(ApplicationPath.class.getName())) {
			Class<?> applicationPathClass = ClassUtils.getClass(info.getName());
			for (Class<?> o : (Set<Class<?>>) MethodUtils.invokeMethod(applicationPathClass.newInstance(),
					"getClasses")) {
				Path path = o.getAnnotation(Path.class);
				JaxrsDescribe jaxrsDescribe = o.getAnnotation(JaxrsDescribe.class);
				if (null != path && null != jaxrsDescribe) {
					classes.add(o);
				}
			}
		}
		return classes;
	}
}
 
Example #7
Source File: WorkLogFactory.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
private void listWithFromActivityTokenForwardNotConnected(String activityToken, List<String> results)
		throws Exception {
	List<String> arrived = SetUniqueList.setUniqueList(new ArrayList<String>());
	List<String> ids = this.listWithFromActivityToken(activityToken);
	if (!ids.isEmpty()) {
		for (WorkLog o : this.entityManagerContainer().fetch(ids, WorkLog.class,
				ListTools.toList(WorkLog.arrivedActivityToken_FIELDNAME, WorkLog.connected_FIELDNAME))) {
			if (!results.contains(o.getId())) {
				if (o.getConnected()) {
					if (StringUtils.isNotEmpty(o.getArrivedActivityToken())) {
						arrived.add(o.getArrivedActivityToken());
					}
				} else {
					results.add(o.getId());
				}
			}
		}
		if (!arrived.isEmpty()) {
			for (String str : arrived) {
				this.listWithFromActivityTokenForwardNotConnected(str, results);
			}
		}
	}
}
 
Example #8
Source File: WorkLogFactory.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
private void listWithFromActivityTokenForward(String activityToken, List<String> results) throws Exception {
	List<String> arrived = SetUniqueList.setUniqueList(new ArrayList<String>());
	List<String> ids = this.listWithFromActivityToken(activityToken);
	if (!ids.isEmpty()) {
		for (WorkLog o : this.entityManagerContainer().fetch(ids, WorkLog.class,
				ListTools.toList(WorkLog.arrivedActivityToken_FIELDNAME, WorkLog.connected_FIELDNAME))) {
			if (!results.contains(o.getId())) {
				results.add(o.getId());
				if ((o.getConnected()) && (StringUtils.isNotEmpty(o.getArrivedActivityToken()))) {
					arrived.add(o.getArrivedActivityToken());
				}
			}
		}
		if (!arrived.isEmpty()) {
			for (String str : arrived) {
				this.listWithFromActivityTokenForward(str, results);
			}
		}
	}
}
 
Example #9
Source File: WorkLogFactory.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
private void listWithFromActivityTokenForwardNotConnected(String activityToken, List<String> results)
		throws Exception {
	List<String> arrived = SetUniqueList.setUniqueList(new ArrayList<String>());
	List<String> ids = this.listWithFromActivityToken(activityToken);
	if (!ids.isEmpty()) {
		for (WorkLog o : this.entityManagerContainer().fetch(ids, WorkLog.class,
				ListTools.toList(WorkLog.arrivedActivityToken_FIELDNAME, WorkLog.connected_FIELDNAME))) {
			if (!results.contains(o.getId())) {
				if (o.getConnected()) {
					if (StringUtils.isNotEmpty(o.getArrivedActivityToken())) {
						arrived.add(o.getArrivedActivityToken());
					}
				} else {
					results.add(o.getId());
				}
			}
		}
		if (!arrived.isEmpty()) {
			for (String str : arrived) {
				this.listWithFromActivityTokenForwardNotConnected(str, results);
			}
		}
	}
}
 
Example #10
Source File: ActionReference.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
private List<WoWork> listWork(Business business, Read read) throws Exception {
	List<String> ids = business.workLog().listWithFromActivityTokenForward(read.getActivityToken());
	List<String> workIds = SetUniqueList.setUniqueList(new ArrayList<String>());
	for (WorkLog o : business.entityManagerContainer().list(WorkLog.class, ids)) {
		workIds.add(o.getWork());
	}
	List<WoWork> wos = WoWork.copier.copy(business.entityManagerContainer().list(Work.class, workIds));
	wos = wos.stream().sorted(Comparator.comparing(Work::getCreateTime, Comparator.nullsLast(Date::compareTo)))
			.collect(Collectors.toList());
	return wos;
}
 
Example #11
Source File: ActionReference.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
private List<WoWork> listWork(Business business, TaskCompleted taskCompleted) throws Exception {
	List<String> ids = business.workLog().listWithFromActivityTokenForward(taskCompleted.getActivityToken());
	List<String> workIds = SetUniqueList.setUniqueList(new ArrayList<String>());
	for (WorkLog o : business.entityManagerContainer().list(WorkLog.class, ids)) {
		workIds.add(o.getWork());
	}
	List<WoWork> wos = WoWork.copier.copy(business.entityManagerContainer().list(Work.class, workIds));
	return wos;
}
 
Example #12
Source File: ActionReference.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
private List<WoWork> listWork(Business business, ReadCompleted readCompleted) throws Exception {
	List<String> ids = business.workLog().listWithFromActivityTokenForward(readCompleted.getActivityToken());
	List<String> workIds = SetUniqueList.setUniqueList(new ArrayList<String>());
	for (WorkLog o : business.entityManagerContainer().list(WorkLog.class, ids)) {
		workIds.add(o.getWork());
	}
	List<WoWork> wos = WoWork.copier.copy(business.entityManagerContainer().list(Work.class, workIds));
	wos = wos.stream().sorted(Comparator.comparing(Work::getCreateTime, Comparator.nullsLast(Date::compareTo)))
			.collect(Collectors.toList());
	return wos;
}
 
Example #13
Source File: WorkLogFactory.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
public List<String> listWithFromActivityTokenBackward(String activityToken) throws Exception {
	List<String> results = SetUniqueList.setUniqueList(new ArrayList<String>());
	/* 需要把开始节点先加入进去 */
	results.addAll(this.listWithFromActivityToken(activityToken));
	this.listWithFromActivityTokenBackward(activityToken, results);
	return results;
}
 
Example #14
Source File: WorkLogFactory.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
public List<String> listWithFromActivityTokenForward(String activityToken) throws Exception {
	List<String> results = SetUniqueList.setUniqueList(new ArrayList<String>());
	this.listWithFromActivityTokenForward(activityToken, results);
	return results;
}
 
Example #15
Source File: WorkLogFactory.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
public List<String> listWithFromActivityTokenForwardNotConnected(String activityToken) throws Exception {
	List<String> results = SetUniqueList.setUniqueList(new ArrayList<String>());
	this.listWithFromActivityTokenForwardNotConnected(activityToken, results);
	return results;
}
 
Example #16
Source File: WorkLogFactory.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
public List<String> listWithFromActivityTokenForward(String activityToken) throws Exception {
	List<String> results = SetUniqueList.setUniqueList(new ArrayList<String>());
	this.listWithFromActivityTokenForward(activityToken, results);
	return results;
}
 
Example #17
Source File: WorkLogFactory.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
public List<String> listWithFromActivityTokenForwardNotConnected(String activityToken) throws Exception {
	List<String> results = SetUniqueList.setUniqueList(new ArrayList<String>());
	this.listWithFromActivityTokenForwardNotConnected(activityToken, results);
	return results;
}
 
Example #18
Source File: WorkLogFactory.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
public List<String> listWithArrivedActivityTokenBackward(String activityToken) throws Exception {
	List<String> results = SetUniqueList.setUniqueList(new ArrayList<String>());
	this.listWithArrivedActivityTokenBackward(activityToken, results);
	return results;
}
 
Example #19
Source File: ReadCountCollectionUtils.java    From gatk-protected with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Creates a new buffer
 */
private Buffer() {
    targets = SetUniqueList.setUniqueList(new ArrayList<>());
    counts = new ArrayList<>();
}
 
Example #20
Source File: CommonCollections.java    From j360-dubbo-app-all with Apache License 2.0 2 votes vote down vote up
/**
 * 队列内元素唯一的List, 内部集成了一个HashSet来实现.
 * 
 * @param list 被包裹的底层List,可先定义ArrayList的初始长度等.
 */
public static <E> SetUniqueList<E> setUniqueList(final List<E> list) {
	return SetUniqueList.setUniqueList(list);
}
 
Example #21
Source File: ReadCountCollectionUtils.java    From gatk-protected with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Returns a live modifiable unique list to the targets already in the buffer.
 *
 * @return never {@code null}.
 */
private SetUniqueList<Target> getTargets() {
    return targets;
}