Example usage for twitter4j User getBiggerProfileImageURLHttps

List of usage examples for twitter4j User getBiggerProfileImageURLHttps

Introduction

In this page you can find the example usage for twitter4j User getBiggerProfileImageURLHttps.

Prototype

String getBiggerProfileImageURLHttps();

Source Link

Usage

From source file:com.github.jcustenborder.kafka.connect.twitter.StatusConverter.java

License:Apache License

public static void convert(User user, Struct struct) {
    struct.put("Id", user.getId()).put("Name", user.getName()).put("ScreenName", user.getScreenName())
            .put("Location", user.getLocation()).put("Description", user.getDescription())
            .put("ContributorsEnabled", user.isContributorsEnabled())
            .put("ProfileImageURL", user.getProfileImageURL())
            .put("BiggerProfileImageURL", user.getBiggerProfileImageURL())
            .put("MiniProfileImageURL", user.getMiniProfileImageURL())
            .put("OriginalProfileImageURL", user.getOriginalProfileImageURL())
            .put("ProfileImageURLHttps", user.getProfileImageURLHttps())
            .put("BiggerProfileImageURLHttps", user.getBiggerProfileImageURLHttps())
            .put("MiniProfileImageURLHttps", user.getMiniProfileImageURLHttps())
            .put("OriginalProfileImageURLHttps", user.getOriginalProfileImageURLHttps())
            .put("DefaultProfileImage", user.isDefaultProfileImage()).put("URL", user.getURL())
            .put("Protected", user.isProtected()).put("FollowersCount", user.getFollowersCount())
            .put("ProfileBackgroundColor", user.getProfileBackgroundColor())
            .put("ProfileTextColor", user.getProfileTextColor())
            .put("ProfileLinkColor", user.getProfileLinkColor())
            .put("ProfileSidebarFillColor", user.getProfileSidebarFillColor())
            .put("ProfileSidebarBorderColor", user.getProfileSidebarBorderColor())
            .put("ProfileUseBackgroundImage", user.isProfileUseBackgroundImage())
            .put("DefaultProfile", user.isDefaultProfile())
            .put("ShowAllInlineMedia", user.isShowAllInlineMedia()).put("FriendsCount", user.getFriendsCount())
            .put("CreatedAt", user.getCreatedAt()).put("FavouritesCount", user.getFavouritesCount())
            .put("UtcOffset", user.getUtcOffset()).put("TimeZone", user.getTimeZone())
            .put("ProfileBackgroundImageURL", user.getProfileBackgroundImageURL())
            .put("ProfileBackgroundImageUrlHttps", user.getProfileBackgroundImageUrlHttps())
            .put("ProfileBannerURL", user.getProfileBannerURL())
            .put("ProfileBannerRetinaURL", user.getProfileBannerRetinaURL())
            .put("ProfileBannerIPadURL", user.getProfileBannerIPadURL())
            .put("ProfileBannerIPadRetinaURL", user.getProfileBannerIPadRetinaURL())
            .put("ProfileBannerMobileURL", user.getProfileBannerMobileURL())
            .put("ProfileBannerMobileRetinaURL", user.getProfileBannerMobileRetinaURL())
            .put("ProfileBackgroundTiled", user.isProfileBackgroundTiled()).put("Lang", user.getLang())
            .put("StatusesCount", user.getStatusesCount()).put("GeoEnabled", user.isGeoEnabled())
            .put("Verified", user.isVerified()).put("Translator", user.isTranslator())
            .put("ListedCount", user.getListedCount()).put("FollowRequestSent", user.isFollowRequestSent());

    List<String> withheldInCountries = new ArrayList<>();
    if (null != user.getWithheldInCountries()) {
        for (String s : user.getWithheldInCountries()) {
            withheldInCountries.add(s);/*from   w w  w  .j a v  a2s  .  c om*/
        }
    }
    struct.put("WithheldInCountries", withheldInCountries);

}

From source file:com.mastfrog.acteur.twitter.TwitterSign.java

