Package it.eng.spagobi.mapcatalogue.bo

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


* @param response The response Source Bean
* @throws EMFUserError If an exception occurs
*/  
private void getDetailMap(SourceBean request, SourceBean response) throws EMFUserError {
  try {                      
    GeoMap map = DAOFactory.getSbiGeoMapsDAO().loadMapByID(new Integer((String)request.getAttribute("ID")));   
    getTabDetails(request, response);   
    this.modalita = SpagoBIConstants.DETAIL_MOD;
    if (request.getAttribute("SUBMESSAGEDET") != null &&
      ((String)request.getAttribute("SUBMESSAGEDET")).equalsIgnoreCase(MOD_SAVEBACK))
    {
View Full Code Here


    SessionContainer permSess = sessCont.getPermanentContainer();
    IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    ISbiGeoMapsDAO daoGeoMaps=DAOFactory.getSbiGeoMapsDAO();
    daoGeoMaps.setUserProfile(profile);
   
    GeoMap mapNew = recoverMapDetails(serviceRequest);
   
    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) {
          serviceResponse.setAttribute("mapObj", mapNew);
          serviceResponse.setAttribute("modality", mod);
          return;
        }
      }
    }
   
    if (mod.equalsIgnoreCase(SpagoBIConstants.DETAIL_INS)) {     
      //if a map with the same name not exists on db ok else error
      if (daoGeoMaps.loadMapByName(mapNew.getName()) != null){
        HashMap params = new HashMap();
        params.put(AdmintoolsConstants.PAGE, ListMapsModule.MODULE_PAGE);
        EMFUserError error = new EMFUserError(EMFErrorSeverity.ERROR, 5005, new Vector(), params );
        getErrorHandler().addError(error);
        return;
      }      
      /* The activity INSERT consists in:
       * - insert a map (SBI_GEO_MAPS),
       * - insert of the features (SBI_GEO_FEATURES) through the   method 'loadUpdateMapFeatures'
       * - insert of the relations (SBI_GEO_MAP_FEATURES) through the method 'loadUpdateMapFeatures'
       * (all objects are had taken from the template file)
       */
      //DAOFactory.getSbiGeoMapsDAO().insertMap(mapNew);
      daoGeoMaps.insertMap(mapNew, content);
      loadUpdateMapFeatures(mapNew,profile);
      GeoMap tmpMap = daoGeoMaps.loadMapByName(mapNew.getName());
      mapNew.setMapId(tmpMap.getMapId());
      mapNew.setBinId(tmpMap.getBinId());
      serviceResponse.setAttribute("mapObj", mapNew);
      serviceResponse.setAttribute("modality", SpagoBIConstants.DETAIL_MOD);
     
      getTabDetails(serviceRequest, serviceResponse);
     
View Full Code Here

        GeoMapFeature tmpMapFeature = DAOFactory.getSbiGeoMapFeaturesDAO().loadMapFeatures(new Integer(id), new Integer(featureId));       
        DAOFactory.getSbiGeoMapFeaturesDAO().eraseMapFeatures(tmpMapFeature);
      }
    }
    //delete the map
    GeoMap map = DAOFactory.getSbiGeoMapsDAO().loadMapByID(new Integer(id));
    DAOFactory.getSbiGeoMapsDAO().eraseMap(map);
  }   catch (EMFUserError e){
      HashMap params = new HashMap();     
      params.put(AdmintoolsConstants.PAGE, ListMapsModule.MODULE_PAGE);
      throw new EMFUserError(EMFErrorSeverity.ERROR, 5010, new Vector(), params);
View Full Code Here

    ISbiGeoMapFeaturesDAO dao=DAOFactory.getSbiGeoMapFeaturesDAO();
    dao.setUserProfile(profile);
   
    String mapId = (String) request.getAttribute("MAP_ID");
    String featureId = (String)request.getAttribute("FEATURE_ID")
    GeoMap map = DAOFactory.getSbiGeoMapsDAO().loadMapByID(new Integer(mapId));
    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("mapObj", map);
          response.setAttribute("modality", SpagoBIConstants.DETAIL_MOD);
          return;
        }
      }
    }

    //inserts the relation
    GeoMapFeature mapFeature = dao.loadMapFeatures(new Integer(mapId), new Integer(featureId));
    if (mapFeature == null){
      mapFeature = new  GeoMapFeature();
      mapFeature.setMapId(new Integer(mapId).intValue());
      mapFeature.setFeatureId(new Integer(featureId).intValue());
      mapFeature.setSvgGroup(null);
      mapFeature.setVisibleFlag(null);   
      dao.insertMapFeatures(mapFeature);
    }
    //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);
