Example usage for com.google.common.collect ComputationException ComputationException

List of usage examples for com.google.common.collect ComputationException ComputationException

Introduction

In this page you can find the example usage for com.google.common.collect ComputationException ComputationException.

Prototype

public ComputationException(@Nullable Throwable cause) 

Source Link

Document

Creates a new instance with the given cause.

Usage

From source file:com.isotrol.impe3.pms.core.impl.ExternalServicesServiceImpl.java

/**
 * @see com.isotrol.impe3.pms.api.esvc.ExternalServicesService#getServices(com.isotrol.impe3.pms.api.esvc.ExternalServiceType)
 *//*from   ww w.j  a  v  a2  s. c om*/
@Transactional(rollbackFor = Throwable.class)
public List<ExternalServiceDTO> getServices(ExternalServiceType type) throws PMSException {
    checkNotNull(type);
    final Class<?> klass = checkNotNull(TYPES.get(type));
    final ContextGlobal ctx = loadContextGlobal();
    final Set<Provider> providers = ctx.getPossibleProviders(klass);
    final Function<Provider, ExternalServiceDTO> f = new Function<Provider, ExternalServiceDTO>() {
        public ExternalServiceDTO apply(Provider from) {
            try {
                final UUID cnnId = from.getConnectorId();
                final ConnectorObject cnn = ctx.loadConnector(cnnId);
                final ExternalServiceDTO dto = new ExternalServiceDTO();
                dto.setId(cnnId.toString().toLowerCase() + ":" + from.getBean());
                cnn.fill(dto);
                return dto;
            } catch (PMSException e) {
                throw new ComputationException(e);
            }
        }
    };
    return BY_NAME.sortedCopy(Iterables.transform(providers, f));
}

From source file:org.openengsb.core.common.VirtualConnectorFactory.java

@Override
public Connector applyAttributes(Connector instance, Map<String, String> attributes) {
    VirtualType handler = handlers.get(instance);
    Collection<String> mixins = Maps.filterKeys(attributes, new Predicate<String>() {
        @Override/*from w  w  w.j  a  va  2  s. c  om*/
        public boolean apply(String s) {
            return s.startsWith("mixin.");
        }
    }).values();
    Collection<Class<?>> mixinClasses = Collections2.transform(mixins, new Function<String, Class<?>>() {
        @Override
        public Class<?> apply(String input) {
            try {
                return getClass().getClassLoader().loadClass(input);
            } catch (ClassNotFoundException e) {
                throw new ComputationException(e);
            }
        }
    });
    instance = createProxy(handler, mixinClasses);
    updateHandlerAttributes(handler, attributes);
    return instance;
}

From source file:com.isotrol.impe3.pms.core.obj.CIPsObject.java

List<ComponentInPageTemplateDTO> toTemplate(final ContextPortal ctx) {
    final Function<UUID, ComponentInPageTemplateDTO> toCIP = new Function<UUID, ComponentInPageTemplateDTO>() {
        public ComponentInPageTemplateDTO apply(UUID from) {
            try {
                final CIPObject cip = hierarchy.get(from);
                final ComponentInPageTemplateDTO dto = cip.toTemplate(ctx);
                dto.setChildren(Mappers.list(hierarchy.getChildrenKeys(from), this));
                return dto;
            } catch (PMSException e) {
                throw new ComputationException(e);
            }//from  ww  w .  j a v a  2s .c  om
        }
    };
    return Mappers.list(hierarchy.getFirstLevelKeys(), toCIP);
}