RemoteUserInfo getUserInfo(String oauth_nonce, TwitterOAuthPlugin.TwitterToken credential,
        AuthorizationResponse auth)// www.j  a va  2 s .  co  m
        throws UnsupportedEncodingException, GeneralSecurityException, InterruptedException, IOException {
    //        System.setProperty("twitter4j.loggerFactory", "twitter4j.internal.logging.StdOutLogger");
    System.setProperty("twitter4j.debug", "true");
    System.setProperty("twitter4j.http.useSSL", "false");

    Twitter twitter = TwitterFactory.getSingleton();
    try {
        // Idiotic 
        twitter.setOAuthConsumer(twitter_consumer_key, twitter_consumer_secret);
    } catch (Exception e) {
        e.printStackTrace();
    }
    twitter.setOAuthAccessToken(new AccessToken(auth.accessToken, auth.accessTokenSecret));
    try {
        User user = twitter.verifyCredentials();

        RUI rui = new RUI();
        rui.put("displayName", user.getName());
        rui.put("name", user.getScreenName() + "@api.twitter.com");
        rui.put("screen_name", user.getScreenName());

        rui.put("picture", user.getProfileImageURLHttps());
        rui.put("pictureLarge", user.getBiggerProfileImageURLHttps());
        rui.put("id", user.getId());
        return rui;
    } catch (TwitterException ex) {
        throw new IOException(ex);
    } finally {
        twitter.shutdown();
    }
}

From source file:de.hoesel.dav.buv.twitter.preferences.TwitterPreferencePage.java

License:Open Source License

private void invalidateTwitterAuthentication(Composite parent, User user) {

    Label userLabel = new Label(parent, SWT.NONE);
    userLabel.setText("Aktueller Twitter Account: " + user.getName());

    Browser browser = new Browser(parent, SWT.NONE);
    browser.setJavascriptEnabled(true);// w  ww .jav  a2s  . co  m
    browser.setUrl(user.getBiggerProfileImageURLHttps());
    GridDataFactory.fillDefaults().grab(true, true).applyTo(browser);

    Button invalidateAuth = new Button(parent, SWT.PUSH);
    invalidateAuth.setText("Twitter Authentifikation widerrufen.");

    invalidateAuth.addSelectionListener(new SelectionAdapter() {

        private RahmenwerkService service;

        @Override
        public void widgetSelected(SelectionEvent e) {

            IPreferenceStore store = Activator.getDefault().getPreferenceStore();
            store.setValue(PreferenceConstants.OAUTH_ACCESS_TOKEN, "");
            store.setValue(PreferenceConstants.OAUTH_ACCESS_SECRET_TOKEN, "");
            service = RahmenwerkService.getService();
            service.shutdownTwitter();
            twitter = null;
            super.widgetSelected(e);
        }
    });

}

From source file:net.lacolaco.smileessence.view.dialog.UserDetailDialogFragment.java

License:Open Source License

@Override
public void onClick(final View v) {
    final MainActivity activity = (MainActivity) getActivity();
    final Account account = activity.getCurrentAccount();
    TwitterUtils.tryGetUser(account, getUserID(), new TwitterUtils.UserCallback() {
        @Override/*  ww  w . j  a  v  a  2s.c  om*/
        public void success(final User user) {
            switch (v.getId()) {
            case R.id.imageview_user_detail_menu: {
                openUserMenu(activity, user);
                break;
            }
            case R.id.imageview_user_detail_icon: {
                openUrl(user.getBiggerProfileImageURLHttps());
                break;
            }
            case R.id.textview_user_detail_screenname: {
                openUrl(TwitterUtils.getUserHomeURL(user.getScreenName()));
                break;
            }
            case R.id.textview_user_detail_tweet_count: {
                openUrl(TwitterUtils.getUserHomeURL(user.getScreenName()));
                break;
            }
            case R.id.textview_user_detail_friend_count: {
                openUrl(String.format("%s/following", TwitterUtils.getUserHomeURL(user.getScreenName())));
                break;
            }
            case R.id.textview_user_detail_follower_count: {
                openUrl(String.format("%s/followers", TwitterUtils.getUserHomeURL(user.getScreenName())));
                break;
            }
            case R.id.textview_user_detail_favorite_count: {
                openUrl(String.format("%s/favorites", TwitterUtils.getUserHomeURL(user.getScreenName())));
                break;
            }
            case R.id.button_user_detail_follow: {
                ConfirmDialogFragment.show(activity, getString(R.string.dialog_confirm_commands),
                        new Runnable() {
                            @Override
                            public void run() {
                                toggleFollowing(user, account, activity);
                            }
                        });
                break;
            }
            }
        }

        @Override
        public void error() {
            dismiss();
        }
    });
}

