Package edu.uga.galileo.voci.model

Examples of edu.uga.galileo.voci.model.ProjectManager$ProjectUpdateNotifier


        // editing permission for each, and attach that data to the
        // search results
        if ((forwardRequestTo.indexOf("/do/") != -1)
            && (results != null)) {
          WorkflowManager wm = new WorkflowManager();
          ProjectManager pm = new ProjectManager();
          User user = (User) request.getSession()
              .getAttribute("user");
          // if user is null, stick with the default that none of
          // the results is editable
          if (user != null) {
            SearchResult result;
            boolean includeExtras = request
                .getParameter("includeExtras") == null ? false
                : true;
            for (int m = results.size() - 1; m >= 0; m--) {
              result = results.get(m);
              try {
                if (wm.canEdit(user, pm.getProjectHandle(result
                    .getProjectId()), ContentType.valueOf(
                    result.getVBO().getType()).getPlural(),
                    result.getVBO().getId())) {
                  result.setUserEditable(true);
                } else if (!includeExtras) {
View Full Code Here


    try {
      if ((includeOnly != null) && (includeOnly.size() == 0)) {
        results = new ArrayList<SearchResult>();
      } else {
        results = manager.performBasicQuery(query, searchType,
            (new ProjectManager()).getProjectID(command
                .getProject()), activeOnly, allowsZero, true,
            useBlurbFields, includeOnly, username, updateDateStart,
            updateDateEnd);
      }
      if (request.getParameter("ctype") != null) {
View Full Code Here

          qualifier = null;
        }

        try {
          int metadataId = MetadataManager.getMetadataId(element,
              qualifier, (new ProjectManager())
                  .getProjectID(command.getProject()),
              contentTypeId);

          if (advancedQuery.length() > 0) {
            advancedQuery.append('|');
          }
          advancedQuery.append(contentTypeLetter);
          advancedQuery.append(metadataId);
          advancedQuery.append(':');
          advancedQuery.append(paramValue.toLowerCase());
        } catch (NoSuchMetadataException e) {
          Logger.warn("Metadata ID couldn't be found to query.", e);
        } catch (NoSuchProjectException e) {
          Logger.warn("Project ID couldn't be found to query.", e);
        }
      }
    }

    // perform the query
    String advancedQueryString = StringUtils
        .undoSpecialCharReplacements(advancedQuery.toString());
    SearchManager manager = new SearchManager();
    List<SearchResult> results = null;
    ArrayList<Integer> includeOnly = processSearchPlugins(request);
    try {
      if ((includeOnly != null) && (includeOnly.size() == 0)) {
        results = new ArrayList<SearchResult>();
      } else {
        results = manager.performAdvancedQuery(advancedQueryString,
            searchType, (new ProjectManager()).getProjectID(command
                .getProject()), contentTypeId, activeOnly,
            allowsZero, true, useBlurbFields, includeOnly,
            username, updateDateStart, updateDateEnd);
      }
      request.getSession().setAttribute("searchResults", results);
View Full Code Here

          .getParameterValues("blurbMe");

      ContentType contentType = ContentType.valueOf(Integer
          .parseInt(request.getParameter("ctype")));
      try {
        int projectId = (new ProjectManager()).getProjectID(command
            .getProject());
        for (int m = 0; m < newFieldsToBlurbFrom.length; m++) {
          // strip out the starting "s:" from the advanced search
          // pages
          newFieldsToBlurbFrom[m] = newFieldsToBlurbFrom[m]
View Full Code Here

    String[] commandPieces = uri.split("/");
    Command command = new Command(commandPieces[2], commandPieces[3],
        (commandPieces.length > 4 ? commandPieces[4] : null),
        (commandPieces.length > 5 ? ArrayUtils.subset(commandPieces, 5,
            commandPieces.length - 1) : null));
    (new ProjectManager()).setDisplayProject(command);
    if (commandPieces[1].equals("go")) {
      command.setViewCommand(true);
    }

    // any command can be saved in the user's session for later retrieval
View Full Code Here

   *            The <code>HttpServletRequest</code> associated with this
   *            request.
   */
  @SuppressWarnings("unchecked")
  private void doProjectSetup(Command command, HttpServletRequest request) {
    ProjectManager pm = new ProjectManager();

    // since project information is regularly required for display,
    // we keep a map of them in the application context so all jsps
    // can reach it. the project servlet will remove any updated
    // project so that it'll be picked up again in the next request.
    HashMap<String, Project> projectMap;
    boolean needsProjectAdded = false;
    if (getServletContext().getAttribute("projectMap") == null) {
      projectMap = new HashMap<String, Project>();
      getServletContext().setAttribute("projectMap", projectMap);
      needsProjectAdded = true;
      Logger.debug("Empty project map added to context.");
    } else {
      projectMap = (HashMap<String, Project>) getServletContext()
          .getAttribute("projectMap");
      Logger.debug("Project map retrieved from context.");
      if (!projectMap.containsKey(command.getProject())) {
        needsProjectAdded = true;
      }
    }

    // add the project if it wasn't found in the map
    if (needsProjectAdded) {
      try {
        projectMap.put(command.getProject(), pm.getProject(command
            .getProject()));
        Logger.debug("'" + command.getProject()
            + "' added to project map");
      } catch (NoSuchProjectException e) {
        // just warn here, b/c the fatal errors will come soon
        // enough if this happens
        Logger.warn("Couldn't get project '" + command.getProject()
            + "'", e);
      }
    }

    // then add any "support project"-related information to the servlet
    // request, listing on those that the user has administrative privileges
    // within
    if (request.getSession().getAttribute("user") != null) {
      User user = (User) request.getSession().getAttribute("user");
      HashMap<String, String> userAdminRoleMap;

      Project project = projectMap.get(command.getProject());
      if (project.getParentId() > 0) {
        // this is a support project, so get the parent project's name
        // and
        // handle for public face linking (LeftHandMenu.jsp)
        try {
          Project parentProject = pm.getProject(pm
              .getProjectHandle(project.getParentId()));
          userAdminRoleMap = user.getAdminRoles().get(
              parentProject.getHandle());
          if ((userAdminRoleMap != null)
              && (userAdminRoleMap.size() > 0)) {
            request.setAttribute("parentProject", parentProject);
          }
        } catch (NoSuchProjectException e) {
          Logger.warn("Couldn't find parent project for display.", e);
        }
      } else {
        // this is a main project, so get any available child projects'
        // names and handles for public face linking
        // (LeftHandMenu.jsp)
        ArrayList<Project> supportProjects = pm
            .getSupportProjects(project);
        if (supportProjects!=null) {
          for (int m = supportProjects.size() - 1; m >= 0; m--) {
            userAdminRoleMap = user.getAdminRoles().get(
                supportProjects.get(m).getHandle());
View Full Code Here

  @SuppressWarnings("unchecked")
  public void getItemWrappersForNode(Command command, User user,
      HttpServletRequest request) {
    int projectId;
    try {
      projectId = (new ProjectManager()).getProjectID(command
          .getProject());
    } catch (NoSuchProjectException e) {
      Logger.warn("No project found matching handle "
          + command.getProject(), e);
      return;
View Full Code Here

   *            The project ID to be associated with this result.
   */
  public void setProjectId(int projectId) {
    this.projectId = projectId;
    try {
      projectHandle = (new ProjectManager()).getProjectHandle(projectId);
    } catch (NoSuchProjectException e) {
      Logger.error("Couldn't get project handle for ID " + projectId);
    }
  }
View Full Code Here

      if ((!isErrors) && (fieldMessages.size() == 0) && (errors.size() == 0))
      {
        try
        {
          User sessionUser = (User) request.getSession().getAttribute("user");
          userManager.updateUser(new ProjectManager().getProject(command.getProject()), sessionUser, user, oldContent);
          request.setAttribute("successMessage", "User successfully updated <span class=\"tinyformtext\">("
              + Calendar.getInstance().getTime().toString() + ")</span>");

        }
        catch( RoleUpdateAddException roleEx )
        {
          errors.add("System failed to update roles for user.");
        }
        catch( UserAddUpdateException nsuex )
        {
          Logger.error("\n Could not update user data \n", nsuex);
          errors.add("User update failed...");
        }
        catch( NoSuchProjectException ex )
        {
          Logger.error("\n Could not update user.  Project doesn't exist (" + project.toString() + ") \n", ex);
          errors.add("Project doesn't exist.");
        }
      }
    }

    if (errors.size() > 0)
    {
      request.setAttribute("errorMessage", generateErrorMessage(errors));
    }

    if (fieldMessages.size() > 0)
    {
      request.setAttribute("fieldMessages", fieldMessages);
    }

    // attach full list of roles to user
    try
    {
      user = new RoleManager().setFullListRoleNames(new ProjectManager().getProjectID(command.getProject()), user);
      user.setRoles(user.getRoles());
    }
    catch( NoSuchProjectException ex )
    {
      Logger.error("System can't retrieve correct Project" + Calendar.getInstance().getTime().toString());
      errors.add("Project does not exist.  Please contact an Administrator.");
    }
    if (oldUser != null)
    {
      request.setAttribute("oldPwd", oldUser.getPwd());
    }
    request.setAttribute("user", user);

    int projectId = -1;
    ArrayList historyRecords = new ArrayList();
    try
    {
      projectId = new ProjectManager().getProjectID(command.getProject());
      historyRecords = (new AuditLogManager()).getUpdateRecords(projectId, ContentType.USER, user.getUserId());
    }
    catch( NoSuchProjectException ex )
    {
      Logger.debug("\n\n Could not retrieve projectId - UserServlet.processUpdateRequest \n\n");
View Full Code Here

    // if no errors and user doesn't already exist add new user record
    if ((!isErrors) && (fieldMessages.size() == 0) && (errors.isEmpty()))
    {
      try
      {
        int projectId = new ProjectManager().getProjectID(command.getProject());
        userManager.addUser(((User) request.getSession().getAttribute("user")), user, projectId);
        request.setAttribute("successMessage", "New user created.");
      }
      catch( NoSuchUserException nsuex )
      {
        Logger.error("\n Could not add user data \n", nsuex);
        // request.setAttribute("errorMessage", "Errors occurred while
        // processing
        // add new user request...");
        errors.add("Errors occurred while processing add new user request...");
        isErrors = true;
      }
      catch( RoleUpdateAddException ruaex )
      {
        Logger.debug("Couldn't add role for user : " + user.getUserName(), ruaex);
        errors.add("Couldn't add role for user : " + user.getUserName());
      }
      catch( NoSuchProjectException ex )
      {
        Logger.error("System can't retrieve correct Project" + Calendar.getInstance().getTime().toString());
        errors.add("Project does not exist.  Please contact an Administrator.");
      }
    }

    if (errors.size() > 0)
    {
      request.setAttribute("errorMessage", generateErrorMessage(errors));
    }

    if (fieldMessages.size() > 0)
    {
      request.setAttribute("fieldMessages", fieldMessages);
      isErrors = true;
    }

    // attach full list of roles to user
    try
    {
      user = new RoleManager().setFullListRoleNames(new ProjectManager().getProjectID(command.getProject()), user);
    }
    catch( NoSuchProjectException ex )
    {
      Logger.error("System can't retrieve correct Project" + Calendar.getInstance().getTime().toString());
      errors.add("Project does not exist.  Please contact an Administrator.");
View Full Code Here

TOP

Related Classes of edu.uga.galileo.voci.model.ProjectManager$ProjectUpdateNotifier

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.