public class Community extends DSpaceObject
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.
| Modifier and Type | Field and Description |
|---|---|
static String |
COPYRIGHT_TEXT |
static String |
INTRODUCTORY_TEXT |
static String |
SHORT_DESCRIPTION |
static String |
SIDEBAR_TEXT |
| Modifier and Type | Method and Description |
|---|---|
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 top-level community, with a new ID.
|
static Community |
create(Community parent,
Context context,
String handle)
Create a new top-level 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.
|
Collection |
createCollection(String handle)
Create a new collection within this community.
|
Community |
createSubcommunity()
Create a new sub-community within this community.
|
Community |
createSubcommunity(String handle)
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.
|
Collection[] |
getAllCollections()
Return an array of collections of this community and its subcommunities
|
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
|
int |
hashCode() |
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.
|
void |
updateLastModified() |
addDetails, clearDetails, find, getDetails, getTypeTextpublic static final String COPYRIGHT_TEXT
public static final String INTRODUCTORY_TEXT
public static final String SHORT_DESCRIPTION
public static final String SIDEBAR_TEXT
public static Community find(Context context, int id) throws SQLException
context - DSpace context objectid - ID of the communitySQLExceptionpublic static Community create(Community parent, Context context) throws SQLException, AuthorizeException
context - DSpace context objectSQLExceptionAuthorizeExceptionpublic static Community create(Community parent, Context context, String handle) throws SQLException, AuthorizeException
context - DSpace context objecthandle - the pre-determined Handle to assign to the new communitySQLExceptionAuthorizeExceptionpublic static Community[] findAll(Context context) throws SQLException
context - DSpace context objectSQLExceptionpublic static Community[] findAllTop(Context context) throws SQLException
context - DSpace context objectSQLExceptionpublic int getID()
getID in class DSpaceObjectpublic String getHandle()
DSpaceObjectnullgetHandle in class DSpaceObjectnull if it doesn't have
oneDSpaceObject.getHandle()public String getMetadata(String field)
field - the name of the metadata field to getIllegalArgumentException - if the requested metadata field doesn't existpublic void setMetadata(String field, String value) throws MissingResourceException
field - the name of the metadata field to getvalue - value to set the field toIllegalArgumentException - if the requested metadata field doesn't existMissingResourceExceptionpublic 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.nullpublic 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.is - the stream to use as the new logonull if there is no
logo (null was passed in)AuthorizeExceptionIOExceptionSQLExceptionpublic void update()
throws SQLException,
AuthorizeException
update in class DSpaceObjectSQLExceptionAuthorizeExceptionpublic Group createAdministrators() throws SQLException, AuthorizeException
SQLExceptionAuthorizeExceptionpublic void removeAdministrators()
throws SQLException,
AuthorizeException
SQLExceptionAuthorizeExceptionpublic 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
SQLExceptionpublic Community[] getSubcommunities() throws SQLException
SQLExceptionpublic Community getParentCommunity() throws SQLException
SQLExceptionpublic Community[] getAllParents() throws SQLException
SQLExceptionpublic Collection[] getAllCollections() throws SQLException
SQLExceptionpublic Collection createCollection() throws SQLException, AuthorizeException
SQLExceptionAuthorizeExceptionpublic Collection createCollection(String handle) throws SQLException, AuthorizeException
handle - the pre-determined Handle to assign to the new communitySQLExceptionAuthorizeExceptionpublic void addCollection(Collection c) throws SQLException, AuthorizeException
c - collection to addSQLExceptionAuthorizeExceptionpublic Community createSubcommunity() throws SQLException, AuthorizeException
SQLExceptionAuthorizeExceptionpublic Community createSubcommunity(String handle) throws SQLException, AuthorizeException
handle - the pre-determined Handle to assign to the new communitySQLExceptionAuthorizeExceptionpublic void addSubcommunity(Community c) throws SQLException, AuthorizeException
c - subcommunity to addSQLExceptionAuthorizeExceptionpublic void removeCollection(Collection c) throws SQLException, AuthorizeException, IOException
c - collection to removeSQLExceptionAuthorizeExceptionIOExceptionpublic void removeSubcommunity(Community c) throws SQLException, AuthorizeException, IOException
c - subcommunity to removeSQLExceptionAuthorizeExceptionIOExceptionpublic void delete()
throws SQLException,
AuthorizeException,
IOException
public boolean equals(Object other)
true if other is the same Community
as this object, false otherwisepublic int getType()
getType in class DSpaceObjectpublic boolean canEditBoolean()
throws SQLException
SQLExceptionpublic void canEdit()
throws AuthorizeException,
SQLException
AuthorizeExceptionSQLExceptionpublic int countItems()
throws SQLException
SQLExceptionpublic 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 needed.
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 thrownSQLExceptionpublic DSpaceObject getParentObject() throws SQLException
DSpaceObjectgetParentObject in class DSpaceObjectSQLExceptionpublic void updateLastModified()
updateLastModified in class DSpaceObjectCopyright © 2015 DuraSpace. All Rights Reserved.