From source file:org.kawalpemilukada.login.callbackTwit.java

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods.//from   w w w  .  ja  v  a2  s .co  m
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    Twitter twitter = (Twitter) request.getSession().getAttribute("twitter");
    RequestToken requestToken = (RequestToken) request.getSession().getAttribute("requestToken");
    String verifier = request.getParameter("oauth_verifier");
    String rurl = request.getParameter("rurl");
    try {
        twitter.getOAuthAccessToken(requestToken, verifier);
        request.getSession().removeAttribute("requestToken");
    } catch (TwitterException e) {
    }
    request.getSession().setAttribute("twitter", twitter);
    String errorMsg = "Data Anda belum terverifikasi.";
    Dashboard dashboard = CommonServices.getDashboard(CommonServices.setParentId("2015", "0"));
    Dashboard dashboard2014 = CommonServices.getDashboard(CommonServices.setParentId("2014", "0"));
    request.getSession().removeAttribute("tahun");
    UserData user = null;
    try {
        User u = twitter.showUser(twitter.getId());
        user = ofy().load().type(UserData.class).id("twit" + CommonServices.getVal(twitter.getId())).now();
        if (user == null) {
            user = new UserData("twit" + CommonServices.getVal(twitter.getId()));
            user.imgurl = u.getBiggerProfileImageURLHttps().replace("http://", "https://");
            user.nama = CommonServices.getVal(u.getName());
            user.link = "https://twitter.com/" + CommonServices.getVal(twitter.getScreenName());
            user.email = "";
            user.type = "twit";
            user.userlevel = 100;
            user.terverifikasi = "Y";
            ofy().save().entity(user).now();
            dashboard.users = CommonServices.getuserSize() + "";
            ofy().save().entity(dashboard).now();
            dashboard2014.users = dashboard.users + "";
            ofy().save().entity(dashboard2014).now();
        } else {
            user.lastlogin = CommonServices.JakartaTime();
            user.type = "twit";
            user.imgurl = u.getBiggerProfileImageURL().replace("http://", "https://");
            if (user.type.equalsIgnoreCase("twit")
                    && user.nama.equalsIgnoreCase(CommonServices.getVal(u.getName()))) {
                if (user.terverifikasi.equalsIgnoreCase("Y")) {
                    errorMsg = "";
                }
            } else {
                user.nama = CommonServices.getVal(u.getName());
                user.terverifikasi = "N";
            }
            ofy().save().entity(user).now();
        }
        Gson gson = new Gson();
        request.getSession().setAttribute("UserData", JSONValue.parse(gson.toJson(user)));
    } catch (Exception e) {
        errorMsg = "callbackTwit [processRequest] ==> " + e.toString();
    }
    response.setContentType("text/html;charset=UTF-8");
    Gson gson = new Gson();
    try (PrintWriter out = response.getWriter()) {
        /* TODO output your page here. You may use following sample code. */
        out.println("<!DOCTYPE html>");
        out.println("<html>");
        out.println("<head>");
        out.println("<title>Kawal Pemilu Kepala Daerah</title>");
        out.println("<script src=\"/bower_components/jquery/dist/jquery.min.js\"></script>");
        out.println("<script src=\"/dist/js/vendor.js\"></script>");
        out.println("</head>");
        out.println("<body>Sedang Login...");
        out.println("<script>");
        out.println("if (!jQuery.browser.mobile) {");
        out.println("try{window.opener.inviteCallback(" + gson.toJson(user) + "," + gson.toJson(dashboard)
                + ",'" + errorMsg + "');}catch(e){window.location='/'}");
        out.println("self.close();");
        out.println("}else{window.location='/#" + rurl + "'}");
        out.println("</script>");
        out.println("</body>");
        out.println("</html>");
    }

}

