Example usage for java.rmi RemoteException getMessage

List of usage examples for java.rmi RemoteException getMessage

Introduction

In this page you can find the example usage for java.rmi RemoteException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message, including the message from the cause, if any, of this exception.

Usage

From source file:com.lp.server.artikel.ejbfac.WebshopItemServiceEjb.java

@Override
public WebshopItemResult getItemFindById(WebshopAuthHeader header, Integer id) {
    setupSessionParams(header);/*from  w  ww. j  av  a 2  s.co m*/

    try {
        ArtikelDto itemDto = getArtikelFac().artikelFindByPrimaryKey(id, webClientDto);

        WebshopItemResult result = getItemFindByIIdImpl(itemDto, id.toString());
        return result;
    } catch (NoResultException e) {
        return new WebshopItemResult(WebshopItemResult.ERROR_NOT_FOUND, id.toString());
    } catch (NonUniqueResultException e) {
        return new WebshopItemResult(WebshopItemResult.ERROR_NOT_FOUND, id.toString());
    } catch (RemoteException re) {
        return new WebshopItemResult(BaseRequestResult.ERROR_RMI_EXCEPTION, re.getMessage());
    } catch (EJBExceptionLP ex) {
        return new WebshopItemResult(BaseRequestResult.ERROR_EJB_EXCEPTION + ex.getCode(), ex.getMessage());
    }
}

From source file:com.lp.server.artikel.ejbfac.WebshopItemServiceEjb.java

@Override
public ShopgroupsResult getShopGroupsFindAll(WebshopAuthHeader authHeader) {
    try {/*from  www  . ja  va2  s  .co  m*/
        setupSessionParams(authHeader);

        ShopgroupsResult sgResult = new ShopgroupsResult();
        List<Shopgruppewebshop> cl = ShopgruppewebshopQuery.listByWebshopId(em, getWebshopIId());
        for (Shopgruppewebshop shopgruppewebshop : cl) {
            ShopgruppeDto shopGruppeDto = getArtikelFac()
                    .shopgruppeFindByPrimaryKey(shopgruppewebshop.getShopgruppeIId(), webClientDto);
            if (shopGruppeDto.getShopgruppeIId() != null)
                continue;

            WebshopShopgroup node = buildWebshopgroup(shopGruppeDto);
            sgResult.getShopgroups().add(node);
        }

        sgResult.setOkay();
        return sgResult;
    } catch (RemoteException ex) {
        return new ShopgroupsResult(BaseRequestResult.ERROR_RMI_EXCEPTION, ex.getMessage());
    } catch (EJBExceptionLP ex) {
        return new ShopgroupsResult(BaseRequestResult.ERROR_EJB_EXCEPTION + ex.getCode(), ex.getMessage());
    }
}

From source file:com.lp.server.artikel.ejbfac.WebshopItemServiceEjb.java

@Override
public WebshopItemResult getItemFindByCnr(WebshopAuthHeader header, String cnr) {
    if (HelperWebshop.isEmptyString(cnr)) {
        return new WebshopItemResult(BaseRequestResult.ERROR_NULL_PARAMETER, "item == null (or blank/empty)");
    }/*from   w  w w .j a  v a2s. c  om*/

    setupSessionParams(header);
    cnr = cnr.trim();

    try {
        ArtikelDto itemDto = getArtikelFac().artikelFindByCNr(cnr, webClientDto);

        WebshopItemResult result = getItemFindByIIdImpl(itemDto, cnr);
        return result;
    } catch (NoResultException e) {
        return new WebshopItemResult(WebshopItemResult.ERROR_NOT_FOUND, cnr);
    } catch (NonUniqueResultException e) {
        return new WebshopItemResult(WebshopItemResult.ERROR_NOT_FOUND, cnr);
    } catch (RemoteException re) {
        return new WebshopItemResult(BaseRequestResult.ERROR_RMI_EXCEPTION, re.getMessage());
    } catch (EJBExceptionLP ex) {
        return new WebshopItemResult(BaseRequestResult.ERROR_EJB_EXCEPTION + ex.getCode(), ex.getMessage());
    }
}

From source file:de.escidoc.core.common.business.fedora.FedoraUtility.java

