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 java.lang.String |
COPYRIGHT_TEXT |
static java.lang.String |
INTRODUCTORY_TEXT |
static java.lang.String |
SHORT_DESCRIPTION |
static java.lang.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,
java.lang.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(java.lang.String handle)
Create a new collection within this community.
|
Community |
createSubcommunity()
Create a new sub-community within this community.
|
Community |
createSubcommunity(java.lang.String handle)
Create a new sub-community within this community.
|
void |
delete()
Delete the community, including the metadata and logo.
|
boolean |
equals(java.lang.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.
|
java.lang.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.
|
java.lang.String |
getMetadata(java.lang.String field)
Get the value of a metadata field
|
java.lang.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(java.io.InputStream is)
Give the community a logo.
|
void |
setMetadata(java.lang.String field,
java.lang.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 java.lang.String COPYRIGHT_TEXT
public static final java.lang.String INTRODUCTORY_TEXT
public static final java.lang.String SHORT_DESCRIPTION
public static final java.lang.String SIDEBAR_TEXT
public static Community find(Context context, int id) throws java.sql.SQLException
context - DSpace context objectid - ID of the communityjava.sql.SQLExceptionpublic static Community create(Community parent, Context context) throws java.sql.SQLException, AuthorizeException
context - DSpace context objectjava.sql.SQLExceptionAuthorizeExceptionpublic static Community create(Community parent, Context context, java.lang.String handle) throws java.sql.SQLException, AuthorizeException
context - DSpace context objecthandle - the pre-determined Handle to assign to the new communityjava.sql.SQLExceptionAuthorizeExceptionpublic static Community[] findAll(Context context) throws java.sql.SQLException
context - DSpace context objectjava.sql.SQLExceptionpublic static Community[] findAllTop(Context context) throws java.sql.SQLException
context - DSpace context objectjava.sql.SQLExceptionpublic int getID()
getID in class DSpaceObjectpublic java.lang.String getHandle()
DSpaceObjectnullgetHandle in class DSpaceObjectnull if it doesn't have
oneDSpaceObject.getHandle()public java.lang.String getMetadata(java.lang.String field)
field - the name of the metadata field to getjava.lang.IllegalArgumentException - if the requested metadata field doesn't existpublic void setMetadata(java.lang.String field,
java.lang.String value)
throws java.util.MissingResourceException
field - the name of the metadata field to getvalue - value to set the field tojava.lang.IllegalArgumentException - if the requested metadata field doesn't existjava.util.MissingResourceExceptionpublic java.lang.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(java.io.InputStream is) throws AuthorizeException, java.io.IOException, java.sql.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)AuthorizeExceptionjava.io.IOExceptionjava.sql.SQLExceptionpublic void update()
throws java.sql.SQLException,
AuthorizeException
update in class DSpaceObjectjava.sql.SQLExceptionAuthorizeExceptionpublic Group createAdministrators() throws java.sql.SQLException, AuthorizeException
java.sql.SQLExceptionAuthorizeExceptionpublic void removeAdministrators()
throws java.sql.SQLException,
AuthorizeException
java.sql.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 java.sql.SQLException
java.sql.SQLExceptionpublic Community[] getSubcommunities() throws java.sql.SQLException
java.sql.SQLExceptionpublic Community getParentCommunity() throws java.sql.SQLException
java.sql.SQLExceptionpublic Community[] getAllParents() throws java.sql.SQLException
java.sql.SQLExceptionpublic Collection[] getAllCollections() throws java.sql.SQLException
java.sql.SQLExceptionpublic Collection createCollection() throws java.sql.SQLException, AuthorizeException
java.sql.SQLExceptionAuthorizeExceptionpublic Collection createCollection(java.lang.String handle) throws java.sql.SQLException, AuthorizeException
handle - the pre-determined Handle to assign to the new communityjava.sql.SQLExceptionAuthorizeExceptionpublic void addCollection(Collection c) throws java.sql.SQLException, AuthorizeException
c - collection to addjava.sql.SQLExceptionAuthorizeExceptionpublic Community createSubcommunity() throws java.sql.SQLException, AuthorizeException
java.sql.SQLExceptionAuthorizeExceptionpublic Community createSubcommunity(java.lang.String handle) throws java.sql.SQLException, AuthorizeException
handle - the pre-determined Handle to assign to the new communityjava.sql.SQLExceptionAuthorizeExceptionpublic void addSubcommunity(Community c) throws java.sql.SQLException, AuthorizeException
c - subcommunity to addjava.sql.SQLExceptionAuthorizeExceptionpublic void removeCollection(Collection c) throws java.sql.SQLException, AuthorizeException, java.io.IOException
c - collection to removejava.sql.SQLExceptionAuthorizeExceptionjava.io.IOExceptionpublic void removeSubcommunity(Community c) throws java.sql.SQLException, AuthorizeException, java.io.IOException
c - subcommunity to removejava.sql.SQLExceptionAuthorizeExceptionjava.io.IOExceptionpublic void delete()
throws java.sql.SQLException,
AuthorizeException,
java.io.IOException
java.sql.SQLExceptionAuthorizeExceptionjava.io.IOExceptionpublic boolean equals(java.lang.Object other)
true if other is the same Community
as this object, false otherwiseequals in class java.lang.Objectother - object to compare totrue if object passed in represents the same
community as this objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int getType()
getType in class DSpaceObjectpublic boolean canEditBoolean()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void canEdit()
throws AuthorizeException,
java.sql.SQLException
AuthorizeExceptionjava.sql.SQLExceptionpublic int countItems()
throws java.sql.SQLException
java.sql.SQLExceptionpublic DSpaceObject getAdminObject(int action) throws java.sql.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 thrownjava.sql.SQLExceptionpublic DSpaceObject getParentObject() throws java.sql.SQLException
DSpaceObjectgetParentObject in class DSpaceObjectjava.sql.SQLExceptionpublic void updateLastModified()
updateLastModified in class DSpaceObjectCopyright © 2018 DuraSpace. All Rights Reserved.