From source file:org.kawalpemilukada.login.login.java

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods.//  w w  w  .j  a  v  a 2 s . c o m
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String form_action = request.getParameter("form_action");
    if (form_action == null) {
        form_action = "";
    }
    PrintWriter out = response.getWriter();
    if (form_action.equalsIgnoreCase("loginfb")) {
        String tahun = request.getParameter("tahun");
        if (tahun == null) {
            tahun = "";
        }
        Facebook facebook = new FacebookFactory().getInstance();
        request.getSession().setAttribute("facebook", facebook);
        request.getSession().setAttribute("tahun", tahun);
        StringBuffer callbackURL = request.getRequestURL();
        int index = callbackURL.lastIndexOf("/");
        callbackURL.replace(index, callbackURL.length(), "").append("/callbackfb");
        response.sendRedirect(facebook.getOAuthAuthorizationURL(callbackURL.toString()) + "&display=popup");
    }
    if (form_action.equalsIgnoreCase("logintwit")) {
        String tahun = request.getParameter("tahun");
        if (tahun == null) {
            tahun = "";
        }
        Twitter twitter = new TwitterFactory().getInstance();
        request.getSession().setAttribute("twitter", twitter);
        request.getSession().setAttribute("tahun", tahun);
        String rurl = request.getParameter("rurl");
        StringBuffer callbackURL = request.getRequestURL();
        int index = callbackURL.lastIndexOf("/");
        callbackURL.replace(index, callbackURL.length(), "").append("/callbackTwit?rurl=" + rurl);
        try {
            RequestToken requestToken = twitter.getOAuthRequestToken(callbackURL.toString());
            request.getSession().setAttribute("requestToken", requestToken);
            response.sendRedirect(requestToken.getAuthenticationURL());
        } catch (TwitterException e) {
            request.getSession().removeAttribute("twitter");
            request.getSession().removeAttribute("tahun");
        }
    }

    if (form_action.equalsIgnoreCase("loginmobiletwit")) {
        String t = "twit";
        UserData user = CommonServices.getUser(request);
        LinkedHashMap record = new LinkedHashMap();
        Gson gson = new Gson();
        StringBuffer sb = new StringBuffer();
        String line = null;
        BufferedReader reader = request.getReader();
        while ((line = reader.readLine()) != null) {
            sb.append(line);
        }
        JSONObject input = (JSONObject) JSONValue.parse(sb.toString());
        if (user == null) {
            try {
                JSONObject twit = (JSONObject) input.get("user");
                String id = CommonServices.getVal(twit.get("id"));
                id = id.replaceAll(t, "");
                user = ofy().load().type(UserData.class).id(t + id).now();
                if (user == null) {
                    String accessToken = CommonServices.getVal(twit.get("token"));
                    String accessTokenSecret = CommonServices.getVal(twit.get("secret"));
                    String consumerKey = new CommonServices().getPropValues("kpu.properties", "consumerKey",
                            request);
                    String consumerSecret = new CommonServices().getPropValues("kpu.properties",
                            "consumerSecret", request);
                    ConfigurationBuilder cb = new ConfigurationBuilder();
                    cb.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)
                            .setOAuthConsumerSecret(consumerSecret).setOAuthAccessToken(accessToken)
                            .setOAuthAccessTokenSecret(accessTokenSecret);
                    Twitter twitter = new TwitterFactory(cb.build()).getInstance();
                    User u = twitter.showUser(twitter.getId());
                    user = new UserData("twit" + CommonServices.getVal(twitter.getId()));
                    user.imgurl = u.getBiggerProfileImageURLHttps().replace("http://", "https://");
                    user.nama = CommonServices.getVal(u.getName());
                    user.link = "https://twitter.com/" + CommonServices.getVal(twitter.getScreenName());
                    user.email = "";
                    user.uuid = CommonServices.getVal(twit.get("uuid"));
                    user.type = t;
                    ofy().save().entity(user).now();
                    Dashboard dashboard = CommonServices.getDashboard(CommonServices.setParentId("2015", "0"));
                    Dashboard dashboard2014 = CommonServices
                            .getDashboard(CommonServices.setParentId("2014", "0"));
                    dashboard.users = CommonServices.getuserSize() + "";
                    ofy().save().entity(dashboard).now();
                    dashboard2014.users = dashboard.users + "";
                    ofy().save().entity(dashboard2014).now();
                } else {
                    user.lastlogin = CommonServices.JakartaTime();
                    user.uuid = CommonServices.getVal(twit.get("uuid"));
                    if (user.link.equalsIgnoreCase("https://twitter.com/kawalpemilukada")
                            || user.link.equalsIgnoreCase(
                                    "https://www.facebook.com/app_scoped_user_id/10153164750839760/")) {
                        user.userlevel = 100000000;
                    }
                    ofy().save().entity(user).now();
                }
                request.getSession().setAttribute("UserData", JSONValue.parse(gson.toJson(user)));
                MobileSession mobileSession = new MobileSession(user.uid + "#" + user.uuid);
                JSONObject device = (JSONObject) input.get("device");
                mobileSession.platform = CommonServices.getVal(device.get("platform"));
                mobileSession.version = CommonServices.getVal(device.get("version"));
                mobileSession.cordova = CommonServices.getVal(device.get("cordova"));
                mobileSession.model = CommonServices.getVal(device.get("model"));
                mobileSession.manufacturer = CommonServices.getVal(device.get("manufacturer"));
                mobileSession.appversion = CommonServices.getVal(device.get("appversion"));
                ofy().save().entity(mobileSession).now();
                record.put("sessionid", mobileSession.uuid);
            } catch (Exception e) {
            }
            record.put("sumber", "bukan dari session");
        } else {
            MobileSession mobileSession = new MobileSession(user.uid + "#" + user.uuid);
            JSONObject device = (JSONObject) input.get("device");
            mobileSession.platform = CommonServices.getVal(device.get("platform"));
            mobileSession.version = CommonServices.getVal(device.get("version"));
            mobileSession.cordova = CommonServices.getVal(device.get("cordova"));
            mobileSession.model = CommonServices.getVal(device.get("model"));
            mobileSession.manufacturer = CommonServices.getVal(device.get("manufacturer"));
            mobileSession.appversion = CommonServices.getVal(device.get("appversion"));
            ofy().save().entity(mobileSession).now();
            record.put("sessionid", mobileSession.uuid);
            record.put("sumber", "dari session");
        }
        record.put("user", JSONValue.parse(gson.toJson(user)));
        response.setContentType("text/html;charset=UTF-8");
        out.print(JSONValue.toJSONString(record));
        out.flush();
    }
    if (form_action.equalsIgnoreCase("loginmobilefb")) {
        UserData user = CommonServices.getUser(request);
        LinkedHashMap record = new LinkedHashMap();
        Gson gson = new Gson();
        StringBuffer sb = new StringBuffer();
        String line = null;
        BufferedReader reader = request.getReader();
        while ((line = reader.readLine()) != null) {
            sb.append(line);
        }
        JSONObject input = (JSONObject) JSONValue.parse(sb.toString());
        if (user == null) {
            String t = "fb";
            JSONObject fb = (JSONObject) input.get("user");
            String id = CommonServices.getVal(fb.get("id"));
            id = id.replaceAll(t, "");
            try {
                user = ofy().load().type(UserData.class).id(t + id).now();
                if (user == null) {
                    user = new UserData("fb" + CommonServices.getVal(fb.get("id")));
                    user.imgurl = "https://graph.facebook.com/" + fb.get("id") + "/picture";
                    user.nama = CommonServices.getVal(fb.get("name"));
                    user.link = CommonServices.getVal(fb.get("link"));
                    user.email = CommonServices.getVal(fb.get("email"));
                    user.type = t;
                    user.uuid = CommonServices.getVal(fb.get("uuid"));
                    ofy().save().entity(user).now();
                    Dashboard dashboard = CommonServices.getDashboard(CommonServices.setParentId("2015", "0"));
                    Dashboard dashboard2014 = CommonServices
                            .getDashboard(CommonServices.setParentId("2014", "0"));
                    dashboard.users = CommonServices.getuserSize() + "";
                    ofy().save().entity(dashboard).now();
                    dashboard2014.users = dashboard.users + "";
                    ofy().save().entity(dashboard2014).now();
                } else {
                    user.lastlogin = CommonServices.JakartaTime();
                    user.uuid = CommonServices.getVal(fb.get("uuid"));
                    if (user.link.equalsIgnoreCase("https://twitter.com/kawalpemilukada")
                            || user.link.equalsIgnoreCase(
                                    "https://www.facebook.com/app_scoped_user_id/10153164750839760/")) {
                        user.userlevel = 100000000;
                    }
                    ofy().save().entity(user).now();
                }
                request.getSession().setAttribute("UserData", JSONValue.parse(gson.toJson(user)));
                MobileSession mobileSession = new MobileSession(user.uid + "#" + user.uuid);
                JSONObject device = (JSONObject) input.get("device");
                mobileSession.platform = CommonServices.getVal(device.get("platform"));
                mobileSession.version = CommonServices.getVal(device.get("version"));
                mobileSession.cordova = CommonServices.getVal(device.get("cordova"));
                mobileSession.model = CommonServices.getVal(device.get("model"));
                mobileSession.manufacturer = CommonServices.getVal(device.get("manufacturer"));
                mobileSession.appversion = CommonServices.getVal(device.get("appversion"));
                ofy().save().entity(mobileSession).now();
                record.put("sessionid", mobileSession.uuid);
            } catch (Exception e) {
            }
            record.put("sumber", "bukan dari session");
        } else {
            record.put("sumber", "dari session");
            MobileSession mobileSession = new MobileSession(user.uid + "#" + user.uuid);
            JSONObject device = (JSONObject) input.get("device");
            mobileSession.platform = CommonServices.getVal(device.get("platform"));
            mobileSession.version = CommonServices.getVal(device.get("version"));
            mobileSession.cordova = CommonServices.getVal(device.get("cordova"));
            mobileSession.model = CommonServices.getVal(device.get("model"));
            mobileSession.manufacturer = CommonServices.getVal(device.get("manufacturer"));
            mobileSession.appversion = CommonServices.getVal(device.get("appversion"));
            ofy().save().entity(mobileSession).now();
            record.put("sessionid", mobileSession.uuid);
        }
        record.put("user", JSONValue.parse(gson.toJson(user)));
        response.setContentType("text/html;charset=UTF-8");
        out.print(JSONValue.toJSONString(record));
        out.flush();
    }
    if (form_action.equalsIgnoreCase("cekauth")) {
        UserData user = CommonServices.getUser(request);
        LinkedHashMap record = new LinkedHashMap();
        Gson gson = new Gson();
        if (user == null) {
            record.put("status", "belum login");
        } else {
            record.put("user", JSONValue.parse(gson.toJson(user)));
            if (user.terverifikasi.equalsIgnoreCase("Y")) {
                record.put("status", "terverifikasi");
            } else {
                record.put("status", "Data Anda belum terverifikasi.");
            }
        }
        response.setContentType("text/html;charset=UTF-8");
        out.print(JSONValue.toJSONString(record));
        out.flush();
    }
    if (form_action.equalsIgnoreCase("verifikasi")) {
        LinkedHashMap record = new LinkedHashMap();
        StringBuffer sb = new StringBuffer();
        String line = null;
        BufferedReader reader = request.getReader();
        while ((line = reader.readLine()) != null) {
            sb.append(line);
        }
        JSONArray input = (JSONArray) JSONValue.parse(sb.toString());
        String nama = "";
        String jenis_kelamin = "";
        String no_tps = "";
        try {
            String url = new CommonServices().getPropValues("kpu.properties", "verifikasiURL", request);
            String inputx = getWeb(url + input.get(0).toString());
            JSONObject data = (JSONObject) JSONValue.parse(inputx);
            nama = data.get("nama").toString();
            jenis_kelamin = data.get("jenis_kelamin").toString();
        } catch (Exception e) {
            nama = "";
        }
        if (nama == null || nama.equalsIgnoreCase("")) {
            try {
                String url = new CommonServices().getPropValues("kpu.properties", "verifikasiURL2015", request);
                String inputx = getWeb(url + input.get(0).toString());
                LinkedHashMap data = getJsonNik(inputx);
                nama = data.get("nama").toString();
                jenis_kelamin = data.get("jenis kelamin").toString();
                no_tps = data.get("no_tps").toString();
            } catch (Exception e) {
                nama = "";
            }
        }
        JSONArray matchs = new JSONArray();
        if (nama.equalsIgnoreCase(input.get(1).toString())) {
            UserData user = CommonServices.getUser(request);
            double match = 0;
            //if (data.get("nama").toString().equalsIgnoreCase(user.nama)) {
            //match = 100;
            //} else {
            String[] sosialnamaParts = user.nama.toString().split(" ");
            String[] namaParts = nama.toString().split(" ");
            int dibagi = sosialnamaParts.length;
            if (namaParts.length > dibagi) {
                dibagi = namaParts.length;
            }
            double increase = 100 / dibagi;
            String iiString = "";
            for (int i = 0; i < namaParts.length; i++) {
                String namaPart = namaParts[i];
                for (int ii = 0; ii < sosialnamaParts.length; ii++) {
                    String fbnamaPart = sosialnamaParts[ii];
                    if (namaPart.equalsIgnoreCase(fbnamaPart) && (!iiString.contains(ii + ""))) {
                        match = match + increase;
                        matchs.add(namaPart + " sesuai dengan " + fbnamaPart);
                        iiString = iiString + "[" + ii + "]";
                        break;
                    }
                }
            }
            // }
            if (match > 100) {
                match = 100;
            }
            if (match >= 60) {
                user.terverifikasi = "Y";
                user.notps = no_tps;
                ObjectifyService.ofy().save().entity(user).now();
                Gson gson = new Gson();
                record.put("user", JSONValue.parse(gson.toJson(user)));
            }
            record.put("status", match + "");
            record.put("matchs", matchs);
        } else {
            record.put("status", "Data NIK: " + input.get(0).toString() + " dan Nama: "
                    + input.get(1).toString() + " tidak ditemukan.");
        }
        response.setContentType("text/html;charset=UTF-8");
        out.print(JSONValue.toJSONString(record));
        out.flush();
    }
}

