Java Code Examples for org.fourthline.cling.support.model.item.Item#getId()

The following examples show how to use org.fourthline.cling.support.model.item.Item#getId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public static boolean isAudioItem(Item item) {
    // TODO zxt need check?
    String objectClass = item.getId();
    if (objectClass != null && objectClass.contains(DLNA_OBJECTCLASS_MUSICID)) {
        return true;
    }
    return false;
}
 
Example 2
public static boolean isVideoItem(Item item) {
    // TODO zxt need check?
    String objectClass = item.getId();
    if (objectClass != null && objectClass.contains(DLNA_OBJECTCLASS_VIDEOID)) {
        return true;
    }
    return false;
}
 
Example 3
public static boolean isPictureItem(Item item) {
    // TODO zxt need check?
    String objectClass = item.getId();
    if (objectClass != null && objectClass.contains(DLNA_OBJECTCLASS_PHOTOID)) {
        return true;
    }
    return false;
}
 
Example 4
public ContentItem(Item item, Service service) {
	// TODO Auto-generated constructor stub
	this.service = service;
	this.content = item;
	this.id = item.getId();
	this.isContainer = false;
}
 
Example 5
Source Project: DroidDLNA   File: UpnpUtil.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static boolean isAudioItem(Item item) {
    // TODO zxt need check?
    String objectClass = item.getId();
    if (objectClass != null && objectClass.contains(DLNA_OBJECTCLASS_MUSICID)) {
        return true;
    }
    return false;
}
 
Example 6
Source Project: DroidDLNA   File: UpnpUtil.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static boolean isVideoItem(Item item) {
    // TODO zxt need check?
    String objectClass = item.getId();
    if (objectClass != null && objectClass.contains(DLNA_OBJECTCLASS_VIDEOID)) {
        return true;
    }
    return false;
}
 
Example 7
Source Project: DroidDLNA   File: UpnpUtil.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static boolean isPictureItem(Item item) {
    // TODO zxt need check?
    String objectClass = item.getId();
    if (objectClass != null && objectClass.contains(DLNA_OBJECTCLASS_PHOTOID)) {
        return true;
    }
    return false;
}
 
Example 8
protected void generateItem(Item item, Document descriptor, Element parent) {

        if (item.getClazz() == null) {
            throw new RuntimeException("Missing 'upnp:class' element for item: " + item.getId());
        }

        Element itemElement = appendNewElement(descriptor, parent, "item");

        if (item.getId() == null)
            throw new NullPointerException("Missing id on item: " + item);
        itemElement.setAttribute("id", item.getId());

        if (item.getParentID() == null)
            throw new NullPointerException("Missing parent id on item: " + item);
        itemElement.setAttribute("parentID", item.getParentID());

        if (item.getRefID() != null)
            itemElement.setAttribute("refID", item.getRefID());
        itemElement.setAttribute("restricted", booleanToInt(item.isRestricted()));

        String title = item.getTitle();
        if (title == null) {
            log.warning("Missing 'dc:title' element for item: " + item.getId());
            title = UNKNOWN_TITLE;
        }

        appendNewElementIfNotNull(
                descriptor,
                itemElement,
                "dc:title",
                title,
                DIDLObject.Property.DC.NAMESPACE.URI
        );

        appendNewElementIfNotNull(
                descriptor,
                itemElement,
                "dc:creator",
                item.getCreator(),
                DIDLObject.Property.DC.NAMESPACE.URI
        );

        appendNewElementIfNotNull(
                descriptor,
                itemElement,
                "upnp:writeStatus",
                item.getWriteStatus(),
                DIDLObject.Property.UPNP.NAMESPACE.URI
        );

        appendClass(descriptor, itemElement, item.getClazz(), "upnp:class", false);

        appendProperties(descriptor, itemElement, item, "upnp", DIDLObject.Property.UPNP.NAMESPACE.class, DIDLObject.Property.UPNP.NAMESPACE.URI);
        appendProperties(descriptor, itemElement, item, "dc", DIDLObject.Property.DC.NAMESPACE.class, DIDLObject.Property.DC.NAMESPACE.URI);
        appendProperties(descriptor, itemElement, item, "sec", DIDLObject.Property.SEC.NAMESPACE.class, DIDLObject.Property.SEC.NAMESPACE.URI);

        for (Res resource : item.getResources()) {
            if (resource == null) continue;
            generateResource(resource, descriptor, itemElement);
        }

        for (DescMeta descMeta : item.getDescMetadata()) {
            if (descMeta == null) continue;
            generateDescMetadata(descMeta, descriptor, itemElement);
        }
    }
 
