91 lines
2.2 KiB
Java
91 lines
2.2 KiB
Java
package eu.eudat.logic.builders.entity;
|
|
|
|
import eu.eudat.commons.enums.IsActive;
|
|
import eu.eudat.data.UserCredentialEntity;
|
|
import eu.eudat.data.DmpEntity;
|
|
import eu.eudat.logic.builders.Builder;
|
|
import eu.eudat.data.UserEntity;
|
|
import eu.eudat.data.UserRoleEntity;
|
|
|
|
import java.time.Instant;
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
import java.util.UUID;
|
|
|
|
/**
|
|
* Created by ikalyvas on 2/15/2018.
|
|
*/
|
|
public class UserInfoBuilder extends Builder<UserEntity> {
|
|
|
|
private UUID id;
|
|
|
|
private String name = null;
|
|
|
|
private Instant created = null;
|
|
|
|
private String additionalinfo;
|
|
|
|
private Set<DmpEntity> dmps;
|
|
|
|
private Set<UserCredentialEntity> credentials = new HashSet<>();
|
|
|
|
private Set<UserRoleEntity> userRoles = new HashSet<>();
|
|
|
|
private IsActive userStatus;
|
|
|
|
public UserInfoBuilder id(UUID id) {
|
|
this.id = id;
|
|
return this;
|
|
}
|
|
|
|
|
|
public UserInfoBuilder name(String name) {
|
|
this.name = name;
|
|
return this;
|
|
}
|
|
|
|
public UserInfoBuilder created(Instant created) {
|
|
this.created = created;
|
|
return this;
|
|
}
|
|
|
|
public UserInfoBuilder additionalinfo(String additionalinfo) {
|
|
this.additionalinfo = additionalinfo;
|
|
return this;
|
|
}
|
|
|
|
public UserInfoBuilder dmps(Set<DmpEntity> dmps) {
|
|
this.dmps = dmps;
|
|
return this;
|
|
}
|
|
|
|
public UserInfoBuilder credentials(Set<UserCredentialEntity> credentials) {
|
|
this.credentials = credentials;
|
|
return this;
|
|
}
|
|
|
|
public UserInfoBuilder userRoles(Set<UserRoleEntity> userRoles) {
|
|
this.userRoles = userRoles;
|
|
return this;
|
|
}
|
|
|
|
public UserInfoBuilder userStatus(IsActive userStatus) {
|
|
this.userStatus = userStatus;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public UserEntity build() {
|
|
UserEntity userInfo = new UserEntity();
|
|
userInfo.setId(id);
|
|
userInfo.setCreatedAt(created);
|
|
userInfo.setName(name);
|
|
userInfo.setAdditionalInfo(additionalinfo);
|
|
// userInfo.setUserRoles(userRoles);
|
|
// userInfo.setCredentials(credentials);
|
|
// userInfo.setDmps(dmps); //TODO
|
|
userInfo.setIsActive(userStatus);
|
|
return userInfo;
|
|
}
|
|
}
|