Example usage for twitter4j Twitter showUser

List of usage examples for twitter4j Twitter showUser

Introduction

In this page you can find the example usage for twitter4j Twitter showUser.

Prototype

User showUser(long userId) throws TwitterException;

Source Link

Document

Returns extended information of a given user, specified by ID or screen name as per the required id parameter.

Usage

From source file:com.javielinux.twitter.ConnectionManager.java

License:Apache License

private void storeAccessToken(Twitter twitter) {

    try {/*from  w w w .  ja  v  a  2  s .  c  o m*/
        DataFramework.getInstance().open(context, Utils.packageName);
    } catch (Exception e) {
        e.printStackTrace();
    }

    String where = KEY_AUTH_KEY + " = '" + accessTokenOAuth.getToken() + "' AND " + KEY_AUTH_SECRET_KEY + " = '"
            + accessTokenOAuth.getTokenSecret() + "'";

    List<Entity> e = DataFramework.getInstance().getEntityList("users", where);

    if (e.size() == 0) {
        DataFramework.getInstance().getDB().execSQL("UPDATE users SET active = 0");

        Entity ent = new Entity("users");
        ent.setValue("service", "twitter.com");
        try {
            ent.setValue("name", twitter.getScreenName());
            ent.setValue("fullname", twitter.showUser(twitter.getId()).getName());
            ent.setValue("user_id", twitter.getId());

            ent.setValue(KEY_AUTH_KEY, accessTokenOAuth.getToken());
            ent.setValue(KEY_AUTH_SECRET_KEY, accessTokenOAuth.getTokenSecret());

        } catch (IllegalStateException e1) {
            e1.printStackTrace();
        } catch (TwitterException e1) {
            e1.printStackTrace();
        }

        ent.setValue("active", 1);

        ent.setValue("last_timeline_id", 0);
        ent.setValue("last_mention_id", 0);
        ent.setValue("last_direct_id", 0);

        ent.save();

        loadUsers();

        try {
            User user = twitter.showUser(ent.getInt("user_id"));

            Bitmap avatar = BitmapFactory.decodeStream(
                    new Utils.FlushedInputStream(new URL(user.getProfileImageURL()).openStream()));

            if (avatar != null) {
                String file = ImageUtils.getFileAvatar(ent.getId());
                FileOutputStream out = new FileOutputStream(file);
                avatar.compress(Bitmap.CompressFormat.JPEG, 90, out);
                avatar.recycle();
            }

        } catch (IllegalStateException ex) {
            ex.printStackTrace();
        } catch (TwitterException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        } catch (Exception ex) {
            ex.printStackTrace();
        }

    }

    DataFramework.getInstance().close();
}

From source file:com.klinker.android.twitter.activities.profile_viewer.fragments.ProfileFragment.java

License:Apache License

