Package org.openqreg.bean

Examples of org.openqreg.bean.User


      awa.setStatus(AjaxWidgetAnswer.STATUS_NOSERVICE);
      return awa;
    }

    // we have access carry on...
    User user = Dispatcher.getInstance().getUser(userId);

    // add default answer text, listboxtexts, guisettings, containers
    addDefaultAnswer(user, awr, awa);
    awa.setStatus(AjaxWidgetAnswer.STATUS_FETCHED);
   
View Full Code Here


  public void setUp() throws Exception {
   
    languageHandler = LanguageHandler.getInstance();
    languageHandler.setNoMatchFoundMessage("");   
   
    User user = new User();
    user.setLanguageid("sv");
   
    parameter = new DefaultElementParameter();
    parameter.setUser(user);
   
  }
View Full Code Here

      sa.setStatus(AjaxWidgetAnswer.STATUS_NOSERVICE);
      return sa;
    }

    // we have access carry on...
     User user = Dispatcher.getInstance().getUser(userId);
   
    //add default answer text, listboxtexts, guisettings, containers
    addDefaultAnswer(user, sr, sa);
   
    // sa.setStatus("fetched");
View Full Code Here

    if (!Dispatcher.getInstance().checkAccess(userId, service)) {
      // no service, return that :)
      sa.setStatus(AjaxWidgetAnswer.STATUS_NOSERVICE);
      return sa;
    }
    User user = Dispatcher.getInstance().getUser(userId);
    // we have access carry on...
    ServiceBean serviceBean = sr.getService();
    Collection<String> userGroups = sr.getUserGroups();
    sa.setService(serviceBean);
    Connection con = null;
View Full Code Here

      wha.setStatus(AjaxWidgetAnswer.STATUS_NOSERVICE);
      return wha;
    }

    // we have access carry on...
     User user = Dispatcher.getInstance().getUser(userId);
   
    //add default answer text, listboxtexts, guisettings, containers
    addDefaultAnswer(user, whr, wha);
   
    wha.setStatus(AjaxWidgetAnswer.STATUS_FETCHED);
