Package org.encuestame.persistence.domain

Examples of org.encuestame.persistence.domain.GeoPointFolder


            final GeoPointFolderType type,
            final Account secUsers,
            final String folderName,
            final GeoPointFolder locationFolder){
        final UserAccount userAcc = createUserAccount("Juan", secUsers);
        final GeoPointFolder geoPointFolder = new GeoPointFolder();
        geoPointFolder.setFolderType(type);
        geoPointFolder.setFolderName(folderName);
        geoPointFolder.setUsers(secUsers);
        geoPointFolder.setSubLocationFolder(locationFolder);
        geoPointFolder.setCreatedAt(Calendar.getInstance().getTime());
        geoPointFolder.setCreatedBy(userAcc);
        getGeoPointDao().saveOrUpdate(geoPointFolder);
        return geoPointFolder;
    }
View Full Code Here


     * @param locationFolder {@link UnitLocationFolder}
     * @return {@link UnitLocationFolder}.
     * @throws EnMeNoResultsFoundException
     */
    public UnitLocationFolder createGeoPointFolder(final UnitLocationFolder locationFolder) throws EnMeNoResultsFoundException{
        final GeoPointFolder geoPointFolder = new GeoPointFolder();
        geoPointFolder.setFolderType(GeoPointFolderType.valueOf(locationFolder.getType()));
        geoPointFolder.setFolderName(locationFolder.getName());
        geoPointFolder.setUsers(getUserAccount(getUserPrincipalUsername()).getAccount());
        getGeoPointDao().saveOrUpdate(geoPointFolder);
        locationFolder.setId(geoPointFolder.getLocationFolderId());
        createNotification(NotificationEnum.LOCATION_FOLDER_NEW, "New Folder "+locationFolder.getName() +" is created.", geoPointFolder.getUsers());
        return locationFolder;
    }
View Full Code Here

     * @throws EnMeNoResultsFoundException
     */
    public void updateLocationFolder(final UnitLocationFolder locationFolderBean,
            final String username, final String typeUpdate)
            throws EnMeNoResultsFoundException {
        final GeoPointFolder locationFolder = getLocationFolder(locationFolderBean
                .getId(), username);
        if (locationFolder == null) {
            throw new EnMeNoResultsFoundException("location folder not found");
        }
        else {
            if (typeUpdate.equals("name")) {
                log.debug("updating folder name");
                locationFolder.setFolderName(locationFolderBean.getName());
            }
            getGeoPointDao().saveOrUpdate(locationFolder);
            createNotification(NotificationEnum.LOCATION_GMAP_CHANGED_NAME, "Folder name change to "
                                + locationFolderBean.getName(), locationFolder.getUsers());
        }
    }
View Full Code Here

     * @throws EnMeExpcetion
     */
    public void createDefaultILocationItem(final UnitLocationFolder locationFolderBean, final String username)
           throws EnMeNoResultsFoundException{
        log.info("createDefaultILocationItem");
        final GeoPointFolder locationFolder = getLocationFolder(locationFolderBean
                .getId(), username);
        log.info("createDefaultILocationItem locationFolder "+locationFolder);
        if (locationFolder == null) {
            throw new EnMeNoResultsFoundException("location folder not found");
        }
View Full Code Here

     * @param unitLocationFolder
     * @param username
     * @throws EnMeExpcetion
     */
    public void deleteLocationFolder(final UnitLocationFolder unitLocationFolder, final String username) throws EnMeNoResultsFoundException{
        final GeoPointFolder locationFolder = getLocationFolder(unitLocationFolder.getId(), username);
        log.info("deleteLocationFolder locationFolder "+locationFolder);
        if (locationFolder == null) {
            throw new EnMeNoResultsFoundException("location folder not found");
        }
        else {
            //TODO: we need remove items on CASCADE.
            final List<GeoPoint> itemsToDelete = getGeoPointDao()
                                    .getLocationByFolder(locationFolder.getLocationFolderId(), getUserAccountId(username));
            for (GeoPoint geoPoint : itemsToDelete) {
                 getGeoPointDao().delete(geoPoint);
            }
            getGeoPointDao().delete(locationFolder);
            log.info("delete location folder");
View Full Code Here

     * test retrieveLocationSubFolderByUser.
     * @throws Exception
     */
    //@Test
    public void testretrieveLocationSubFolderByUser() throws Exception{
        final GeoPointFolder locationFolder = createGeoPointFolder(GeoPointFolderType.GROUPING, this.secondary.getAccount(), "folder", null);
        createGeoPointFolder(GeoPointFolderType.GROUPING, this.secondary.getAccount(), "folder sub", locationFolder);
        final List<UnitLocationFolder> list = this.locationService.retrieveLocationSubFolderByUser(locationFolder.getLocationFolderId(), this.secondary.getUsername());
        Assert.assertEquals(list.size(), 1);
    }
View Full Code Here

     *
     * @throws Exception
     */
    //@Test
    public void testupdateLocationMap() throws Exception{
        final GeoPointFolder locationFolder = createGeoPointFolder(GeoPointFolderType.GROUPING, this.secondary.getAccount(), "folder", null);
        //final CatLocation location = createCatLocation("Managua", locTypeName, Level, secUsers)
    }
View Full Code Here

     * Test for getLocationFoldersByLocationFolderId.
     */
  @Ignore
  @Test
    public void testGetLocationFoldersByLocationFolderId(){
        final GeoPointFolder geoPointFolder = createGeoPointFolder(GeoPointFolderType.GROUPING, this.userPrimary, "Condega2", null);
        createGeoPointFolder(GeoPointFolderType.GROUPING, this.userPrimary, "Wiwili2", geoPointFolder);
        final List<GeoPointFolder> geoPointFolders = getGeoPointDao().getLocationFoldersByLocationFolderId(
                geoPointFolder.getLocationFolderId(), this.userPrimary.getUid());
        assertEquals("Should be equals",1 , geoPointFolders.size());
    }
View Full Code Here

    /**
     * Test getLocationByFolder.
     */
  @Test
    public void testGetLocationByFolder(){
        final GeoPointFolder geoPointFolder = createGeoPointFolder(GeoPointFolderType.GROUPING,
                                                    this.userPrimary, "Matagalpa", null);
        createGeoPoint("Location 1", "type", 1, this.userPrimary, geoPointFolder);
        final List<GeoPoint> geoPoint = getGeoPointDao().getLocationByFolder(geoPointFolder.getLocationFolderId(),
                                         this.userPrimary.getUid());
        assertEquals("Should be equals",1 , geoPoint.size());
    }
View Full Code Here

    /**
     * Test getLocationFolderByIdAndUserId.
     */
  @Test
    public void testGetLocationFolderByIdAndUserId(){
        final GeoPointFolder geoPointFolder = createGeoPointFolder(GeoPointFolderType.GROUPING,
                this.userPrimary, "Carazo", null);
        final GeoPointFolder geoPointFolder2 = getGeoPointDao().getLocationFolderByIdAndUserId(geoPointFolder.getLocationFolderId(), this.userPrimary.getUid());
        assertEquals("Should be equals", geoPointFolder.getLocationFolderId() , geoPointFolder2.getLocationFolderId());
    }
View Full Code Here

TOP

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

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.