Examples of UserDao


Examples of com.philip.journal.core.dao.UserDAO

        final ServiceFacade mockedFacade = Mockito.mock(ServiceFacade.class);
        getSession().put(BusinessServiceProxy.SERVICE_FACADE, mockedFacade);

        final BranchDAO mockBranchDAO = mock(BranchDAO.class);
        final EntryDAO mockEntryDAO = mock(EntryDAO.class);
        final UserDAO mockUserDAO = mock(UserDAO.class);
        final ConfigItemDAO mockConfigDAO = mock(ConfigItemDAO.class);

        when(daoFacade.getConfigItemDAO()).thenReturn(mockConfigDAO);
        when(mockConfigDAO.readAll()).thenReturn(new ArrayList<ConfigItem>());

        when(daoFacade.getBranchDAO()).thenReturn(mockBranchDAO);
        testRootBranch = new Branch(Constant.ROOT_NAME, null); //mock(Branch.class);
        testRootBranch.setBranchId(Constant.ROOT_ID);
        when(mockBranchDAO.read(Constant.ROOT_ID)).thenReturn(testRootBranch);
        /*
         * when(TEST_ROOT_BRANCH.getBranchId()).thenReturn(Constant.ROOT_ID);
         * when(TEST_ROOT_BRANCH.getName()).thenReturn(Constant.ROOT_NAME);
         */
        when(daoFacade.getEntryDAO()).thenReturn(mockEntryDAO);

        when(daoFacade.getUserDAO()).thenReturn(mockUserDAO);
        when(mockUserDAO.readByUsername(eq(JournalTestCommon.TEST_USERNAME))).thenReturn(testUser);

        try {
            testInstance = getTestInstanceClass().newInstance();
        } catch (final Exception e) {
            logger.error(e.getMessage(), e);
View Full Code Here

Examples of com.pv.mf.db.mock.example.simpledao.user.dao.UserDao

   public static void main(String[] args) {
      ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
               "classpath*:applicationContext.xml");
     
      UserDao userDao = ctx.getBean(UserDao.class);
   }
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

      return ans;
    }

    //Helper for JSP Page
    public String getUsername(){
      UserDao userDao = new UserDao();
      User reportUser = userDao.getUser(this.userId);
        if(reportUser != null)
          return reportUser.getUsername();
        else
          return Common.translate("reports.validate.userDNE");
    }
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

        if (previousPeriodCount < 1)
            response.addContextualMessage("previousPeriodCount", "reports.validate.periodCountLessThan1");
        if (pastPeriodCount < 1)
            response.addContextualMessage("pastPeriodCount", "reports.validate.periodCountLessThan1");
       
        UserDao dao = new UserDao();
        User user = dao.getUser(userId);
        if(user == null){
            response.addContextualMessage("userId", "reports.validate.userDNE");
        }
       
        File t = new File(Common.MA_HOME + ModuleRegistry.getModule("reports").getDirectoryPath() + "/web/ftl/" + template);
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

    public static void queueReport(ReportVO report) {
        LOG.debug("Queuing report with id " + report.getId());

        // Verify that the user is not disabled.
        User user = new UserDao().getUser(report.getUserId());
        if (user.isDisabled())
            return;

        // User is ok. Continue...
        ReportWorkItem item = new ReportWorkItem();
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

        xidMap = template.getXidMapping();
        templateFile = template.getTemplate();
        includeEvents = template.getIncludeEvents();
        includeUserComments = template.isIncludeUserComments();

        UserDao userDao = new UserDao();
        User reportUser = userDao.getUser(userId);
        if(reportUser != null)
          username = reportUser.getUsername();
        else
          username = Common.translate("reports.validate.userDNE");
       
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

        ReportDao reportDao = new ReportDao();
        User user = Common.getUser();

        response.addData("points", getReadablePoints());
        response.addData("mailingLists", new MailingListDao().getMailingLists());
        response.addData("users", new UserDao().getUsers());
        if(user.isAdmin()) {
          response.addData("reports", reportDao.getReports());
          response.addData("instances", getReportInstances(user));
      }
        else {
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

      if(user.isAdmin())
        result = new ReportDao().getReportInstances();
      else
        result = new ReportDao().getReportInstances(user.getId());
        Translations translations = getTranslations();
        UserDao userDao = new UserDao();
        for (ReportInstance i : result){
            i.setTranslations(translations);
            User reportUser = userDao.getUser(i.getUserId());
            if(reportUser != null)
              i.setUsername(reportUser.getUsername());
            else
              i.setUsername(Common.translate("reports.validate.userDNE"));
           
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

     * This method is used before the view is displayed in order to validate: - that the given user is allowed to access
     * points that back any components - that the points that back components still have valid data types for the
     * components that render them
     */
    public void validateViewComponents(boolean makeReadOnly) {
        User owner = new UserDao().getUser(userId);
        for (ViewComponent viewComponent : viewComponents)
            viewComponent.validateDataPoint(owner, makeReadOnly);
    }
View Full Code Here

Examples of com.serotonin.m2m2.db.dao.UserDao

        }
    }

    @Override
    public void jsonWrite(ObjectWriter writer) throws IOException, JsonException {
        writer.writeEntry("user", new UserDao().getUser(userId).getUsername());
        writer.writeEntry("anonymousAccess", ShareUser.ACCESS_CODES.getCode(anonymousAccess));
        writer.writeEntry("viewComponents", viewComponents);
        writer.writeEntry("sharingUsers", viewUsers);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.