Package it.eng.spagobi.mapcatalogue.dao

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


   
    RequestContainer reqCont = getRequestContainer();
    SessionContainer sessCont = reqCont.getSessionContainer();
    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);
     
      if (((String)serviceRequest.getAttribute("SUBMESSAGEDET")).equalsIgnoreCase(MOD_SAVEBACK))
      {
        serviceResponse.setAttribute("loopback", "true");
        return;
      }
     
      return;

    } else {
      /* The activity UPDATE consists in:
       * - update of a map (SBI_GEO_MAPS),
       * - update of the relations (SBI_GEO_MAP_FEATURES) through the method 'loadUpdateMapFeatures', eventually if
       *   there are new features those will be inserted.
       * (all objects had taken from the template file)
       */
      //if content is null is because the user has modified the detail of map but not the content file (not upload)
      if (content == null){
        content = DAOFactory.getBinContentDAO().getBinContent(new Integer(mapNew.getBinId()));
      }
      List lstOldFeatures = DAOFactory.getSbiGeoMapFeaturesDAO().loadFeaturesByMapId(new Integer(mapNew.getMapId()));
      //update map
      daoGeoMaps.modifyMap(mapNew, content);     
      //update features
      List lstNewFeatures = loadUpdateMapFeatures(mapNew,profile);
      logger.debug("Loaded " +lstNewFeatures.size()+ " features form svg file." );
       // If in the new file svg there aren't more some feature, the user can choose if erase theme relations or not.
      List lstFeaturesDel = new ArrayList();
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++) {
View Full Code Here

     */
    private String getMapUrl(String mapName) {
   logger.debug("IN");
  String toReturn = null;
  try {
      ISbiGeoMapsDAO mapDAO = DAOFactory.getSbiGeoMapsDAO();
      GeoMap tmpMap = mapDAO.loadMapByName(mapName);
      if (tmpMap == null)
    return null;
      toReturn = ((tmpMap.getUrl()== null)?"":tmpMap.getUrl()).replace('\\', '/');
      logger.debug("MapUrl:"+toReturn);
      return toReturn;
View Full Code Here

    private String getAllMapNames() {
  logger.debug("IN");
  String toReturn = null;
  try {
      ISbiGeoMapsDAO mapDAO = DAOFactory.getSbiGeoMapsDAO();
      List lstMaps = mapDAO.loadAllMaps();
      if (lstMaps == null)
    return null;
      if (lstMaps != null) {
    for (int i = 0; i < lstMaps.size(); i++) {
        toReturn = ((toReturn == null) ? "" : toReturn) + ((GeoMap) lstMaps.get(i)).getName()
View Full Code Here

   */
  private void insertMaps(Session session) throws EMFUserError {
    logger.debug("IN");
    try {
      Transaction tx = session.beginTransaction();
      ISbiGeoMapsDAO mapsDAO = DAOFactory.getSbiGeoMapsDAO();
      List allMaps = mapsDAO.loadAllMaps();
      Iterator mapsIt = allMaps.iterator();
      while (mapsIt.hasNext()) {
        GeoMap map = (GeoMap) mapsIt.next();
        SbiGeoMaps hibMap = new SbiGeoMaps(map.getMapId());
        hibMap.setDescr(map.getDescr());
View Full Code Here

   */
  private void insertMapFeaturesAssociations(Session session) throws EMFUserError {
    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()));
View Full Code Here

TOP

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

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.