Examples of Item


Examples of org.restlet.test.ext.odata.cafe.Item

        assertEquals("Levallois-Perret", cafe.getCity());
        assertEquals(92300, cafe.getZipCode());

        Iterator<Item> iterator2 = cafe.getItems().iterator();
        assertTrue(iterator2.hasNext());
        Item item = iterator2.next();
        assertEquals("1", item.getId());
        assertEquals("Poulet au curry", item.getDescription());

        assertTrue(iterator2.hasNext());
        item = iterator2.next();
        assertEquals("2", item.getId());
        assertEquals("Pate", item.getDescription());

        assertTrue(iterator.hasNext());
        cafe = iterator.next();
        assertEquals("2", cafe.getId());
        assertEquals("Le Petit Marly", cafe.getName());
        assertEquals("Cafe inc.", cafe.getCompanyName());
        assertEquals("Marly Le Roi", cafe.getCity());
        assertEquals(78310, cafe.getZipCode());

        iterator2 = cafe.getItems().iterator();
        assertTrue(iterator2.hasNext());
        item = iterator2.next();
        assertEquals("3", item.getId());
        assertEquals("Banana Split", item.getDescription());

        assertTrue(iterator2.hasNext());
        item = iterator2.next();
        assertEquals("4", item.getId());
        assertEquals("Cotes du Rhone", item.getDescription());
    }
View Full Code Here

Examples of org.restlet.test.ext.odata.cafecustofeeds.Item

        assertEquals("Levallois-Perret", cafe.getCity());
        assertEquals(92300, cafe.getZipCode());

        Iterator<Item> iterator2 = cafe.getItems().iterator();
        assertTrue(iterator2.hasNext());
        Item item = iterator2.next();
        assertEquals("1", item.getId());
        assertEquals("Poulet au curry", item.getDescription());

        assertTrue(iterator2.hasNext());
        item = iterator2.next();
        assertEquals("2", item.getId());
        assertEquals("Pate", item.getDescription());

        assertTrue(iterator.hasNext());
        cafe = iterator.next();
        assertEquals("2", cafe.getId());
        assertEquals("Le Petit Marly", cafe.getName());
        assertEquals("Cafe inc.", cafe.getCompanyName());
        assertEquals("Marly Le Roi", cafe.getCity());
        assertEquals(78310, cafe.getZipCode());

        iterator2 = cafe.getItems().iterator();
        assertTrue(iterator2.hasNext());
        item = iterator2.next();
        assertEquals("3", item.getId());
        assertEquals("Banana Split", item.getDescription());

        assertTrue(iterator2.hasNext());
        item = iterator2.next();
        assertEquals("4", item.getId());
        assertEquals("Cotes du Rhone", item.getDescription());
    }
View Full Code Here

Examples of org.sfaci.jumper2dx.characters.Item

  public void raiseItem(final int x, final int y) {
   
    Timer.schedule(new Task(){
        @Override
        public void run() {
          Item item = new Item();
        item.position.set(x, y);
        items.add(item);
        }
    }, 1);
  }
View Full Code Here

Examples of org.shams.phonebook.domain.impl.Item

        assertEquals(after, before + 1);
    }

    public void load() {
        int before = countRowsInTable("_item");
        Item item = getItem();
        dao.save(item);
        assertEquals(countRowsInTable("_item"), before + 1);
        List<Item> items = dao.load();
        assertEquals(items.size(), before + 1);
        assertEquals(items.get(before).getFirstName(), "f");

        Item lastItem = dao.load(items.get(before).getId());
        assertNotNull(lastItem);
        assertEquals(lastItem.getLastName(), "l");

        assertEquals(dao.load("@").size(), 1);
        assertEquals(dao.load("@1").size(), 0);
    }
View Full Code Here

Examples of org.spout.vanilla.component.entity.substance.Item

    // Conversion factor, some sort of unit problem
    //TODO: This needs an actual value and this value might change when gravity changes!
    impulse = impulse.mul(100);

    // Finally drop using a 4 second pickup delay
    Item spawnedItem = Item.drop(dropFrom.getPosition(), item, impulse);
    spawnedItem.setUncollectableDelay(4000);
  }