public void getData(final TextView statement, final AsyncListView listView) {

    Thread getData = new Thread(new Runnable() {
        @Override/* w  w w.  ja  v a  2 s  . co  m*/
        public void run() {
            Twitter twitter = Utils.getTwitter(context, settings);
            try {
                Log.v("talon_profile", "start of load time: " + Calendar.getInstance().getTimeInMillis());
                if (!isMyProfile) {
                    thisUser = twitter.showUser(screenName);
                } else {
                    if (settings.myId == 0) {
                        try {
                            thisUser = twitter.showUser(settings.myScreenName);
                        } catch (Exception e) {
                            // the user has changed their screen name, so look for the id
                            ((Activity) context).runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    Toast.makeText(context,
                                            context.getResources().getString(R.string.changed_screenname),
                                            Toast.LENGTH_LONG).show();

                                    spinner.setVisibility(View.GONE);
                                    canRefresh = false;
                                    hasMore = false;
                                }
                            });
                        }
                        return;
                    } else {
                        thisUser = twitter.showUser(settings.myId);
                    }

                    // update the profile picture url and the background url in shared prefs
                    int currentAccount = sharedPrefs.getInt("current_account", 1);

                    SharedPreferences.Editor e = sharedPrefs.edit();
                    e.putString("twitter_users_name_" + currentAccount, thisUser.getName()).commit();
                    e.putString("twitter_screen_name_" + currentAccount, thisUser.getScreenName()).commit();
                    e.putLong("twitter_id_" + currentAccount, thisUser.getId()).commit();
                    e.putString("profile_pic_url_" + currentAccount, thisUser.getOriginalProfileImageURL());
                    e.putString("twitter_background_url_" + currentAccount, thisUser.getProfileBannerURL());
                    e.commit();
                }

                ((Activity) context).runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            if (thisUser.isVerified()) {
                                if (settings.addonTheme) {
                                    verified.setVisibility(View.VISIBLE);
                                    verified.setText(getResources().getString(R.string.verified));
                                } else {
                                    verified.setVisibility(View.VISIBLE);
                                    verified.setText(getResources().getString(R.string.verified));
                                }
                            }

                            String state = thisUser.getDescription() + "\n";
                            String loca = thisUser.getLocation();

                            if (!loca.equals("")) {
                                state += "\n" + thisUser.getLocation();
                            }

                            if (state.equals("")) {
                                statement.setText(getResources().getString(R.string.no_description));
                            } else {
                                statement.setText(state);
                            }

                            if (!settings.addonTheme) {
                                statement.setLinkTextColor(getResources().getColor(R.color.app_color));
                            } else {
                                statement.setLinkTextColor(settings.accentInt);
                            }

                            tweetsBtn.setText(getResources().getString(R.string.tweets) + "\n" + "("
                                    + thisUser.getStatusesCount() + ")");
                            followersBtn.setText(getResources().getString(R.string.followers) + "\n" + "("
                                    + thisUser.getFollowersCount() + ")");
                            followingBtn.setText(getResources().getString(R.string.following) + "\n" + "("
                                    + thisUser.getFriendsCount() + ")");

                            getURL(statement, thisUser);
                            getTimeline(thisUser, listView);
                        } catch (Exception e) {
                            // Illegal state because the activity is destroyed
                        }
                    }
                });
            } catch (Exception e) {
                e.printStackTrace();
                ((Activity) context).runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            if (thisUser != null && thisUser.isProtected()) {
                                Toast.makeText(context, getResources().getString(R.string.protected_account),
                                        Toast.LENGTH_SHORT).show();
                                if (settings.roundContactImages) {
                                    ImageUtils.loadSizedCircleImage(context, profilePicture,
                                            thisUser.getOriginalProfileImageURL(), mCache, 96);
                                } else {
                                    ImageUtils.loadImage(context, profilePicture,
                                            thisUser.getOriginalProfileImageURL(), mCache);
                                }

                                String url = thisUser.getProfileBannerURL();
                                ImageUtils.loadImage(context, background, url, mCache);
                            } else {
                                Toast.makeText(context,
                                        getResources().getString(R.string.error_loading_timeline),
                                        Toast.LENGTH_SHORT).show();
                            }
                            spinner.setVisibility(View.GONE);
                        } catch (Exception e) {
                            // not attached to activity
                        }
                        canRefresh = false;
                        hasMore = false;
                    }
                });
            }
        }
    });

    getData.setPriority(Thread.MAX_PRIORITY);
    getData.start();
}

From source file:com.klinker.android.twitter.activities.profile_viewer.ProfilePager.java

License:Apache License

public void getUser() {
    Thread getUser = new Thread(new Runnable() {
        @Override// ww  w.  j  av  a 2 s  .co  m
        public void run() {
            try {
                Twitter twitter = Utils.getTwitter(context, settings);
                thisUser = twitter.showUser(screenName);
            } catch (Exception e) {
                thisUser = null;
            }

            if (thisUser != null) {
                try {
                    FollowersDataSource.getInstance(context).createUser(thisUser,
                            sharedPrefs.getInt("current_account", 1));

                } catch (Exception e) {
                    // the user already exists. don't know if this is more efficient than querying the db or not.
                }

                final SearchRecentSuggestions suggestions = new SearchRecentSuggestions(context,
                        MySuggestionsProvider.AUTHORITY, MySuggestionsProvider.MODE);
                suggestions.saveRecentQuery("@" + thisUser.getScreenName(), null);
            }

            new GetActionBarInfo().execute();
        }
    });

    getUser.setPriority(Thread.MAX_PRIORITY);
    getUser.start();
}