/**
 * The method returns the foxml of the Fedora object with provided id via Fedora APIM-Webservice export().
 * //  w  w  w  .ja v  a2  s.c  o  m
 * @param pid
 *            Fedora object pid.
 * @return content of the fedora object foxml as byte []
 * @throws FedoraSystemException
 *             Thrown if retrieving FOXML of object failed.
 */
public byte[] getObjectFoxml(final String pid) throws FedoraSystemException {

    final FedoraAPIM apim = borrowApim();
    try {
        return apim.export(pid, FOXML_FORMAT, "public");
    } catch (final RemoteException e) {
        throw new FedoraSystemException("APIM export failure: " + e.getMessage(), e);
    } finally {
        returnApim(apim);
    }
}

From source file:de.escidoc.core.common.business.fedora.FedoraUtility.java

/**
 * The method sets the data stream status to a provided value.
 * //from   w  w  w .  j a  v  a2 s.com
 * @param pid
 *            The Fedora object id.
 * @param dsName
 *            The name of the datastream
 * @param dsState
 *            The status of the datastream.
 * @return Timestamp of the datastream.
 * @throws FedoraSystemException
 *             Thrown if set datastream at Fedora failed.
 */
public String setDatastreamState(final String pid, final String dsName, final String dsState)
        throws FedoraSystemException {

    String timestamp = null;
    final FedoraAPIM apim = borrowApim();
    try {
        timestamp = apim.setDatastreamState(pid, dsName, dsState, "ds state is changed.");
    } catch (final RemoteException e) {
        throw new FedoraSystemException("APIM setDatastreamState failure: " + e.getMessage(), e);
    } finally {
        returnApim(apim);
    }
    return timestamp;
}

From source file:de.escidoc.core.common.business.fedora.FedoraUtility.java

/**
 * Get next object IDs from Fedora (Fedora use the name PID for there identifier).
 * /*from w w w .j a v  a2  s.  c  om*/
 * @param noOfPids
 *            Number of IDs which are to request.
 * @return Array with object IDs.
 * @throws FedoraSystemException
 *             Thrown if collection values from Fedora failed.
 */
public String[] getNextPID(final int noOfPids) throws FedoraSystemException {

    String[] pids = null;
    final NonNegativeInteger number = new NonNegativeInteger(String.valueOf(noOfPids));

    final FedoraAPIM apim = borrowApim();
    try {
        pids = apim.getNextPID(number, this.identifierPrefix);
    } catch (final RemoteException e) {
        throw new FedoraSystemException("Unable to get Obids from Fedora: " + e.getMessage(), e);
    } finally {
        returnApim(apim);
    }
    return pids;
}

From source file:com.lp.server.artikel.ejbfac.WebshopItemServiceEjb.java

private ShopgroupsResult getShopGroupsFindIdChangedImpl(WebshopAuthHeader header, Integer shopgruppeIId,
        Timestamp changedStamp, String searchKey) {

    if (!existsShopgroupIIdForWebshopIId(shopgruppeIId))
        return new ShopgroupsResult(BaseRequestResult.ERROR_NOT_FOUND, searchKey);

    try {//w w w  . j a  va 2s  .  c o  m
        ShopgroupsResult sgResult = new ShopgroupsResult();
        List<Shopgruppe> changedShopgruppen = new ArrayList<Shopgruppe>();

        Collection<Shopgruppe> childs = queryChildShopgruppen(shopgruppeIId);
        for (Shopgruppe shopgruppe : childs) {
            if (haveChangedWithChildShopgruppen(shopgruppe, changedStamp)) {
                changedShopgruppen.add(shopgruppe);
            }
        }

        if (childs.size() == 0) {
            Shopgruppe me = em.find(Shopgruppe.class, shopgruppeIId);
            if (me != null) {
                changedShopgruppen.add(me);
            }
        }

        for (Shopgruppe shopgruppe : changedShopgruppen) {
            Object o = CollectionUtils.find(sgResult.getShopgroups(), new ShopgruppeIdPredicate(shopgruppeIId));
            if (o == null) {
                ShopgruppeDto rootShopDto = getArtikelFac().shopgruppeFindByPrimaryKey(shopgruppe.getIId(),
                        webClientDto);
                WebshopShopgroup node = buildWebshopgroup(rootShopDto, changedStamp);
                sgResult.getShopgroups().add(node);
            }
        }

        sgResult.setOkay();
        return sgResult;
    } catch (RemoteException ex) {
        return new ShopgroupsResult(BaseRequestResult.ERROR_RMI_EXCEPTION, ex.getMessage());
    } catch (EJBExceptionLP ex) {
        return new ShopgroupsResult(BaseRequestResult.ERROR_EJB_EXCEPTION + ex.getCode(), searchKey);
    }
}