Example 9
protected void generateItem(Item item, Document descriptor, Element parent) {

        if (item.getClazz() == null) {
            throw new RuntimeException("Missing 'upnp:class' element for item: " + item.getId());
        }

        Element itemElement = appendNewElement(descriptor, parent, "item");

        if (item.getId() == null)
            throw new NullPointerException("Missing id on item: " + item);
        itemElement.setAttribute("id", item.getId());

        if (item.getParentID() == null)
            throw new NullPointerException("Missing parent id on item: " + item);
        itemElement.setAttribute("parentID", item.getParentID());

        if (item.getRefID() != null)
            itemElement.setAttribute("refID", item.getRefID());
        itemElement.setAttribute("restricted", booleanToInt(item.isRestricted()));

        String title = item.getTitle();
        if (title == null) {
            log.warning("Missing 'dc:title' element for item: " + item.getId());
            title = UNKNOWN_TITLE;
        }

        appendNewElementIfNotNull(
                descriptor,
                itemElement,
                "dc:title",
                title,
                DIDLObject.Property.DC.NAMESPACE.URI
        );

        appendNewElementIfNotNull(
                descriptor,
                itemElement,
                "dc:creator",
                item.getCreator(),
                DIDLObject.Property.DC.NAMESPACE.URI
        );

        appendNewElementIfNotNull(
                descriptor,
                itemElement,
                "upnp:writeStatus",
                item.getWriteStatus(),
                DIDLObject.Property.UPNP.NAMESPACE.URI
        );

        appendClass(descriptor, itemElement, item.getClazz(), "upnp:class", false);

        appendProperties(descriptor, itemElement, item, "upnp", DIDLObject.Property.UPNP.NAMESPACE.class, DIDLObject.Property.UPNP.NAMESPACE.URI);
        appendProperties(descriptor, itemElement, item, "dc", DIDLObject.Property.DC.NAMESPACE.class, DIDLObject.Property.DC.NAMESPACE.URI);
        appendProperties(descriptor, itemElement, item, "sec", DIDLObject.Property.SEC.NAMESPACE.class, DIDLObject.Property.SEC.NAMESPACE.URI);

        for (Res resource : item.getResources()) {
            if (resource == null) continue;
            generateResource(resource, descriptor, itemElement);
        }

        for (DescMeta descMeta : item.getDescMetadata()) {
            if (descMeta == null) continue;
            generateDescMetadata(descMeta, descriptor, itemElement);
        }
    }
 
Example 10
protected void generateItem(Item item, Document descriptor, Element parent) {

		if (item.getClazz() == null) {
			throw new RuntimeException(
					"Missing 'upnp:class' element for item: " + item.getId());
		}

		Element itemElement = appendNewElement(descriptor, parent, "item");

		if (item.getId() == null)
			throw new NullPointerException("Missing id on item: " + item);
		itemElement.setAttribute("id", item.getId());

		if (item.getParentID() == null)
			throw new NullPointerException("Missing parent id on item: " + item);
		itemElement.setAttribute("parentID", item.getParentID());

		if (item.getRefID() != null)
			itemElement.setAttribute("refID", item.getRefID());
		itemElement.setAttribute("restricted",
				booleanToInt(item.isRestricted()));

		String title = item.getTitle();
		if (title == null) {
			log.warning("Missing 'dc:title' element for item: " + item.getId());
			title = UNKNOWN_TITLE;
		}

		appendNewElementIfNotNull(descriptor, itemElement, "dc:title", title,
				DIDLObject.Property.DC.NAMESPACE.URI);

		appendNewElementIfNotNull(descriptor, itemElement, "dc:creator",
				item.getCreator(), DIDLObject.Property.DC.NAMESPACE.URI);

		appendNewElementIfNotNull(descriptor, itemElement, "upnp:writeStatus",
				item.getWriteStatus(), DIDLObject.Property.UPNP.NAMESPACE.URI);

		appendClass(descriptor, itemElement, item.getClazz(), "upnp:class",
				false);

		appendProperties(descriptor, itemElement, item, "upnp",
				DIDLObject.Property.UPNP.NAMESPACE.class,
				DIDLObject.Property.UPNP.NAMESPACE.URI);
		appendProperties(descriptor, itemElement, item, "dc",
				DIDLObject.Property.DC.NAMESPACE.class,
				DIDLObject.Property.DC.NAMESPACE.URI);
		appendProperties(descriptor, itemElement, item, "sec",
				DIDLObject.Property.SEC.NAMESPACE.class,
				DIDLObject.Property.SEC.NAMESPACE.URI);

		for (Res resource : item.getResources()) {
			if (resource == null)
				continue;
			generateResource(resource, descriptor, itemElement);
		}

		for (DescMeta descMeta : item.getDescMetadata()) {
			if (descMeta == null)
				continue;
			generateDescMetadata(descMeta, descriptor, itemElement);
		}
	}