use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.
the class SaveDragAndDropCommand method execute.
@Override
public SaveDragAndDropResponse execute(SaveDragAndDropRequest request, HttpServletRequest httpServletRequest) {
logger.debug("##################### Executing {} Command", this.getClass().getSimpleName());
MementoSaveDragDrop memento = request.getMemento();
Preconditions.checkNotNull(memento, "The MementoSaveDragDrop must not " + "be null.");
try {
this.sessionUtility.getLoggedAccount(httpServletRequest);
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
}
GPWebServiceMapData map = this.dtoMementoConverter.convertDescendantMap(memento.getWsDescendantMap());
boolean result = false;
switch(request.getElementType()) {
case COMPOSITE:
try {
result = this.geoPlatformServiceClient.saveDragAndDropFolderAndTreeModifications(new WSDDFolderAndTreeModifications(memento.getIdBaseElement(), memento.getIdNewParent(), memento.getNewZIndex(), map));
} catch (ResourceNotFoundFault ex) {
logger.error("Failed to save Folder drag&drop : " + ex);
throw new GeoPlatformException(ex);
}
break;
case LEAF:
try {
result = this.geoPlatformServiceClient.saveDragAndDropLayerAndTreeModifications(new WSDDLayerAndTreeModificationsRequest(memento.getIdBaseElement(), memento.getIdNewParent(), memento.getNewZIndex(), map));
} catch (ResourceNotFoundFault ex) {
logger.error("Failed to save Layer drag&drop : " + ex);
throw new GeoPlatformException(ex);
} catch (IllegalParameterFault ilg) {
logger.error("Error on SaveDragAndDropCommand: " + ilg);
throw new GeoPlatformException("Parameter incorrect " + "on saveDragAndDropLayerAndTreeModifications");
}
break;
}
return new SaveDragAndDropResponse(result);
}
use of org.geosdi.geoplatform.exception.IllegalParameterFault 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 org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.
the class GPCatalogFinderService method getRecordById.
@Override
public String getRecordById(Long serverID, String identifier, String moduleName, HttpServletRequest httpServletRequest) throws Exception {
try {
String url = httpServletRequest.getSession().getServletContext().getRealPath("/" + moduleName + "/csw-template");
logger.trace("PATH @@@@@@@@@@@@@@@@@@ {}", url);
String response = geoPlatformCSWClient.getRecordById(serverID, identifier);
response = this.deAccent(response);
String fileName = url + "/" + System.currentTimeMillis() + "-" + identifier + ".xml";
File file = new File(fileName);
FileUtils.writeStringToFile(file, response);
logger.debug("Name FILE Created @@@@@@@@@@@@@@@@@@@@@@@@@@@ {}", file.getName());
return file.getName();
} catch (IOException ex) {
logger.error("\n*** IOException ***\n{}", ex.getMessage());
throw new GeoPlatformException(ex.getMessage());
} 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());
}
}
use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.
the class LayerService method updateProject.
@Override
public void updateProject(GPClientProject project, HttpServletRequest httpServletRequest) throws GeoPlatformException {
try {
GPAccount account = this.sessionUtility.getLoggedAccount(httpServletRequest);
AccountProjectPropertiesDTO dto = this.dtoLayerConverter.convertToAccountProjectPropertiesDTO(account.getId(), project);
if (this.geoPlatformServiceClient.saveAccountProjectProperties(dto)) {
this.sessionUtility.storeLoggedAccountAndDefaultProject(account, project.getId(), httpServletRequest);
}
} catch (ResourceNotFoundFault rnf) {
logger.error("Failed to update project on SecurityService: " + rnf);
throw new GeoPlatformException(rnf);
} catch (IllegalParameterFault ilg) {
logger.error("Error on SecurityService: {}", ilg.getMessage());
throw new GeoPlatformException("Parameter incorrect on updateProject");
} catch (GPSessionTimeout timeout) {
logger.error("Session 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 LayerService method saveFolderForUser.
@Override
public Long saveFolderForUser(String folderName, int position, int numberOfDescendants, boolean isChecked, HttpServletRequest httpServletRequest) throws GeoPlatformException {
GPFolder folder = new GPFolder();
folder.setName(folderName);
folder.setPosition(position);
folder.setShared(false);
Long projectId;
try {
projectId = this.sessionUtility.getDefaultProject(httpServletRequest);
this.sessionUtility.getLoggedAccount(httpServletRequest);
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
}
folder.setNumberOfDescendants(numberOfDescendants);
folder.setChecked(isChecked);
Long savedFolderId;
try {
savedFolderId = this.geoPlatformServiceClient.insertFolder(new InsertFolderRequest(projectId, folder));
} catch (IllegalParameterFault ilg) {
logger.error("Error on LayerService: " + ilg);
throw new GeoPlatformException("Parameter incorrect on saveFoldeForUser");
} catch (ResourceNotFoundFault rnff) {
logger.error("Error on LayerService: " + rnff);
throw new GeoPlatformException(rnff);
}
return savedFolderId;
}
Aggregations