Package org.encuestame.utils.enums

Examples of org.encuestame.utils.enums.EmbeddedType


        try {
            @SuppressWarnings("rawtypes")
            final Map model = new HashMap();
            final String domain = WidgetUtil.getRelativeDomain(request);
            final TypeSearchResult typeItem = TypeSearchResult.getTypeSearchResult(type);
            final EmbeddedType embeddedType = EmbeddedType.getEmbeddedType(embedded);
            final JavascriptEmbebedBody embebedBody = new JavascriptEmbebedBody();
            final ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
            response.setContentType("text/javascript; charset=UTF-8");
            model.put("domain", domain);
            model.put("embedded_type", embeddedType.toString().toLowerCase());
            model.put("typeItem", typeItem.toString().toLowerCase());
            model.put("itemId", itemId);
            model.put("class_type", TypeSearchResult.getCSSClass(typeItem));
            model.put("domain_config", WidgetUtil.getDomain(request, true));
            if (TypeSearchResult.TWEETPOLL.equals(typeItem)) {
                final TweetPoll tp = getTweetPollService().getTweetPollById(itemId);
                model.put("url", EnMeUtils.createTweetPollUrlAccess(domain, tp));
            } else if (TypeSearchResult.POLL.equals(typeItem)) {
                final Poll poll = getPollService().getPollById(itemId);
                model.put("url", EnMeUtils.createUrlPollAccess(domain, poll));
            } else if (TypeSearchResult.TWEETPOLLRESULT.equals(typeItem)) {
                final TweetPoll tp = getTweetPollService().getTweetPollById(itemId);
                model.put("url", EnMeUtils.createTweetPollUrlAccess(domain, tp));
            } else if (TypeSearchResult.POLLRESULT.equals(typeItem)) {
                final Poll poll = getPollService().getPollById(itemId);
                model.put("url", EnMeUtils.createUrlPollAccess(domain, poll));
            } else if (TypeSearchResult.HASHTAG.equals(typeItem)) {
                //FUTURE:
                model.put("url", "");
            } else if (TypeSearchResult.PROFILE.equals(typeItem)) {
                final UserAccount user = getSecurityService().getUserbyId(itemId);
                model.put("url", domain + "/profile/" + user.getUsername());
            }
            text = VelocityEngineUtils.mergeTemplateIntoString(
                    velocityEngine, CODE_TEMPLATES  + embeddedType.toString().toLowerCase() +"_code.vm", "utf-8", model);
            String string = new String(text.getBytes("UTF-8"));
            embebedBody.setBody(string);
            final String json = ow.writeValueAsString(embebedBody);
            out.print(callback + "(" + json + ")");
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.encuestame.utils.enums.EmbeddedType

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.