View Full Code Here

   */
  public Collection<CentreBean> findByCountryId(String userId,
      String countryId) throws SQLException, NoServiceException {
    String service = "ADMINUSER_PAGE";
    if (hasService(userId, service)) {
      User user = Dispatcher.getInstance().getUser(userId);
      Connection con = null;
      try {
        con = DbHandler.getConnection();
        Collection<CentreBean> col = UserRelation
            .retrieveCentreListForACountry(con, user, Integer
View Full Code Here

   * @throws SQLException
   */
  public Collection<AjaxAutocompleteAnswer> findByCountryIdAutocomplete(String userIdEditing, String countryId, String term, String userIdEdited, String status) throws SQLException, NoServiceException {
    String service = "ADMINUSER_PAGE";
    if (hasService(userIdEditing, service)) {
      User user = Dispatcher.getInstance().getUser(userIdEditing);
      Connection con = null;
      try {
        con = DbHandler.getConnection();
        Collection<CentreBean> col = UserRelation.retrieveCentreListForACountry(con, user, Integer.valueOf(1), Integer.valueOf(1), countryId, term);

        BeanSorter.sort(BeanSorter.getLocale(user), col, "centrename");
        Collection<AjaxAutocompleteAnswer> aaac = Collections.synchronizedList(new ArrayList<AjaxAutocompleteAnswer>());
        Map<String, Map<String, GrouprelationBean>> userGroupRels = GrouprelationFinder.findAllAsMap(con);
        Map<String, UsergroupBean> userGroupMap = UsergroupFinder.searchByUseUcr(Integer.valueOf(0));
        // if admin user is not ucr-user, then the user might have different groupid for different centers,
        // set to null now and find out groupid per center
        String grpidforcentre = (userGroupMap.get(user.getGroupid()) != null ? user.getGroupid() : null);
        for (CentreBean cb : col) {
          if (userIdEdited != null) {
            //Find all relations to centers for the user that is administrated
            Collection<UsercentrerelBean> colUserCentres = UsercentrerelFinder.findByUserid(con, userIdEdited);
            boolean show = true;
            for (UsercentrerelBean crb : colUserCentres) {
              //No status means that we are interested in all centers that the edited user is NOT related to
              if (status == null && crb.getCentreid().equals(cb.getId())) {
                show = false;
                break;
              //Status not null means that we want all centres that the user has a relation to with the specified status
              } else if (status != null && crb.getCentreid().equals(cb.getId()) && Integer.valueOf(status).equals(crb.getStatus())) {
                show = true;
                break;
              } else if (status != null) {
                show = false;
              }
            }
            if (show) {
              if (grpidforcentre == null) {
                grpidforcentre = UsercentrerelFinder.findGroupidByUseridCentreid(con, user.getId(), cb.getId());
              }
              AjaxAutocompleteAnswer aaa = new AjaxAutocompleteAnswer();
              aaa.setLabel(cb.getCentrename());
              aaa.setValue(cb.getId());
              aaa.setExtra1(AdminUserCentreRelFormTag.getGroupSelect(LanguageHandler.getInstance(), user.getLanguageid(),
                  grpidforcentre, cb.getId(), null, userGroupMap, userGroupRels).toString());
              aaac.add(aaa);             
            }
          } else {
            AjaxAutocompleteAnswer aaa = new AjaxAutocompleteAnswer();
View Full Code Here

      throws ServletException, IOException {
    Dispatcher disp = null;

    LoginAnswer loginAnswer = null;

    User user = null;

    String langId = null;

    FetchData fetch = null;
    // checks that we are active and so on....

    // Try to get the Dispatcher from the application scope
    disp = Dispatcher.getInstance();
    if (disp != null) {

      // loginAnswer = disp.isActiveForInterfaceUpdates(req);
      loginAnswer = disp.isActive(req);

      // Get the user from the application scope
      user = disp.getUser(loginAnswer.getUserId());
      // Get the fetch from the application scope
      fetch = loginAnswer.getFetch();

      // If active & has needed service
      if ("active".equals(loginAnswer.getStatus())
          && (null == requiredService() || disp.checkAccess(
              loginAnswer.getUserId(), requiredService()))) {

        // Get the langId from the application scope
        langId = user.getLanguageid();
        // must be implemented in subclass, does the magic... :)
        giveService(req, res, user, loginAnswer, fetch, langId);

      } else {
        // no access to service
        // res.getWriter().write(NOACCESS);
        abuseLog.log(Level.INFO, "service() no access to :"
            + requiredService() + " userId:" + user.getId());

      }
    }
  }
View Full Code Here

      rw.setLinks(getLinks(""));
      return Response.status(Response.Status.FORBIDDEN).entity(rw)
          .build();
    }

    User user = Dispatcher.getInstance().getUser(la.getUserId());
    AjaxWidgetAnswer awa = new AjaxWidgetAnswer();
    // add default answer text, listboxtexts, guisettings, containers
    try {
      addDefaultAnswer(user, awr, awa);
    } catch (SQLException e) {
View Full Code Here

      rw.setLinks(getLinks(""));
      return Response.status(Response.Status.FORBIDDEN).entity(rw)
          .build();
    }

    User user = Dispatcher.getInstance().getUser(la.getUserId());
    AjaxWidgetAnswer awa = new AjaxWidgetAnswer();
    // add default answer text, listboxtexts, guisettings, containers
    try {
      addDefaultAnswer(user, awr, awa);
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    // TODO: the first userId should be id of link, or come up with better
    // solution
    rw.setSuccess(true);
    rw.setLinks(getLinks(userId));

    rw.setData(awa);
    String name = null;
    String contenttype = null;
    String freeText = null;
    String description = null;
    Date dateFrom = null;
    Date dateTo = null;

    try {
      Map<String, Object> filter = getFilterMap(userId, awr);

      freeText = (String) filter.get("freeText");

      if (null != filter.get("dateFrom")
          && !"".equals((String) filter.get("dateFrom"))) {
        dateFrom = Converter.stringToSqlDate((String) filter
            .get("dateFrom"));
      }
      if (null != filter.get("dateTo")
          && !"".equals((String) filter.get("dateTo"))) {
        dateTo = Converter.stringToSqlDate((String) filter
            .get("dateTo"));
      }
      Collection<RestWrapper> colRW = new ArrayList<>();
      // Collection<FileBean> col = FileFinder.findByOwner(user.getId());
      Collection<FileBean> col = FileFinder
          .searchByNameContenttypeDescriptionOwnerDateFromDateTo(
              user, 500, freeText, contenttype, description,
              user.getId(), dateFrom, dateTo);
      for (FileBean fb : col) {
        fb.setFileShareUserCol(FileshareuserFinder.findByFileid(fb
            .getId()));
        RestWrapper rwFile = new RestWrapper();
        rwFile.setLinks(getLinksForObject(userId, fb.getId().toString()));
View Full Code Here

TOP

Related Classes of org.openqreg.bean.User

Copyright © 2018 www.massapicom. 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.