|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dspace.content.DSpaceObject
org.dspace.content.Community
public class Community
Class representing a community
The community's metadata (name, introductory text etc.) is loaded into'
memory. Changes to this metadata are only reflected in the database after
update is called.
| Method Summary | |
|---|---|
void |
addCollection(Collection c)
Add an exisiting collection to the community |
void |
addSubcommunity(Community c)
Add an exisiting community as a subcommunity to the community |
void |
canEdit()
|
boolean |
canEditBoolean()
return TRUE if context's user can edit community, false otherwise |
int |
countItems()
counts items in this community |
static Community |
create(Community parent,
Context context)
Create a new community, with a new ID. |
Group |
createAdministrators()
Create a default administrators group if one does not already exist. |
Collection |
createCollection()
Create a new collection within this community. |
Community |
createSubcommunity()
Create a new sub-community within this community. |
void |
delete()
Delete the community, including the metadata and logo. |
boolean |
equals(Object other)
Return true if other is the same Community
as this object, false otherwise |
static Community |
find(Context context,
int id)
Get a community from the database. |
static Community[] |
findAll(Context context)
Get a list of all communities in the system. |
static Community[] |
findAllTop(Context context)
Get a list of all top-level communities in the system. |
Group |
getAdministrators()
Get the default group of administrators, if there is one. |
DSpaceObject |
getAdminObject(int action)
Return the dspace object where an ADMIN action right is sufficient to grant the initial authorize check. |
Community[] |
getAllParents()
Return an array of parent communities of this community, in ascending order. |
Collection[] |
getCollections()
Get the collections in this community. |
String |
getHandle()
Get the Handle of the object. |
int |
getID()
Get the internal ID of this collection |
Bitstream |
getLogo()
Get the logo for the community. |
String |
getMetadata(String field)
Get the value of a metadata field |
String |
getName()
Get a proper name for the object. |
Community |
getParentCommunity()
Return the parent community of this community, or null if the community is top-level |
DSpaceObject |
getParentObject()
Return the dspace object that "own" the current object in the hierarchy. |
Community[] |
getSubcommunities()
Get the immediate sub-communities of this community. |
int |
getType()
return type found in Constants |
void |
removeAdministrators()
Remove the administrators group, if no group has already been created then return without error. |
void |
removeCollection(Collection c)
Remove a collection. |
void |
removeSubcommunity(Community c)
Remove a subcommunity. |
Bitstream |
setLogo(InputStream is)
Give the community a logo. |
void |
setMetadata(String field,
String value)
Set a metadata value |
void |
update()
Update the community metadata (including logo) to the database. |
| Methods inherited from class org.dspace.content.DSpaceObject |
|---|
addDetails, clearDetails, find, getDetails |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Community find(Context context,
int id)
throws SQLException
context - DSpace context objectid - ID of the community
SQLException
public static Community create(Community parent,
Context context)
throws SQLException,
AuthorizeException
context - DSpace context object
SQLException
AuthorizeException
public static Community[] findAll(Context context)
throws SQLException
context - DSpace context object
SQLException
public static Community[] findAllTop(Context context)
throws SQLException
context - DSpace context object
SQLExceptionpublic int getID()
getID in class DSpaceObjectpublic String getHandle()
DSpaceObjectnull
getHandle in class DSpaceObjectnull if it doesn't have
oneDSpaceObject.getHandle()public String getMetadata(String field)
field - the name of the metadata field to get
IllegalArgumentException - if the requested metadata field doesn't exist
public void setMetadata(String field,
String value)
throws MissingResourceException
field - the name of the metadata field to getvalue - value to set the field to
IllegalArgumentException - if the requested metadata field doesn't exist
MissingResourceExceptionpublic String getName()
DSpaceObjectnull.
Name should be suitable for display in a user interface.
getName in class DSpaceObjectnull if it doesn't have
onepublic Bitstream getLogo()
null is return if the
community does not have a logo.
null
public Bitstream setLogo(InputStream is)
throws AuthorizeException,
IOException,
SQLException
null removes any
existing logo. You will need to set the format of the new logo bitstream
before it will work, for example to "JPEG". Note that
update(/code> will need to be called for the change to take
effect. Setting a logo and not calling update later may
result in a previous logo lying around as an "orphaned" bitstream.
- Parameters:
is - the stream to use as the new logo
- Returns:
- the new logo bitstream, or
null if there is no
logo (null was passed in)
- Throws:
AuthorizeException
IOException
SQLException
public void update()
throws SQLException,
IOException,
AuthorizeException
SQLException
IOException
AuthorizeException
public Group createAdministrators()
throws SQLException,
AuthorizeException
SQLException
AuthorizeException
public void removeAdministrators()
throws SQLException,
AuthorizeException
SQLException
AuthorizeExceptionpublic Group getAdministrators()
The default group of administrators for community 100 is the one called
community_100_admin.
null if there is no
default group.
public Collection[] getCollections()
throws SQLException
SQLException
public Community[] getSubcommunities()
throws SQLException
SQLException
public Community getParentCommunity()
throws SQLException
SQLException
public Community[] getAllParents()
throws SQLException
SQLException
public Collection createCollection()
throws SQLException,
AuthorizeException
SQLException
AuthorizeException
public void addCollection(Collection c)
throws SQLException,
AuthorizeException
c - collection to add
SQLException
AuthorizeException
public Community createSubcommunity()
throws SQLException,
AuthorizeException
SQLException
AuthorizeException
public void addSubcommunity(Community c)
throws SQLException,
AuthorizeException
c - subcommunity to add
SQLException
AuthorizeException
public void removeCollection(Collection c)
throws SQLException,
AuthorizeException,
IOException
c - collection to remove
SQLException
AuthorizeException
IOException
public void removeSubcommunity(Community c)
throws SQLException,
AuthorizeException,
IOException
c - subcommunity to remove
SQLException
AuthorizeException
IOException
public void delete()
throws SQLException,
AuthorizeException,
IOException
SQLException
AuthorizeException
IOExceptionpublic boolean equals(Object other)
true if other is the same Community
as this object, false otherwise
equals in class Objectother - object to compare to
true if object passed in represents the same
community as this objectpublic int getType()
getType in class DSpaceObject
public boolean canEditBoolean()
throws SQLException
SQLException
public void canEdit()
throws AuthorizeException,
SQLException
AuthorizeException
SQLException
public int countItems()
throws SQLException
SQLException
public DSpaceObject getAdminObject(int action)
throws SQLException
DSpaceObjectDefault behaviour is ADMIN right on the object grant right on all other action on the object itself. Subclass should override this method as need.
getAdminObject in class DSpaceObjectaction - ID of action being attempted, from
org.dspace.core.Constants. The ADMIN action is
not a valid parameter for this method, an
IllegalArgumentException should be thrown
SQLException
public DSpaceObject getParentObject()
throws SQLException
DSpaceObject
getParentObject in class DSpaceObjectSQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||