use of com.extjs.gxt.ui.client.data.BasePagingLoadResult in project geo-platform by geosdi.
the class LayerService method searchProjects.
@Override
public BasePagingLoadResult<GPClientProject> searchProjects(PagingLoadConfig config, String searchText, String imageURL, HttpServletRequest httpServletRequest) throws GeoPlatformException {
GPAccount account;
try {
account = this.sessionUtility.getLoggedAccount(httpServletRequest);
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
}
int start = config.getOffset();
SearchRequest srq = new SearchRequest(searchText);
try {
Long projectsCount = this.geoPlatformServiceClient.getAccountProjectsCount(account.getId(), srq);
if (projectsCount == 0l) {
throw new GeoPlatformException("There are no results");
}
logger.debug("#############################PROJECT_COUNT : {}\n", projectsCount);
int page = start == 0 ? start : start / config.getLimit();
PaginatedSearchRequest psr = new PaginatedSearchRequest(searchText, config.getLimit(), page);
List<ProjectDTO> projectsDTO = this.geoPlatformServiceClient.searchAccountProjects(account.getId(), psr);
if (projectsDTO == null) {
throw new GeoPlatformException("There are no results");
}
ArrayList<GPClientProject> clientProjects = new ArrayList<GPClientProject>();
for (ProjectDTO projectDTO : projectsDTO) {
GPClientProject clientProject = this.dtoLayerConverter.convertToGPCLientProject(projectDTO, imageURL);
clientProjects.add(clientProject);
}
return new BasePagingLoadResult<GPClientProject>(clientProjects, config.getOffset(), projectsCount.intValue());
} catch (ResourceNotFoundFault ex) {
ex.printStackTrace();
throw new GeoPlatformException(ex.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
throw new GeoPlatformException(ex.getMessage());
}
}
use of com.extjs.gxt.ui.client.data.BasePagingLoadResult in project geo-platform by geosdi.
the class GPCatalogFinderService method searchCSWServers.
@Override
public PagingLoadResult<GPCSWServerBeanModel> searchCSWServers(PagingLoadConfig config, String searchText, String organization, HttpServletRequest httpServletRequest) throws GeoPlatformException {
SearchRequest srq = new SearchRequest(searchText);
int serversCount = geoPlatformCSWClient.getCSWServersCount(srq, organization);
ArrayList<GPCSWServerBeanModel> searchServers;
if (serversCount == 0) {
logger.info("\n*** No catalog found ***");
searchServers = new ArrayList<GPCSWServerBeanModel>(0);
} else {
int start = config.getOffset();
int page = start == 0 ? start : start / config.getLimit();
PaginatedSearchRequest psr = new PaginatedSearchRequest(searchText, config.getLimit(), page);
List<ServerCSWDTO> serverList = geoPlatformCSWClient.searchCSWServers(psr, organization);
searchServers = new ArrayList<GPCSWServerBeanModel>(serverList.size());
for (ServerCSWDTO serverDTO : serverList) {
searchServers.add(this.convertServerDTO(serverDTO));
}
}
return new BasePagingLoadResult<GPCSWServerBeanModel>(searchServers, config.getOffset(), serversCount);
}
use of com.extjs.gxt.ui.client.data.BasePagingLoadResult in project geo-platform by geosdi.
the class GPCatalogFinderService method searchSummaryRecords.
@Override
public PagingLoadResult<SummaryRecord> searchSummaryRecords(PagingLoadConfig config, CatalogFinderBean catalogFinder, HttpServletRequest httpServletRequest) throws Exception {
int recordsCount;
ArrayList<SummaryRecord> searchRecords;
try {
recordsCount = geoPlatformCSWClient.getRecordsCount(catalogFinder);
if (recordsCount == 0) {
logger.info("\n*** No Summary Record found ***");
searchRecords = new ArrayList<SummaryRecord>(0);
} else {
List<SummaryRecordDTO> recordList = geoPlatformCSWClient.searchSummaryRecords(config.getLimit(), config.getOffset() + 1, catalogFinder);
searchRecords = new ArrayList<SummaryRecord>(recordList.size());
for (SummaryRecordDTO recordDTO : recordList) {
searchRecords.add(this.convertSummaryRecordDTO(recordDTO));
}
}
} catch (IllegalParameterFault ex) {
logger.error("\n*** IllegalParameterFault ***\n{}", ex.getMessage());
throw new GeoPlatformException(ex.getMessage());
} catch (ResourceNotFoundFault ex) {
logger.error("\n*** ResourceNotFoundFault ***\n{}", ex.getMessage());
throw new GeoPlatformException(ex.getMessage());
} catch (ServerInternalFault ex) {
logger.error("\n*** ServerInternalFault ***\n{}", ex.getMessage());
throw new GeoPlatformException(ex.getMessage());
}
return new BasePagingLoadResult<SummaryRecord>(searchRecords, config.getOffset(), recordsCount);
}
use of com.extjs.gxt.ui.client.data.BasePagingLoadResult in project geo-platform by geosdi.
the class GPCatalogFinderService method searchFullRecords.
@Override
public PagingLoadResult<FullRecord> searchFullRecords(PagingLoadConfig config, CatalogFinderBean catalogFinder, HttpServletRequest httpServletRequest) throws Exception {
logger.debug("\n--------------------------\n{}\n--------------------------\n", catalogFinder);
int recordsCount;
ArrayList<FullRecord> searchRecords;
try {
recordsCount = geoPlatformCSWClient.getRecordsCount(catalogFinder);
if (recordsCount == 0) {
logger.info("\n*** No Full Record found ***");
searchRecords = new ArrayList<FullRecord>(0);
} else {
List<FullRecordDTO> recordList = geoPlatformCSWClient.searchFullRecords(config.getLimit(), config.getOffset() + 1, catalogFinder);
searchRecords = new ArrayList<FullRecord>(recordList.size());
for (FullRecordDTO recordDTO : recordList) {
searchRecords.add(this.convertFullRecordDTO(recordDTO));
}
}
} catch (IllegalParameterFault ex) {
logger.error("\n*** IllegalParameterFault ***\n{}", ex.getMessage());
throw new GeoPlatformException(ex.getMessage());
} catch (ResourceNotFoundFault ex) {
logger.error("\n*** ResourceNotFoundFault ***\n{}", ex.getMessage());
throw new GeoPlatformException(ex.getMessage());
} catch (ServerInternalFault ex) {
logger.error("\n*** ServerInternalFault ***\n{}", ex.getMessage());
throw new GeoPlatformException(ex.getMessage());
}
return new BasePagingLoadResult<FullRecord>(searchRecords, config.getOffset(), recordsCount);
}
use of com.extjs.gxt.ui.client.data.BasePagingLoadResult 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