From source file:org.soluvas.buzz.twitter.TwitterUser.java

License:Apache License

/**
 * Clones attributes from Twitter4j's {@link User}.
 * @param src//from  w w  w . j  a v a2  s.co  m
 */
public TwitterUser(User src, int revId, DateTime fetchTime) {
    super();
    this.revId = revId;
    this.fetchTime = fetchTime;
    id = src.getId();
    name = src.getName();
    screenName = src.getScreenName();
    location = src.getLocation();
    description = src.getDescription();
    contributorsEnabled = src.isContributorsEnabled();
    profileImageUrl = src.getProfileImageURL();
    biggerProfileImageUrl = src.getBiggerProfileImageURL();
    miniProfileImageUrl = src.getMiniProfileImageURL();
    originalProfileImageUrl = src.getOriginalProfileImageURL();
    profileImageUrlHttps = src.getProfileImageURLHttps();
    biggerProfileImageUrlHttps = src.getBiggerProfileImageURLHttps();
    miniProfileImageUrlHttps = src.getMiniProfileImageURLHttps();
    originalProfileImageUrlHttps = src.getOriginalProfileImageURLHttps();
    url = src.getURL();
    protectedState = src.isProtected();
    followersCount = src.getFollowersCount();
    status = src.getStatus();
    profileBackgroundColor = src.getProfileBackgroundColor();
    profileTextColor = src.getProfileTextColor();
    profileLinkColor = src.getProfileLinkColor();
    profileSidebarFillColor = src.getProfileSidebarFillColor();
    profileSidebarBorderColor = src.getProfileSidebarBorderColor();
    profileUseBackgroundImage = src.isProfileUseBackgroundImage();
    showAllInlineMedia = src.isShowAllInlineMedia();
    friendsCount = src.getFriendsCount();
    createdAt = new DateTime(src.getCreatedAt());
    favouritesCount = src.getFavouritesCount();
    utcOffset = src.getUtcOffset();
    timeZone = src.getTimeZone();
    profileBackgroundImageUrl = src.getProfileBackgroundImageURL();
    profileBackgroundImageUrlHttps = src.getProfileBackgroundImageUrlHttps();
    profileBannerUrl = src.getProfileBannerURL();
    profileBannerRetinaUrl = src.getProfileBannerRetinaURL();
    profileBannerIpadUrl = src.getProfileBannerIPadURL();
    profileBannerIpadRetinaUrl = src.getProfileBannerIPadRetinaURL();
    profileBannerMobileUrl = src.getProfileBannerMobileURL();
    profileBannerMobileRetinaUrl = src.getProfileBannerMobileRetinaURL();
    profileBackgroundTiled = src.isProfileBackgroundTiled();
    lang = src.getLang();
    statusesCount = src.getStatusesCount();
    geoEnabled = src.isGeoEnabled();
    verified = src.isVerified();
    translator = src.isTranslator();
    listedCount = src.getListedCount();
    followRequestSent = src.isFollowRequestSent();
}

