Examples of Album


Examples of models.Album

    /**
     * Save album via JSON API
     */
    private static void saveAlbumJson() {
        Gson gson = new Gson();
        Album album = gson.fromJson(new InputStreamReader(request.body), Album.class);
        album.replaceDuplicateArtist();
        album.save();
    }
View Full Code Here

Examples of models.Album

        Node artistNode = XPath.selectNode("artist", albumNode);
        String artistName = XPath.selectText("name",artistNode);
        Artist artist = new Artist(artistName);
        //get the name
        String albumName = XPath.selectText("name", albumNode);
        Album album = new Album(albumName);
        //get the date
        String date = XPath.selectText("release-date",albumNode);
        DateFormat dateFormat = new SimpleDateFormat("yyyy");
        try {
            album.releaseDate = dateFormat.parse(date);
        } catch (ParseException e) {
            Logger.error(e.getMessage());
        }
        //get the genre
        String genre = XPath.selectText("genre", albumNode);
        Genre genreEnum = Genre.valueOf(genre.toString().toUpperCase());
        album.genre = genreEnum;

        //save in db
        album.artist = artist;
        album.save();
    }
View Full Code Here

Examples of models.Album

    /**
     * @param id
     */
    public static void vote(String id) {
        Album album = Album.findById(Long.parseLong(id));
        album.vote();
        renderText(album.nbVotes);
    }
View Full Code Here

Examples of models.Album


    @Test
    public void testUniqueArtist() {
        Artist artist1 = new Artist("john");
        Album album1 = new Album("coolAlbum");
        album1.artist=artist1;
        album1.replaceDuplicateArtist();
        album1.save();
        // name must be unique
        Artist artist2 = new Artist("john");
        Album album2 = new Album("coolAlbum2");
        album2.artist=artist2;
        album2.replaceDuplicateArtist();
        album2.save();
        // check artist is unique
        assertEquals(Artist.find("byName", "john").fetch().size(),1);
    }
View Full Code Here

Examples of net.pterodactylus.sone.data.Album

        return;
      }
      String description = request.getHttpRequest().getPartAsStringFailsafe("description", 256).trim();
      Sone currentSone = getCurrentSone(request.getToadletContext());
      String parentId = request.getHttpRequest().getPartAsStringFailsafe("parent", 36);
      Album parent = webInterface.getCore().getAlbum(parentId, false);
      if (parentId.equals("")) {
        parent = currentSone.getRootAlbum();
      }
      Album album = webInterface.getCore().createAlbum(currentSone, parent);
      album.modify().setTitle(name).setDescription(TextFilter.filter(request.getHttpRequest().getHeader("host"), description)).update();
      webInterface.getCore().touchConfiguration();
      throw new RedirectException("imageBrowser.html?album=" + album.getId());
    }
  }
View Full Code Here

Examples of net.sf.jmp3renamer.plugins.Web.provider.Album

            }
           
            List<Album> result = new ArrayList<Album>(albums.size());
            if (albums.size() > 0) {
                for (Iterator<Album> iterator = albums.iterator(); iterator.hasNext();) {
                    Album a = (Album) iterator.next();
                    result.add(new AlbumWrapper(a, prov));
                }
            } else {
                logger.info("{}: No album found", prov.getName());
            }
View Full Code Here

Examples of org.apache.photark.services.album.Album

    private synchronized boolean isUserTheOwner(String userId, String albumName) {
        if (userId == null || albumName == null || userId.trim().equals("") || albumName.trim().equals("")) {
            return false;
        }
        Album album = new JCRAlbumImpl(repositoryManager, albumName);
        return Arrays.asList(album.getOwners()).contains(userId);
    }
View Full Code Here

Examples of org.apache.photark.services.album.Album

    private boolean isNoOwnerForAlbum(String albumName) {
        if (albumName == null || albumName.trim().equals("")) {
            return false;
        }
        Album album = new JCRAlbumImpl(repositoryManager, albumName);
        String[] owners = album.getOwners();
        if (owners.length == 0) {
            return true;
        } else {
            return false;
        }
View Full Code Here

Examples of org.apache.photark.services.album.Album

        albums.toArray(albumArray);
        return albumArray;
    }

    public String getAlbumCover(String albumName) {
        Album albumLookup = getAlbum(albumName);

        if (albumLookup != null) {
            String[] pictures = albumLookup.getPictures();
            // this check is to avoid Exception
            if (pictures.length > 0) {
                return albumLookup.getPictures()[0];
            } else {
                logger.info("No Album Cover Picture found for album:" + albumName);
                return null;
            }
        } else {
View Full Code Here

Examples of org.apache.photark.services.album.Album

            return null;
        }
    }

    public String[] getAlbumPictures(String albumName) {
        Album albumLookup = getAlbum(albumName);

        if (albumLookup != null) {
            return albumLookup.getPictures();
        } else {
            // FIXME: return proper not found exception
            return new String[] {};
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.