View Full Code Here

private void newDetailMap(SourceBean response) throws EMFUserError {
 
  try {
   
    GeoMap map = null;
    this.modalita = SpagoBIConstants.DETAIL_INS;
    response.setAttribute("modality", modalita);
    map = new GeoMap();
    map.setMapId(-1);
    map.setDescr("");
    map.setName("");
    map.setFormat("");
    map.setBinId(-1);
    response.setAttribute("mapObj", map);
  } catch (Exception ex) {
    TracerSingleton.log(SpagoBIConstants.NAME_MODULE, TracerSingleton.MAJOR, "Cannot prepare page for the insertion" + ex.getLocalizedMessage());   
    throw new EMFUserError(EMFErrorSeverity.ERROR, 100);
  }
View Full Code Here

 
}


private GeoMap recoverMapDetails (SourceBean serviceRequest) throws EMFUserError, SourceBeanException, IOException  {
  GeoMap map  = new GeoMap();
 
  String idStr = (String)serviceRequest.getAttribute("ID");
  Integer id = new Integer(idStr);
  String description = (String)serviceRequest.getAttribute("DESCR")
  String name = (String)serviceRequest.getAttribute("NAME");
  String format = (String)serviceRequest.getAttribute("FORMAT");
  Integer binId = new Integer((String)serviceRequest.getAttribute("BIN_ID"));
 
  map.setMapId(id.intValue());
  map.setName(name);
  map.setDescr(description);
  map.setFormat(format);
  map.setBinId(binId);
 
  //gets the file eventually uploaded and sets the content variable
  FileItem uploaded = (FileItem) serviceRequest.getAttribute("UPLOADED_FILE");
    String fileName = null;
    if(uploaded!=null) {
View Full Code Here

      super.checkUserPermissionForFunctionality(SpagoBIConstants.MAPCATALOGUE_MANAGEMENT, "User cannot see map catalogue congifuration.");
      if (mapId == null) {
        logger.warn("map identifier in input is null!");
        return null;
      }
      GeoMap geoMap = DAOFactory.getSbiGeoMapsDAO().loadMapByID(mapId);
      if (geoMap == null) {
        logger.warn("Geo Map with identifier [" + mapId + "] not existing.");
        return null;
      }
      toReturn = new SDKObjectsConverter().fromSbiGeoMapToSDKMap(geoMap.toSpagoBiGeoMaps());
    } catch(NotAllowedOperationException e) {
      throw e;
    } catch(Exception e) {
      logger.error("Error while retrieving SDKFeature list", e);
      logger.debug("Returning null");
View Full Code Here

    try {
      super.checkUserPermissionForFunctionality(SpagoBIConstants.MAPCATALOGUE_MANAGEMENT, "User cannot see map catalogues congifuration.");
      List mapList = DAOFactory.getSbiGeoMapsDAO().loadAllMaps();
      toReturn = new SDKMap[mapList.size()];
      for (int i = 0; i < mapList.size(); i++) {
        GeoMap geoMap = (GeoMap) mapList.get(i);
        SDKMap sdkMap = new SDKObjectsConverter().fromSbiGeoMapToSDKMap(geoMap.toSpagoBiGeoMaps());
        toReturn[i] = sdkMap;
      }
    } catch(NotAllowedOperationException e) {
      throw e;
    } catch(Exception e) {
View Full Code Here

    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));
          DAOFactory.getSbiGeoMapFeaturesDAO().eraseMapFeatures(mapFeature);
        }
        //deletes the feature
        DAOFactory.getSbiGeoFeaturesDAO().eraseFeature(feature);
  }   catch (EMFUserError e){
View Full Code Here

        logger.debug("IN");
        logger.debug("mapName = " +mapName);
        Content content = new Content();
        try {
            validateTicket(token,user);
            GeoMap tmpMap =  DAOFactory.getSbiGeoMapsDAO().loadMapByName(mapName);
            if (tmpMap == null) {
              logger.info("Map with name " + mapName + " not found on db.");
              return null;
            }
            byte[] template = DAOFactory.getBinContentDAO().getBinContent(tmpMap.getBinId());
  
            if (template == null)
            {
              logger.info("Template map is empty. Try uploadyng the svg.");
              return null;
View Full Code Here

TOP

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

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.