use of org.geosdi.geoplatform.core.model.GPUser in project geo-platform by geosdi.
the class LayerService method setLayerRefreshTime.
@Override
public void setLayerRefreshTime(String emiteResource, String layerUUID, int secondToRefresh, HttpServletRequest httpServletRequest) throws GeoPlatformException {
try {
GPAccount account = this.sessionUtility.getLoggedAccount(httpServletRequest);
if (account instanceof GPUser) {
String username = ((GPUser) account).getUsername();
if (secondToRefresh > 0) {
logger.debug("Request to subscribe layer refresh for: " + username + " - " + layerUUID);
httpServletRequest.getSession().setMaxInactiveInterval(-1);
this.geoPlatformTrackingClient.subscribeLayerNotification(username, emiteResource, layerUUID, secondToRefresh);
} else if (account instanceof GPUser) {
logger.debug("Request to UNsubscribe layer refresh for: " + username + " - " + layerUUID);
this.geoPlatformTrackingClient.unscribeLayerNotification(username, layerUUID);
}
}
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
}
}
use of org.geosdi.geoplatform.core.model.GPUser in project geo-platform by geosdi.
the class UserService method updateUser.
@Override
public Long updateUser(IGPUserManageDetail userDetail, HttpServletRequest httpServletRequest) throws GeoPlatformException {
this.getCheckLoggedUser(httpServletRequest);
logger.debug("\nUser to UPDATE:\n{}", userDetail);
Long userID = null;
try {
GPUser user = this.dtoUserConverter.convertToGPUser(userDetail);
userID = geoPlatformServiceClient.updateUser(user);
} catch (IllegalParameterFault ipf) {
throw new GeoPlatformException(ipf.getMessage());
} catch (ResourceNotFoundFault rnnf) {
throw new GeoPlatformException(rnnf.getMessage());
}
return userID;
}
use of org.geosdi.geoplatform.core.model.GPUser in project geo-platform by geosdi.
the class UserService method updateUserTreeOptions.
@Override
public Long updateUserTreeOptions(IGPTreeOptions userTreeOptions, HttpServletRequest httpServletRequest) throws GeoPlatformException {
GPUser gPUser = this.getCheckLoggedUser(httpServletRequest);
logger.debug("\nUserTreeOptions to UPDATE:\n{}", userTreeOptions);
Long accountProjectID = null;
try {
gPUser.setLoadExpandedFolders(userTreeOptions.isLoadExpandedFolders());
accountProjectID = geoPlatformServiceClient.updateUser(gPUser);
} catch (IllegalParameterFault ipf) {
throw new GeoPlatformException(ipf.getMessage());
} catch (ResourceNotFoundFault rnnf) {
throw new GeoPlatformException(rnnf.getMessage());
}
return accountProjectID;
}
use of org.geosdi.geoplatform.core.model.GPUser in project geo-platform by geosdi.
the class UserService method insertUser.
@Override
public Long insertUser(IGPUserManageDetail userDetail, String organization, HttpServletRequest httpServletRequest, boolean checkUserSession, boolean sendEmail) throws GeoPlatformException {
if (checkUserSession) {
this.getCheckLoggedUser(httpServletRequest);
}
logger.debug("\nUser to INSERT (of the organization \"{}\"):\n{}", organization, userDetail);
Long iserId = null;
try {
GPUser user = this.dtoUserConverter.convertToGPUser(userDetail);
user.setOrganization(new GPOrganization(organization));
iserId = geoPlatformServiceClient.insertAccount(new InsertAccountRequest(user, sendEmail));
} catch (IllegalParameterFault ipf) {
throw new GeoPlatformException(ipf.getMessage());
}
return iserId;
}
use of org.geosdi.geoplatform.core.model.GPUser in project geo-platform by geosdi.
the class UserService method searchUsers.
@Override
public PagingLoadResult<GPUserManageDetail> searchUsers(PagingLoadConfig config, String searchText, String organization, HttpServletRequest httpServletRequest) {
GPUser user = this.getCheckLoggedUser(httpServletRequest);
SearchRequest srq = new SearchRequest(searchText);
Long usersCount = this.geoPlatformServiceClient.getUsersCount(organization, srq);
int start = config.getOffset();
int page = start == 0 ? start : start / config.getLimit();
PaginatedSearchRequest psr = new PaginatedSearchRequest(searchText, config.getLimit(), page);
List<UserDTO> userList = null;
try {
userList = this.geoPlatformServiceClient.searchUsers(user.getId(), psr).getSearchUsers();
if (userList == null) {
throw new GeoPlatformException("There are no results");
}
} catch (ResourceNotFoundFault rnnf) {
// TODO Better message
throw new GeoPlatformException(rnnf.getMessage());
}
List<GPUserManageDetail> searchUsers = new ArrayList<GPUserManageDetail>();
for (UserDTO userDTO : userList) {
GPUserManageDetail userDetail = this.dtoUserConverter.convertToGPUserManageDetail(userDTO);
searchUsers.add(userDetail);
}
return new BasePagingLoadResult<GPUserManageDetail>(searchUsers, config.getOffset(), usersCount.intValue());
}
Aggregations