Package org.fluxtream.core.connectors.annotations

Examples of org.fluxtream.core.connectors.annotations.ObjectTypeSpec


        return isMixedType;
    }

    public static int getObjectTypeValue(final Class<? extends AbstractFacet> facetClass) {
        try {
            final ObjectTypeSpec annotation = facetClass.getAnnotation(ObjectTypeSpec.class);
            final int value = annotation.value();
            return value;
        } catch (Throwable t) {
            final String message = "Could not get Facet ObjectType value for " + facetClass.getName();
            throw new RuntimeException(message);
        }
View Full Code Here


    }

    private static ObjectType getFacetTypeMetadata(final Connector connector,
                                             final Class<? extends AbstractFacet>[] facetTypes,
                                             final Class<? extends AbstractFacet> facetType) {
        ObjectTypeSpec ots = facetType
                .getAnnotation(ObjectTypeSpec.class);
        // objectTypes are mandatory only if there are more than 1
        if (ots == null) {
            if (facetTypes.length>1)
                throw new RuntimeException(
                        "No ObjectTypeSpec Annotation for Facet ["
                        + facetType.getName() + "]");
            else
                return null;
        }
        ObjectType objectType = new ObjectType();
        objectType.facetClass = facetType;
        objectType.value = ots.value();
        objectType.name = ots.name();
        objectType.prettyname = ots.prettyname();
        objectType.isImageType = ots.isImageType();
        objectType.isDateBased = ots.isDateBased();
        objectType.isMixedType = ots.isMixedType();
        objectType.isClientFacet = ots.clientFacet();
        objectType.visibleClause = ots.visibleClause().equals("")?null:ots.visibleClause();
        objectType.orderBy = ots.orderBy().equals("")?null:ots.orderBy();
        if (ots.extractor() != null && ots.extractor()!=AbstractFacetExtractor.class) {
            connector.addObjectTypeExtractorClass(
                    objectType.value, ots.extractor(),
                    ots.parallel());
        }
        return objectType;
    }
View Full Code Here

        query.setParameter(1, apiKey.getId());
        query.executeUpdate();
    }

    private LocationFacet.Source getLocationFacetSource(final Class<? extends AbstractFacet> facetClass) {
        final ObjectTypeSpec objectTypeSpec = facetClass.getAnnotation(ObjectTypeSpec.class);
        final LocationFacet.Source locationFacetSource = objectTypeSpec.locationFacetSource();
        return locationFacetSource;
    }
View Full Code Here

    private PhotoFacetFinderStrategy getPhotoFacetFinderStrategyFromObjectType(final ObjectType objectType) {
        if (objectType != null) {
            try {
                final Class<? extends AbstractFacet> facetClass = objectType.facetClass();
                final ObjectTypeSpec objectTypeSpec = facetClass.getAnnotation(ObjectTypeSpec.class);
                final Class<? extends PhotoFacetFinderStrategy> photoFacetFinderStrategyClass = objectTypeSpec.photoFacetFinderStrategy();
                return beanFactory.getBean(photoFacetFinderStrategyClass);
            }
            catch (Exception e) {
                LOG.error("Exception caught while trying trying to instantiate the PhotoFacetFinderStrategy from objectType [" + objectType + "].  Returning null.", e);
            }
View Full Code Here

        this.timeUpdated = System.currentTimeMillis();
        figureOutObjectType();
    }

    private void figureOutObjectType() {
        ObjectTypeSpec objectType = this.getClass().getAnnotation(ObjectTypeSpec.class);
        if (objectType!=null)
            this.objectType = objectType.value();
        else
            this.objectType = -1;
    }
View Full Code Here

TOP

Related Classes of org.fluxtream.core.connectors.annotations.ObjectTypeSpec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.