Package org.encuestame.persistence.domain

Examples of org.encuestame.persistence.domain.GeoPoint


                       final String locDescription,
                       final String locTypeName,
                       final Integer Level,
                       final Account secUsers,
                       final GeoPointFolder geoPointFolder){
        final GeoPoint location = new GeoPoint();
        location.setLocationStatus(Status.ACTIVE);
        location.setLocationDescription(locDescription);
        location.setLocationLatitude(2F);
        location.setAccount(secUsers);
        location.setGeoPointFolder(geoPointFolder);
        location.setLocationLongitude(3F);
        location.setTidtype(createGeoPointType(locTypeName));
        getGeoPointDao().saveOrUpdate(location);
      return location;
    }
View Full Code Here


     * @param username username
     * @throws EnMeNoResultsFoundException
     * @throws EnMeExpcetion EnMeExpcetion
     */
    public void updateGeoPoint(final UnitLocationBean locationBean) throws EnMeNoResultsFoundException, EnMeExpcetion{
       final GeoPoint geoPoint =  getLocation(locationBean.getId(), getUserPrincipalUsername());
        if (geoPoint!=null){
            geoPoint.setLocationStatus(Status.valueOf(locationBean.getStatus()));
            geoPoint.setLocationDescription(locationBean.getName());
            geoPoint.setLocationLatitude(locationBean.getLat());
            geoPoint.setLocationLongitude(locationBean.getLng());
            getGeoPointDao().saveOrUpdate(geoPoint);
        }else{
            throw new EnMeExpcetion("geoPoint not found");
        }
   }
View Full Code Here

     * @throws EnMeExpcetion exception
     */
    public UnitLocationBean createGeoPoint(final UnitLocationBean location) throws EnMeExpcetion{
        if (location != null){
            try{
                final GeoPoint geoPointDomain = new GeoPoint();
                geoPointDomain.setLocationDescription(location.getName());
                geoPointDomain.setLocationStatus(Status.ACTIVE);
                geoPointDomain.setLocationLatitude(location.getLat());
                geoPointDomain.setAccount(getUserAccount(getUserPrincipalUsername()).getAccount());
                geoPointDomain.setLocationLongitude(location.getLng());
                if(location.getTidtype() != null){
                    geoPointDomain.setTidtype(getGeoPointTypeDao().getLocationById(location.getTidtype()));
                }
                getGeoPointDao().saveOrUpdate(geoPointDomain);
                location.setId(geoPointDomain.getLocateId());
                createNotification(NotificationEnum.LOCATION_NEW, location.getName() +" is created.", geoPointDomain.getAccount());
            } catch (Exception e) {
                throw new EnMeExpcetion(e);
            }
            return location;
        } else {
View Full Code Here

     * @param username
     * @throws EnMeExpcetion
     * @throws EnMeNoResultsFoundException
     */
    public void updateLocationMap(final UnitLocationBean locationBean, final Long locationId, final String username) throws EnMeExpcetion, EnMeNoResultsFoundException{
        final GeoPoint location = getLocation(locationId, username);
        log.info("location map location "+location);
        if(location == null){
            throw new EnMeExpcetion("location not found");
        }
        else{
            location.setLocationAccuracy(locationBean.getAccuracy());
            location.setLocationLatitude(locationBean.getLat());
            location.setLocationAddress(locationBean.getAddress());
            location.setLocationCountryCode(locationBean.getCountryCode());
            location.setLocationCountryName(locationBean.getCountryName());
            location.setLocationLongitude(locationBean.getLng());
            getGeoPointDao().saveOrUpdate(location);
            createNotification(NotificationEnum.LOCATION_GMAP_UPDATED, "Updated to "+ locationBean.getAddress(), location.getAccount());
            log.info("location map updated");
        }
    }
View Full Code Here

     * @param username username logged
     * @throws EnMeExpcetion exception
     * @throws EnMeNoResultsFoundException
     */
    public void updateLocationName(final UnitLocationBean locationBean, final String username) throws EnMeNoResultsFoundException{
        final GeoPoint location = getLocation(locationBean.getId(), username);
        if(location == null){
            throw new EnMeNoResultsFoundException("location not found");
        }
        else{
            final String lastName = location.getLocationDescription();
            location.setLocationDescription(locationBean.getName());
            getGeoPointDao().saveOrUpdate(location);
            log.info("location name updated");
            createNotification(NotificationEnum.LOCATION_GMAP_CHANGED_NAME,
                               lastName+" is update to "+locationBean.getName(), location.getAccount());
        }
    }
View Full Code Here

        log.info("createDefaultILocationItem locationFolder "+locationFolder);
        if (locationFolder == null) {
            throw new EnMeNoResultsFoundException("location folder not found");
        }
        else {
            final GeoPoint geopoint = new GeoPoint();
            geopoint.setGeoPointFolder(locationFolder);
            geopoint.setAccount(getUserAccount(username).getAccount());
            geopoint.setLocationStatus(Status.ACTIVE);
            geopoint.setLocationDescription("Default Item Name");
            getGeoPointDao().saveOrUpdate(geopoint);
            log.info("Default Location Item Created");
        }
    }
View Full Code Here

     * Delete Location Item.
     * @param unitLocationBean
     * @param username
     */
    public void deleteLocationItem(final UnitLocationBean unitLocationBean, final String username) throws EnMeNoResultsFoundException{
        final GeoPoint location = getLocation(unitLocationBean.getId(), username);
        if(location == null){
            throw new EnMeNoResultsFoundException("location not found");
        }
        else{
           //TODO: Maybe we have conflict in the future if this location was used on other tables, delete on cascade
View Full Code Here

     *
     * @throws EnMeExpcetion
     */
    @Test
    public void testupdateGeoPoint() throws EnMeExpcetion{
        final GeoPoint locationBean = createGeoPoint("test", "test", 0, getSpringSecurityLoggedUserAccount().getAccount());
        final UnitLocationBean bean = ConvertDomainBean.convertLocationToBean(locationBean);
        bean.setName("test2");
        this.locationService.updateGeoPoint(bean);
        Assert.assertEquals(locationBean.getLocationDescription(), new String("test2"));
    }
View Full Code Here

    /**
     * getLocationById.
     */
    @Test
    public void testGetLocationById(){
        final GeoPoint geoPoint = getGeoPointDao().getLocationById(this.defaultLocation.getLocateId(),
                                        this.userPrimary.getUid());
        assertNotNull(geoPoint);
        assertEquals("Should be equals", this.defaultLocation.getLocateId() , geoPoint.getLocateId());
    }
View Full Code Here

    /**
     * Test LocationByTypeLocationId..
     **/
    @Test
    public void getLocationByTypeLocationId(){
        final GeoPoint catLoc = createGeoPoint("Managua","Departamento",1, this.userPrimary);
        final List<GeoPoint> retrieveLocations = getGeoPointDao().getLocationByTypeLocationId(catLoc.getTidtype().getLocationTypeId());
        assertEquals("Should be equals ",1 , retrieveLocations.size());
    }
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.GeoPoint

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.