SharedServiceSpring.java
1.3 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
package org.legrog.application;
import org.legrog.entities.*;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
import javax.ejb.Stateless;
import javax.inject.Inject;
import java.util.List;
import java.util.Vector;
@Stateless
public class SharedServiceSpring implements SharedService {
@Inject
CountryRepository countryRepository;
@Inject
UserRoleRepository userRoleRepository;
@Inject
UserPropertyRepository userPropertyRepository;
private List<DisplayNameMask> allDisplayNameMasks;
public void addCountry(Country country) {
countryRepository.save(country);
}
public List<Country> getAllCountries() {
return countryRepository.findAll();
}
public List<DisplayNameMask> getAllDisplayNameMasks() {
if (allDisplayNameMasks == null)
{
allDisplayNameMasks = new Vector<DisplayNameMask>(DisplayNameMask.values().length);
for (DisplayNameMask mask : DisplayNameMask.values())
{
allDisplayNameMasks.add(mask);
}
}
return allDisplayNameMasks;
}
public List<UserRole> getAvailableUserRoles() {
return userRoleRepository.findAll();
}
public List<UserProperty> getAvailableUserProperties() { return userPropertyRepository.findAll(); }
}