use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.
the class SaveFolderPropertiesCommand method execute.
@Override
public SaveFolderPropertiesResponse execute(SaveFolderPropertiesRequest request, HttpServletRequest httpServletRequest) {
logger.info("##################### Executing {} Command", this.getClass().getSimpleName());
try {
this.sessionUtility.getLoggedAccount(httpServletRequest);
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
}
try {
MementoFolderOriginalProperties memento = request.getMementoFolderOriginalProperties();
geoPlatformServiceClient.saveFolderProperties(memento.getIdBaseElement(), memento.getName(), memento.isChecked(), memento.isExpanded());
} catch (ResourceNotFoundFault ex) {
SaveFolderPropertiesCommand.logger.error("Failed to save folder on LayerService: " + ex);
throw new GeoPlatformException(ex);
} catch (IllegalParameterFault ex) {
SaveFolderPropertiesCommand.logger.error("Failed to save folder on LayerService: " + ex);
throw new GeoPlatformException(ex);
}
logger.debug("#################### After sending project notification");
return new SaveFolderPropertiesResponse(Boolean.TRUE);
}
use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.
the class LayerService method shareProjectToUsers.
@Override
public boolean shareProjectToUsers(long idSharedProject, List<Long> accountIDsProject, HttpServletRequest httpServletRequest) throws GeoPlatformException {
boolean result;
try {
GPAccount account = this.sessionUtility.getLoggedAccount(httpServletRequest);
result = this.geoPlatformServiceClient.updateAccountsProjectSharing(new PutAccountsProjectRequest(idSharedProject, accountIDsProject));
if (result) {
MessageDTO message = new MessageDTO();
message.setCommands(Lists.newArrayList(GPMessageCommandType.OPEN_PROJECT));
message.setCommandsProperties("" + idSharedProject);
message.setCreationDate(new Date());
message.setSenderID(account.getId());
message.setSubject("Project Shared");
String sharerName;
if (account instanceof GPUser) {
GPUser user = (GPUser) account;
sharerName = user.getName();
} else {
sharerName = account.getNaturalID();
}
GPProject project = this.geoPlatformServiceClient.getProjectDetail(idSharedProject);
message.setText(sharerName + " shared with you the " + project.getName() + " project. Do you want to open it?");
message.setRecipientIDs(accountIDsProject);
this.geoPlatformServiceClient.insertMultiMessage(message);
}
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
} catch (ResourceNotFoundFault | IllegalParameterFault rnf) {
logger.error("Failed to save Shared project to Accounts for Shared Project with id: " + idSharedProject + "on SecurityService: " + rnf);
throw new GeoPlatformException(rnf);
}
return result;
}
use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.
the class LayerService method saveFolder.
@Override
public Long saveFolder(Long idParentFolder, String folderName, int position, int numberOfDescendants, boolean isChecked, HttpServletRequest httpServletRequest) throws GeoPlatformException {
try {
this.sessionUtility.getLoggedAccount(httpServletRequest);
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
}
GPFolder gpFolder = null;
try {
gpFolder = geoPlatformServiceClient.getFolderDetail(idParentFolder);
} catch (Exception e) {
logger.error("LayerService", "Ubable to load Folder with ID : " + idParentFolder);
throw new GeoPlatformException("The Folder with ID : " + idParentFolder + " was deleted.");
}
GPFolder folder = new GPFolder();
folder.setName(folderName);
folder.setPosition(position);
folder.setShared(false);
folder.setParent(gpFolder);
folder.setNumberOfDescendants(numberOfDescendants);
folder.setChecked(isChecked);
Long projectId;
// folder.setProject(project);
Long savedFolderId = null;
try {
projectId = this.sessionUtility.getDefaultProject(httpServletRequest);
savedFolderId = this.geoPlatformServiceClient.insertFolder(new InsertFolderRequest(projectId, folder));
} catch (IllegalParameterFault ilg) {
logger.error("Error on LayerService: " + ilg);
throw new GeoPlatformException("Parameter incorrect on saveFolde");
} catch (ResourceNotFoundFault rnff) {
logger.error("Error on LayerService: " + rnff);
throw new GeoPlatformException(rnff);
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
}
return savedFolderId;
}
use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.
the class LayerService method saveLayerProperties.
@Override
public boolean saveLayerProperties(MementoLayerOriginalProperties memento, HttpServletRequest httpServletRequest) throws GeoPlatformException {
boolean result;
try {
this.sessionUtility.getLoggedAccount(httpServletRequest);
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
}
RasterPropertiesDTO dto = this.dtoMementoConverter.convertMementoProperties(memento);
try {
result = geoPlatformServiceClient.saveLayerProperties(dto);
} catch (ResourceNotFoundFault ex) {
this.logger.error("Failed to save layers on LayerService: {}", ex.getMessage());
throw new GeoPlatformException(ex);
} catch (IllegalParameterFault ex) {
this.logger.error("Failed to save layers on LayerService: {}", ex.getMessage());
throw new GeoPlatformException(ex);
}
return result;
}
use of org.geosdi.geoplatform.exception.IllegalParameterFault in project geo-platform by geosdi.
the class LayerService method saveAddedFolderAndTreeModifications.
@Override
public Long saveAddedFolderAndTreeModifications(MementoSaveAddedFolder memento, HttpServletRequest httpServletRequest) throws GeoPlatformException {
try {
this.sessionUtility.getLoggedAccount(httpServletRequest);
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
}
GPWebServiceMapData map = this.dtoMementoConverter.convertDescendantMap(memento.getWsDescendantMap());
Long idSavedFolder;
try {
Long projectId = this.sessionUtility.getDefaultProject(httpServletRequest);
GPFolder gpFolder = this.dtoLayerConverter.convertMementoFolder(memento.getAddedFolder());
idSavedFolder = this.geoPlatformServiceClient.saveAddedFolderAndTreeModifications(new WSAddFolderAndTreeModificationsRequest(projectId, memento.getAddedFolder().getIdParent(), gpFolder, map));
} catch (ResourceNotFoundFault ex) {
this.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) {
throw new GeoPlatformException(ex.getMessage());
}
return idSavedFolder;
}
Aggregations