Package it.eng.spagobi.mapcatalogue.bo

Examples of it.eng.spagobi.mapcatalogue.bo.GeoFeature


    //create a List of features
    List lstAllFeatures = dao.loadFeatureNamesByMapId(new Integer(map.getMapId()));
    List lstMapFeatures = new ArrayList();

    for (int i=0; i < lstAllFeatures.size(); i ++){     
      GeoFeature aFeature = DAOFactory.getSbiGeoFeaturesDAO().loadFeatureByName((String)lstAllFeatures.get(i));
      lstMapFeatures.add(aFeature);
      //for the first time sets selectedFeatureId with the first feature
      if (i==0)
        featureId = String.valueOf(aFeature.getFeatureId());
   
    }

      response.setAttribute("lstMapFeatures",lstMapFeatures);
      response.setAttribute("selectedFeatureId",featureId)
View Full Code Here


  }
 
  private List loadUpdateMapFeatures(GeoMap mapNew,IEngUserProfile profile) throws EMFUserError, Exception {
    try {
  //    through the content of a map, gets and opens the svg file and inserts a feature for every tag <g>
      GeoFeature feature = null;
      List lstHashFeatures = DAOFactory.getSbiGeoMapsDAO().getFeaturesFromSVG(content)
      List lstFeatures = new ArrayList();
      int mapId;
      int featureId;
      for (int i=0; i < lstHashFeatures.size(); i++){       
        HashMap hFeature = (HashMap)lstHashFeatures.get(i);
        //checks if a feature with the same name yet exists in db
        //NB: the field "id" of hashmap [hFeature] contains the name of the feature)
        feature = DAOFactory.getSbiGeoFeaturesDAO().loadFeatureByName((String)hFeature.get("id"));
        
        if (feature == null || feature.getFeatureId() == 0) {
          feature = new GeoFeature();
          feature.setName((String)hFeature.get("id"));
          feature.setDescr((String)hFeature.get("descr"));
          feature.setType((String)hFeature.get("type"));
          ISbiGeoFeaturesDAO dao=DAOFactory.getSbiGeoFeaturesDAO();
          dao.setUserProfile(profile);
          dao.insertFeature(feature);                  
        }
        lstFeatures.add(feature.getName());
  //      for every map/feature inserts a row in join table (SBI_GEO_MAP_FEATURES)             
        //gets map_id
        mapId = mapNew.getMapId();
        if (mapId == -1 )
          mapId = ((GeoMap)DAOFactory.getSbiGeoMapsDAO().loadMapByName(mapNew.getName())).getMapId();
       
        //gets feature id       
        if (feature.getFeatureId() == 0)
          feature = DAOFactory.getSbiGeoFeaturesDAO().loadFeatureByName((String)hFeature.get("id"));
       
        featureId = feature.getFeatureId();
        //gets relation
        GeoMapFeature mapFeature = DAOFactory.getSbiGeoMapFeaturesDAO().loadMapFeatures(new Integer(mapId), new Integer(featureId));
        if (mapFeature == null){ 
          mapFeature = new GeoMapFeature();
          mapFeature.setMapId(mapId);
View Full Code Here

      List lstAllFeatures = new ArrayList();
      lstAllFeatures = DAOFactory.getSbiGeoMapFeaturesDAO().loadFeatureNamesByMapId(new Integer(mapId));       
   
      List lstMapFeatures = new ArrayList();     
      for (int i=0; i < lstAllFeatures.size(); i ++){
        GeoFeature aFeature = DAOFactory.getSbiGeoFeaturesDAO().loadFeatureByName((String)lstAllFeatures.get(i));
        lstMapFeatures.add(aFeature);
      }
      if ((selectedFeatureId == null || selectedFeatureId.equals("-1")) && lstMapFeatures.size()>0)
        selectedFeatureId = String.valueOf(((GeoFeature)lstMapFeatures.get(0)).getFeatureId());
View Full Code Here

      oldFeatures = oldFeatures.replace("]","");
          String[] lstOldFeatures = oldFeatures.split(",");                    
      if (lstOldFeatures != null){
        String mapId = (String)request.getAttribute("id");
        for (int i=0; i<lstOldFeatures.length; i++){
          GeoFeature aFeature = DAOFactory.getSbiGeoFeaturesDAO().loadFeatureByName(((String)lstOldFeatures[i]).trim());
          GeoMapFeature aMapFeature = (GeoMapFeature)DAOFactory.getSbiGeoMapFeaturesDAO().loadMapFeatures(new Integer(mapId), new Integer(aFeature.getFeatureId()));                
          DAOFactory.getSbiGeoMapFeaturesDAO().eraseMapFeatures(aMapFeature);
        }         
      } 
     
      if (((String)request.getAttribute("SUBMESSAGEDET")).equalsIgnoreCase(MOD_SAVEBACK))
View Full Code Here

    try {
      super.checkUserPermissionForFunctionality(SpagoBIConstants.MAPCATALOGUE_MANAGEMENT, "User cannot see map catalogues congifuration.");
      List featuresList = DAOFactory.getSbiGeoFeaturesDAO().loadAllFeatures();
      toReturn = new SDKFeature[featuresList.size()];
      for (int i = 0; i < featuresList.size(); i++) {
        GeoFeature geoFeature = (GeoFeature) featuresList.get(i);
        SDKFeature sdkFeature = new SDKObjectsConverter().fromSbiGeoFeatureToSDKFeature(geoFeature.toSpagoBiGeoFeatures());
        toReturn[i] = sdkFeature;
      }
    } catch(NotAllowedOperationException e) {
      throw e;
    } catch(Exception e) {
View Full Code Here

      super.checkUserPermissionForFunctionality(SpagoBIConstants.MAPCATALOGUE_MANAGEMENT, "User cannot see map catalogue congifuration.");
      if (featureId == null) {
        logger.warn("Feature identifier in input is null!");
        return null;
      }
      GeoFeature geoFeature = DAOFactory.getSbiGeoFeaturesDAO().loadFeatureByID(featureId);
      if (geoFeature == null) {
        logger.warn("Geo Feature with identifier [" + featureId + "] not existing.");
        return null;
      }
      toReturn = new SDKObjectsConverter().fromSbiGeoFeatureToSDKFeature(geoFeature.toSpagoBiGeoFeatures());
    } catch(NotAllowedOperationException e) {
      throw e;
    } catch(Exception e) {
      logger.error("Error while retrieving SDKFeature list", e);
      logger.debug("Returning null");
View Full Code Here

        return null;
      }
      List featuresList = DAOFactory.getSbiGeoMapFeaturesDAO().loadFeaturesByMapId(mapId);
      toReturn = new SDKFeature[featuresList.size()];
      for (int i = 0; i < featuresList.size(); i++) {
        GeoFeature geoFeature = (GeoFeature) featuresList.get(i);
        SDKFeature sdkFeature = new SDKObjectsConverter().fromSbiGeoFeatureToSDKFeature(geoFeature.toSpagoBiGeoFeatures());
        toReturn[i] = sdkFeature;
      }
    } catch(NotAllowedOperationException e) {
      throw e;
    } catch(Exception e) {
View Full Code Here

*/
private void getDetailFeature(String key, SourceBean response) throws EMFUserError {
  try {
    this.modalita = SpagoBIConstants.DETAIL_MOD;
    response.setAttribute("modality", modalita);
    GeoFeature feature = DAOFactory.getSbiGeoFeaturesDAO().loadFeatureByID(new Integer(key));
    response.setAttribute("featureObj", feature);
  } catch (Exception ex) {
    TracerSingleton.log(SpagoBIConstants.NAME_MODULE, TracerSingleton.MAJOR, "Cannot fill response container" + ex.getLocalizedMessage())
    HashMap params = new HashMap();
    params.put(AdmintoolsConstants.PAGE, ListMapsModule.MODULE_PAGE);
View Full Code Here

    SessionContainer permSess = sessCont.getPermanentContainer();
    IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
   
    ISbiGeoFeaturesDAO dao=DAOFactory.getSbiGeoFeaturesDAO();
    dao.setUserProfile(profile);
    GeoFeature feature = recoverFeatureDetails(request);
    if (feature.getName() == null) {
      response.setAttribute("mapObj", feature);
      response.setAttribute("modality", mod);
      return;
    }

    EMFErrorHandler errorHandler = getErrorHandler();
   
    // if there are some validation errors into the errorHandler does not write into DB
    Collection errors = errorHandler.getErrors();
    if (errors != null && errors.size() > 0) {
      Iterator iterator = errors.iterator();
      while (iterator.hasNext()) {
        Object error = iterator.next();
        if (error instanceof EMFValidationError) {
          response.setAttribute("featureObj", feature);
          response.setAttribute("modality", mod);
          return;
        }
      }
    }
   
    if (mod.equalsIgnoreCase(SpagoBIConstants.DETAIL_INS)) {
      //if a feature with the same name yet exists on db: error
      if (dao.loadFeatureByName(feature.getName()) != null){
        HashMap params = new HashMap();
        params.put(AdmintoolsConstants.PAGE, ListFeaturesModule.MODULE_PAGE);
        EMFUserError error = new EMFUserError(EMFErrorSeverity.ERROR, 5018, new Vector(), params );
        getErrorHandler().addError(error);
        return;
View Full Code Here

private void delDetailFeature(SourceBean request, String mod, SourceBean response)
  throws EMFUserError, SourceBeanException {
 
  try {
    String id = (String) request.getAttribute("ID");
        GeoFeature feature = DAOFactory.getSbiGeoFeaturesDAO().loadFeatureByID(new Integer(id));
        List lstMapFeature =DAOFactory.getSbiGeoMapFeaturesDAO().loadMapsByFeatureId(new Integer(id));
        //deletes relations between feature and maps
        for (int i=0; i < lstMapFeature.size(); i++){
          GeoMap map = (GeoMap)lstMapFeature.get(i);
          GeoMapFeature mapFeature = DAOFactory.getSbiGeoMapFeaturesDAO().loadMapFeatures(new Integer(map.getMapId()), new Integer(id));
View Full Code Here

TOP

Related Classes of it.eng.spagobi.mapcatalogue.bo.GeoFeature

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.