From source file:com.klinker.android.twitter.utils.text.TouchableSpan.java

License:Apache License

public void longClickMentions() {
    AlertDialog.Builder builder = getBuilder();

    builder.setItems(R.array.long_click_mentions, new DialogInterface.OnClickListener() {
        @Override/*ww w . j av a  2s  .com*/
        public void onClick(DialogInterface dialogInterface, int i) {
            final SharedPreferences sharedPrefs = mContext.getSharedPreferences(
                    "com.klinker.android.twitter_world_preferences",
                    Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE);

            switch (i) {
            case 0: // open profile
                TouchableSpan.this.onClick(null);
                break;
            case 1: // copy handle
                copy();
                break;
            case 2: // search user
                search();
                break;
            case 3: // favorite user
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            Twitter twitter = Utils.getTwitter(mContext, settings);
                            User user = twitter.showUser(full.replace("@", ""));

                            int current = sharedPrefs.getInt("current_account", 1);

                            FavoriteUsersDataSource.getInstance(mContext).createUser(user, current);

                            sharedPrefs.edit()
                                    .putString("favorite_user_names_" + current,
                                            sharedPrefs.getString("favorite_user_names_" + current, "")
                                                    + user.getScreenName() + " ")
                                    .commit();
                        } catch (Exception e) {

                        }
                    }
                }).start();
                break;
            case 4: // mute user
                String current = sharedPrefs.getString("muted_users", "");
                sharedPrefs.edit()
                        .putString("muted_users", current + full.replaceAll(" ", "").replaceAll("@", "") + " ")
                        .commit();
                sharedPrefs.edit().putBoolean("refresh_me", true).commit();
                sharedPrefs.edit().putBoolean("just_muted", true).commit();
                if (mContext instanceof DrawerActivity) {
                    ((Activity) mContext).recreate();
                }
                break;
            case 5: // mute retweets
                String muted_rts = sharedPrefs.getString("muted_rts", "");
                sharedPrefs.edit()
                        .putString("muted_rts", muted_rts + full.replaceAll(" ", "").replaceAll("@", "") + " ")
                        .commit();
                sharedPrefs.edit().putBoolean("refresh_me", true).commit();
                sharedPrefs.edit().putBoolean("just_muted", true).commit();
                if (mContext instanceof DrawerActivity) {
                    ((Activity) mContext).recreate();
                }
                break;
            case 6: // share profile
                share("https://twitter.com/" + full.replace("@", "").replace(" ", ""));
                break;
            }
        }
    });

    builder.create().show();
}

From source file:com.michaelstark.twitteroauth.OAuthCallbackServlet.java

/**
 * Handles the HTTP <code>GET</code> method.
 *
 * @param request servlet request// w w  w.ja  va  2 s .c om
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String verificationToken = request.getParameter("oauth_verifier");

    HttpSession session = request.getSession(true);

    // Get the stored Twitter client from LoginServlet.
    Twitter twitter = (Twitter) session.getAttribute("twitterClient");

    // Get the saved request token.
    RequestToken requestToken = (RequestToken) session.getAttribute("requestToken");

    try {
        // Get an access token so we can do stuff.
        AccessToken accessToken = twitter.getOAuthAccessToken(requestToken, verificationToken);

        // Store the access token for later.
        session.setAttribute("accessToken", accessToken);

        // Configure the Twitter client to use our access token.
        twitter.setOAuthAccessToken(accessToken);

        // Get the current user info from Twitter and store it in the session.
        session.setAttribute("user", twitter.showUser(twitter.getScreenName()));
    } catch (TwitterException e) {
        logger.log(Level.SEVERE, "Could not get the user info: ", e);
    }

    request.getRequestDispatcher("/index.jsp").forward(request, response);
}

From source file:com.oldterns.vilebot.handlers.user.UrlTweetAnnouncer.java

License:Open Source License

/**
 * Accesses the source of a HTML page and looks for a title element
 * //from   w  ww .  j av a2 s . com
 * @param url http tweet String
 * @return String of text which represents the tweet.  Empty if error.
 */
