if (controlOperation.equals("GET_OAUTH_REQUEST_URL")) {
// get and store AuthURL in plugin config to be rederend on UI
ctrlResult.getComplexResults().put(new PropertySimple("authorizationURL", getAuthorizationURL()));
} else if (controlOperation.equals("GET_ACCESS_TOKEN")) {
AccessToken accessToken = null;
String pin = operationConfig.getSimpleValue("pin", null);
log.debug("using PIN [" + pin + "]");
if (pin != null && pin.length() > 0) {
accessToken = this.twitter.getOAuthAccessToken(requestToken, pin);
} else {
accessToken = this.twitter.getOAuthAccessToken();
}
log.debug("ScreenName: " + twitter.getScreenName());
log.debug("TwitterId: [" + twitter.verifyCredentials().getId() + "]");
log.debug("token: [" + accessToken.getToken() + "]");
log.debug("tokenSecret: [" + accessToken.getTokenSecret() + "]");
// Save the accessToken for future use by this plugin.
String filePath = storeAccessToken(accessToken);
ctrlResult.getComplexResults().put(
new PropertySimple("accessToken", "token[" + accessToken.getToken() + "] tokenSecret["
+ accessToken.getTokenSecret() + ""));
ctrlResult.getComplexResults().put(new PropertySimple("twitterScreenName", twitter.getScreenName()));
ctrlResult.getComplexResults().put(new PropertySimple("accessTokenFilePath", filePath));
} else {
ctrlResult.setError("Invalid Operation! Please Select a valid one.");
}