Package org.dspace.content
Class BitstreamFormatServiceImpl
- java.lang.Object
-
- org.dspace.content.BitstreamFormatServiceImpl
-
- All Implemented Interfaces:
BitstreamFormatService,DSpaceCRUDService<BitstreamFormat>
public class BitstreamFormatServiceImpl extends Object implements BitstreamFormatService
Service implementation for the BitstreamFormat object. This class is responsible for all business logic calls for the BitstreamFormat object and is autowired by spring. This class should never be accessed directly.- Author:
- kevinvandevelde at atmire.com
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorizeServiceauthorizeServiceprotected BitstreamFormatDAObitstreamFormatDAOprotected String[]supportLevelTexttranslate support-level ID to string.
-
Constructor Summary
Constructors Modifier Constructor Description protectedBitstreamFormatServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BitstreamFormatcreate(Context context)voiddelete(Context context, BitstreamFormat bitstreamFormat)BitstreamFormatfind(Context context, int id)Get a bitstream format from the database.List<BitstreamFormat>findAll(Context context)Retrieve all bitstream formats from the registry, ordered by IDBitstreamFormatfindByMIMEType(Context context, String mimeType)Find a bitstream format by its (unique) MIME type.BitstreamFormatfindByShortDescription(Context context, String desc)Find a bitstream format by its (unique) short descriptionList<BitstreamFormat>findNonInternal(Context context)Retrieve all non-internal bitstream formats from the registry.BitstreamFormatfindUnknown(Context context)Get the generic "unknown" bitstream format.intgetSupportLevelID(String supportLevel)If you know the support level string, look up the corresponding type ID constant.StringgetSupportLevelText(BitstreamFormat bitstreamFormat)Get the support level text for this bitstream format - one ofUNKNOWN,KNOWNorSUPPORTED.BitstreamFormatguessFormat(Context context, Bitstream bitstream)Attempt to identify the format of a particular bitstream.voidsetShortDescription(Context context, BitstreamFormat bitstreamFormat, String shortDescription)Set the short description of the bitstream formatvoidsetSupportLevel(BitstreamFormat bitstreamFormat, int supportLevel)Set the support level for this bitstream format - one ofUNKNOWN,KNOWNorSUPPORTED.voidupdate(Context context, List<BitstreamFormat> bitstreamFormats)Persist a collection of model objects.voidupdate(Context context, BitstreamFormat bitstreamFormat)Persist a model object.
-
-
-
Field Detail
-
bitstreamFormatDAO
@Autowired(required=true) protected BitstreamFormatDAO bitstreamFormatDAO
-
authorizeService
@Autowired(required=true) protected AuthorizeService authorizeService
-
supportLevelText
protected final String[] supportLevelText
translate support-level ID to string. MUST keep this table in sync with support level definitions above.
-
-
Method Detail
-
find
public BitstreamFormat find(Context context, int id) throws SQLException
Get a bitstream format from the database.- Specified by:
findin interfaceDSpaceCRUDService<BitstreamFormat>- Parameters:
context- DSpace context objectid- ID of the bitstream format- Returns:
- the bitstream format, or null if the ID is invalid.
- Throws:
SQLException- if database error
-
findByMIMEType
public BitstreamFormat findByMIMEType(Context context, String mimeType) throws SQLException
Description copied from interface:BitstreamFormatServiceFind a bitstream format by its (unique) MIME type. If more than one bitstream format has the same MIME type, the one returned is unpredictable.- Specified by:
findByMIMETypein interfaceBitstreamFormatService- Parameters:
context- DSpace context objectmimeType- MIME type value- Returns:
- the corresponding bitstream format, or
nullif there's no bitstream format with the given MIMEtype. - Throws:
SQLException- if database error
-
findByShortDescription
public BitstreamFormat findByShortDescription(Context context, String desc) throws SQLException
Description copied from interface:BitstreamFormatServiceFind a bitstream format by its (unique) short description- Specified by:
findByShortDescriptionin interfaceBitstreamFormatService- Parameters:
context- DSpace context objectdesc- the short description- Returns:
- the corresponding bitstream format, or
nullif there's no bitstream format with the given short description - Throws:
SQLException- if database error
-
findUnknown
public BitstreamFormat findUnknown(Context context) throws SQLException
Description copied from interface:BitstreamFormatServiceGet the generic "unknown" bitstream format.- Specified by:
findUnknownin interfaceBitstreamFormatService- Parameters:
context- DSpace context object- Returns:
- the "unknown" bitstream format.
- Throws:
SQLException- if database error
-
findAll
public List<BitstreamFormat> findAll(Context context) throws SQLException
Description copied from interface:BitstreamFormatServiceRetrieve all bitstream formats from the registry, ordered by ID- Specified by:
findAllin interfaceBitstreamFormatService- Parameters:
context- DSpace context object- Returns:
- the bitstream formats.
- Throws:
SQLException- if database error
-
findNonInternal
public List<BitstreamFormat> findNonInternal(Context context) throws SQLException
Description copied from interface:BitstreamFormatServiceRetrieve all non-internal bitstream formats from the registry. The "unknown" format is not included, and the formats are ordered by support level (highest first) first then short description.- Specified by:
findNonInternalin interfaceBitstreamFormatService- Parameters:
context- DSpace context object- Returns:
- the bitstream formats.
- Throws:
SQLException- if database error
-
create
public BitstreamFormat create(Context context) throws SQLException, AuthorizeException
- Specified by:
createin interfaceDSpaceCRUDService<BitstreamFormat>- Throws:
SQLExceptionAuthorizeException
-
setShortDescription
public void setShortDescription(Context context, BitstreamFormat bitstreamFormat, String shortDescription) throws SQLException
Description copied from interface:BitstreamFormatServiceSet the short description of the bitstream format- Specified by:
setShortDescriptionin interfaceBitstreamFormatService- Parameters:
context- contextbitstreamFormat- formatshortDescription- the new short description- Throws:
SQLException- if database error
-
getSupportLevelText
public String getSupportLevelText(BitstreamFormat bitstreamFormat)
Description copied from interface:BitstreamFormatServiceGet the support level text for this bitstream format - one ofUNKNOWN,KNOWNorSUPPORTED.- Specified by:
getSupportLevelTextin interfaceBitstreamFormatService- Parameters:
bitstreamFormat- format- Returns:
- the support level
-
setSupportLevel
public void setSupportLevel(BitstreamFormat bitstreamFormat, int supportLevel)
Description copied from interface:BitstreamFormatServiceSet the support level for this bitstream format - one ofUNKNOWN,KNOWNorSUPPORTED.- Specified by:
setSupportLevelin interfaceBitstreamFormatService- Parameters:
bitstreamFormat- formatsupportLevel- the new support level
-
update
public void update(Context context, BitstreamFormat bitstreamFormat) throws SQLException, AuthorizeException
Description copied from interface:DSpaceCRUDServicePersist a model object.- Specified by:
updatein interfaceDSpaceCRUDService<BitstreamFormat>bitstreamFormat- object to be persisted.- Throws:
SQLException- passed through.AuthorizeException- passed through.
-
update
public void update(Context context, List<BitstreamFormat> bitstreamFormats) throws SQLException, AuthorizeException
Description copied from interface:DSpaceCRUDServicePersist a collection of model objects.- Specified by:
updatein interfaceDSpaceCRUDService<BitstreamFormat>bitstreamFormats- object to be persisted.- Throws:
SQLException- passed through.AuthorizeException- passed through.
-
delete
public void delete(Context context, BitstreamFormat bitstreamFormat) throws SQLException, AuthorizeException
- Specified by:
deletein interfaceDSpaceCRUDService<BitstreamFormat>- Throws:
SQLExceptionAuthorizeException
-
getSupportLevelID
public int getSupportLevelID(String supportLevel)
Description copied from interface:BitstreamFormatServiceIf you know the support level string, look up the corresponding type ID constant.- Specified by:
getSupportLevelIDin interfaceBitstreamFormatService- Parameters:
supportLevel- String with the name of the action (must be exact match)- Returns:
- the corresponding action ID, or
-1if the action string is unknown
-
guessFormat
public BitstreamFormat guessFormat(Context context, Bitstream bitstream) throws SQLException
Description copied from interface:BitstreamFormatServiceAttempt to identify the format of a particular bitstream. If the format is unknown, null is returned.- Specified by:
guessFormatin interfaceBitstreamFormatService- Parameters:
context- contextbitstream- the bitstream to identify the format of- Returns:
- a format from the bitstream format registry, or null
- Throws:
SQLException- if database error
-
-