FileDocCategorySizeDatePackage
MediaItem.javaAPI DocExample1792Thu Dec 26 11:01:36 GMT 2002com.mediamania.store

MediaItem

public class MediaItem extends Object

Fields Summary
private com.mediamania.content.MediaContent
content
private String
format
private BigDecimal
purchasePrice
private RentalCode
rentalCode
private Set
rentalItems
private int
quantityInStockForPurchase
private int
soldYTD
private int
rentedYTD
Constructors Summary
private MediaItem()

 
public MediaItem(com.mediamania.content.MediaContent content, String format, BigDecimal price, RentalCode rentalCode, int number4sale)

        this.content = content;
        content.addMediaItem(this);
        this.format = format;
        purchasePrice = price;
        this.rentalCode = rentalCode;
        rentalItems = new HashSet();
        quantityInStockForPurchase = number4sale;
        soldYTD = 0;
        rentedYTD = 0;
    
Methods Summary
public voidaddRentalItem(RentalItem rentalItem)

        rentalItems.add(rentalItem);
    
public java.lang.StringgetFormat()

        return format;
    
public com.mediamania.content.MediaContentgetMediaContent()

        return content;
    
public java.math.BigDecimalgetPurchasePrice()

        return purchasePrice;
    
public RentalCodegetRentalCode()

        return rentalCode;
    
public java.util.SetgetRentalItems()

        return Collections.unmodifiableSet(rentalItems);
    
public voidsetRentalCode(RentalCode code)

        rentalCode = code;
    
public voidsold(int qty)

        if (qty > quantityInStockForPurchase) {
            // report error
        }
        quantityInStockForPurchase -= qty;
        soldYTD += qty;