View Full Code Here

Examples of org.springframework.richclient.samples.dataeditor.domain.Item

public class ItemForm extends TabbedForm
{
    public ItemForm()
    {
        super(FormModelHelper.createFormModel(new Item(), "itemForm"));
    }
View Full Code Here

Examples of org.springframework.samples.jpetstore.domain.Item

    this.petStore = petStore;
  }

  public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
    String itemId = request.getParameter("itemId");
    Item item = this.petStore.getItem(itemId);
    Map model = new HashMap();
    model.put("item", item);
    model.put("product", item.getProduct());
    return new ModelAndView("Item", model);
  }
View Full Code Here

Examples of org.switchyard.component.resteasy.util.support.Item

    @Test
    public void generateClassInstances() throws Exception {
        String[] intfs = {"org.switchyard.component.resteasy.util.support.WarehouseResource"};
        Object instance = ClassUtil.generateSingletons(intfs, this).get(0);
        Method method = instance.getClass().getMethod("getItem", Integer.class);
        Item response = (Item)method.invoke(instance, 1);
        Item apple = new Item(1, "Apple");
        Assert.assertTrue(response.equals(apple));
        method = instance.getClass().getMethod("addItem", Item.class);
        Item orange = new Item(2, "Orange");
        Assert.assertEquals("[2:Orange]", method.invoke(instance, orange));
        method = instance.getClass().getMethod("updateItem", Item.class);
        Item grape = new Item(2, "Grape");
        Assert.assertEquals("[2:Grape]", method.invoke(instance, grape));
        method = instance.getClass().getMethod("removeItem", Integer.class);
        //Assert.assertEquals("2", method.invoke(instance, 2));
        method = instance.getClass().getMethod("getItemCount");
        Assert.assertEquals(0, method.invoke(instance));
View Full Code Here

Examples of org.switchyard.quickstarts.demo.multiapp.Item

public class InventoryServiceBean implements InventoryService {

    private final Map<String, Item> _inventory = new HashMap<String, Item>();

    public InventoryServiceBean() {
        Item butter = new Item()
            .setItemId("BUTTER")
            .setName("Not Parkay")
            .setQuantity(1000);
        _inventory.put(butter.getItemId(), butter);
    }
View Full Code Here

Examples of org.teleal.cling.support.model.item.Item

   
    // Memo: DIDL object mandatory elements:
    // id, parentID, title, class, restricted (for 'object' base class)
   
    Container upnpContainer = null;
    Item upnpItem = null;
   
    for(ResultItem<?> browsedItem: browsedContent.getItems()) {
     
      // nullify container to prevent a bug if browsedItem type is unknown
      // unless nullified, the same object will be added twice in didl document
      upnpContainer = null;
     
      if(browsedItem.getType().equals("Folder") || browsedItem.getType().equals("ImageFolder") ) {
       
       
        // found item is a Folder (could be root elements, LastFM Image, etc.
        upnpContainer = new SmdFolder( (ResultItem<String>)browsedItem);

        // create object ID (parentId/itemID)
        if(smdObjectID != null) {
          upnpContainer.setId(smdObjectID+"/"+browsedItem.getId());
        }
        // before r839: upnpContainer.setChildCount(browseService.findChildren(browsedItem.getId(), null, null, false).getCount().intValue());
                // after  r839: upnpContainer.setChildCount(browseService.findChildren("upnp", browsedItem.getId(), null, null, false).getCount().intValue());

      } else if (browsedItem.getType().equals("Artist") ) {
       
        // SMD Item is considered as an artist, create corresponding UPnP container
       
        ResultItem<ArtistEntity> artistItem = (ResultItem<ArtistEntity>) browsedItem;
       
        org.teleal.cling.support.model.container.MusicArtist upnpMusicArtist = new org.teleal.cling.support.model.container.MusicArtist();
       
        upnpContainer = upnpMusicArtist;
        upnpMusicArtist.setId(objectID+"/"+artistItem.getId())
          .setClazz(new org.teleal.cling.support.model.DIDLObject.Class("object.container.person.musicArtist"))
          .setTitle(artistItem.getItem().getName());
        System.err.println("CurrentArtist: "+upnpMusicArtist.getTitle());
        // TODO: Artist can have "artistDiscographyURI"
        // upnpMusicArtist.setGenres( new String[] {"Unknown"} );
       
        // findChildren seems to require parent path concatenation now
        //upnpContainer.setChildCount(browseService.findChildren(artistItem.getId(), null, null, false).getCount().intValue());
        // upnpContainer.setChildCount(browseService.findChildren(objectID+"/"+artistItem.getId(), null, null, false).getCount().intValue());
       
        // search for artist genre
        // TODO: activate again when performance problem is gone
//        List<String> artistGenres = new ArrayList<String>();
//        for(ResultItem<ClassificationEntity> classificationResult: classificationBrowseService.findChildren(Arrays.asList(artistItem.getId()), null, 0, null, false).getItems() ) {
//          ClassificationEntity classification = classificationResult.getItem();
//          if(classification.getType().equals("genre")) {
//            artistGenres.add(classification.getName());
//          }
//        }
//        if(artistGenres.size()>0) {
//          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());

      } else if (browsedItem.getType().equals("Classification") ) {
        ResultItem<ClassificationEntity> classificationItem = (ResultItem<ClassificationEntity>) browsedItem;
        upnpContainer = new org.teleal.cling.support.model.container.MusicArtist();
        upnpContainer.setId(objectID+"/"+classificationItem.getId())
          .setClazz(new org.teleal.cling.support.model.DIDLObject.Class("object.container.genre.musicGenre"))
          .setTitle(classificationItem.getItem().getName());
        upnpContainer.setChildCount(browseService.findChildren("upnp", classificationItem.getId(), null, null, false).getCount().intValue());
       
      } else if (browsedItem.getType().equals("Track") ) {
       
        upnpItem = getUpnpMusicTrackFromSmdTrackEntity((ResultItem<TrackEntity>)browsedItem, objectID, filters);
       
      } else if (browsedItem.getType().equals("LastFMImage") ) {
        ResultItemImage smdImage = browsedItem.getImage();    
        Photo upnpPhoto = new Photo();
          upnpItem = upnpPhoto;
         
        // Mandatory elements:
          upnpPhoto.setTitle("unknown");
          upnpPhoto.setAlbum("unknown");
          upnpPhoto.setWriteStatus(WriteStatus.NOT_WRITABLE);
          upnpPhoto.setCreator("LastFM");
          upnpPhoto.setId(objectID+"/"+browsedItem.getId());
          upnpPhoto.setClazz(new org.teleal.cling.support.model.DIDLObject.Class("object.item.imageItem.photo"));
          Res url = new Res();
          upnpPhoto.addResource(url);
          url.setValue(smdImage.getUrl());
          if(url.getValue().endsWith(".png")) {
            url.setProtocolInfo(new ProtocolInfo("http-get:*:image/png:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS="));
          } else if(url.getValue().endsWith(".jpg")) {
            url.setProtocolInfo(new ProtocolInfo("http-get:*:image/jpeg:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS="));
          }

      } else {
        System.err.println("TYPE: "+browsedItem.getType());
      }
     
      if(upnpContainer != null) {
        upnpContainer.setRestricted(true);
        upnpContainer.setParentID(objectID);
       
        if(upnpContainer.getCreator() == null) {
          upnpContainer.setCreator("SMD");
        }
       
        didl.addContainer(upnpContainer);
      }
      if(upnpItem != null) {
        upnpItem.setRestricted(true);
        upnpItem.setParentID(objectID);
        didl.addItem(upnpItem);
      }
               
    }
    return new BrowseResult(new DIDLParser().generate(didl), browsedContent.getItems().size(), browsedContent.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.