Class AnnotationServiceJpaImpl
java.lang.Object
org.opencastproject.annotation.impl.AnnotationServiceJpaImpl
- All Implemented Interfaces:
AnnotationService
JPA-based implementation of the
AnnotationService-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DBSessionprotected DBSessionFactoryprotected javax.persistence.EntityManagerFactoryThe factory used to generate the entity managerstatic final StringJPA persistence unit nameprotected SecurityServiceOpencast's security service -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Adds a new annotation to the database and returns the event with an updated annotationId, to make sure the annotationId stays uniqueChanges an annotation in the database it uses the annotationId to overwrite the value.voidgetAnnotation(long id) Gets an annotation by its identifier.getAnnotations(int offset, int limit) Returns annotationsgetAnnotationsByDay(String day, int offset, int limit) Returns annotations of a given day (YYYYMMDD)getAnnotationsByMediapackageId(String mediapackageId, int offset, int limit) Returns annotations of a given mediapackage IDgetAnnotationsByType(String type, int offset, int limit) Returns annotations of a given typegetAnnotationsByTypeAndDay(String type, String day, int offset, int limit) Returns annotations of a given type and daygetAnnotationsByTypeAndMediapackageId(String type, String mediapackageId, int offset, int limit) Returns annotations of a given type and mediapackage idbooleanRemove a given annotation from databasevoidsetDBSessionFactory(DBSessionFactory dbSessionFactory) voidsetSecurityService(SecurityService securityService) Sets the opencast security service
-
Field Details
-
PERSISTENCE_UNIT
JPA persistence unit name- See Also:
-
emf
protected javax.persistence.EntityManagerFactory emfThe factory used to generate the entity manager -
dbSessionFactory
-
db
-
securityService
Opencast's security service
-
-
Constructor Details
-
AnnotationServiceJpaImpl
public AnnotationServiceJpaImpl()
-
-
Method Details
-
setDBSessionFactory
-
activate
public void activate() -
deactivate
public void deactivate() -
setSecurityService
Sets the opencast security service- Parameters:
securityService- the securityService to set
-
addAnnotation
Description copied from interface:AnnotationServiceAdds a new annotation to the database and returns the event with an updated annotationId, to make sure the annotationId stays unique- Specified by:
addAnnotationin interfaceAnnotationService- Parameters:
a- The Annotation that will be added to the database- Returns:
- the updated annotation, with a new ID. NULL if there are errors while adding the annotation.
-
removeAnnotation
Description copied from interface:AnnotationServiceRemove a given annotation from database- Specified by:
removeAnnotationin interfaceAnnotationService- Parameters:
a- The Annotation that will be removed from the database- Returns:
- true if successfull removed, false else.
-
changeAnnotation
Description copied from interface:AnnotationServiceChanges an annotation in the database it uses the annotationId to overwrite the value. It returns the event with an updated annotation.- Specified by:
changeAnnotationin interfaceAnnotationService- Parameters:
a- The Annotation that will be changed in the database- Returns:
- the updated annotation. NULL if there are errors while changing the annotation.
- Throws:
NotFoundException
-
getAnnotation
Description copied from interface:AnnotationServiceGets an annotation by its identifier.- Specified by:
getAnnotationin interfaceAnnotationService- Parameters:
id- the annotation identifier- Returns:
- the annotation
- Throws:
NotFoundException- if there is no annotation with this identifier
-
getAnnotations
Description copied from interface:AnnotationServiceReturns annotations- Specified by:
getAnnotationsin interfaceAnnotationService- Parameters:
offset- the offsetlimit- the limit- Returns:
- the annotation list
-
getAnnotationsByTypeAndMediapackageId
public AnnotationList getAnnotationsByTypeAndMediapackageId(String type, String mediapackageId, int offset, int limit) Description copied from interface:AnnotationServiceReturns annotations of a given type and mediapackage id- Specified by:
getAnnotationsByTypeAndMediapackageIdin interfaceAnnotationService- Parameters:
type- the annotation typemediapackageId- the mediapackage idoffset- the offsetlimit- the limit- Returns:
- the annotation list
-
getAnnotationsByMediapackageId
Description copied from interface:AnnotationServiceReturns annotations of a given mediapackage ID- Specified by:
getAnnotationsByMediapackageIdin interfaceAnnotationService- Parameters:
mediapackageId- The mediapackage IDoffset- the offsetlimit- the limit- Returns:
- the annotation list
-
getAnnotationsByTypeAndDay
Description copied from interface:AnnotationServiceReturns annotations of a given type and day- Specified by:
getAnnotationsByTypeAndDayin interfaceAnnotationService- Parameters:
type- the annotation typeday- the dayoffset- the offsetlimit- the limit- Returns:
- the annotation list
-
getAnnotationsByDay
Description copied from interface:AnnotationServiceReturns annotations of a given day (YYYYMMDD)- Specified by:
getAnnotationsByDayin interfaceAnnotationService- Parameters:
day- The day in the format of YYYYMMDDoffset- the offsetlimit- the limit- Returns:
- the annotation list
-
getAnnotationsByType
Description copied from interface:AnnotationServiceReturns annotations of a given type- Specified by:
getAnnotationsByTypein interfaceAnnotationService- Parameters:
type- The annotation typeoffset- the offsetlimit- the limit- Returns:
- the annotation list
-