private String scrapeURLHTMLTitle(String url) {
    String text = "";

    URL page;
    try {
        page = new URL(url);
    } catch (MalformedURLException x) {
        // System.err.format("scrapeURLHTMLTitle new URL error: %s%n", x);
        return text;
    }

    //split the url into pieces, change the request based on what we have
    String parts[] = url.split("/");
    int userPosition = 0;
    long tweetID = 0;
    for (int i = 0; i < parts.length; i++) {

        if (parts[i].toString().equals("twitter.com"))
            userPosition = i + 1;
        if (parts[i].toString().equals("status") || parts[i].toString().equals("statuses"))
            tweetID = Long.valueOf(parts[i + 1].toString()).longValue();
    }
    if (userPosition == 0)
        return text;
    else {
        try {
            String consumerKey = ""; //may be known as 'API key'
            String consumerSecret = ""; //may be known as 'API secret'
            String accessToken = ""; //may be known as 'Access token'
            String accessTokenSecret = ""; //may be known as 'Access token secret'
            ConfigurationBuilder cb = new ConfigurationBuilder();
            cb.setDebugEnabled(true).setOAuthConsumerKey(consumerKey).setOAuthConsumerSecret(consumerSecret)
                    .setOAuthAccessToken(accessToken).setOAuthAccessTokenSecret(accessTokenSecret);
            TwitterFactory tf = new TwitterFactory(cb.build());
            Twitter twitter = tf.getInstance();
            if (tweetID != 0) //tweet of the twitter.com/USERID/status/TWEETID variety
            {
                Status status = twitter.showStatus(tweetID);
                return (status.getUser().getName() + ": " + status.getText());
            } else //just the user is given, ie, twitter.com/USERID 
            {
                User user = twitter.showUser(parts[userPosition].toString());
                if (!user.getDescription().isEmpty()) //the user has a description
                    return ("Name: " + user.getName() + " | " + user.getDescription() + "\'\nLast Tweet: \'"
                            + user.getStatus().getText());
                else //the user doesn't have a description, don't print it
                    return ("Name: " + user.getName() + "\'\nLast Tweet: \'" + user.getStatus().getText());

            }
        } catch (TwitterException x) {
            return text;
        }
    }
}

From source file:com.rsinghal.cep.sample.facebook.StreamCollector1.java

License:Apache License

