use of com.keybox.manage.model.SortedSet in project KeyBox by skavanagh.
the class SystemStatusDB method getSortedSetStatus.
/**
* returns all key placement statuses
* @param userId user id
*/
public static SortedSet getSortedSetStatus(Long userId) {
SortedSet sortedSet = new SortedSet();
sortedSet.setItemList(getAllSystemStatus(userId));
return sortedSet;
}
use of com.keybox.manage.model.SortedSet in project KeyBox by skavanagh.
the class SecureShellAction method createTerms.
/**
* creates composite terminals if there are errors or authentication issues.
*/
@Action(value = "/admin/createTerms", results = { @Result(name = "success", location = "/admin/secure_shell.jsp") })
public String createTerms() {
Long userId = AuthUtil.getUserId(servletRequest.getSession());
Long sessionId = AuthUtil.getSessionId(servletRequest.getSession());
if (pendingSystemStatus != null && pendingSystemStatus.getId() != null) {
//get status
currentSystemStatus = SystemStatusDB.getSystemStatus(pendingSystemStatus.getId(), userId);
//if initial status run script
if (currentSystemStatus != null && (HostSystem.INITIAL_STATUS.equals(currentSystemStatus.getStatusCd()) || HostSystem.AUTH_FAIL_STATUS.equals(currentSystemStatus.getStatusCd()) || HostSystem.PUBLIC_KEY_FAIL_STATUS.equals(currentSystemStatus.getStatusCd()))) {
//set current session
currentSystemStatus = SSHUtil.openSSHTermOnSystem(passphrase, password, userId, sessionId, currentSystemStatus, userSchSessionMap);
}
if (currentSystemStatus != null && (HostSystem.AUTH_FAIL_STATUS.equals(currentSystemStatus.getStatusCd()) || HostSystem.PUBLIC_KEY_FAIL_STATUS.equals(currentSystemStatus.getStatusCd()))) {
pendingSystemStatus = currentSystemStatus;
} else {
pendingSystemStatus = SystemStatusDB.getNextPendingSystem(userId);
//if success loop through systems until finished or need password
while (pendingSystemStatus != null && currentSystemStatus != null && HostSystem.SUCCESS_STATUS.equals(currentSystemStatus.getStatusCd())) {
currentSystemStatus = SSHUtil.openSSHTermOnSystem(passphrase, password, userId, sessionId, pendingSystemStatus, userSchSessionMap);
pendingSystemStatus = SystemStatusDB.getNextPendingSystem(userId);
}
}
}
//set system list if no pending systems
if (SystemStatusDB.getNextPendingSystem(userId) == null) {
setSystemList(userId, sessionId);
//set allocated systems for connect to
SortedSet sortedSet = new SortedSet();
sortedSet.setOrderByField(SystemDB.SORT_BY_NAME);
if (Auth.MANAGER.equals(AuthUtil.getUserType(servletRequest.getSession()))) {
sortedSet = SystemDB.getSystemSet(sortedSet);
} else {
sortedSet = SystemDB.getUserSystemSet(sortedSet, userId);
}
if (sortedSet != null && sortedSet.getItemList() != null) {
allocatedSystemList = (List<HostSystem>) sortedSet.getItemList();
}
//set theme
this.userSettings = UserThemeDB.getTheme(userId);
}
return SUCCESS;
}