示例#1
0
 @Override
 public GPClientProject loadDefaultProject(HttpServletRequest httpServletRequest)
     throws GeoPlatformException {
   ProjectDTO projectDTO = null;
   try {
     GPAccount account = this.sessionUtility.getLoggedAccount(httpServletRequest);
     projectDTO = this.geoPlatformServiceClient.getDefaultProjectDTO(account.getId());
   } catch (GPSessionTimeout timeout) {
     throw new GeoPlatformException(timeout);
   } catch (ResourceNotFoundFault ex) {
     logger.error("An Error Occured : " + ex.getMessage());
     throw new GeoPlatformException(ex.getMessage());
   }
   return this.dtoLayerConverter.convertToGPClientProject(projectDTO);
 }
示例#2
0
 @Override
 public void setDefaultProject(Long projectID, HttpServletRequest httpServletRequest)
     throws GeoPlatformException {
   try {
     GPAccount account = this.sessionUtility.getLoggedAccount(httpServletRequest);
     GPProject updatedProjecd =
         this.geoPlatformServiceClient.updateDefaultProject(account.getId(), projectID);
     this.sessionUtility.storeLoggedAccountAndDefaultProject(
         account, updatedProjecd.getId(), httpServletRequest);
   } catch (GPSessionTimeout timeout) {
     throw new GeoPlatformException(timeout);
   } catch (ResourceNotFoundFault ex) {
     logger.error("An Error Occured : " + ex.getMessage());
     throw new GeoPlatformException(ex);
   }
 }
示例#3
0
  @Override
  public BasePagingLoadResult<GPClientProject> searchProjects(
      PagingLoadConfig config,
      String searchText,
      String imageURL,
      HttpServletRequest httpServletRequest)
      throws GeoPlatformException {
    GPAccount account = null;
    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);

      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) {
      logger.error("An Error Occured : " + ex.getMessage());
      throw new GeoPlatformException(ex.getMessage());
    }
  }
示例#4
0
 @Override
 public List<GPLayerAttributes> describeFeatureType(String layerName) throws GeoPlatformException {
   List<GPLayerAttributes> attributeList = Lists.<GPLayerAttributes>newArrayList();
   try {
     List<LayerAttribute> result =
         this.geoPlatformPublishClient.describeFeatureType(layerName).getLayerAttributes();
     for (LayerAttribute layerAttribute : result) {
       GPLayerAttributes gpLayerAttributes = new GPLayerAttributes();
       gpLayerAttributes.setAttributeType(layerAttribute.getType());
       gpLayerAttributes.setAttributeValue(layerAttribute.getValue());
       attributeList.add(gpLayerAttributes);
     }
   } catch (ResourceNotFoundFault rnff) {
     throw new GeoPlatformException(rnff.getMessage());
   }
   return attributeList;
 }
示例#5
0
 @Override
 public boolean saveLayerProperties(
     MementoLayerOriginalProperties memento, HttpServletRequest httpServletRequest)
     throws GeoPlatformException {
   boolean result = false;
   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;
 }