-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathActiveUserDeleteCommand.java
More file actions
41 lines (31 loc) · 1.19 KB
/
ActiveUserDeleteCommand.java
File metadata and controls
41 lines (31 loc) · 1.19 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
package edu.uark.registerapp.commands.activeUsers;
import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.pringframework.transaction.annotation.Transactional;
import edu.uark.registerapp.commands.VoidCommandInterface;
import edu.uark.registerapp.nodels.entities.ActiveUserEntity;
import edu.uark.registerapp.models.repositories.ActiveUserRepository;
@Service
public class ActiveUserDeleteCommand implements VoidCommandInterface{
@Override
@Transactional
public void execute(){
final Optional<ActiveUserEntity> activeUserEntity=
this.activeUserRepository.findBySessionKey(this.sessionKey);
if(!activeUserEntity.isPresent()){
this.activeUserRepository.delete(activeUserEntity.get());
}
}
private String sessionKey;
public String getSessionKey(){
return this.sessionKey;
}
public ActiveUserDeleteCommand setSessionKey(final String sessionKey){
this.sessionKey = sessionKey;
return this;
}
@Autowired
private ActiveUserRepository activeUserRepository;
}