From source file:com.lp.server.artikel.ejbfac.WebshopItemServiceEjb.java

@Override
public WebshopItemImageResult getItemImage(WebshopAuthHeader header, String itemImageName) {
    if (HelperWebshop.isEmptyString(itemImageName)) {
        return new WebshopItemImageResult(BaseRequestResult.ERROR_NULL_PARAMETER,
                "itemImageName == null (or blank/empty)");
    }/* w  ww .  j av  a 2  s  . co  m*/

    setupSessionParams(header);

    WebshopItemImageResult notFoundResult = new WebshopItemImageResult(BaseRequestResult.ERROR_NOT_FOUND,
            itemImageName);

    itemImageName = itemImageName.trim();
    // Format des Namens:
    // iid-dateiname
    int hyphen = itemImageName.indexOf('-');
    if (hyphen < 0)
        return notFoundResult;
    if (itemImageName.length() <= hyphen)
        return notFoundResult;

    try {
        Integer kommentarIId = Integer.parseInt(itemImageName.substring(0, hyphen));
        ArtikelkommentarDto kommentarDto = getArtikelkommentarFac()
                .artikelkommentarFindByPrimaryKey(kommentarIId, webClientDto);
        if (kommentarDto.getArtikelkommentarsprDto().getCDateiname()
                .equals(itemImageName.substring(hyphen + 1))) {

            WebshopItemImageResult result = new WebshopItemImageResult();
            result.setImage(kommentarDto.getArtikelkommentarsprDto().getOMedia());
            result.setImageName(itemImageName);
            result.setMimeType(kommentarDto.getDatenformatCNr().trim());
            result.setOkay();
            return result;
        }
    } catch (NumberFormatException e) {
        return new WebshopItemImageResult(BaseRequestResult.ERROR_NOT_FOUND, itemImageName);
    } catch (RemoteException re) {
        return new WebshopItemImageResult(BaseRequestResult.ERROR_RMI_EXCEPTION, re.getMessage());
    } catch (EJBExceptionLP ex) {
        return new WebshopItemImageResult(BaseRequestResult.ERROR_EJB_EXCEPTION + ex.getCode(),
                ex.getMessage());
    }

    return notFoundResult;
}

From source file:com.lp.server.artikel.ejbfac.WebshopItemServiceEjb.java

@Override
public ShopgroupsResult getShopGroupsFindAllChanged(WebshopAuthHeader header, String changedDateTime) {
    if (HelperWebshop.isEmptyString(changedDateTime)) {
        return new ShopgroupsResult(BaseRequestResult.ERROR_NULL_PARAMETER,
                "changedDate == null (or blank/empty)");
    }//from  w  ww .  ja  va 2 s . c om
    Date d = HelperWebshop.parseDateTimeString(changedDateTime);
    if (null == d) {
        return new ShopgroupsResult(BaseRequestResult.ERROR_NULL_PARAMETER,
                "Date == null (or illegal format [" + changedDateTime + "])");
    }

    Timestamp changedStamp = new Timestamp(normalizeDateTime(d).getTime());

    List<ShopgruppeDto> changedShopgruppen = new ArrayList<ShopgruppeDto>();
    try {
        setupSessionParams(header);

        ShopgroupsResult sgResult = new ShopgroupsResult();
        List<Shopgruppewebshop> cl = ShopgruppewebshopQuery.listByWebshopId(em, getWebshopIId());
        for (Shopgruppewebshop shopgruppewebshop : cl) {
            ShopgruppeDto shopGruppeDto = getArtikelFac()
                    .shopgruppeFindByPrimaryKey(shopgruppewebshop.getShopgruppeIId(), webClientDto);

            // Hat sich die Shopgruppe selbst geaendert
            if (shopGruppeDto.getTAendern().after(changedStamp)) {
                changedShopgruppen.add(shopGruppeDto);
                continue;
            }

            // Oder ein Artikel in dieser Gruppe?
            Collection<Artikel> artikelCl = artikelFindByShopgroupIId(shopGruppeDto.getIId(), changedStamp);
            if (artikelCl.size() > 0) {
                changedShopgruppen.add(shopGruppeDto);
                continue;
            }
        }

        for (ShopgruppeDto shopgruppeDto : changedShopgruppen) {
            ShopgruppeDto rootShopDto = findRootShopgruppeDto(shopgruppeDto);
            if (rootShopDto != null) {

                Object o = CollectionUtils.find(sgResult.getShopgroups(),
                        new ShopgruppeIdPredicate(rootShopDto.getIId()));
                if (o == null) {
                    WebshopShopgroup node = buildWebshopgroup(rootShopDto, changedStamp);
                    sgResult.getShopgroups().add(node);
                }
            }
        }

        sgResult.setOkay();
        return sgResult;
    } catch (RemoteException ex) {
        return new ShopgroupsResult(BaseRequestResult.ERROR_RMI_EXCEPTION, ex.getMessage());
    } catch (EJBExceptionLP ex) {
        return new ShopgroupsResult(BaseRequestResult.ERROR_EJB_EXCEPTION + ex.getCode(), ex.getMessage());
    }
}

