@Service
public class ServerPackService
extends java.lang.Object
| Constructor and Description |
|---|
ServerPackService(ServerPackRepository injectedServerPackRepository)
Constructor responsible for our DI.
|
| Modifier and Type | Method and Description |
|---|---|
void |
deleteServerPack(int id)
Deletes a server pack with the given id.
|
org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> |
downloadServerPackById(int id)
Download a server pack with the given database id.
|
java.util.List<ServerPackModel> |
getServerPacks()
Get a list of all available server packs.
|
void |
insert(ServerPackModel serverPackModel)
Store a server pack in the database.
|
void |
updateConfirmedCounter(int id,
int vote)
Either increment or decrement the confirmed working value of a given server pack entry in the
database, identified by the database id.
|
void |
updateDownloadCounter(int id)
Increment the download counter for a given server pack entry in the database identified by the
database id.
|
void |
updateServerPackByID(int id,
ServerPackModel serverPackModel)
Update a server pack database entry with the given database id.
|
org.springframework.http.ResponseEntity<java.lang.Object> |
voteForServerPack(java.lang.String voting)
Either upvote or downvote a given server pack.
|
@Autowired public ServerPackService(ServerPackRepository injectedServerPackRepository)
injectedServerPackRepository - Instance of ServerPackRepository.public org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> downloadServerPackById(int id)
id - The database id of the server pack to download.public org.springframework.http.ResponseEntity<java.lang.Object> voteForServerPack(java.lang.String voting)
voting - The database id of the server pack and whether it should be up- or downvoted.public java.util.List<ServerPackModel> getServerPacks()
public void insert(ServerPackModel serverPackModel)
serverPackModel - Instance of ServerPackModel to store in the database.public void updateServerPackByID(int id,
ServerPackModel serverPackModel)
id - Integer. The database id of the server pack to initialize.serverPackModel - Instance of ServerPackModel with which to initialize the entry
in the database.public void updateDownloadCounter(int id)
id - The database id of the server pack.public void updateConfirmedCounter(int id,
int vote)
id - The database id of the server pack.vote - Positive for upvote, negative for downvotepublic void deleteServerPack(int id)
id - The database id of the server pack to delete.