Examples of MusicAlbum


Examples of org.apache.taglibs.rdc.sampleapps.musicstore.ws.MusicAlbum

  public void generateAlbumLinks(MusicAlbum[] albums) {
    links = "";
   
    for (int i = 0; i < albums.length; i++) {
      MusicAlbum album = albums[i];
      String linkURL = baseURL + "/reviewalbum_gui.do?asin=" + album.getASIN();
      String text = album.getTitle() + ", " + album.getArtist();
      links += buildLinkNL(linkURL, text);
    }
  }
View Full Code Here

Examples of org.apache.taglibs.rdc.sampleapps.musicstore.ws.MusicAlbum

    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        AlbumFilterForm afForm = (AlbumFilterForm) form;
        MusicAlbum albums[] = null;
        HttpSession session = request.getSession();
        MusicStoreAppBean msBean = (MusicStoreAppBean) session
                .getAttribute(MusicStoreAppBean.SESSION_KEY);
       
        try {
View Full Code Here

Examples of org.apache.taglibs.rdc.sampleapps.musicstore.ws.MusicAlbum

    MusicAlbum[] albums = msBean.getAlbums();
    if (albums == null) {
      msBean.setErrorDescription("Albums array not found in session");
      return mapping.findForward("notFound");
    }   
    MusicAlbum currentAlbum = null;
    for (int i = 0; i < albums.length; i++) {
      if (asin.equals(albums[i].getASIN())) {
        currentAlbum = albums[i];
        break;
      }
View Full Code Here

Examples of org.apache.taglibs.rdc.sampleapps.musicstore.ws.MusicAlbum

        HttpSession session = request.getSession();
        MusicStoreAppBean msBean = (MusicStoreAppBean) session
                .getAttribute(MusicStoreAppBean.SESSION_KEY);

        MusicAlbum album = msBean.getCurrentAlbum();
       
        if (album == null) {
            msBean.setErrorDescription("Current album not found in "
                    + "MusicStoreAppBean");
            return mapping.findForward("onerror");
        }
       
        MusicStore ms = msBean.getMusicStore();
        MusicAlbum albums[] = ms.getSimilarItems(album);
        //override the old Albums array in session
        msBean.setAlbums(albums);
       
        if (msBean.getChannel() == MusicStoreAppBean.GUI_APP) {
            // GUI Channel
View Full Code Here

Examples of org.apache.taglibs.rdc.sampleapps.musicstore.ws.MusicAlbum

        HttpSession session = request.getSession();
    MusicStoreAppBean msBean = (MusicStoreAppBean) session.
      getAttribute(MusicStoreAppBean.SESSION_KEY);
        MusicStore ms = msBean.getMusicStore();
        Cart currentCart = msBean.getCart();
        MusicAlbum currentAlbum = msBean.getCurrentAlbum();

        if (currentCart != null) {
            currentCart = ms.addToCart(currentCart, currentAlbum, 1);
        } else {
            if (currentAlbum != null) {
                currentCart = ms.createCart(currentAlbum, 1);
            }
        }
    //cleanup session from RDCs
    session.removeAttribute("dialogMap");
   
        if (currentAlbum == null || currentCart == null) {
            msBean.setErrorDescription("Failed to add album to your " +
              "shopping cart. please try again.");
            return mapping.findForward("onerror");
        }

        msBean.setCart(currentCart);
        String title = currentAlbum.getTitle();
        request.setAttribute("promptContent", "Added " + title +
      " to the shopping cart.");
    return mapping.findForward("OK");

    }
View Full Code Here

Examples of org.teleal.cling.support.model.container.MusicAlbum

//          upnpMusicArtist.setGenres(artistGenres.toArray(new String[0]));
//        }

      } else if (browsedItem.getType().equals("Release") ) {
        ResultItem<ReleaseEntity> releaseItem = (ResultItem<ReleaseEntity>) browsedItem;
        MusicAlbum upnpAlbum = new MusicAlbum();
        upnpContainer = upnpAlbum;
        List<PersonWithRole> contributors =  new ArrayList<PersonWithRole>();
       
//        try {

        Collection<ResultItem<ArtistEntity>> artists =
          artistBrowseService.findChildren(Arrays.asList(releaseItem.getId()), null, 0, null, false).getItems();
       
        for(ResultItem<ArtistEntity> artist : artists) {
          // TODO: replace hard coded "performer" by SMD role
           contributors.add(new PersonWithRole(artist.getItem().getName(), "Performer"));
        }
       
        upnpAlbum.setArtists(contributors.toArray(new PersonWithRole[0] ));
// TODO: check what happens if there's no artist (should be handled below by contributors.size test)
//        } catch(java.util.NoSuchElementException Ex) {
//          // ignore this exception, it means there's no artist for that album
//        }
       
        upnpAlbum.setId(objectID+"/"+releaseItem.getId());
        upnpAlbum.setClazz(new org.teleal.cling.support.model.DIDLObject.Class("object.container.album.musicAlbum"));
       
        if(contributors.size()>0) {
          upnpAlbum.setCreator(contributors.get(0).getName());
        } else {
          upnpAlbum.setCreator("unknown");
        }
       
        upnpAlbum.setTitle(releaseItem.getItem().getName());
        upnpAlbum.addProperty(new DIDLObject.Property.UPNP.ALBUM(upnpAlbum.getTitle()) );
        upnpAlbum.setDescription("aze");
        // <albumArtUri dlna:profileID="PNG_TN">
        // <albumArtUri dlna:profileID="JPEG_TN">
       
        upnpAlbum.setAlbumArtURIs(new URI[] { new URI(releaseItem.getImage().getUrl())} );
        Property<URI>[] albumArtUriProperties = upnpAlbum.getProperties(UPNP.ALBUM_ART_URI.class);
        for(Property<URI> uriProperty : albumArtUriProperties) {
          //DIDLObject.Property.DLNA.PROFILE_ID toto = new DIDLObject.Property.DLNA.PROFILE_ID();
          //toto.getValue().
          //DIDLAttribute tutu = new DIDLAttribute(DIDLObject.Property.DLNA, "dlna", "zeazé")
         
          // value for dlna:profileID attribute of upnp:albumArtURI element
          String upnpProfileID;
         
            if(uriProperty.getValue().toString().endsWith(".png")) {
              upnpProfileID = "PNG_TN";
            } else {
              // if extension isn't png, suppose it's JPEG (may be a bad guess)
              upnpProfileID = "JPEG_TN";
              // TODO: improve image entity to contain image type or enhance this code
              // to detect image format
            }
           
          uriProperty.addAttribute(
              new DIDLObject.Property.DLNA.PROFILE_ID(
                  new DIDLAttribute(
                  DIDLObject.Property.DLNA.NAMESPACE.URI,
                  "dlna",
                  upnpProfileID)
              ) 
          );         
        }
       
        // search for album genre
// commented for performance reason, should be uncommented or changed
// when performance problem is solved
//        List<String> albumGenres = new ArrayList<String>();
//        for(ResultItem<ClassificationEntity> classificationResult: classificationBrowseService.findChildren(Arrays.asList(releaseItem.getId()), null, 0, null, false).getItems() ) {
//          ClassificationEntity classification = classificationResult.getItem();
//          if(classification.getType().equals("genre")) {
//            albumGenres.add(classification.getName());
//          }
//        }

       
        // construct album genres from genre, style and moods classifications
        List<String> albumGenres = new ArrayList<String>();
        for(ResultItem<ClassificationEntity> classificationResult:
                classificationBrowseService.findChildren(
                  Arrays.asList(releaseItem.getId(),"Classification.genre"),
                    null, 0, null, false).getItems()
        ) {
          StringTokenizer sk = new StringTokenizer(classificationResult.getItem().getName(), ",");
          while(sk.hasMoreTokens() ) {
            String genre = sk.nextToken().trim();
            if(!albumGenres.contains(genre))
              albumGenres.add(genre);
          }
        }

        for(ResultItem<ClassificationEntity> classificationResult:
          classificationBrowseService.findChildren(
            Arrays.asList(releaseItem.getId(),"Classification.style"),
              null, 0, null, false).getItems()
        ) {
//            albumGenres.addAll( Arrays.asList(classificationResult.getItem().getName().split(" ")) );
          StringTokenizer sk = new StringTokenizer(classificationResult.getItem().getName(), ",");
          while(sk.hasMoreTokens() ) {
            String genre = sk.nextToken().trim();
            if(!albumGenres.contains(genre))
              albumGenres.add(genre);
          }
        }

        for(ResultItem<ClassificationEntity> classificationResult:
          classificationBrowseService.findChildren(
            Arrays.asList(releaseItem.getId(),"Classification.mood"),
              null, 0, null, false).getItems()
        ) {
//            albumGenres.add(classificationResult.getItem().getName());
            StringTokenizer sk = new StringTokenizer(classificationResult.getItem().getName(), ",");
            while(sk.hasMoreTokens() ) {
              String genre = sk.nextToken().trim();
              if(!albumGenres.contains(genre))
                albumGenres.add(genre);
            }           
        }
         
        if(albumGenres.size()>0) {
          upnpAlbum.setGenres(albumGenres.toArray(new String[0]));
        }
       
        // TODO: add childcount is asked for by the client parameters
        // before r839: upnpContainer.setChildCount(browseService.findChildren(objectID+"/"+releaseItem.getId(), null, null, false).getCount().intValue());
        // after  r839: upnpContainer.setChildCount(browseService.findChildren("upnp", artistItem.getId(), null, null, false).getCount().intValue());
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.