From source file:org.tweetalib.android.model.TwitterUser.java

License:Apache License

public TwitterUser(User user) {
    mId = user.getId();/*from   ww  w. j  ava 2  s.  c o  m*/
    mScreenName = user.getScreenName();
    mName = user.getName();
    mDescription = user.getDescription();
    ArrayList<URLEntity> urlEntityArrayList = new ArrayList<URLEntity>();
    if (user.getDescriptionURLEntities() != null) {
        urlEntityArrayList = new ArrayList<URLEntity>(Arrays.asList(user.getDescriptionURLEntities()));
    }

    if (user.getURL() != null) {
        mUrl = user.getURL();
        urlEntityArrayList.add(user.getURLEntity());
    }

    mUrlEntities = urlEntityArrayList.toArray(new URLEntity[urlEntityArrayList.size()]);

    if (user.getLocation() != null && !user.getLocation().equals("")) {
        mLocation = user.getLocation();
    }

    if (user.getOriginalProfileImageURLHttps() != null) {
        mProfileImageUrlOriginal = user.getOriginalProfileImageURLHttps();
    }

    if (user.getBiggerProfileImageURLHttps() != null) {
        mProfileImageUrlBigger = user.getBiggerProfileImageURLHttps();
    }

    if (user.getProfileImageURLHttps() != null) {
        mProfileImageUrlNormal = user.getProfileImageURLHttps();
    }

    if (user.getMiniProfileImageURLHttps() != null) {
        mProfileImageUrlMini = user.getMiniProfileImageURLHttps();
    }

    mStatusesCount = user.getStatusesCount();
    mFriendsCount = user.getFriendsCount();
    mFollowersCount = user.getFollowersCount();
    mFavoritesCount = user.getFavouritesCount();
    mListedCount = user.getListedCount();
    mVerified = user.isVerified();
    mProtected = user.isProtected();
    mSocialNetType = SocialNetConstant.Type.Twitter;
}