Package NTNU.IDATT1002.repository
Class MetadataRepository
java.lang.Object
NTNU.IDATT1002.repository.AbstractRepository<Metadata,java.lang.Long>
NTNU.IDATT1002.repository.MetadataRepository
- All Implemented Interfaces:
Repository<Metadata,java.lang.Long>
public class MetadataRepository extends AbstractRepository<Metadata,java.lang.Long>
Tag Repository.
Implementation of
AbstractRepository
which supports regular Create, Read, Update and Delete operations.- Version:
- 1.0 22.03.20
- Author:
- Stian Mogen, Eirik Steira
- See Also:
AbstractRepository
-
Field Summary
Fields inherited from class NTNU.IDATT1002.repository.AbstractRepository
entityClass, entityManager, logger
-
Constructor Summary
Constructors Constructor Description MetadataRepository(javax.persistence.EntityManager entityManager)
Set the class type toMetadata
-
Method Summary
Modifier and Type Method Description java.util.Optional<Metadata>
findOrCreate(Metadata metadata)
Retrieves a tag if found and creates it if not.Methods inherited from class NTNU.IDATT1002.repository.AbstractRepository
delete, deleteById, findAll, findById, save, setEntityClass, update
-
Constructor Details
-
MetadataRepository
public MetadataRepository(javax.persistence.EntityManager entityManager)Set the class type toMetadata
-
-
Method Details
-
findOrCreate
Retrieves a tag if found and creates it if not.- Parameters:
metadata
- the tag to retrieve- Returns:
- the tag if found, else the newly created one.
-