List of usage examples for org.springframework.social.facebook.api Facebook userOperations
UserOperations userOperations();
From source file:org.meruvian.yama.service.social.facebook.FacebookSocialManager.java
@Override public User createUser(Connection<?> connection) { Facebook facebook = (Facebook) connection.getApi(); FacebookProfile profile = facebook.userOperations().getUserProfile(); String alphanumeric = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; String randomUsername = RandomStringUtils.random(4, alphanumeric); DefaultUser user = new DefaultUser(); user.setUsername(profile.getFirstName() + profile.getLastName() + randomUsername); user.getName().setFirst(profile.getFirstName()); user.getName().setLast(profile.getLastName()); user.getName().setMiddle(profile.getMiddleName()); user.setEmail(profile.getEmail());//from ww w . j a v a2s . c o m String password = RandomStringUtils.random(8, alphanumeric); user.setPassword(password); return user; }
From source file:com.bg.jtown.social.facebook.PostToWallAfterSignInInterceptor.java
public void postConnect(Connection<Facebook> connection, WebRequest request) { try {// w w w. j a va 2 s . com Facebook facebook = connection.getApi(); FacebookProfile fp = facebook.userOperations().getUserProfile(); String username = fp.getEmail(); Boolean facebookFeed = loginService.selectFacebookFeed(username); if (facebookFeed != null && facebookFeed) { String message = fp.getName() + "? (Mirros) :: ? ? ? ."; // String sex = fp.getGender().equals("male") ? "2" : "1"; FacebookLink link = new FacebookLink("https://www.mirros.net", " :: ? ? ", "", "? ? .\n? , ? ?!"); facebook.feedOperations().postLink(message, link); } } catch (OperationNotPermittedException e) { Facebook facebook = connection.getApi(); FacebookProfile fp = facebook.userOperations().getUserProfile(); String username = fp.getEmail(); JtownUser jtownUser = new JtownUser(); jtownUser.setUsername(username); loginService.updateFacebookFeed(jtownUser); } catch (ApiException e) { e.printStackTrace(); logger.debug("PostConnect Catch"); } }
From source file:com.bg.jtown.social.facebook.PostToWallAfterConnectInterceptor.java
public void postConnect(Connection<Facebook> connection, WebRequest request) { try {/*w w w . jav a2 s . co m*/ Facebook facebook = connection.getApi(); FacebookProfile fp = facebook.userOperations().getUserProfile(); String username = fp.getEmail(); Boolean facebookFeed = loginService.selectFacebookFeed(username); if (facebookFeed != null && facebookFeed) { String message = fp.getName() + "? (Mirros) :: ? ? ? ."; // String sex = fp.getGender().equals("male") ? "2" : "1"; FacebookLink link = new FacebookLink("https://www.mirros.net", " :: ? ? ", "", "? ? .\n? , ? ?!"); facebook.feedOperations().postLink(message, link); } } catch (OperationNotPermittedException e) { Facebook facebook = connection.getApi(); FacebookProfile fp = facebook.userOperations().getUserProfile(); String username = fp.getEmail(); JtownUser jtownUser = new JtownUser(); jtownUser.setUsername(username); loginService.updateFacebookFeed(jtownUser); } catch (ApiException e) { logger.debug("PostConnect Catch"); } }
From source file:org.meruvian.yama.social.facebook.FacebookService.java
@Override public User createUser(Connection<?> connection) { Facebook facebook = (Facebook) connection.getApi(); org.springframework.social.facebook.api.User profile = facebook.userOperations().getUserProfile(); String randomUsername = RandomStringUtils.randomAlphanumeric(6); User user = new User(); user.setUsername(StringUtils.join(profile.getFirstName(), profile.getLastName(), randomUsername)); user.getName().setFirst(profile.getFirstName()); user.getName().setLast(profile.getLastName()); user.getName().setMiddle(profile.getMiddleName()); user.setEmail(profile.getEmail());//from w ww . j av a 2s . c om if (StringUtils.isBlank(profile.getEmail())) { user.setEmail(StringUtils.join(profile.getId(), "@facebook.com")); } user.setPassword(RandomStringUtils.randomAlphanumeric(8)); FileInfo fileInfo = new FileInfo(); fileInfo.setDataBlob( new ByteArrayInputStream(facebook.userOperations().getUserProfileImage(ImageType.NORMAL))); user.setFileInfo(fileInfo); return user; }
From source file:architecture.ee.web.community.spring.controller.FacebookController.java
@RequestMapping(value = "/user/lookup.json", method = RequestMethod.POST) @ResponseBody//from ww w .ja va 2 s.c o m public FacebookProfile lookupUser( @RequestParam(value = "userId", defaultValue = "", required = false) String userId) throws Exception { SocialConnect account = getSocialConnect(SecurityHelper.getUser(), Media.FACEBOOK); Facebook api = (Facebook) account.getConnection().getApi(); UserOperations userOperations = api.userOperations(); if (StringUtils.isNotBlank(userId)) return userOperations.getUserProfile(userId); else return userOperations.getUserProfile(); }
From source file:org.socialsignin.showcase.SocialSignInShowcaseController.java
@RequestMapping("/protected") public String helloProtectedWorld(Map model) { List<String> profileUrls = new ArrayList<String>(); LastFm lastFm = lastFmProviderService.getAuthenticatedApi(); if (lastFm != null) { profileUrls.add(lastFm.userOperations().getUserProfile().getUrl()); }//from ww w .j a v a 2s. c o m Facebook facebook = facebookProviderService.getAuthenticatedApi(); if (facebook != null) { profileUrls.add(facebook.userOperations().getUserProfile().getLink()); } Twitter twitter = twitterProviderService.getAuthenticatedApi(); if (twitter != null) { profileUrls.add(twitter.userOperations().getUserProfile().getProfileUrl()); } Mixcloud mixcloud = mixcloudProviderService.getAuthenticatedApi(); if (mixcloud != null) { profileUrls.add(mixcloud.meOperations().getUserProfile().getUrl()); } SoundCloud soundCloud = soundCloudProviderService.getAuthenticatedApi(); if (soundCloud != null) { profileUrls.add(soundCloud.meOperations().getUserProfile().getPermalinkUrl()); } LinkedIn linkedIn = linkedInProviderService.getAuthenticatedApi(); if (linkedIn != null) { profileUrls.add(linkedIn.profileOperations().getProfileUrl()); } Tumblr tumblr = tumblrProviderService.getAuthenticatedApi(); if (tumblr != null) { List<UserInfoBlog> blogs = tumblr.userOperations().info().getBlogs(); if (blogs != null && blogs.size() > 0) { profileUrls.add(blogs.get(0).getUrl()); } } model.put("profileUrls", profileUrls); return "protectedPage"; }
From source file:com.ssn.app.loader.SplashDemo.java
/** * @param args the command line arguments *///from w w w.j av a 2 s . c om //public static void main(String[] args) { public SplashDemo() { // TODO code application logic here logger.info("SplashDemo Start : "); splashInit(); // initialize splash overlay drawing parameters appInit(); // simulate what an application would do // before starting HttpURLConnection conn = null; boolean isLoggedIn = SSNHelper.isLoggedInWithSocial(); if (isLoggedIn) { Map<String, Object> map = SSNHelper.deserializeAccessToken(); SSNLoginModel loginModel = new SSNLoginModel(); if (map.keySet().contains("Facebook")) { AccessGrant accessGrant = (AccessGrant) map.get("Facebook"); FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory( SSNConstants.SSN_FACEBOOK_API_KEY, SSNConstants.SSN_FACEBOOK_SECRET_KEY); Connection<Facebook> facebookConnection = connectionFactory.createConnection(accessGrant); Facebook facebook = facebookConnection.getApi(); FacebookProfile userProfile = facebook.userOperations().getUserProfile(); SSNSocialModel model = null; try { model = SSNDao.findUserByUsernname(userProfile.getName(), "Facebook"); } catch (SQLException ex) { java.util.logging.Logger.getLogger(SplashDemo.class.getName()).log(Level.SEVERE, null, ex); } SSNLoginResponse loginResponse = loginModel.processSSNSocialLogin(userProfile.getFirstName(), "Facebook", userProfile.getId() + ""); SSNHomeForm homeForm = new SSNHomeForm(null, loginResponse, model, accessGrant, "Facebook"); // homeForm.setFacebookAccessGrant(accessGrant); } else if (map.keySet().contains("Twitter")) { OAuthToken oAuthToken = (OAuthToken) map.get("Twitter"); Twitter twitter = new TwitterTemplate(SSNConstants.SSN_TWITTER_API_KEY, SSNConstants.SSN_TWITTER_SECRET_KEY, oAuthToken.getValue(), oAuthToken.getSecret()); TwitterProfile userProfile = twitter.userOperations().getUserProfile(); SSNSocialModel model = null; try { model = SSNDao.findUserByUsernname(twitter.userOperations().getScreenName(), "Twitter"); } catch (SQLException ex) { java.util.logging.Logger.getLogger(SplashDemo.class.getName()).log(Level.SEVERE, null, ex); } SSNLoginResponse loginResponse = loginModel.processSSNSocialLogin(userProfile.getName(), "Twitter", userProfile.getId() + ""); SSNHomeForm homeForm = new SSNHomeForm(null, loginResponse, model, oAuthToken); // homeForm.setTwitterOAuthToken(oAuthToken); } else if (map.keySet().contains("Instagram")) { try { AccessGrant accessGrant = (AccessGrant) map.get("Instagram"); URL url = new URL(String.format("https://api.instagram.com/v1/users/self?access_token=%s", accessGrant.getAccessToken())); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Accept", "application/json"); String username = "", fullName = "", id = ""; if (conn.getResponseCode() == 200) { StringBuilder builder = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream()))); String output; while ((output = br.readLine()) != null) { builder.append(output); } ObjectMapper mapper = new ObjectMapper(); Map<String, Object> outputJSON = mapper.readValue(builder.toString(), Map.class); Map<String, Object> data = (Map<String, Object>) outputJSON.get("data"); username = (String) data.get("username"); fullName = (String) data.get("full_name"); id = (String) data.get("id"); br.close(); } SSNSocialModel model = SSNDao.findUserByUsernname(username, "Instagram"); SSNLoginResponse loginResponse = loginModel.processSSNSocialLogin(fullName, "Instagram", id); SSNHomeForm homeForm = new SSNHomeForm(null, loginResponse, model, accessGrant, "Instagram"); } catch (IOException e) { logger.error(e.getMessage()); } catch (SQLException ex) { java.util.logging.Logger.getLogger(SplashDemo.class.getName()).log(Level.SEVERE, null, ex); } finally { } } } else { new SSNLoginForm(); } //new SSNSplashScreen(5000,750,477); if (mySplash != null) // check if we really had a spash screen { if (mySplash.isVisible()) mySplash.close(); // if so we're now done with it } // begin with the interactive portion of the program }
From source file:gr.abiss.calipso.userDetails.service.impl.UserDetailsServiceImpl.java
/** * @see org.springframework.social.connect.ConnectionSignUp#execute(org.springframework.social.connect.Connection) *//* ww w. ja v a 2 s . com*/ @Override @Transactional(readOnly = false) public String execute(Connection<?> connection) { //if(LOGGER.isDebugEnabled()){ LOGGER.info("ConnectionSignUp#execute, connection: " + connection); //} //String localUsername = null; String accessToken = connection.createData().getAccessToken(); UserProfile profile = connection.fetchUserProfile(); ConnectionData data = connection.createData(); String socialUsername = profile.getUsername(); if (StringUtils.isBlank(socialUsername)) { LOGGER.info("blank username for profile class: " + profile.getClass()); Object api = connection.getApi(); if (SocialMediaService.FACEBOOK.toString().equalsIgnoreCase(connection.createData().getProviderId())) { Facebook fbApi = new FacebookTemplate(accessToken); User fbProfile = fbApi.userOperations().getUserProfile(); if (fbProfile != null) { socialUsername = fbProfile.getId(); LOGGER.debug("ConnectionSignUp#execute, Got facebook id: " + socialUsername); } } else if (SocialMediaService.LINKEDIN.toString() .equalsIgnoreCase(connection.createData().getProviderId())) { LinkedIn liApi = new LinkedInTemplate(accessToken); LinkedInProfile liProfile = liApi.profileOperations().getUserProfile(); if (liProfile != null) { socialUsername = liProfile.getId(); LOGGER.debug("ConnectionSignUp#execute, Got linkedin id: " + socialUsername); } } } String socialName = profile.getName(); String socialEmail = profile.getEmail(); String socialFirstName = profile.getFirstName(); String socialLastName = profile.getLastName(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("ConnectionSignUp#execute, profile: " + profile + ", data: " + data + ", socialUsername: " + socialUsername + ", socialName: " + socialName + ", socialEmail: " + socialEmail + ", socialFirstName: " + socialFirstName + ", socialLastName: " + socialLastName + ", accessToken: " + accessToken); } // get email from github if empty // if (StringUtils.isNullOrEmpty(socialEmail)) { // Object api = connection.getApi(); // if (SocialMediaService.GITHUB.toString().equalsIgnoreCase(connection.createData().getProviderId())) { // GitHub githubApi = new GitHubTemplate(accessToken);//(GitHub) api; // GitHubUserProfile githubProfile = githubApi.userOperations().getUserProfile(); // LOGGER.debug("ConnectionSignUp#execute, Got github profile: " + githubProfile + ", authorized: " + githubApi.isAuthorized()); // if (githubProfile != null) { // socialEmail = githubProfile.getEmail(); // LOGGER.debug("ConnectionSignUp#execute, Got github email: " + socialEmail); // } // } // } LocalUser user = null; if (!StringUtils.isBlank(socialEmail)) { // LOGGER.debug("ConnectionSignUp#execute, Social email accessible, looking for local user match"); user = localUserService.findByUserNameOrEmail(socialEmail); // if (user != null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "ConnectionSignUp#execute, Email matches existing local user, no need to create one"); } //localUsername = user.getUsername(); } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "ConnectionSignUp#execute, Email did not match an local user, trying to create one"); } user = new SimpleLocalUser(); user.setActive(true); user.setEmail(socialEmail); user.setUsername(socialEmail); user.setFirstName(socialFirstName); user.setLastName(socialLastName); user.setPassword(UUID.randomUUID().toString()); try { user = localUserService.createForImplicitSignup(user); //localUsername = user.getUsername(); } catch (DuplicateEmailException e) { LOGGER.error("ConnectionSignUp#executeError while implicitly registering user", e); } } } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "ConnectionSignUp#execute, Social email was not accessible, unable to implicitly sign in user"); } } //localUserService.createAccount(account); String result = user != null && user.getId() != null ? user.getId().toString() : null; if (LOGGER.isDebugEnabled()) { LOGGER.debug("ConnectionSignUp#execute, returning result: " + result); } return result; }
From source file:com.ssn.event.controller.SSNShareController.java
@Override public void mouseClicked(MouseEvent e) { Object mouseEventObj = e.getSource(); if (mouseEventObj != null && mouseEventObj instanceof JLabel) { JLabel label = (JLabel) mouseEventObj; getShareForm().setCursor(new Cursor(Cursor.WAIT_CURSOR)); // Tracking this sharing event in Google Analytics GoogleAnalyticsUtil.track(SSNConstants.SSN_APP_EVENT_SHARING); Thread thread = null;//from w w w .jav a2s . c om switch (label.getName()) { case "FacebookSharing": thread = new Thread() { boolean isAlreadyLoggedIn = false; @Override public void run() { Set<String> sharedFileList = getFiles(); AccessGrant facebookAccessGrant = getHomeModel().getHomeForm().getFacebookAccessGrant(); if (facebookAccessGrant == null) { try { LoginWithFacebook loginWithFacebook = new LoginWithFacebook(null); loginWithFacebook.setHomeForm(getHomeModel().getHomeForm()); loginWithFacebook.login(); boolean processFurther = false; while (!processFurther) { facebookAccessGrant = getHomeModel().getHomeForm().getFacebookAccessGrant(); if (facebookAccessGrant == null) { Thread.sleep(10000); } else { processFurther = true; isAlreadyLoggedIn = true; } } } catch (InterruptedException ex) { logger.error(ex); } } FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory( SSNConstants.SSN_FACEBOOK_API_KEY, SSNConstants.SSN_FACEBOOK_SECRET_KEY); Connection<Facebook> connection = connectionFactory.createConnection(facebookAccessGrant); Facebook facebook = connection.getApi(); MediaOperations mediaOperations = facebook.mediaOperations(); if (!isAlreadyLoggedIn) { // SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox(); SSNConfirmationDialogBox confirmeDialog = new SSNConfirmationDialogBox(); FacebookProfile userProfile = facebook.userOperations().getUserProfile(); String userName = ""; if (userProfile != null) { userName = userProfile.getName() != null ? userProfile.getName() : userProfile.getFirstName(); } confirmeDialog.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Confirmation", "", "You are already logged in with " + userName + ", Click OK to continue."); int result = confirmeDialog.getResult(); if (result == JOptionPane.YES_OPTION) { SwingUtilities.invokeLater(new Runnable() { public void run() { SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox(); messageDialogBox.initDialogBoxUI( SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Message", "", "Successfully uploaded."); messageDialogBox.setFocusable(true); } }); } else if (result == JOptionPane.NO_OPTION) { AccessGrant facebookAccessGrant1 = null; if (facebookAccessGrant1 == null) { try { LoginWithFacebook loginWithFacebook = new LoginWithFacebook(null); loginWithFacebook.setHomeForm(getHomeModel().getHomeForm()); loginWithFacebook.login(); boolean processFurther = false; while (!processFurther) { facebookAccessGrant1 = getHomeModel().getHomeForm() .getFacebookAccessGrant(); if (facebookAccessGrant1 == null) { Thread.sleep(10000); } else { processFurther = true; //isAlreadyLoggedIn = true; } } connectionFactory = new FacebookConnectionFactory( SSNConstants.SSN_FACEBOOK_API_KEY, SSNConstants.SSN_FACEBOOK_SECRET_KEY); connection = connectionFactory.createConnection(facebookAccessGrant); facebook = connection.getApi(); mediaOperations = facebook.mediaOperations(); } catch (InterruptedException ex) { logger.error(ex); } } } } String[] videoSupported = SSNConstants.SSN_VIDEO_FORMAT_SUPPORTED; final List<String> videoSupportedList = Arrays.asList(videoSupported); for (String file : sharedFileList) { String fileExtension = file.substring(file.lastIndexOf(".") + 1, file.length()); Resource resource = new FileSystemResource(file); if (!videoSupportedList.contains(fileExtension.toUpperCase())) { String output = mediaOperations.postPhoto(resource); } else { String output = mediaOperations.postVideo(resource); } } getShareForm().dispose(); } }; thread.start(); break; case "TwitterSharing": LoginWithTwitter.deniedPermission = false; thread = new Thread() { boolean isAlreadyLoggedIn = false; @Override public void run() { Set<String> sharedFileList = getFiles(); OAuthToken twitterOAuthToken = getHomeModel().getHomeForm().getTwitterOAuthToken(); if (twitterOAuthToken == null) { try { LoginWithTwitter loginWithTwitter = new LoginWithTwitter(null); loginWithTwitter.setHomeForm(getHomeModel().getHomeForm()); loginWithTwitter.login(); boolean processFurther = false; while (!processFurther) { if (LoginWithTwitter.deniedPermission) break; twitterOAuthToken = getHomeModel().getHomeForm().getTwitterOAuthToken(); if (twitterOAuthToken == null) { Thread.sleep(10000); } else { processFurther = true; isAlreadyLoggedIn = true; } } } catch (IOException | InterruptedException ex) { logger.error(ex); } } if (!LoginWithTwitter.deniedPermission) { Twitter twitter = new TwitterTemplate(SSNConstants.SSN_TWITTER_API_KEY, SSNConstants.SSN_TWITTER_SECRET_KEY, twitterOAuthToken.getValue(), twitterOAuthToken.getSecret()); TimelineOperations timelineOperations = twitter.timelineOperations(); if (!isAlreadyLoggedIn) { SSNConfirmationDialogBox confirmeDialog = new SSNConfirmationDialogBox(); TwitterProfile userProfile = twitter.userOperations().getUserProfile(); String userName = ""; if (userProfile != null) { userName = twitter.userOperations().getScreenName() != null ? twitter.userOperations().getScreenName() : userProfile.getName(); } confirmeDialog.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Confirmation", "", "You are already logged in with " + userName + ", Click OK to continue."); int result = confirmeDialog.getResult(); if (result == JOptionPane.YES_OPTION) { SwingUtilities.invokeLater(new Runnable() { public void run() { SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox(); messageDialogBox.initDialogBoxUI( SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Message", "", "Successfully uploaded."); messageDialogBox.setFocusable(true); } }); } else if (result == JOptionPane.NO_OPTION) { twitterOAuthToken = null; if (twitterOAuthToken == null) { try { LoginWithTwitter loginWithTwitter = new LoginWithTwitter(null); loginWithTwitter.setHomeForm(getHomeModel().getHomeForm()); loginWithTwitter.login(); boolean processFurther = false; while (!processFurther) { twitterOAuthToken = getHomeModel().getHomeForm() .getTwitterOAuthToken(); if (twitterOAuthToken == null) { Thread.sleep(10000); } else { processFurther = true; } } twitter = new TwitterTemplate(SSNConstants.SSN_TWITTER_API_KEY, SSNConstants.SSN_TWITTER_SECRET_KEY, twitterOAuthToken.getValue(), twitterOAuthToken.getSecret()); timelineOperations = twitter.timelineOperations(); } catch (IOException | InterruptedException ex) { logger.error(ex); } } } } for (String file : sharedFileList) { Resource image = new FileSystemResource(file); TweetData tweetData = new TweetData("At " + new Date()); tweetData.withMedia(image); timelineOperations.updateStatus(tweetData); } } else { SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox(); messageDialogBox.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Alert", "", "User denied for OurHive App permission on twitter."); messageDialogBox.setFocusable(true); } getShareForm().dispose(); } }; thread.start(); break; case "InstagramSharing": break; case "MailSharing": try { String OS = System.getProperty("os.name").toLowerCase(); Set<String> sharedFileList = getFiles(); Set<String> voiceNoteList = new HashSet<String>(); for (String sharedFile : sharedFileList) { String voiceNote = SSNDao.getVoiceCommandPath(new File(sharedFile).getAbsolutePath()); if (voiceNote != null && !voiceNote.isEmpty()) { voiceNoteList.add(voiceNote); } } sharedFileList.addAll(voiceNoteList); String fileFullPath = ""; String caption = ""; if (sharedFileList.size() == 1) { fileFullPath = sharedFileList.toArray(new String[0])[0]; caption = SSMMediaGalleryPanel.readMetaDataForTitle(new File(fileFullPath)); } else if (sharedFileList.size() > 1) { fileFullPath = SSNHelper.createZipFileFromMultipleFiles(sharedFileList); } if (OS.contains("win")) { // String subject = "SSN Subject"; String subject = caption.equals("") ? SSNConstants.SSN_SHARE_WITH_MAIL_SUBJECT : caption; String body = ""; String m = "&subject=%s&body=%s"; String outLookExeDir = "C:\\Program Files\\Microsoft Office\\Office14\\Outlook.exe"; String mailCompose = "/c"; String note = "ipm.note"; String mailBodyContent = "/m"; m = String.format(m, subject, body); String slashA = "/a"; String mailClientConfigParams[] = null; Process startMailProcess = null; mailClientConfigParams = new String[] { outLookExeDir, mailCompose, note, mailBodyContent, m, slashA, fileFullPath }; startMailProcess = Runtime.getRuntime().exec(mailClientConfigParams); OutputStream out = startMailProcess.getOutputStream(); File zipFile = new File(fileFullPath); zipFile.deleteOnExit(); } else if (OS.indexOf("mac") >= 0) { //Process p = Runtime.getRuntime().exec(new String[]{String.format("open -a mail ", fileFullPath)}); Desktop desktop = Desktop.getDesktop(); String mailTo = caption.equals("") ? "?SUBJECT=" + SSNConstants.SSN_SHARE_WITH_MAIL_SUBJECT : caption; URI uriMailTo = null; uriMailTo = new URI("mailto", mailTo, null); desktop.mail(uriMailTo); } this.getShareForm().dispose(); } catch (Exception ex) { logger.error(ex); } break; case "moveCopy": getShareForm().dispose(); File album = new File(SSNHelper.getSsnHiveDirPath()); File[] albumPaths = album.listFiles(); Vector albumNames = new Vector(); for (int i = 0; i < albumPaths.length; i++) { if (!(albumPaths[i].getName().equals("OurHive")) && SSNHelper.lastAlbum != null && !(albumPaths[i].getName().equals(SSNHelper.lastAlbum))) albumNames.add(albumPaths[i].getName()); } if (SSNHelper.lastAlbum != null && !SSNHelper.lastAlbum.equals("OurHive")) albumNames.insertElementAt("OurHive", 0); SSNInputDialogBox inputBox = new SSNInputDialogBox(true, albumNames); inputBox.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Copy Media", "Please Select Album Name"); String destAlbumName = inputBox.getTextValue(); if (StringUtils.isNotBlank(destAlbumName)) { homeModel.moveAlbum(destAlbumName, getFiles()); } } getShareForm().setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }