Anonymous avatar Anonymous committed 3128e48

Change the names of parameters related to the old domain name SecUserTwitterAccount
.

git-svn-id: http://svn.encuesta.me/trunk/encuestame@1007 39e2479b-dd58-4041-9f67-69c9b71f0610

Comments (0)

Files changed (14)

encuestame-business/src/main/java/org/encuestame/business/service/SecurityService.java

      */
     public Collection<UnitPermission> loadAllListPermission() {
         final Collection<UnitPermission> loadListPermission = new LinkedList<UnitPermission>();
-        final Collection<Permission> listSecPermission = getPermissionDao()
+        final Collection<Permission> listPermission = getPermissionDao()
                 .loadAllPermissions();
-        for (Iterator<Permission> iterator = listSecPermission.iterator(); iterator
+        for (Iterator<Permission> iterator = listPermission.iterator(); iterator
                 .hasNext();) {
             final UnitPermission permissionBean = new UnitPermission();
             Permission permission = iterator.next();
     /**
      * Assign Permissions to {@link UserAccount}.
      * @param userAccount {@link UserAccount}.
-     * @param secPermissions List of {@link Permission}.
+     * @param permissions List of {@link Permission}.
      */
-    private void assingPermission(final UserAccount userAccount , final Set<Permission> secPermissions){
-        for (Permission secPermission : secPermissions) {
-            if(secPermission != null){
-                userAccount.getSecUserPermissions().add(secPermission);
+    private void assingPermission(final UserAccount userAccount , final Set<Permission> permissions){
+        for (Permission Permission : permissions) {
+            if(Permission != null){
+                userAccount.getSecUserPermissions().add(Permission);
             } else {
                 log.error("Error on assing permission to "+userAccount.getUsername());
             }
     private void setSpringSecurityAuthentication(
             final String username,
             final String password,
-            final Set<Permission> secPermissions){
+            final Set<Permission> permissions){
          SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_GLOBAL);
-         Collection<GrantedAuthority> authorities = ConvertDomainsToSecurityContext.convertEnMePermission(secPermissions);
+         Collection<GrantedAuthority> authorities = ConvertDomainsToSecurityContext.convertEnMePermission(permissions);
          SecurityContextHolder.getContext().setAuthentication(
                  new UsernamePasswordAuthenticationToken(username, String.valueOf(password), authorities));
     }

encuestame-business/src/main/java/org/encuestame/business/service/TweetPollService.java

                 final String account[] = {};
                 final TweetPollSavedPublishedStatus publishedStatus = new TweetPollSavedPublishedStatus();
                 final TweetPoll tweetPoll = getTweetPollDao().getTweetPollById(tweetPollId);
-                final SocialAccount secUserTwitterAccounts = getAccountDao().getTwitterAccount(unitTwitterAccountBean.getAccountId());
+                final SocialAccount socialTwitterAccounts = getAccountDao().getTwitterAccount(unitTwitterAccountBean.getAccountId());
                 publishedStatus.setApiType(Type.TWITTER);
-                if(secUserTwitterAccounts != null && tweetPoll != null){
-                    log.debug("secUserTwitterAccounts Account"+secUserTwitterAccounts.getTwitterAccount());
+                if(socialTwitterAccounts != null && tweetPoll != null){
+                    log.debug("secUserTwitterAccounts Account"+socialTwitterAccounts.getTwitterAccount());
                     publishedStatus.setTweetPoll(tweetPoll);
-                    publishedStatus.setTwitterAccount(secUserTwitterAccounts);
+                    publishedStatus.setTwitterAccount(socialTwitterAccounts);
                     try {
                         log.debug("Publishing...");
-                        final Status status = this.publicTweetPoll(tweetText, secUserTwitterAccounts);
+                        final Status status = this.publicTweetPoll(tweetText, socialTwitterAccounts);
                         publishedStatus.setTweetId(status.getId());
                         publishedStatus.setPublicationDateTweet(status.getCreatedAt());
                         publishedStatus.setStatus(TweetPollSavedPublishedStatus.Status.SUCCESS);
                         createNotification(NotificationEnum.TWEETPOLL_PUBLISHED,
-                                buildTwitterItemView(secUserTwitterAccounts.getTwitterAccount(), String.valueOf(status.getId())),
-                                secUserTwitterAccounts.getSecUsers());
+                                buildTwitterItemView(socialTwitterAccounts.getTwitterAccount(), String.valueOf(status.getId())),
+                                socialTwitterAccounts.getSecUsers());
                     } catch (Exception e) {
                         log.error("Error publish tweet "+e.getMessage());
                         publishedStatus.setStatus(TweetPollSavedPublishedStatus.Status.FAILED);

encuestame-business/src/main/java/org/encuestame/business/service/TwitterService.java

 
     /**
      * OAuth Public Tweet.
-     * @param secUserTwitterAccount
+     * @param socialTwitterAccount
      * @param tweet
      * @return
      * @throws TwitterException
      */
-    public Status publicTweet(final SocialAccount secUserTwitterAccount, final String tweet) throws TwitterException{
-        log.debug("publicTweet "+secUserTwitterAccount.getTwitterAccount());
+    public Status publicTweet(final SocialAccount socialTwitterAccount, final String tweet) throws TwitterException{
+        log.debug("publicTweet "+socialTwitterAccount.getTwitterAccount());
         //Twitter twitter = new TwitterFactory().getInstance();
-        log.debug("publicTweet Before  Token  {"+secUserTwitterAccount.getToken());
-        log.debug("publicTweet Before Secret Token  {"+secUserTwitterAccount.getSecretToken());
-        final AccessToken accessToken = this.createNewOAuthAccessToken(secUserTwitterAccount);
+        log.debug("publicTweet Before  Token  {"+socialTwitterAccount.getToken());
+        log.debug("publicTweet Before Secret Token  {"+socialTwitterAccount.getSecretToken());
+        final AccessToken accessToken = this.createNewOAuthAccessToken(socialTwitterAccount);
         log.debug("Access Token "+accessToken);
-        final Twitter twitter = this.getOAuthAuthorizedInstance(secUserTwitterAccount, accessToken);
+        final Twitter twitter = this.getOAuthAuthorizedInstance(socialTwitterAccount, accessToken);
         log.debug("Verify  "+twitter.verifyCredentials());
         log.debug("Update Status "+tweet);
         return twitter.updateStatus(tweet);
 
     /**
      * Create New OAuth Access Token.
-     * @param secUserTwitterAccount {@link SocialAccount}.
+     * @param socialTwitterAccount {@link SocialAccount}.
      * @return {@link AccessToken}.
      */
-    public AccessToken createNewOAuthAccessToken(final SocialAccount secUserTwitterAccount){
-         final AccessToken accessToken = new AccessToken(secUserTwitterAccount.getToken(), secUserTwitterAccount.getSecretToken());
+    public AccessToken createNewOAuthAccessToken(final SocialAccount socialTwitterAccount){
+         final AccessToken accessToken = new AccessToken(socialTwitterAccount.getToken(), socialTwitterAccount.getSecretToken());
          return accessToken;
     }
 
     /**
      * Get OAuthorized Token.
-     * @param secUserTwitterAccount {@link SocialAccount}.
+     * @param socialTwitterAccount {@link SocialAccount}.
      * @return {@link Twitter}.
      */
-    public Twitter getOAuthAuthorizedInstance(final SocialAccount secUserTwitterAccount, final AccessToken accessToken){
-         return new TwitterFactory().getOAuthAuthorizedInstance(secUserTwitterAccount.getConsumerKey(),
-                 secUserTwitterAccount.getConsumerSecret(),
+    public Twitter getOAuthAuthorizedInstance(final SocialAccount socialTwitterAccount, final AccessToken accessToken){
+         return new TwitterFactory().getOAuthAuthorizedInstance(socialTwitterAccount.getConsumerKey(),
+                 socialTwitterAccount.getConsumerSecret(),
                  accessToken);
     }
 

encuestame-business/src/test/java/org/encuestame/test/business/service/TestSecurityService.java

     private UserAccount secUserSecondary;
 
     /** {@link Permission}. **/
-    private Permission secPermission;
+    private Permission permission;
 
     /**
      * Before.
         final Group group2 = createGroups("editors");
       //  this.secUserSecondary.getSecGroups().add(group);
        // this.secUserSecondary.getSecGroups().add(group2);
-        this.secPermission = createPermission(EnMePermission.ENCUESTAME_EDITOR.name());
+        this.permission = createPermission(EnMePermission.ENCUESTAME_EDITOR.name());
         createPermission(EnMePermission.ENCUESTAME_OWNER.name());
         createPermission(EnMePermission.ENCUESTAME_PUBLISHER.name());
         createPermission(EnMePermission.ENCUESTAME_ADMIN.name());
-        this.secUserSecondary.getSecUserPermissions().add(this.secPermission);
+        this.secUserSecondary.getSecUserPermissions().add(this.permission);
         getGroup().saveOrUpdate(this.secUserSecondary);
     }
 
       final Permission secPerm = createPermission("writer");
       final UnitPermission permissionBean = ConvertDomainBean.convertPermissionToBean(secPerm);
       securityService.createPermission(permissionBean);
-      final Permission permissionRetrieve = getSecPermissionDaoImp().getPermissionById(secPerm.getIdPermission());
+      final Permission permissionRetrieve = getPermissionDaoImp().getPermissionById(secPerm.getIdPermission());
       assertNotNull(permissionRetrieve);
       assertEquals("should be","writer", permissionRetrieve.getPermissionDescription());
 
       public void testAssignPermissionwithIdUsername() throws EnMeExpcetion{
         final UserAccount secUser = createSecondaryUser("demo",this.userPrimary);
         final UnitUserBean userPermissionBean = ConvertDomainBean.convertSecondaryUserToUserBean(secUser);
-        final UnitPermission permissionBean = ConvertDomainBean.convertPermissionToBean(this.secPermission);
+        final UnitPermission permissionBean = ConvertDomainBean.convertPermissionToBean(this.permission);
         userPermissionBean.setId(userPermissionBean.getId());
         userPermissionBean.setUsername("demo");
         securityService.assignPermission(userPermissionBean, permissionBean);
         @ExpectedException(EnMeExpcetion.class)
         public void testAssignPermissionwithoutIdUsername() throws EnMeExpcetion{
           final UnitUserBean userPermissionBean = new UnitUserBean();
-          final UnitPermission permissionBean = ConvertDomainBean.convertPermissionToBean(this.secPermission);
+          final UnitPermission permissionBean = ConvertDomainBean.convertPermissionToBean(this.permission);
           //modify id user id.
           userPermissionBean.setId(1L);
           securityService.assignPermission(userPermissionBean, permissionBean);
          */
         @Test
         public void testloadBeanPermission() throws EnMeExpcetion{
-            final UnitPermission permission = securityService.loadBeanPermission(this.secPermission.getPermission());
+            final UnitPermission permission = securityService.loadBeanPermission(this.permission.getPermission());
             assertNotNull(permission);
         }
         /**

encuestame-business/src/test/java/org/encuestame/test/business/service/TestTwitterService.java

     /** {@link Account}. **/
     private Account user;
 
-    private SocialAccount secUserTwitterAccount;
+    private SocialAccount socialTwitterAccount;
 
     /**
      * Before.
     @Before
     public void before(){
         this.user = createUser();
-        this.secUserTwitterAccount = createDefaultSettedTwitterAccount(this.user);
+        this.socialTwitterAccount = createDefaultSettedTwitterAccount(this.user);
     }
 
     /**
     @Test
     public void testPublicTweet() throws TwitterException{
         final String testTweet = RandomStringUtils.randomAlphabetic(5);
-        final Status tweet = twitterService.publicTweet(this.secUserTwitterAccount, testTweet);
+        final Status tweet = twitterService.publicTweet(this.socialTwitterAccount, testTweet);
         assertNotNull(tweet.getId());
     }
 
      */
     @Test
     public void testVerifyCredentials() throws TwitterException{
-        final Twitter twitter = getTwitterService().getOAuthAuthorizedInstance(this.secUserTwitterAccount, getTwitterService().createNewOAuthAccessToken(this.secUserTwitterAccount));
+        final Twitter twitter = getTwitterService().getOAuthAuthorizedInstance(this.socialTwitterAccount, getTwitterService().createNewOAuthAccessToken(this.socialTwitterAccount));
         final User user = twitter.verifyCredentials();
         assertNotNull(user);
     }

encuestame-core/src/main/java/org/encuestame/core/util/ConvertDomainBean.java

   */
     public static final Collection<UnitPermission> convertSetToUnitPermission(final Set<Permission> permissions) {
         final Collection<UnitPermission> loadListPermission = new LinkedList<UnitPermission>();
-        for (Permission secPermission : permissions) {
-            loadListPermission.add(ConvertDomainBean.convertPermissionToBean(secPermission));
+        for (Permission permission : permissions) {
+            loadListPermission.add(ConvertDomainBean.convertPermissionToBean(permission));
         }
         return loadListPermission;
     }

encuestame-core/src/main/java/org/encuestame/core/util/ConvertDomainsToSecurityContext.java

       */
      public static final  List<GrantedAuthority> convertEnMePermission(final Set<Permission> permissions){
             final List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
-            for (Permission secPermission : permissions) {
-                if(secPermission != null){
-                    authorities.add(new GrantedAuthorityImpl(secPermission.getPermission().toString()));
+            for (Permission permission : permissions) {
+                if(permission != null){
+                    authorities.add(new GrantedAuthorityImpl(permission.getPermission().toString()));
                 } else {
                     log.warn("Impossible granted authority");
                 }

encuestame-persistence/src/main/java/org/encuestame/persistence/dao/imp/PermissionDaoImp.java

 @Repository("permissionDaoImp")
 public class PermissionDaoImp extends AbstractHibernateDaoSupport implements IPermissionDao {
 
-	@Autowired
-	public PermissionDaoImp(SessionFactory sessionFactory) {
-	 		setSessionFactory(sessionFactory);
+    @Autowired
+    public PermissionDaoImp(SessionFactory sessionFactory) {
+             setSessionFactory(sessionFactory);
     }
-	
+
     /**
      * Load permissions by user.
      * @param userId user id
 
     /**
      * Load all permisssion.
-     * @return List of  {@link SecPermission}
+     * @return List of  {@link Permission}
      */
     public List<Permission> loadAllPermissions() throws HibernateException {
         return getHibernateTemplate().find("from Permission");

encuestame-persistence/src/main/java/org/encuestame/persistence/domain/security/Group.java

     /**
      * Permissions by Group.
      */
-    private Set<Permission> secPermissions = new HashSet<Permission>();
+    private Set<Permission> permissions = new HashSet<Permission>();
 
     /**
      * {@link Account}.
     }
 
     /**
-     * @return the secPermissions
+     * @return the permissions
      */
     @ManyToMany()
     @JoinTable(name="groups_permission",
                joinColumns={@JoinColumn(name="sec_id_group")},
                inverseJoinColumns={@JoinColumn(name="sec_id_permission")})
-    public Set<Permission> getSecPermissions() {
-        return secPermissions;
+    public Set<Permission> getPermissions() {
+        return permissions;
     }
 
     /**
-     * @param secPermissions the secPermissions to set
+     * @param permissions the permissions to set
      */
-    public void setSecPermissions(Set<Permission> secPermissions) {
-        this.secPermissions = secPermissions;
+    public void setPermissions(Set<Permission> permissions) {
+        this.permissions = permissions;
     }
 
     /**

encuestame-persistence/src/main/java/org/encuestame/persistence/domain/security/Permission.java

 import javax.persistence.Table;
 
 /**
- * SecPermission.
+ * Permission.
  *
  * @author Picado, Juan juan@encuestame.org
  * @since October 17, 2009

encuestame-persistence/src/test/java/org/encuestame/test/config/AbstractBase.java

     }
 
     /**
-     * @return the secPermissionDaoImp
+     * @return the permissionDaoImp
      */
-    public IPermissionDao getSecPermissionDaoImp() {
+    public IPermissionDao getPermissionDaoImp() {
         return permissionDaoImp;
     }
 
     /**
-     * @param secPermissionDaoImp the secPermissionDaoImp to set
+     * @param permissionDaoImp the permissionDaoImp to set
      */
-    public void setSecPermissionDaoImp(final IPermissionDao secPermissionDaoImp) {
-        this.permissionDaoImp = secPermissionDaoImp;
+    public void setPermissionDaoImp(final IPermissionDao permissionDaoImp) {
+        this.permissionDaoImp = permissionDaoImp;
     }
 
     /**
         final Permission permission = new Permission();
         permission.setPermissionDescription(permissionName);
         permission.setPermission(EnMePermission.getPermissionString(permissionName));
-        getSecPermissionDaoImp().saveOrUpdate(permission);
+        getPermissionDaoImp().saveOrUpdate(permission);
         return permission;
     }
 
             final Integer twitterPin,
             final Account secUsers,
             final String twitterAccount){
-        final SocialAccount secUserTwitterAccounts = new SocialAccount();
-        secUserTwitterAccounts.setConsumerKey(consumerKey);
-        secUserTwitterAccounts.setConsumerSecret(consumerSecret);
-        secUserTwitterAccounts.setToken(token);
-        secUserTwitterAccounts.setSecretToken(secretToken);
-        secUserTwitterAccounts.setSecUsers(secUsers);
-        secUserTwitterAccounts.setTwitterPin(twitterPin);
-        secUserTwitterAccounts.setVerfied(Boolean.FALSE);
-        secUserTwitterAccounts.setTwitterAccount(twitterAccount);
-        secUserTwitterAccounts.setTwitterPassword("not valid");
-        getSecUserDao().saveOrUpdate(secUserTwitterAccounts);
-        return secUserTwitterAccounts;
+        final SocialAccount socialTwitterAccounts = new SocialAccount();
+        socialTwitterAccounts.setConsumerKey(consumerKey);
+        socialTwitterAccounts.setConsumerSecret(consumerSecret);
+        socialTwitterAccounts.setToken(token);
+        socialTwitterAccounts.setSecretToken(secretToken);
+        socialTwitterAccounts.setSecUsers(secUsers);
+        socialTwitterAccounts.setTwitterPin(twitterPin);
+        socialTwitterAccounts.setVerfied(Boolean.FALSE);
+        socialTwitterAccounts.setTwitterAccount(twitterAccount);
+        socialTwitterAccounts.setTwitterPassword("not valid");
+        getSecUserDao().saveOrUpdate(socialTwitterAccounts);
+        return socialTwitterAccounts;
      }
 
     /**

encuestame-persistence/src/test/java/org/encuestame/test/persistence/dao/TestSecPermissionDaoImp.java

      */
     @Test
     public void testloadPermission(){
-        final Permission retrievedPermission = getSecPermissionDaoImp().loadPermission(EnMePermission.ENCUESTAME_USER);
+        final Permission retrievedPermission = getPermissionDaoImp().loadPermission(EnMePermission.ENCUESTAME_USER);
         assertEquals("should be equals", permission.getPermission(), retrievedPermission.getPermission());
     }
 
      */
     @Test
     public void testloadAllPermissions(){
-        final List<Permission> allPermissions = getSecPermissionDaoImp().loadAllPermissions();
+        final List<Permission> allPermissions = getPermissionDaoImp().loadAllPermissions();
         for (Permission secPermission : allPermissions) {
             log.info("s "+secPermission.getPermission());
         }
      */
     @Test
     public void testFindAllPermissions(){
-          final List<Permission> findPermissions = getSecPermissionDaoImp().findAllPermissions();
+          final List<Permission> findPermissions = getPermissionDaoImp().findAllPermissions();
           for (Permission secPermission : findPermissions) {
               log.info("s "+secPermission.getPermission());
           }
      */
     @Test
     public void testGetPermissionById(){
-        final Permission perm =getSecPermissionDaoImp().getPermissionById(this.permission.getIdPermission());
+        final Permission perm = getPermissionDaoImp().getPermissionById(this.permission.getIdPermission());
         System.out.println("PERMISSIOn "+ this.permission.getPermission());
         System.out.println("PERMISSIOn2 "+ perm.getPermission());
         assertNotNull(perm);

encuestame-persistence/src/test/java/org/encuestame/test/persistence/dao/TestUserDao.java

         final Permission admon = createPermission("publisher");
         final Permission permission = createPermission("administrator");
         final Group group = createGroups("group 1");
-        group.getSecPermissions().add(editor);
-        group.getSecPermissions().add(admon);
-        group.getSecPermissions().add(permission);
+        group.getPermissions().add(editor);
+        group.getPermissions().add(admon);
+        group.getPermissions().add(permission);
         getGroup().saveOrUpdate(group);
-        assertEquals("Should be equals", 3, group.getSecPermissions().size());
+        assertEquals("Should be equals", 3, group.getPermissions().size());
     }
 
     /**

encuestame-persistence/src/test/java/org/encuestame/test/persistence/domain/TestHibernateDomains.java

         groups.setGroupName("writers");
         groups.setGroupDescriptionInfo("writers");
         groups.setAccount(createUser());
-        groups.getSecPermissions().add(createPermission("administrator"));
+        groups.getPermissions().add(createPermission("administrator"));
         groups.getProjects().add(createProject("TIC", "TIC", "TIC", createUser()));
         getGroup().saveOrUpdate(groups);
         assertNotNull(groups.getGroupId());
         permission.setPermissionDescription("Administrator of alls options");
         permission.getGroups().add(createGroups("administrator"));
         permission.getSecUserSecondaries().add(createSecondaryUser("juan carlos", createUser()));
-        getSecPermissionDaoImp().saveOrUpdate(permission);
+        getPermissionDaoImp().saveOrUpdate(permission);
         assertNotNull(permission.getIdPermission());
     }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.