Mercurial > hg > Members > tatsuki > JungleXMLReader
changeset 18:0fce1292ab38
add deepPersonIdsTest and Method but not Test
author | one |
---|---|
date | Mon, 27 Oct 2014 06:49:08 +0900 |
parents | f59fc20f4af9 |
children | da872647cbe4 |
files | src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/JuGrix.java src/test/java/jp/ac/u_ryukyu/cr/ie/tatsuki/functionTest/deepPersonIdsTest.java |
diffstat | 2 files changed, 47 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/JuGrix.java Mon Oct 27 04:49:58 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/cr/ie/tatsuki/bbs/JuGrix.java Mon Oct 27 06:49:08 2014 +0900 @@ -56,6 +56,10 @@ return personIdsSearch(orgId, roleIds).iterator(); } + public LinkedList<String> personIdLink(String orgId, LinkedList<String> roleIds){ + return personIdsSearch(orgId, roleIds); + } + public Iterator<String> personIds(LinkedList<String> orgIds ,LinkedList<String> roleIds){ LinkedList<String> personIds = new LinkedList<String>(); @@ -425,6 +429,24 @@ return pairPersonIterator; } + + + public Iterator<String> deepPersonIds(String orgId, LinkedList<String> filterIds) { + + Iterator<String> childrensIterator = deepChildOrganizationIds(orgId, new LinkedList<String>()); + if (!childrensIterator.hasNext()) + return new NullIterator(); + + LinkedList<String> childrenPersonList = new LinkedList<String>(); + childrenPersonList.addAll(personIdLink(orgId, filterIds)); + for (;childrensIterator.hasNext();) { + String id = childrensIterator.next(); + childrenPersonList.addAll(personIdLink(id, filterIds)); + } + + return childrenPersonList.iterator(); + } + public Iterator<String> deepChildOrganizationIds(String orgId, LinkedList<String> filterIds) { return _deepChildOrganizationIds(orgId,filterIds).iterator(); } @@ -602,4 +624,6 @@ + + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/jp/ac/u_ryukyu/cr/ie/tatsuki/functionTest/deepPersonIdsTest.java Mon Oct 27 06:49:08 2014 +0900 @@ -0,0 +1,23 @@ +package jp.ac.u_ryukyu.cr.ie.tatsuki.functionTest; + +import java.util.Iterator; +import java.util.LinkedList; + +import jp.ac.u_ryukyu.cr.ie.tatsuki.bbs.JuGrix; + +import org.junit.Test; + +public class deepPersonIdsTest { + @Test + public void deepPersonIdsTest(){ + JuGrix jugrix = new JuGrix(); + LinkedList<String> filterIds = new LinkedList<String>(); + //filterIds.add("r:9"); + Iterator<String> ids = jugrix.deepPersonIds("o:3",filterIds); + System.out.println("------------------------------------------------"); + for (;ids.hasNext();) { + System.out.println(ids.next()); + } + } + +}