Commits

Juan Carlos Picado Herrera committed 4efda14 Merge

Merge branch 'juanpicado' into development

  • Participants
  • Parent commits ebbe850, 29d7ee4

Comments (0)

Files changed (175)

 #!/bin/bash
 DOJO_PATH=dojo
-SVN_DOJO=http://svn.dojotoolkit.org/src/tags/release-1.5.0/
-FILE_DOJO=http://download.dojotoolkit.org/release-1.5.0/dojo-release-1.5.0.zip
-FILE_NAME=dojo-release-1.5.0.zip
+SVN_DOJO=http://svn.dojotoolkit.org/src/tags/release-1.6.0/
+FILE_DOJO=http://download.dojotoolkit.org/release-1.6.0/dojo-release-1.6.0-src.zip
+FILE_NAME=dojo-release-1.6.0-src.zip
 
 function createFromDownload {
         if [ -d ${DOJO_PATH} ]; then
 
 function warningShow {
     echo "****************************************************************"
-    echo "*  WARNING !!! -- DOJO 1.5 IS REQUIRED                         *"
+    echo "*  WARNING !!! -- DOJO 1.6 IS REQUIRED                         *"
     echo "*  Download from http://dojotoolkit.org/download               *"
     echo "*  Copy the content on root folder named DOJO                  *"   
     echo "*  After that run again this script                            *"
     wget ${FILE_DOJO}
     echo "ZIP - Create work path"
     unzip ${FILE_NAME}
-    mv dojo-release-1.5.0 ${DOJO_PATH}
+    mv dojo-release-1.6.0-src ${DOJO_PATH}
     echo "ZIP - Copy Resources"
     rm ${FILE_NAME}
     copyResources

encuestame-business/pom.xml

                 </executions>
             </plugin>
         </plugins>
+        <resources>
+            <resource>
+              <directory>src/main/resources/</directory>
+              <includes>
+                <include>spring-test/*.*</include>
+                <include>org/**/*.*</include>
+                <include>properties-test/*.*</include>
+              </includes>
+              <filtering>true</filtering>
+            </resource>
+        </resources>
     </build>
     <dependencies>
      <dependency>
         </dependency>
         <dependency>
             <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-annotations</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate</groupId>
             <artifactId>hibernate-core</artifactId>
         </dependency>
         <dependency>

encuestame-business/src/main/java/org/encuestame/business/config/EncuestameConfig.java

+
+package org.encuestame.business.config;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.PropertyConfigurator;
+
+/**
+ * Encuestame config file.
+ * @author Picado, Juan juanATencuestame.org
+ * @since Mar 14, 2011
+ */
+public class EncuestameConfig {
+
+    private static String encuestameConfigFileName = "/org/encuestame/config/encuestame-config.properties";
+    private static String encuestameOverwriteConfigFileName = "/encuestame-config-overwrite.properties";
+    private static String overwriteJvmParam = "encuestame.overwrite.config";
+    private static File customEncuestameFile = null;
+
+    private static Properties configHolderProperty;
+
+    private static Log log = LogFactory.getLog(EncuestameConfig.class);
+
+    /*
+     * Static block run once at class loading
+     *
+     * We load the default properties and any custom properties we find
+     */
+    static {
+        configHolderProperty = new Properties();
+
+        try {
+            // we'll need this to get at our properties files in the classpath
+            Class configClass = Class.forName("org.encuestame.business.config.EncuestameConfig");
+
+            // first, lets load our default properties
+            InputStream is = configClass.getResourceAsStream(encuestameConfigFileName);
+            configHolderProperty.load(is);
+
+            // now, see if we can find our custom config
+            is = configClass.getResourceAsStream(encuestameOverwriteConfigFileName);
+            if(is != null) {
+                configHolderProperty.load(is);
+                log.info("Encuestame : Loading custom properties.");
+            } else {
+                log.error("Encuestame : Loading default properties, custom configuration properties not found.");
+            }
+            // finally, check for an external config file
+            final String enviromentPropertyFile = System.getProperty(overwriteJvmParam);
+            if(enviromentPropertyFile != null && enviromentPropertyFile.length() > 0) {
+                customEncuestameFile = new File(enviromentPropertyFile);
+                // make sure the file exists, then try and load it
+                if(customEncuestameFile != null && customEncuestameFile.exists()) {
+                    is = new FileInputStream(customEncuestameFile);
+                    configHolderProperty.load(is);
+                    System.out.println("EncuestameConfig file: Successfully loaded custom properties from "+
+                            customEncuestameFile.getAbsolutePath());
+                } else {
+                    System.out.println("EncuestameConfig file: Failed to load custom properties from "+
+                            customEncuestameFile.getAbsolutePath());
+                }
+
+            }
+
+            // Now expand system properties for properties in the config.expandedProperties list,
+            // replacing them by their expanded values.
+            /*String expandedPropertiesDef = (String) configHolderProperty.get("config.expandedProperties");
+            if (expandedPropertiesDef != null) {
+                String[] expandedProperties = expandedPropertiesDef.split(",");
+                for (int i = 0; i < expandedProperties.length; i++) {
+                    String propName = expandedProperties[i].trim();
+                    String initialValue = (String) configHolderProperty.get(propName);
+                    if (initialValue != null) {
+                        String expandedValue = PropertyExpander.expandSystemProperties(initialValue);
+                        configHolderProperty.put(propName,expandedValue);
+                    }
+                }
+            }*/
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.fatal("Encuestame Config: "+e);
+        }
+    }
+
+    /**
+     * Get properties starting with a specified string.
+     */
+    public static Properties getPropertiesStartingWith(String startingWith) {
+        Properties props = new Properties();
+        for (Enumeration it = configHolderProperty.keys(); it.hasMoreElements();) {
+            String key = (String)it.nextElement();
+            props.put(key, configHolderProperty.get(key));
+        }
+        return props;
+    }
+}

encuestame-business/src/main/java/org/encuestame/business/mail/MailServiceImpl.java

 import org.apache.commons.logging.LogFactory;
 import org.apache.velocity.app.VelocityEngine;
 import org.encuestame.core.mail.MailService;
-import org.encuestame.core.service.IService;
+import org.encuestame.core.service.ServiceOperations;
 import org.encuestame.business.service.AbstractBaseService;
 import org.encuestame.utils.mail.InvitationBean;
 import org.encuestame.utils.mail.NotificationBean;
  */
 
 @SuppressWarnings("unchecked")
-public class MailServiceImpl extends AbstractBaseService implements MailService, IService {
+public class MailServiceImpl extends AbstractBaseService implements MailService, ServiceOperations {
 
     private Log log = LogFactory.getLog(this.getClass());
 
               Map model = new HashMap();
               model.put("invitation", invitation);
               String text = VelocityEngineUtils.mergeTemplateIntoString(
-                 velocityEngine, "invitation.vm", model);
+                 velocityEngine, "/org/encuestame/business/mail/templates/invitation.vm", model);
               message.setText(text, true);
            }
         };
               Map model = new HashMap();
               model.put("notification", notification);
               String text = VelocityEngineUtils.mergeTemplateIntoString(
-                 velocityEngine, "notification.vm", model);
+                 velocityEngine, "/org/encuestame/business/mail/templates/notification.vm", model);
               message.setText(text, true);
            }
         };
               Map model = new HashMap();
               model.put("user", user);
               String text = VelocityEngineUtils.mergeTemplateIntoString(
-                 velocityEngine, "password-confirmation.vm", model);
+                 velocityEngine, "/org/encuestame/business/mail/templates/password-confirmation.vm", model);
               message.setText(text, true);
            }
         };
               model.put("user", user);
               model.put("inviteCode", inviteCode);
               String text = VelocityEngineUtils.mergeTemplateIntoString(
-                              velocityEngine, "confirm-your-account.vm", model);
+                              velocityEngine, "/org/encuestame/business/mail/templates/confirm-your-account.vm", model);
               message.setText(text, true);
            }
         };
         final Map<String, UserAccountBean> model = new HashMap<String, UserAccountBean>();
         model.put("user", unitUserBean);
         this.sendMimeEmail(model, unitUserBean.getEmail(), "Your New Password", this.noEmailResponse,
-                           "renew-password.vm");
+                           "/org/encuestame/business/mail/templates/renew-password.vm");
     }
 
     /**

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

 
     private String proxyPass;
 
-    private @Value("${application.picture.path}") String dataGlobalPath;
+    //private @Value("${dir.data.warehouse}") String dataGlobalPath;
 
+    private String dataGlobalPath;
     /**
      * App Consumer Key.
      */

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

         final List<SocialAccount> socialAccounts = getAccountDao()
                 .getTwitterVerifiedAccountByUser(getUserAccount(username).getAccount(), provider);
         for (SocialAccount socialAccount : socialAccounts) {
+            log.debug("getTwitterService() "+getTwitterService());
             if(getTwitterService().verifyCredentials(socialAccount)){
                 log.debug("Confirmed Account  -- "+socialAccount.getSocialAccountName());
                 comfirmedSocialAccounts.add(ConvertDomainBean.convertSocialAccountToBean(socialAccount));

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

 import org.encuestame.business.service.imp.IPictureService;
 import org.encuestame.business.service.imp.IPollService;
 import org.encuestame.business.service.imp.IProjectService;
-import org.encuestame.business.service.imp.ISecurityService;
+import org.encuestame.business.service.imp.SecurityOperations;
 import org.encuestame.business.service.imp.ISurveyService;
 import org.encuestame.business.service.imp.ITweetPollService;
 import org.springframework.stereotype.Service;
 public class ApplicationServices extends AbstractBaseService implements IApplicationServices {
 
     /** {@link SecurityService}. **/
-    private ISecurityService securityService;
+    private SecurityOperations securityService;
     /** {@link SurveyService}. **/
     private ISurveyService surveyService;
     /** {@link PollService}. **/
     /**
      * @return the securityService
      */
-    public ISecurityService getSecurityService() {
+    public SecurityOperations getSecurityService() {
         return securityService;
     }
 
     /**
      * @param securityService the securityService to set
      */
-    public void setSecurityService(ISecurityService securityService) {
+    public void setSecurityService(SecurityOperations securityService) {
         this.securityService = securityService;
     }
 

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

     public List<Poll> searchPolls(String searchString, String path, String fieldName,
             int results) throws IOException, ParseException {
         List<Poll> pollList = new ArrayList<Poll>();
-        IndexReader reader = IndexReader.open(path, true);
-        Searcher searcher = new IndexSearcher(reader);
+        //IndexReader reader = IndexReader.open(path, true);
+        //IndexReader reader = IndexReader.open(path);
+        //Searcher searcher = new IndexSearcher(reader);
+        Searcher searcher = null;
         QueryParser qp = new QueryParser(Version.LUCENE_29, fieldName,
                 new StandardAnalyzer(Version.LUCENE_29));
         Query query = qp.parse(searchString);
             throws IOException, ParseException {
         Map<String, Object> map = new HashMap<String, Object>();
         List<Poll> articles = new ArrayList<Poll>();
-        Searcher searcher = new IndexSearcher(IndexReader.open(path));
+        //Searcher searcher = new IndexSearcher(IndexReader.open(path));
+        //IndexReader reader = IndexReader.open(path);
+        //Searcher searcher = new IndexSearcher(reader);
+        Searcher searcher = null;
         QueryParser qp = new QueryParser(Version.LUCENE_29, fieldName,
                 new StandardAnalyzer(Version.LUCENE_29));
         Query query = qp.parse(searchString);
     public List<Poll> searchArticle(String searchString, String path, String fieldName,
             int results) throws IOException, ParseException {
         List<Poll> articles = new ArrayList<Poll>();
-        IndexReader reader = IndexReader.open(path);
-        Searcher searcher = new IndexSearcher(reader);
+        //IndexReader reader = IndexReader.open(path);
+        //Searcher searcher = new IndexSearcher(reader);
+        Searcher searcher = null;
         QueryParser qp = new QueryParser(Version.LUCENE_29, fieldName,
                 new StandardAnalyzer(Version.LUCENE_29));
         Query query = qp.parse(searchString);

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

 import java.util.Set;
 
 import org.apache.log4j.Logger;
-import org.encuestame.business.service.imp.ISecurityService;
+import org.encuestame.business.service.imp.SecurityOperations;
 import org.encuestame.core.security.util.EnMePasswordUtils;
 import org.encuestame.core.security.util.PasswordGenerator;
 import org.encuestame.core.util.ConvertDomainBean;
  * @since 27/04/2009 11:35:01
  */
 @Service
-public class SecurityService extends AbstractBaseService implements ISecurityService {
+public class SecurityService extends AbstractBaseService implements SecurityOperations {
 
     private Logger log = Logger.getLogger(this.getClass());
 

encuestame-business/src/main/java/org/encuestame/business/service/imp/IApplicationServices.java

  */
 package org.encuestame.business.service.imp;
 
-import org.encuestame.core.service.IService;
+import org.encuestame.core.service.ServiceOperations;
 
 /**
  * Interface to Application Bean Service.
  * @since 11/05/2009 14:35:21
  * @version $Id$
  */
-public interface IApplicationServices  extends IService {
+public interface IApplicationServices  extends ServiceOperations {
 
 
     /**
      * Getter.
-     * @return {@link ISecurityService}
+     * @return {@link SecurityOperations}
      */
-    public ISecurityService getSecurityService();
+    public SecurityOperations getSecurityService();
 
     /**
      * Setter.
-     * @param securityService {@link ISecurityService}
+     * @param securityService {@link SecurityOperations}
      */
-    public void setSecurityService(ISecurityService securityService);
+    public void setSecurityService(SecurityOperations securityService);
 
     /**
      * @return the surveyService

encuestame-business/src/main/java/org/encuestame/business/service/imp/IFrontEndService.java

 
 import java.util.List;
 
-import org.encuestame.core.service.IService;
+import org.encuestame.core.service.ServiceOperations;
 import org.encuestame.persistence.exception.EnMeSearchException;
 import org.encuestame.utils.web.frontEnd.UnitSearchItem;
 
  * @since Oct 17, 2010 11:29:51 AM
  * @version $Id:$
  */
-public interface IFrontEndService extends IService {
+public interface IFrontEndService extends ServiceOperations {
 
 
     /**

encuestame-business/src/main/java/org/encuestame/business/service/imp/ILinkedInService.java

 
 package org.encuestame.business.service.imp;
 
-import org.encuestame.core.service.IService;
+import org.encuestame.core.service.ServiceOperations;
 
 
-public interface ILinkedInService extends IService {
+public interface ILinkedInService extends ServiceOperations {
 
     public String getAuthorizeLinkedInUrl();
 }

encuestame-business/src/main/java/org/encuestame/business/service/imp/IMasterSurveyService.java

 
 import java.util.List;
 
-import org.encuestame.core.service.IService;
+import org.encuestame.core.service.ServiceOperations;
 import org.encuestame.persistence.exception.EnMeNoResultsFoundException;
 import org.encuestame.utils.web.UnitHashTag;
 import org.encuestame.utils.web.UnitQuestionBean;
  * @since 27/05/2010 20:36:29
  * @version $Id:$
  */
-public interface IMasterSurveyService extends IService{
+public interface IMasterSurveyService extends ServiceOperations{
 
     /**
      * Suggestion Question List.

encuestame-business/src/main/java/org/encuestame/business/service/imp/ISecurityService.java

-/*
- ************************************************************************************
- * Copyright (C) 2001-2009 encuestame: system online surveys Copyright (C) 2009
- * encuestame Development Team.
- * Licensed under the Apache Software License version 2.0
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to  in writing,  software  distributed
- * under the License is distributed  on  an  "AS IS"  BASIS,  WITHOUT  WARRANTIES  OR
- * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
- * specific language governing permissions and limitations under the License.
- ************************************************************************************
- */
-package org.encuestame.business.service.imp;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.encuestame.business.service.SecurityService.FollowOperations;
-import org.encuestame.business.service.SecurityService.Profile;
-import org.encuestame.core.service.IService;
-import org.encuestame.persistence.domain.EnMePermission;
-import org.encuestame.persistence.domain.security.Group;
-import org.encuestame.persistence.domain.security.Permission;
-import org.encuestame.persistence.domain.security.Account;
-import org.encuestame.persistence.domain.security.UserAccount;
-import org.encuestame.persistence.domain.social.SocialProvider;
-import org.encuestame.persistence.exception.EnMeNoResultsFoundException;
-import org.encuestame.persistence.exception.EnMeExpcetion;
-import org.encuestame.persistence.exception.EnmeFailOperation;
-import org.encuestame.utils.security.SignUpBean;
-import org.encuestame.utils.security.SocialAccountBean;
-import org.encuestame.utils.web.UnitGroupBean;
-import org.encuestame.utils.web.UnitLists;
-import org.encuestame.utils.web.UnitPermission;
-import org.encuestame.utils.web.UserAccountBean;
-import org.springframework.mail.MailSendException;
-
-/**
- * Interface for Security Service.
- * @author Picado, Juan juan@encuestame.org
- * @since 27/04/2009  11:35:01
- * @version $Id$
- */
-public interface ISecurityService extends IService {
-
-     String getDefaultUserPermission();
-    /**f
-     * Load list of users.
-     * @return list of users with groups and permission
-     * @throws Exception Exception
-     * @throws EnMeExpcetion excepcion
-     */
-    List<UserAccountBean> loadListUsers(final String currentUsername, final Integer maxResults,
-            final Integer start) throws Exception;
-
-    /**
-     * Retrieve Total Own Users.
-     * @param username
-     * @return
-     * @throws EnMeNoResultsFoundException
-     */
-    Long totalOwnUsers(final String username) throws EnMeNoResultsFoundException;
-
-    /**
-     * Get User Complete Info.
-     * @param currentUsername
-     * @return
-     * @throws EnMeNoResultsFoundException
-     */
-    UserAccountBean getUserCompleteInfo(final Long userId, final String currentUsername) throws EnMeNoResultsFoundException;
-
-
-    /**
-     * Assing Group to User.
-     * @param user user
-     * @param group group
-     * @throws EnMeNoResultsFoundException
-     */
-    void assingGroupFromUser(
-            final Long groupId,
-            final Long userId,
-            final String username) throws EnMeNoResultsFoundException;
-
-    /**
-     * Search user by username.
-     * @param username username
-     * @return {@link UserAccountBean}
-     */
-    UserAccountBean searchUserByUsername(final String username);
-
-    /**
-     * Load all list of permisssions and covert to permission bean.
-     * @return list of permisssions
-     */
-    Collection<UnitPermission> loadAllListPermission();
-
-    /**
-     * Delete Group Domain.
-     * @param Long group
-     */
-    void deleteGroup(final Long groupId);
-
-    /**
-     * Delete user.
-     * @param userBean user to delete
-     * @throws EnMeNoResultsFoundException
-     * @throws EnMeExpcetion exception
-     */
-     void deleteUser(final UserAccountBean userBean) throws EnMeNoResultsFoundException;
-    /**
-     * Renew password.
-     * @param userBean {@link UserAccountBean}
-     * @param newPassword new password
-     * @return new password
-     * @throws EnMeExpcetion exception
-     */
-    String renewPassword(final UserAccountBean userBean, final String newPassword) throws EnMeExpcetion;
-    /**
-     * Update a Group.
-     * @param groupBean {@link UnitGroupBean}
-     */
-    UnitGroupBean updateGroup(UnitGroupBean groupBean) throws EnMeExpcetion;
-    /**
-     * Update user.
-     * @param userBean user bean.
-     * @throws EnMeExpcetion exception
-     */
-    void updateUser(final UserAccountBean userBean);
-    /**
-     * Create a new Group.
-     * @param groupBean group bean
-     * @throws EnMeNoResultsFoundException
-     */
-    UnitGroupBean createGroup(final UnitGroupBean groupBean , final String username) throws EnMeNoResultsFoundException;
-    /**
-     * Create a new Permisssion.
-     * @param permissionBean {@link UnitPermission}
-     */
-    void createPermission(final UnitPermission permissionBean);
-    /**
-     * Create a user, generate password for user and send email to confirmate
-     * the account.
-     * @param userBean user bean
-     * @throws EnMeExpcetion
-     * @throws EnMeExpcetion personalize exception
-     */
-    void createUser(final UserAccountBean userBean,  final String username) throws EnMeExpcetion;
-
-    /**
-     * Assign permission to user.
-     * @param userBean {@link UserAccountBean}
-     * @param permissionBean {@link UnitPermission}
-     * @throws EnMeExpcetion exception
-     */
-    void assignPermission(
-            final UserAccountBean userBean,
-            final UnitPermission permissionBean)
-            throws EnMeExpcetion;
-
-    /**
-     * Remove {@link Group} from User.
-     * @param userBean {@link UserAccountBean}
-     * @param groupBean {@link UnitGroupBean}
-     * @throws EnMeExpcetion
-     */
-    void removeGroupFromUser(
-            final UserAccountBean userBean,
-            final UnitGroupBean groupBean)
-            throws EnMeExpcetion;
-
-    /**
-     * Load Permission domain and covert to permission bean.
-     * @param permission permission
-     * @return permission bean
-     * @throws EnMeExpcetion excepcion
-     */
-    UnitPermission loadBeanPermission(final EnMePermission  permission)
-    throws EnMeExpcetion;
-
-    /**
-     * Load domain permission.
-     * @param permission permission
-     * @return permission domain
-     */
-    Permission loadPermission(final String permission);
-
-    /**
-     * Invite some users to register in the system.
-     * @param email list of users
-     * @param code code
-     * @throws Exception
-     * @throws Exception excepcion
-     */
-    void inviteUser(String email, String code) throws Exception;
-
-    /**
-     * Generate hash code invitation.
-     * @return generated code
-     */
-    String generateHashCodeInvitation();
-
-
-    /**
-     * Find {@link UserAccount} by UserName
-     * @param username user name
-     * @return {@link UserAccount}
-     */
-    UserAccount findUserByUserName(final String username);
-
-    /**
-     * Find {@link UserAccount} by email.
-     * @param email
-     * @return
-     */
-    UserAccount findUserAccountByEmail(final String email);
-
-    /**
-     * Setter.
-     * @param suspendedNotification suspended notification
-     */
-    void setSuspendedNotification(final Boolean suspendedNotification);
-
-
-    /**
-     * Load Groups by Client.
-     * @return
-     * @throws EnMeNoResultsFoundException
-     */
-    List<UnitGroupBean> loadGroups(final String currentUsername) throws EnMeNoResultsFoundException;
-
-    /**
-     * SingUp User
-     * @param singUpBean {@link SignUpBean}.
-     * @return {@link UserAccountBean}.
-     */
-    UserAccountBean singupUser(final SignUpBean singUpBean);
-
-    /**
-     * Search {@link UserAccount} by email.
-     * @param email email
-     * @return
-     */
-    List<UserAccount> searchUsersByEmail(final String email);
-
-    /**
-     * Search List of User By Username
-     * @param username username
-     * @return
-     */
-    List<UserAccount> searchUsersByUsername(final String username);
-
-    /**
-     * Load list of {@link Permission}.
-     * @return list of permissions.
-     */
-    List<UnitPermission> loadPermissions();
-
-    /**
-     * Send password to user.
-     * @param email email
-     * @param password password
-     * @throws MailSendException
-     */
-    void sendUserPassword(final String email,
-            final String password)
-            throws MailSendException;
-
-    /**
-     * Find {@link UserAccount} by UserName
-     * @param username user name
-     * @return {@link UserAccount}
-     */
-    UserAccountBean findUserByEmail(final String email);
-
-    /**
-     * Get Email List by Username.
-     * @param username
-     * @return
-     * @throws EnMeNoResultsFoundException
-     */
-    List<UnitLists> getListbyUsername(final String username) throws EnMeNoResultsFoundException;
-
-    /**
-     * Assign Permission,
-     * @param userId user id
-     * @param permission {@link EnMePermission}.
-     * @param loggedUse user logged.
-     * @throws EnMeExpcetion exception.
-     */
-    void updatePermission(
-            final Long userId,
-            final String loggedUser,
-            final EnMePermission permission,
-            final String action)
-            throws EnMeExpcetion;
-
-    /**
-     * Get Group by Id and User Id.
-     * @param groupId
-     * @param username
-     * @return
-     * @throws EnMeNoResultsFoundException
-     */
-    Group getGroupbyIdandUser(final Long groupId, final String username) throws EnMeNoResultsFoundException;
-
-    /**
-     * User Bean.
-     * @param user
-     * @return
-     */
-    void getStatsByUsers(final UserAccountBean user);
-
-    /**
-     * Get User by Group.
-     * @param secGroupId
-     * @param username
-     * @return
-     */
-    Long getUserbyGroup(final Long groupId, final String username)throws EnMeNoResultsFoundException;
-
-    /**
-     * Count Users by Groups
-     * @param username
-     * @param groupId
-     * @return
-     */
-    List<Object[]> countUsersbyGroups(final Long groupId, final String username);
-
-    /**
-     * Change User Status.
-     * @param username
-     * @throws EnmeFailOperation
-     */
-    void changeUserStatus(final String username) throws EnmeFailOperation;
-
-    /**
-     * Update property for user account.
-     * @param property
-     * @param value
-     * @param username
-     * @throws EnMeNoResultsFoundException
-     */
-    void upadteAccountProfile(
-            final Profile property,
-            final String value,
-            final String username) throws EnMeNoResultsFoundException;
-
-    /**
-     * Update Account Profile.
-     * @param bio
-     * @param email
-     * @param username
-     * @param language
-     * @param completeName
-     * @throws EnMeNoResultsFoundException
-     */
-    void upadteAccountProfile(
-            final String bio,
-            final String language,
-            final String completeName,
-            final String loggedUsername) throws EnMeNoResultsFoundException;
-
-    /**
-     * User Account Is Activated.
-     * @param signUpBean
-     * @return
-     */
-    Boolean isActivated(final SignUpBean signUpBean);
-
-    /**
-     * Add Followers.
-     * @param myUser
-     * @param followerUser
-     * @return
-     * @throws EnMeNoResultsFoundException
-     */
-    UserAccount addFollower(final String myUser, final String followerUser) throws EnMeNoResultsFoundException;
-
-   /**
-    * Follow Operations.
-    * @param userAcc
-    * @param myUsername
-    * @param followerUser
-    * @param operation
-    * @throws EnMeNoResultsFoundException
-    */
-    void followOperations(final UserAccount userAcc,
-            final String myUsername, final String followerUser,
-            final FollowOperations operation) throws EnMeNoResultsFoundException;
-}

encuestame-business/src/main/java/org/encuestame/business/service/imp/ITwitterService.java

 import java.io.IOException;
 
 import org.apache.commons.httpclient.HttpException;
-import org.encuestame.core.service.IService;
+import org.encuestame.core.service.ServiceOperations;
 import org.encuestame.persistence.domain.security.SocialAccount;
 
 import twitter4j.Status;
  * @since Feb 13, 2010 4:07:14 PM
  * @version $Id$
  */
-public interface ITwitterService extends IService{
+public interface ITwitterService extends ServiceOperations{
 
 
     /**

encuestame-business/src/main/java/org/encuestame/business/service/imp/SecurityOperations.java

+/*
+ ************************************************************************************
+ * Copyright (C) 2001-2009 encuestame: system online surveys Copyright (C) 2009
+ * encuestame Development Team.
+ * Licensed under the Apache Software License version 2.0
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to  in writing,  software  distributed
+ * under the License is distributed  on  an  "AS IS"  BASIS,  WITHOUT  WARRANTIES  OR
+ * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
+ * specific language governing permissions and limitations under the License.
+ ************************************************************************************
+ */
+package org.encuestame.business.service.imp;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.encuestame.business.service.SecurityService.FollowOperations;
+import org.encuestame.business.service.SecurityService.Profile;
+import org.encuestame.core.service.ServiceOperations;
+import org.encuestame.persistence.domain.EnMePermission;
+import org.encuestame.persistence.domain.security.Group;
+import org.encuestame.persistence.domain.security.Permission;
+import org.encuestame.persistence.domain.security.UserAccount;
+import org.encuestame.persistence.exception.EnMeExpcetion;
+import org.encuestame.persistence.exception.EnMeNoResultsFoundException;
+import org.encuestame.persistence.exception.EnmeFailOperation;
+import org.encuestame.utils.security.SignUpBean;
+import org.encuestame.utils.web.UnitGroupBean;
+import org.encuestame.utils.web.UnitLists;
+import org.encuestame.utils.web.UnitPermission;
+import org.encuestame.utils.web.UserAccountBean;
+import org.springframework.mail.MailSendException;
+
+/**
+ * Interface for Security Service.
+ * @author Picado, Juan juan@encuestame.org
+ * @since 27/04/2009  11:35:01
+ * @version $Id$
+ */
+public interface SecurityOperations extends ServiceOperations {
+
+     String getDefaultUserPermission();
+    /**f
+     * Load list of users.
+     * @return list of users with groups and permission
+     * @throws Exception Exception
+     * @throws EnMeExpcetion excepcion
+     */
+    List<UserAccountBean> loadListUsers(final String currentUsername, final Integer maxResults,
+            final Integer start) throws Exception;
+
+    /**
+     * Retrieve Total Own Users.
+     * @param username
+     * @return
+     * @throws EnMeNoResultsFoundException
+     */
+    Long totalOwnUsers(final String username) throws EnMeNoResultsFoundException;
+
+    /**
+     * Get User Complete Info.
+     * @param currentUsername
+     * @return
+     * @throws EnMeNoResultsFoundException
+     */
+    UserAccountBean getUserCompleteInfo(final Long userId, final String currentUsername) throws EnMeNoResultsFoundException;
+
+
+    /**
+     * Assing Group to User.
+     * @param user user
+     * @param group group
+     * @throws EnMeNoResultsFoundException
+     */
+    void assingGroupFromUser(
+            final Long groupId,
+            final Long userId,
+            final String username) throws EnMeNoResultsFoundException;
+
+    /**
+     * Search user by username.
+     * @param username username
+     * @return {@link UserAccountBean}
+     */
+    UserAccountBean searchUserByUsername(final String username);
+
+    /**
+     * Load all list of permisssions and covert to permission bean.
+     * @return list of permisssions
+     */
+    Collection<UnitPermission> loadAllListPermission();
+
+    /**
+     * Delete Group Domain.
+     * @param Long group
+     */
+    void deleteGroup(final Long groupId);
+
+    /**
+     * Delete user.
+     * @param userBean user to delete
+     * @throws EnMeNoResultsFoundException
+     * @throws EnMeExpcetion exception
+     */
+     void deleteUser(final UserAccountBean userBean) throws EnMeNoResultsFoundException;
+    /**
+     * Renew password.
+     * @param userBean {@link UserAccountBean}
+     * @param newPassword new password
+     * @return new password
+     * @throws EnMeExpcetion exception
+     */
+    String renewPassword(final UserAccountBean userBean, final String newPassword) throws EnMeExpcetion;
+    /**
+     * Update a Group.
+     * @param groupBean {@link UnitGroupBean}
+     */
+    UnitGroupBean updateGroup(UnitGroupBean groupBean) throws EnMeExpcetion;
+    /**
+     * Update user.
+     * @param userBean user bean.
+     * @throws EnMeExpcetion exception
+     */
+    void updateUser(final UserAccountBean userBean);
+    /**
+     * Create a new Group.
+     * @param groupBean group bean
+     * @throws EnMeNoResultsFoundException
+     */
+    UnitGroupBean createGroup(final UnitGroupBean groupBean , final String username) throws EnMeNoResultsFoundException;
+    /**
+     * Create a new Permisssion.
+     * @param permissionBean {@link UnitPermission}
+     */
+    void createPermission(final UnitPermission permissionBean);
+    /**
+     * Create a user, generate password for user and send email to confirmate
+     * the account.
+     * @param userBean user bean
+     * @throws EnMeExpcetion
+     * @throws EnMeExpcetion personalize exception
+     */
+    void createUser(final UserAccountBean userBean,  final String username) throws EnMeExpcetion;
+
+    /**
+     * Assign permission to user.
+     * @param userBean {@link UserAccountBean}
+     * @param permissionBean {@link UnitPermission}
+     * @throws EnMeExpcetion exception
+     */
+    void assignPermission(
+            final UserAccountBean userBean,
+            final UnitPermission permissionBean)
+            throws EnMeExpcetion;
+
+    /**
+     * Remove {@link Group} from User.
+     * @param userBean {@link UserAccountBean}
+     * @param groupBean {@link UnitGroupBean}
+     * @throws EnMeExpcetion
+     */
+    void removeGroupFromUser(
+            final UserAccountBean userBean,
+            final UnitGroupBean groupBean)
+            throws EnMeExpcetion;
+
+    /**
+     * Load Permission domain and covert to permission bean.
+     * @param permission permission
+     * @return permission bean
+     * @throws EnMeExpcetion excepcion
+     */
+    UnitPermission loadBeanPermission(final EnMePermission  permission)
+    throws EnMeExpcetion;
+
+    /**
+     * Load domain permission.
+     * @param permission permission
+     * @return permission domain
+     */
+    Permission loadPermission(final String permission);
+
+    /**
+     * Invite some users to register in the system.
+     * @param email list of users
+     * @param code code
+     * @throws Exception
+     * @throws Exception excepcion
+     */
+    void inviteUser(String email, String code) throws Exception;
+
+    /**
+     * Generate hash code invitation.
+     * @return generated code
+     */
+    String generateHashCodeInvitation();
+
+
+    /**
+     * Find {@link UserAccount} by UserName
+     * @param username user name
+     * @return {@link UserAccount}
+     */
+    UserAccount findUserByUserName(final String username);
+
+    /**
+     * Find {@link UserAccount} by email.
+     * @param email
+     * @return
+     */
+    UserAccount findUserAccountByEmail(final String email);
+
+    /**
+     * Setter.
+     * @param suspendedNotification suspended notification
+     */
+    void setSuspendedNotification(final Boolean suspendedNotification);
+
+
+    /**
+     * Load Groups by Client.
+     * @return
+     * @throws EnMeNoResultsFoundException
+     */
+    List<UnitGroupBean> loadGroups(final String currentUsername) throws EnMeNoResultsFoundException;
+
+    /**
+     * SingUp User
+     * @param singUpBean {@link SignUpBean}.
+     * @return {@link UserAccountBean}.
+     */
+    UserAccountBean singupUser(final SignUpBean singUpBean);
+
+    /**
+     * Search {@link UserAccount} by email.
+     * @param email email
+     * @return
+     */
+    List<UserAccount> searchUsersByEmail(final String email);
+
+    /**
+     * Search List of User By Username
+     * @param username username
+     * @return
+     */
+    List<UserAccount> searchUsersByUsername(final String username);
+
+    /**
+     * Load list of {@link Permission}.
+     * @return list of permissions.
+     */
+    List<UnitPermission> loadPermissions();
+
+    /**
+     * Send password to user.
+     * @param email email
+     * @param password password
+     * @throws MailSendException
+     */
+    void sendUserPassword(final String email,
+            final String password)
+            throws MailSendException;
+
+    /**
+     * Find {@link UserAccount} by UserName
+     * @param username user name
+     * @return {@link UserAccount}
+     */
+    UserAccountBean findUserByEmail(final String email);
+
+    /**
+     * Get Email List by Username.
+     * @param username
+     * @return
+     * @throws EnMeNoResultsFoundException
+     */
+    List<UnitLists> getListbyUsername(final String username) throws EnMeNoResultsFoundException;
+
+    /**
+     * Assign Permission,
+     * @param userId user id
+     * @param permission {@link EnMePermission}.
+     * @param loggedUse user logged.
+     * @throws EnMeExpcetion exception.
+     */
+    void updatePermission(
+            final Long userId,
+            final String loggedUser,
+            final EnMePermission permission,
+            final String action)
+            throws EnMeExpcetion;
+
+    /**
+     * Get Group by Id and User Id.
+     * @param groupId
+     * @param username
+     * @return
+     * @throws EnMeNoResultsFoundException
+     */
+    Group getGroupbyIdandUser(final Long groupId, final String username) throws EnMeNoResultsFoundException;
+
+    /**
+     * User Bean.
+     * @param user
+     * @return
+     */
+    void getStatsByUsers(final UserAccountBean user);
+
+    /**
+     * Get User by Group.
+     * @param secGroupId
+     * @param username
+     * @return
+     */
+    Long getUserbyGroup(final Long groupId, final String username)throws EnMeNoResultsFoundException;
+
+    /**
+     * Count Users by Groups
+     * @param username
+     * @param groupId
+     * @return
+     */
+    List<Object[]> countUsersbyGroups(final Long groupId, final String username);
+
+    /**
+     * Change User Status.
+     * @param username
+     * @throws EnmeFailOperation
+     */
+    void changeUserStatus(final String username) throws EnmeFailOperation;
+
+    /**
+     * Update property for user account.
+     * @param property
+     * @param value
+     * @param username
+     * @throws EnMeNoResultsFoundException
+     */
+    void upadteAccountProfile(
+            final Profile property,
+            final String value,
+            final String username) throws EnMeNoResultsFoundException;
+
+    /**
+     * Update Account Profile.
+     * @param bio
+     * @param email
+     * @param username
+     * @param language
+     * @param completeName
+     * @throws EnMeNoResultsFoundException
+     */
+    void upadteAccountProfile(
+            final String bio,
+            final String language,
+            final String completeName,
+            final String loggedUsername) throws EnMeNoResultsFoundException;
+
+    /**
+     * User Account Is Activated.
+     * @param signUpBean
+     * @return
+     */
+    Boolean isActivated(final SignUpBean signUpBean);
+
+    /**
+     * Add Followers.
+     * @param myUser
+     * @param followerUser
+     * @return
+     * @throws EnMeNoResultsFoundException
+     */
+    UserAccount addFollower(final String myUser, final String followerUser) throws EnMeNoResultsFoundException;
+
+   /**
+    * Follow Operations.
+    * @param userAcc
+    * @param myUsername
+    * @param followerUser
+    * @param operation
+    * @throws EnMeNoResultsFoundException
+    */
+    void followOperations(final UserAccount userAcc,
+            final String myUsername, final String followerUser,
+            final FollowOperations operation) throws EnMeNoResultsFoundException;
+}

encuestame-business/src/main/java/org/encuestame/business/setup/ApplicationStartup.java

+
+package org.encuestame.business.setup;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Manages encuestame application startup.
+ * @author Picado, Juan juanATencuestame.org
+ * @since Mar 15, 2011
+ */
+public class ApplicationStartup implements Startup {
+
+    public ApplicationStartup() {
+        System.out.println("**********************ApplicationStartup*************************************");
+    }
+
+    protected Logger log = Logger.getLogger(this.getClass());
+
+    @PostConstruct
+    public void init(){
+        log.debug("*******************************");
+        log.debug("*                             *");
+        log.debug("*         STARTUP             *");
+        log.debug("*                             *");
+        log.debug("*******************************");
+    }
+
+    @PreDestroy
+    public void shuthdown(){
+        log.debug("*******************************");
+        log.debug("*                             *");
+        log.debug("*         SHUTHDOWN           *");
+        log.debug("*                             *");
+        log.debug("*******************************");
+    }
+
+    public void startProcess() {
+        // TODO Auto-generated method stub
+
+    }
+}

encuestame-business/src/main/java/org/encuestame/business/setup/SetupFilter.java

+
+package org.encuestame.business.setup;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+
+public class SetupFilter implements Filter {
+
+    public void init(FilterConfig filterConfig) throws ServletException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response,
+            FilterChain chain) throws IOException, ServletException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void destroy() {
+        // TODO Auto-generated method stub
+
+    }
+
+}

encuestame-business/src/main/java/org/encuestame/business/setup/Startup.java

+
+package org.encuestame.business.setup;
+
+
+public interface Startup {
+
+    void startProcess();
+}

encuestame-business/src/main/resources/confirm-your-account.vm

-<html>
-<body>
-    <div style="padding:14px;margin-bottom:4px;background-color:#008eb9">
-        <div style="font-size:16px;font-weidth:bold:padding:5px;">
-            Encuestame Survey System
-        </div>
-    </div>
-    <h2>Hi, ${user.username} </h2>
-    <p>
-    <div>Please confirm your encuestame account by clicking this link:</div>
-    <a href="http://localhost:8080/encuestame/account/confirm/email/${user.username}/${inviteCode}">
-        http://localhost:8080/encuestame/account/confirm/email/${user.username}/${inviteCode}
-    </a><br/>
-    <div>Once you have confirmed your account, you can access full access.</div><br/>
-
-    <div>${app.url}</div><br/>
-
-    <div>If you have received this message in error, please <a href="#">click here.</a></div><br/>
-
-    <div style="font-size:10px;">
-        footer message footer message footer message footer message footer message footer message footer message
-        footer message footer message footer messagefooter message footer message footer message footer message
-         footer message footer message footer message footer messagefooter message footer message
-    </div>
-    </p>
-</body>
-</html>

encuestame-business/src/main/resources/encuestame-report-context.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://www.springframework.org/schema/beans
-       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-</beans>

encuestame-business/src/main/resources/encuestame-security-context.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-  xmlns:security="http://www.springframework.org/schema/security"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://www.springframework.org/schema/beans
-       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-       http://www.springframework.org/schema/security
-       http://www.springframework.org/schema/security/spring-security-3.0.xsd">
-
-  <!-- To enable @Pre and @Post Annotations -->
-  <security:global-method-security pre-post-annotations="enabled"/>
-
-  <!-- Authentication Manager -->
-  <security:authentication-manager alias="authenticationManager">
-    <security:authentication-provider  user-service-ref="enMeAuthenticationDao">
-        <security:password-encoder ref="passwordEncoder" />
-    </security:authentication-provider>
-  </security:authentication-manager>
-
-  <bean id="passwordEncoder" class="org.jasypt.spring.security3.PasswordEncoder">
-    <property name="passwordEncryptor">
-      <ref bean="jasyptPasswordEncryptor" />
-    </property>
-  </bean>
-
-  <bean id="jasyptPasswordEncryptor" class="org.jasypt.util.password.StrongPasswordEncryptor" />
-
-
-  <bean id="enMeAuthenticationDao" class="org.encuestame.core.security.EnMeUserServiceImp">
-    <property name="roleGroupAuth" value="${spring.sec.roleByGroup}" />
-    <property name="roleUserAuth" value="${spring.sec.roleByAuthor}" />
-  </bean>
-
-  <bean id="authenticationEntryPoint"
-    class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
-    <property name="loginFormUrl" value="${spring.sec.loginPath}" />
-    <property name="forceHttps" value="${spring.sec.forceLoginSSL}" />
-  </bean>
-
-  <security:http auto-config="false"
-                 entry-point-ref="authenticationEntryPoint"
-                 access-decision-manager-ref="voteAccessDecisionManager"
-                 access-denied-page="${spring.sec.login.denied}">
-    <security:intercept-url pattern="index.jsp" filters="none" />
-
-    <!-- Public Paths -->
-    <security:intercept-url pattern="/index.jspx" filters="none"/>
-    <security:intercept-url pattern="/error.jspx" filters="none"/>
-    <security:intercept-url pattern="/home" filters="none"/>
-    <security:intercept-url pattern="/users.jspx" filters="none"/>
-    <security:intercept-url pattern="/tags.jspx" filters="none"/>
-    <security:intercept-url pattern="/signin.jspx" filters="none"/>
-    <security:intercept-url pattern="/forgot.jspx" filters="none"/>
-    <security:intercept-url pattern="/signup.jspx" filters="none"/>
-
-    <!-- Admon Paths -->
-    <security:intercept-url pattern="/admon/**/*" access="ENCUESTAME_ADMIN, ENCUESTAME_USER"/>
-
-    <!-- Account Paths
-    <security:intercept-url pattern="/user/signin.jspx" access="ENCUESTAME_ANONYMOUS"/>
-    <security:intercept-url pattern="/user/forgot.jspx" access="ENCUESTAME_ANONYMOUS" />
-    <security:intercept-url pattern="/user/signup.jspx" access="ENCUESTAME_ANONYMOUS"/>
-    -->
-
-    <security:intercept-url pattern="/user/logout" access="ENCUESTAME_USER"/>
-
-    <!-- Super Admin -->
-    <security:intercept-url pattern="/superAdmin.jspx" access="ENCUESTAME_SUPER"/>
-
-    <!-- Shared areas -->
-    <security:intercept-url pattern="/settings/**/*" access="ENCUESTAME_USER"/>