use of org.geosdi.geoplatform.exception.IllegalParameterFault 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 org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.
the class UserService method updateOwnUser.
@Override
public Long updateOwnUser(IGPUserManageDetail userDetail, String currentPlainPassword, String newPlainPassword, HttpServletRequest httpServletRequest) throws GeoPlatformException {
this.getCheckLoggedUser(httpServletRequest);
logger.debug("\nOWN User to update:\n{}", userDetail);
Long userID = null;
try {
UserDTO userDTO = new UserDTO();
userDTO.setId(userDetail.getId());
userDTO.setName(userDetail.getName());
userDTO.setEmailAddress(userDetail.getEmail());
userID = geoPlatformServiceClient.updateOwnUser(userDTO, currentPlainPassword, newPlainPassword);
sessionUtility.storeLoggedAccount(this.dtoUserConverter.convertToGPUser(userDetail), httpServletRequest);
} catch (IllegalParameterFault ipf) {
throw new GeoPlatformException(ipf.getMessage());
} catch (ResourceNotFoundFault rnnf) {
throw new GeoPlatformException(rnnf.getMessage());
}
return userID;
}
use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.
the class MapService method saveBaseLayer.
// @Override
// public String layerAuthenticate(String userName, String password, String url) throws GeoPlatformException {
// HTTPUtils hTTPUtils = new HTTPUtils(userName, password);
// String responce = null;
// try {
// logger.info("Layer: " + url);
// responce = hTTPUtils.get("http://localhost:8989/geoserver");
// logger.info("Auth Responce: " + responce);
// } catch (MalformedURLException mfe) {
// System.out.println("Url tazzo: " + mfe);
// }
// return responce;
// }
@Override
public void saveBaseLayer(String baseLayer, HttpServletRequest httpServletRequest) throws GeoPlatformException {
GPAccount account;
Long projectID;
try {
account = this.sessionUtility.getLoggedAccount(httpServletRequest);
projectID = this.sessionUtility.getDefaultProject(httpServletRequest);
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
}
try {
GPAccountProject accountProject = this.geoPlatformServiceClient.getAccountProjectByAccountAndProjectIDs(account.getId(), projectID);
accountProject.setBaseLayer(baseLayer);
this.geoPlatformServiceClient.updateAccountProject(accountProject);
} catch (ResourceNotFoundFault rnff) {
logger.error("Error on MapService: " + rnff);
throw new GeoPlatformException(rnff);
} catch (IllegalParameterFault ipf) {
logger.error("Error on MapService: " + ipf);
throw new GeoPlatformException(ipf);
}
}
use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.
the class SaveAddedFolderAndTreeModificationsCommand method execute.
@Override
public SaveAddedFolderAndTreeModificationsResponse execute(SaveAddedFolderAndTreeModificationsRequest request, HttpServletRequest httpServletRequest) {
logger.debug("##################### Executing {} Command", this.getClass().getSimpleName());
MementoSaveAddedFolder memento = request.getMemento();
checkNotNull(memento, "MementoSaveAddedFolder must not be null.");
try {
this.sessionUtility.getLoggedAccount(httpServletRequest);
GPFolder gpFolder = this.dtoLayerConverter.convertMementoFolder(memento.getAddedFolder());
GPWebServiceMapData map = this.dtoMementoConverter.convertDescendantMap(memento.getWsDescendantMap());
Long projectId = this.sessionUtility.getDefaultProject(httpServletRequest);
Long idSavedFolder = this.geoPlatformServiceClient.saveAddedFolderAndTreeModifications(new WSAddFolderAndTreeModificationsRequest(projectId, memento.getAddedFolder().getIdParent(), gpFolder, map));
logger.debug("\n\n@@@@@@@@@@@@@@@@SaveAddedFolderAndTreeModificationsCommand");
return new SaveAddedFolderAndTreeModificationsResponse(idSavedFolder);
} catch (ResourceNotFoundFault ex) {
logger.error("Failed to save folder on LayerService: " + ex);
throw new GeoPlatformException(ex);
} catch (IllegalParameterFault ilg) {
logger.error("Error on LayerService: " + ilg);
throw new GeoPlatformException("Parameter incorrect on saveAddedFolderAndTreeModifications");
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
} catch (Exception ex) {
ex.printStackTrace();
throw new GeoPlatformException(ex.getMessage());
}
}
use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.
the class SecurityService method createNewCASUser.
private IGPAccountDetail createNewCASUser(String casUserName, HttpServletRequest httpServletRequest) {
IGPUserManageDetail newCASAccount = this.fillNewCASAccount(casUserName);
logger.info("A new user from CAS login will be created with username: " + casUserName);
userService.insertUser(newCASAccount, this.casOrganization, httpServletRequest, Boolean.FALSE, Boolean.TRUE);
StringTokenizer tokenizer = new StringTokenizer(this.casAdminEmails, ";");
List<String> emailList = Lists.<String>newArrayListWithExpectedSize(tokenizer.countTokens());
while (tokenizer.hasMoreElements()) {
emailList.add(tokenizer.nextToken());
}
try {
geoPlatformServiceClient.sendCASNewUserNotification(emailList, casUserName);
} catch (IllegalParameterFault ex) {
logger.error("SecurityService", "Unable to send email to: " + this.casAdminEmails + " after new cas user creation. Error: " + ex);
}
return this.casLogin(httpServletRequest);
}
Aggregations