-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSponsorService.java
More file actions
37 lines (30 loc) · 982 Bytes
/
SponsorService.java
File metadata and controls
37 lines (30 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.test.service;
import com.test.errors.SponsorNotFoundException;
import com.test.model.SponsorModel;
import lombok.extern.slf4j.Slf4j;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.Collections;
import java.util.List;
@Singleton
@Slf4j
public class SponsorService {
@Inject
public SponsorService() {
}
public List<SponsorModel> getSponsors() {
SponsorModel sponsor = new SponsorModel("1", "test");
return Collections.singletonList(sponsor);
}
public SponsorModel getSponsorById(String id) {
if ("test".equals(id)) {
throw new SponsorNotFoundException("Cannot find sponsor with provided ID");
} else {
return new SponsorModel("1", "test");
}
}
public void deleteSponsorById(String id) {
// Your logic to delete the sponsor from the database or storage
// For example, if using DynamoDB: dynamoDBMapper.delete(...)
}
}