From source file:com.lp.server.artikel.ejbfac.WebshopItemServiceEjb.java

@Override
public ShopgroupsFlatResult getShopGroupsFlatFindAllChanged(WebshopAuthHeader header, String changedDateTime) {
    if (HelperWebshop.isEmptyString(changedDateTime)) {
        return new ShopgroupsFlatResult(BaseRequestResult.ERROR_NULL_PARAMETER,
                "changedDate == null (or blank/empty)");
    }//from  w  w  w.ja va2 s . c om
    Date d = HelperWebshop.parseDateTimeString(changedDateTime);
    if (null == d) {
        return new ShopgroupsFlatResult(BaseRequestResult.ERROR_NULL_PARAMETER,
                "Date == null (or illegal format [" + changedDateTime + "])");
    }

    List<ShopgruppeDto> changedShopgruppen = new ArrayList<ShopgruppeDto>();
    try {
        setupSessionParams(header);

        Timestamp changedStamp = HelperWebshop.normalizeDateTimeAsTimestamp(d, webClientDto.getLocMandant());

        ShopgroupsFlatResult sgResult = new ShopgroupsFlatResult();
        List<Shopgruppewebshop> cl = ShopgruppewebshopQuery.listByWebshopId(em, getWebshopIId());

        for (Shopgruppewebshop shopgruppewebshop : cl) {
            ShopgruppeDto shopGruppeDto = getArtikelFac()
                    .shopgruppeFindByPrimaryKey(shopgruppewebshop.getShopgruppeIId(), webClientDto);

            // Hat sich die Shopgruppe selbst geaendert
            if (shopGruppeDto.getTAendern().after(changedStamp)) {
                changedShopgruppen.add(shopGruppeDto);
                continue;
            }

            // Oder ein Artikel in dieser Gruppe?
            Collection<Artikel> artikelCl = artikelFindByShopgroupIId(shopGruppeDto.getIId(), changedStamp);
            if (artikelCl.size() > 0) {
                changedShopgruppen.add(shopGruppeDto);
                continue;
            }

            // Oder der Referenzartikel
            if (shopGruppeDto.getArtikelIId() != null) {
                List<BmeCatKommentar> kommentare = getArtikelkommentar(shopGruppeDto.getArtikelIId());
                for (BmeCatKommentar bmecatKommentar : kommentare) {
                    if (bmecatKommentar.isChanged(changedStamp)) {
                        changedShopgruppen.add(shopGruppeDto);
                        break;
                    }
                }
            }
        }

        for (ShopgruppeDto shopgruppeDto : changedShopgruppen) {
            WebshopShopgroupFlat node = buildWebshopgroupFlat(shopgruppeDto);
            sgResult.getShopgroups().add(node);
        }

        sgResult.setOkay();
        return sgResult;
    } catch (RemoteException ex) {
        return new ShopgroupsFlatResult(BaseRequestResult.ERROR_RMI_EXCEPTION, ex.getMessage());
    } catch (EJBExceptionLP ex) {
        return new ShopgroupsFlatResult(BaseRequestResult.ERROR_EJB_EXCEPTION + ex.getCode(), ex.getMessage());
    }
}