Package it.eng.spagobi.mapcatalogue.dao

Examples of it.eng.spagobi.mapcatalogue.dao.ISbiGeoMapFeaturesDAO


    RequestContainer reqCont = getRequestContainer();
    SessionContainer sessCont = reqCont.getSessionContainer();
    SessionContainer permSess = sessCont.getPermanentContainer();
    IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

    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


          mapFeature = new GeoMapFeature();
          mapFeature.setMapId(mapId);
          mapFeature.setFeatureId(featureId);
          mapFeature.setSvgGroup(null);
          mapFeature.setVisibleFlag(null);
          ISbiGeoMapFeaturesDAO dao=DAOFactory.getSbiGeoMapFeaturesDAO();
          dao.setUserProfile(profile);
          dao.insertMapFeatures(mapFeature);     
        }
      }//for
      return lstFeatures;
    } catch(EMFUserError eu){
      throw new EMFUserError(eu);
View Full Code Here

    private String getMapsByFeature(String featureName) {
  logger.debug("IN");
  String toReturn = null;
  try {
      ISbiGeoMapFeaturesDAO mapFeaturesDAO = DAOFactory.getSbiGeoMapFeaturesDAO();
      ISbiGeoFeaturesDAO featureDAO = DAOFactory.getSbiGeoFeaturesDAO();
      GeoFeature tmpFeature = featureDAO.loadFeatureByName(featureName);
      if (tmpFeature == null)
    return null;
      List lstMaps = mapFeaturesDAO.loadMapNamesByFeatureId(new Integer(tmpFeature.getFeatureId()));
      if (lstMaps != null) {
    for (int i = 0; i < lstMaps.size(); i++) {
        toReturn = ((toReturn == null) ? "" : toReturn) + (String) lstMaps.get(i)
          + ((i == lstMaps.size() - 1) ? "" : ",");
    }
View Full Code Here

    private String getFeaturesInMap(String mapName) {
  logger.debug("IN");
  String toReturn = null;
  try {
      ISbiGeoMapFeaturesDAO mapFeaturesDAO = DAOFactory.getSbiGeoMapFeaturesDAO();
      ISbiGeoMapsDAO mapDAO = DAOFactory.getSbiGeoMapsDAO();
      GeoMap tmpMap = mapDAO.loadMapByName(mapName);
      if (tmpMap == null)
    return null;
      List lstFeatures = mapFeaturesDAO.loadFeatureNamesByMapId(new Integer(tmpMap.getMapId()));
      if (lstFeatures != null) {
    for (int i = 0; i < lstFeatures.size(); i++) {
        toReturn = ((toReturn == null) ? "" : toReturn) + (String) lstFeatures.get(i)
          + ((i == lstFeatures.size() - 1) ? "" : ",");
    }
View Full Code Here

    logger.debug("IN");
    try {
      Transaction tx = session.beginTransaction();
      ISbiGeoMapsDAO mapsDAO = DAOFactory.getSbiGeoMapsDAO();
      List allMaps = mapsDAO.loadAllMaps();
      ISbiGeoMapFeaturesDAO mapFeaturesDAO = DAOFactory.getSbiGeoMapFeaturesDAO();
      Iterator mapsIt = allMaps.iterator();
      while (mapsIt.hasNext()) {
        GeoMap map = (GeoMap) mapsIt.next();
        List mapFeatures = mapFeaturesDAO.loadFeaturesByMapId(new Integer(map.getMapId()));
        Iterator mapFeaturesIt = mapFeatures.iterator();
        while (mapFeaturesIt.hasNext()) {
          GeoFeature feature = (GeoFeature) mapFeaturesIt.next();
          GeoMapFeature mapFeature = mapFeaturesDAO.loadMapFeatures(new Integer(map.getMapId()), new Integer(feature.getFeatureId()));
          SbiGeoMapFeatures hibMapFeature = new SbiGeoMapFeatures()
          SbiGeoMapFeaturesId hibMapFeatureId = new SbiGeoMapFeaturesId();     
          hibMapFeatureId.setMapId(mapFeature.getMapId());
          hibMapFeatureId.setFeatureId(mapFeature.getFeatureId());
          hibMapFeature.setId(hibMapFeatureId);
View Full Code Here

TOP

Related Classes of it.eng.spagobi.mapcatalogue.dao.ISbiGeoMapFeaturesDAO

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.