Example usage for javax.xml.registry.infomodel RegistryObject getSlot

List of usage examples for javax.xml.registry.infomodel RegistryObject getSlot

Introduction

In this page you can find the example usage for javax.xml.registry.infomodel RegistryObject getSlot.

Prototype

Slot getSlot(String slotName) throws JAXRException;

Source Link

Document

Gets the slot specified by slotName.

Usage

From source file:it.cnr.icar.eric.client.ui.thin.SearchPanelBean.java

private void handleCompressedContent(BulkResponse bulkResponse) throws JAXRException {
    try {/*  ww  w  .j a  va2  s  .  co m*/
        Iterator<?> itr = bulkResponse.getCollection().iterator();
        if (itr.hasNext()) {
            RegistryObject ro = (RegistryObject) itr.next();
            if (ro != null) {
                Slot fileNameSlot = ro
                        .getSlot(BindingUtility.FREEBXML_REGISTRY_FILTER_QUERY_COMPRESSCONTENT_FILENAME);
                if (fileNameSlot != null) {
                    Iterator<?> slotItr = fileNameSlot.getValues().iterator();
                    if (slotItr.hasNext()) {
                        String filename = (String) slotItr.next();
                        ExportBean.getInstance().setZipFileName(filename);
                    }
                }
            }
        }
    } catch (Throwable t) {
        throw new JAXRException(t);
    }
}

From source file:it.cnr.icar.eric.client.ui.swing.RegistryBrowser.java

/**
 * Shows the specified RepositoryItem for the RegistryObject in a Web
 * Browser//from ww w. j  a va2 s.c o  m
 * 
 * @param registryObject
 *            DOCUMENT ME!
 */
public static void showRepositoryItem(RegistryObject registryObject) {

    DataHandler repositoryItem = null;
    @SuppressWarnings("unused")
    File defaultItemFile = null;

    try {
        repositoryItem = ((ExtrinsicObject) registryObject).getRepositoryItem();
        String url = null;
        if (repositoryItem == null) {
            // I18N??
            // displayInfo("There is no repository item for this object");
            Slot contentLocatorSlot = registryObject.getSlot(CanonicalConstants.CANONICAL_SLOT_CONTENT_LOCATOR);
            if (contentLocatorSlot != null) {
                @SuppressWarnings("rawtypes")
                Collection values = contentLocatorSlot.getValues();
                String contentLocator = null;
                if (values.size() > 0) {
                    contentLocator = (String) (values.toArray())[0];
                }

                if (isExternalURL(contentLocator)) {
                    url = contentLocator;
                }
            }
        } else {
            url = baseURL.substring(0, baseURL.length() - 4)
                    + "http?interface=QueryManager&method=getRepositoryItem&param-id="
                    + URLEncoder.encode(registryObject.getKey().getId(), "utf-8");
        }

        if (url != null) {
            HyperLinker.displayURL(url);
        } else {
            displayInfo(resourceBundle.getString("message.info.noRepositoryItemOrURL"));
        }
    } catch (Exception e) {
        displayError(e);
    }
}