public void start() {

    Twitter twitter = TwitterFactory.getSingleton();
    twitter.setOAuthConsumer(consumerKey, consumerSecret);
    twitter.setOAuthAccessToken(new AccessToken(accessToken, accessTokenSecret));

    long[] userIdsToTrack = new long[trackTerms.size()];
    for (int i = 0; i < trackTerms.size(); i++) {
        try {// ww w.  ja v  a  2  s  .  c  om
            String screenName = StringUtils.substringAfter(trackTerms.get(i), "@");
            logger.info("Fetching user ID for - " + screenName);
            userIdsToTrack[i] = twitter.showUser(screenName).getId();
        } catch (TwitterException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    twitter = null;

    twitterStream.setOAuthAccessToken(new AccessToken(accessToken, accessTokenSecret));
    twitterStream.setOAuthConsumer(consumerKey, consumerSecret);
    twitterStream.addListener(listener2);
    // sample() method internally creates a thread which manipulates TwitterStream and calls these adequate listener methods continuously.
    twitterStream.filter(new FilterQuery(0, userIdsToTrack, trackTerms.toArray(new String[trackTerms.size()])));

    System.out.println("start() ...");
    /*   // Create an appropriately sized blocking queue
       BlockingQueue<String> queue = new LinkedBlockingQueue<String>(10000);
               
       // create the endpoint
       DefaultStreamingEndpoint endpoint = createEndpoint();
       System.out.println("endpoint created ...");
            
       endpoint.stallWarnings(false);
            
       // create an authentication
       Authentication auth = new OAuth1(consumerKey, consumerSecret, accessToken, accessTokenSecret);
            
       // Create a new BasicClient. By default gzip is enabled.
       client = new ClientBuilder().name("sampleExampleClient")
    .hosts(Constants.STREAM_HOST).endpoint(endpoint)
    .authentication(auth)
    .processor(new StringDelimitedProcessor(queue)).build();
       System.out.println("client created ...");
            
       // Create an executor service which will spawn threads to do the actual
       // work of parsing the incoming messages and
       // calling the listeners on each message
       ExecutorService service = Executors
    .newFixedThreadPool(this.numberOfProcessingThreads);
            
       // Wrap our BasicClient with the twitter4j client
       Twitter4jStatusClient t4jClient = new Twitter4jStatusClient(client,
    queue, Lists.newArrayList(listener2), service);
            
       // Establish a connection
       t4jClient.connect();
               
       System.out.println("connection established ...");
            
       for (int threads = 0; threads < this.numberOfProcessingThreads; threads++) {
          // This must be called once per processing thread
          t4jClient.process();
          System.out.println("thread " + threads + " started ...");
            
       }*/
}

From source file:com.rsinghal.cep.sample.twitter.StreamCollector1.java

License:Apache License

public void start() {

    Twitter twitter = TwitterFactory.getSingleton();
    twitter.setOAuthConsumer(consumerKey, consumerSecret);
    twitter.setOAuthAccessToken(new AccessToken(accessToken, accessTokenSecret));

    long[] userIdsToTrack = new long[trackTerms.size()];
    for (int i = 0; i < trackTerms.size(); i++) {
        try {//  w  w w .  jav a 2  s.  co m
            String screenName = StringUtils.substringAfter(trackTerms.get(i), "@");
            logger.info("Fetching user ID for - " + screenName);
            userIdsToTrack[i] = twitter.showUser(screenName).getId();
        } catch (TwitterException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    twitter = null;
    twitterStream.setOAuthConsumer(consumerKey, consumerSecret);
    twitterStream.setOAuthAccessToken(new AccessToken(accessToken, accessTokenSecret));

    twitterStream.addListener(listener2);
    // sample() method internally creates a thread which manipulates TwitterStream and calls these adequate listener methods continuously.
    twitterStream.filter(new FilterQuery(0, userIdsToTrack, trackTerms.toArray(new String[trackTerms.size()])));

    System.out.println("start() ...");
    /*   // Create an appropriately sized blocking queue
       BlockingQueue<String> queue = new LinkedBlockingQueue<String>(10000);
               
       // create the endpoint
       DefaultStreamingEndpoint endpoint = createEndpoint();
       System.out.println("endpoint created ...");
            
       endpoint.stallWarnings(false);
            
       // create an authentication
       Authentication auth = new OAuth1(consumerKey, consumerSecret, accessToken, accessTokenSecret);
            
       // Create a new BasicClient. By default gzip is enabled.
       client = new ClientBuilder().name("sampleExampleClient")
    .hosts(Constants.STREAM_HOST).endpoint(endpoint)
    .authentication(auth)
    .processor(new StringDelimitedProcessor(queue)).build();
       System.out.println("client created ...");
            
       // Create an executor service which will spawn threads to do the actual
       // work of parsing the incoming messages and
       // calling the listeners on each message
       ExecutorService service = Executors
    .newFixedThreadPool(this.numberOfProcessingThreads);
            
       // Wrap our BasicClient with the twitter4j client
       Twitter4jStatusClient t4jClient = new Twitter4jStatusClient(client,
    queue, Lists.newArrayList(listener2), service);
            
       // Establish a connection
       t4jClient.connect();
               
       System.out.println("connection established ...");
            
       for (int threads = 0; threads < this.numberOfProcessingThreads; threads++) {
          // This must be called once per processing thread
          t4jClient.process();
          System.out.println("thread " + threads + " started ...");
            
       }*/
}

From source file:com.speed.traquer.app.TraqComplaintTaxi.java

private void checkTwitterID() {

    /* Get Access Token after login*/
    try {//from  www.  ja  v  a2 s . c om
        ConfigurationBuilder builder = new ConfigurationBuilder();
        builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY);
        builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET);

        // Access Token
        String access_token = mSharedPreferences.getString(PREF_KEY_OAUTH_TOKEN, "");
        // Access Token Secret
        String access_token_secret = mSharedPreferences.getString(PREF_KEY_OAUTH_SECRET, "");

        AccessToken accessToken = new AccessToken(access_token, access_token_secret);
        Twitter twitter = new TwitterFactory(builder.build()).getInstance(accessToken);

        // Getting user details from twitter
        // For now i am getting his name only
        twitterID = accessToken.getUserId();
        User user = twitter.showUser(twitterID);

        userName = user.getName();

        //Toast.makeText(TraqComplaintTaxi.this, Long.toString(twitterID) + userName, Toast.LENGTH_SHORT).show();
        // Displaying in xml ui
        //lblUserName.setText(Html.fromHtml("<b>Welcome " + username + "</b>" + description));

    } catch (TwitterException e) {
        // Error in updating status
        Log.d("Twitter Update Error", e.getMessage());
    } catch (Exception e) {
        // Error in updating status
        Log.d("error!", e.getMessage());
    }
}

From source file:com.stronquens.amgtwitter.ControllerTwitter.java

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods./* ww w  .j  av  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 {
    response.setContentType("text/html;charset=UTF-8");
    try (PrintWriter out = response.getWriter()) {
        // Obtenemos parametros de la peticion
        String op = request.getParameter("op");
        String accesToken = request.getParameter("token");
        String accesTokenSecret = request.getParameter("secret");

        // Inicializamos variables
        String jsonResult = "";
        Twitter twitter = null;
        ConfigurationBuilder configBuilder = new ConfigurationBuilder();
        Gson gson = new GsonBuilder().setDateFormat("dd/MM/yyyy HH:mm:ss").create();

        // Se crea la instancia de twitter segun los parametros de ususario
        if (!"".equalsIgnoreCase(accesToken) && !"".equalsIgnoreCase(accesTokenSecret)) {
            try {
                configBuilder.setDebugEnabled(true).setOAuthConsumerKey("nyFJnGU5NfN7MLuGufXhAcPTf")
                        .setOAuthConsumerSecret("QOofP3lOC7ytKutfoexCyh3zDVIFNHoMuuuKI98S78XmeGvqgW")
                        .setOAuthAccessToken(accesToken).setOAuthAccessTokenSecret(accesTokenSecret);
                twitter = new TwitterFactory(configBuilder.build()).getInstance();
            } catch (Exception e) {
                System.out.println(e);
            }
        } else {
            try {
                configBuilder.setDebugEnabled(true).setOAuthConsumerKey("nyFJnGU5NfN7MLuGufXhAcPTf")
                        .setOAuthConsumerSecret("QOofP3lOC7ytKutfoexCyh3zDVIFNHoMuuuKI98S78XmeGvqgW");
                twitter = new TwitterFactory(configBuilder.build()).getInstance();
            } catch (Exception e) {
                System.out.println(e);
            }
        }

        // Se realizan las diferentes operaciones
        switch (op) {
        case "timeline":
            try {
                Paging pagina = new Paging();
                pagina.setCount(25);
                ResponseList listado = twitter.getHomeTimeline(pagina);
                jsonResult = gson.toJson(listado);
            } catch (TwitterException ex) {
                System.out.println(ex);
            }
            break;
        case "usersettings":
            try {
                jsonResult = gson.toJson(twitter.showUser(twitter.getId()));
            } catch (TwitterException ex) {
                System.out.println(ex);
            }
            break;
        case "pruebas":
            try {
                jsonResult = gson.toJson(twitter.showUser(twitter.getId()));
            } catch (TwitterException ex) {
                System.out.println(ex);
            }
            break;
        default:
            jsonResult = "{\"eror\":\"la operacion no existe\"}";
        }
        // Se devuelven los valores
        out.println(jsonResult);
    }
}