Package org.jboss.aerogear.unifiedpush.api

Examples of org.jboss.aerogear.unifiedpush.api.Variant


    @Override
    public void delete(Variant variant) {
        entityManager.createQuery("delete from Installation i where i.variant = :variant")
                .setParameter("variant", variant).executeUpdate();
        Variant entity = entityManager.find(Variant.class, variant.getId());
        remove(entity);
    }
View Full Code Here



    @Override
    public Variant findByVariantID(String variantID) {

        Variant entity = getSingleResultForQuery(createQuery("select t from Variant t where t.variantID = :variantID")
                .setParameter("variantID", variantID));

        return entity;
    }
View Full Code Here

    }

    @Override
    public Variant findByVariantIDForDeveloper(String variantID, String loginName) {

        Variant entity = getSingleResultForQuery(createQuery("select t from Variant t where t.variantID = :variantID and t.developer = :developer")
                .setParameter("variantID", variantID)
                .setParameter("developer", loginName));


        return entity;
View Full Code Here

                .setParameter("variantIDs", variantIDs).getResultList();
    }

    @Override
    public Variant find(String id) {
        Variant entity = entityManager.find(Variant.class, id);
        return entity;
    }
View Full Code Here

        final List<Installation> resultList = entityManager.createQuery("from Installation i where i.variant = :variant", Installation.class)
                .setParameter("variant", variant).getResultList();
        for (Installation installation : resultList) {
            entityManager.remove(installation);
        }
        Variant entity = entityManager.find(Variant.class, variant.getId());
        remove(entity);
    }
View Full Code Here


    @Override
    public Variant findByVariantID(String variantID) {

        Variant entity = getSingleResultForQuery(createQuery("select t from Variant t where t.variantID = :variantID")
                .setParameter("variantID", variantID));

        return entity;
    }
View Full Code Here

    }

    @Override
    public Variant findByVariantIDForDeveloper(String variantID, String loginName) {

        Variant entity = getSingleResultForQuery(createQuery("select t from Variant t where t.variantID = :variantID and t.developer = :developer")
                .setParameter("variantID", variantID)
                .setParameter("developer", loginName));


        return entity;
View Full Code Here

                .setParameter("variantIDs", variantIDs).getResultList();
    }

    @Override
    public Variant find(String id) {
        Variant entity = entityManager.find(Variant.class, id);
        return entity;
    }
View Full Code Here

        // if the criteria payload did specify the "variants" field,
        // we look up each of those mentioned variants, by their "variantID":
        if (variantIDs != null) {

            for (String variantID : variantIDs) {
                Variant variant = genericVariantService.findByVariantID(variantID);

                // does the variant exist ?
                if (variant != null) {
                    variants.add(variant);
                }
            }
        } else {
            // No specific variants have been requested,
            // we get all the variants, from the given PushApplicationEntity:
            variants.addAll(pushApplication.getVariants());
        }

        // all possible criteria
        final List<String> categories = criteria.getCategories();
        final List<String> aliases = criteria.getAliases();
        final List<String> deviceTypes = criteria.getDeviceTypes();

        // let's check if we actually have data for native platforms!
        if (message.getData() != null) {

            // TODO: DISPATCH TO A QUEUE .....
            for (final Variant variant : variants) {
                final List<String> tokenPerVariant = clientInstallationService.findAllDeviceTokenForVariantIDByCriteria(variant.getVariantID(), categories, aliases, deviceTypes);

                // extracting the size for our counters
                final int tokenSize = tokenPerVariant.size();
                senders.select(new SenderTypeLiteral(variant.getClass())).get().sendPushMessage(variant, tokenPerVariant, message, new NotificationSenderCallback() {
                    @Override
                    public void onSuccess() {
                        logger.log(Level.FINE, String.format("Sent '%s' message to '%d' devices", variant.getType().getTypeName(), tokenSize));
                        updateStatusOfPushMessageInformation(pushMessageInformation, variant.getVariantID(), tokenSize, Boolean.TRUE);
                    }

                    @Override
                    public void onError(final String reason) {
                        logger.log(Level.WARNING, String.format("Error on '%s' delivery", variant.getType().getTypeName()));
                        updateStatusOfPushMessageInformation(pushMessageInformation, variant.getVariantID(), tokenSize, Boolean.FALSE, reason);
                    }
                });

            }
        }
View Full Code Here

        // if the criteria payload did specify the "variants" field,
        // we look up each of those mentioned variants, by their "variantID":
        if (variantIDs != null) {

            for (String variantID : variantIDs) {
                Variant variant = genericVariantService.findByVariantID(variantID);

                // does the variant exist ?
                if (variant != null) {

                    // based on type, we store in the matching collection
                    switch (variant.getType()) {
                    case ANDROID:
                        androidVariants.add((AndroidVariant) variant);
                        break;
                    case IOS:
                        iOSVariants.add((iOSVariant) variant);
View Full Code Here

TOP

Related Classes of org.jboss.aerogear.unifiedpush.api.Variant

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.