|
|
@@ -8,11 +8,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.util.HashSet;
|
|
|
import java.util.LinkedHashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
-import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.concurrent.ConcurrentSkipListSet;
|
|
|
|
|
|
/**
|
|
|
@@ -44,13 +42,23 @@ public class MasterService implements InitializingBean{
|
|
|
this.scanAll();
|
|
|
}
|
|
|
|
|
|
- public Set<Master> findAll() {
|
|
|
- return masters;
|
|
|
+ public Set<Master> findAll(boolean cloudEnabled) {
|
|
|
+ if (!cloudEnabled) {
|
|
|
+ return masters;
|
|
|
+ }
|
|
|
+ Set<Master> cloudMasters = new LinkedHashSet<>();
|
|
|
+ for (Master master : masters) {
|
|
|
+ if (master.isCloudEnabled()) {
|
|
|
+ cloudMasters.add(master);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return cloudMasters;
|
|
|
}
|
|
|
|
|
|
- public Set<MasterView> findAllView() {
|
|
|
+ public Set<MasterView> findAllView(boolean cloudEnabled) {
|
|
|
Set<MasterView> views = new LinkedHashSet<>();
|
|
|
- for (Master master : masters) {
|
|
|
+ Set<Master> thisMasters = findAll(cloudEnabled);
|
|
|
+ for (Master master : thisMasters) {
|
|
|
views.add(new MasterView(master));
|
|
|
}
|
|
|
return views;
|