@Test public void testGetAllParents() throws Exception { new NonStrictExpectations() { AuthorizeManager authManager; { AuthorizeManager.authorizeAction((Context) any, (Community) any, Constants.ADD); result = null; AuthorizeManager.authorizeActionBoolean((Context) any, (Community) any, Constants.ADD); result = true; } }; assertThat("testGetAllParents 0",c.getAllParents(), notNullValue()); assertTrue("testGetAllParents 1", c.getAllParents().length == 0); Community son = Community.create(c, context); assertThat("testGetAllParents 2",son.getAllParents(), notNullValue()); assertTrue("testGetAllParents 3", son.getAllParents().length == 1); assertThat("testGetAllParents 4", son.getAllParents()[0], equalTo(c)); }
public Community[] getAllParents() throws SQLException { List<Community> parentList = new ArrayList<Community>(); Community parent = getParentCommunity(); while (parent != null) { parentList.add(parent); parent = parent.getParentCommunity(); } Community[] communityArray = new Community[parentList.size()]; communityArray = (Community[]) parentList.toArray(communityArray); return communityArray; }
Community extends DSpaceObject { public Community[] getAllParents() throws SQLException { List<Community> parentList = new ArrayList<Community>(); Community parent = getParentCommunity(); while (parent != null) { parentList.add(parent); parent = parent.getParentCommunity(); } Community[] communityArray = new Community[parentList.size()]; communityArray = (Community[]) parentList.toArray(communityArray); return communityArray; } }
Community extends DSpaceObject { public Community[] getAllParents() throws SQLException { List<Community> parentList = new ArrayList<Community>(); Community parent = getParentCommunity(); while (parent != null) { parentList.add(parent); parent = parent.getParentCommunity(); } Community[] communityArray = new Community[parentList.size()]; communityArray = (Community[]) parentList.toArray(communityArray); return communityArray; } Community(Context context, TableRow row); }
Community extends DSpaceObject { public Community[] getAllParents() throws SQLException { List<Community> parentList = new ArrayList<Community>(); Community parent = getParentCommunity(); while (parent != null) { parentList.add(parent); parent = parent.getParentCommunity(); } Community[] communityArray = new Community[parentList.size()]; communityArray = (Community[]) parentList.toArray(communityArray); return communityArray; } Community(Context context, TableRow row); static Community find(Context context, int id); static Community create(Community parent, Context context); static Community create(Community parent, Context context, String handle); static Community[] findAll(Context context); static Community[] findAllTop(Context context); int getID(); String getHandle(); String getMetadata(String field); void setMetadata(String field, String value); String getName(); Bitstream getLogo(); Bitstream setLogo(InputStream is); void update(); Group createAdministrators(); void removeAdministrators(); Group getAdministrators(); Collection[] getCollections(); Community[] getSubcommunities(); Community getParentCommunity(); Community[] getAllParents(); Collection createCollection(); Collection createCollection(String handle); void addCollection(Collection c); Community createSubcommunity(); Community createSubcommunity(String handle); void addSubcommunity(Community c); void removeCollection(Collection c); void removeSubcommunity(Community c); void delete(); boolean equals(Object other); int hashCode(); int getType(); boolean canEditBoolean(); void canEdit(); int countItems(); DSpaceObject getAdminObject(int action); DSpaceObject getParentObject(); }
Community extends DSpaceObject { public Community[] getAllParents() throws SQLException { List<Community> parentList = new ArrayList<Community>(); Community parent = getParentCommunity(); while (parent != null) { parentList.add(parent); parent = parent.getParentCommunity(); } Community[] communityArray = new Community[parentList.size()]; communityArray = (Community[]) parentList.toArray(communityArray); return communityArray; } Community(Context context, TableRow row); static Community find(Context context, int id); static Community create(Community parent, Context context); static Community create(Community parent, Context context, String handle); static Community[] findAll(Context context); static Community[] findAllTop(Context context); int getID(); String getHandle(); String getMetadata(String field); void setMetadata(String field, String value); String getName(); Bitstream getLogo(); Bitstream setLogo(InputStream is); void update(); Group createAdministrators(); void removeAdministrators(); Group getAdministrators(); Collection[] getCollections(); Community[] getSubcommunities(); Community getParentCommunity(); Community[] getAllParents(); Collection createCollection(); Collection createCollection(String handle); void addCollection(Collection c); Community createSubcommunity(); Community createSubcommunity(String handle); void addSubcommunity(Community c); void removeCollection(Collection c); void removeSubcommunity(Community c); void delete(); boolean equals(Object other); int hashCode(); int getType(); boolean canEditBoolean(); void canEdit(); int countItems(); DSpaceObject getAdminObject(int action); DSpaceObject getParentObject();  }