Package org.dspace.core

Examples of org.dspace.core.Context


    }

    public ModelAndView list(HttpServletRequest arg0, HttpServletResponse arg1)
            throws Exception
    {
        Context context = UIUtil.obtainContext(arg0);
        EPerson e = context.getCurrentUser();

        List<StatSubscriptionViewBean> subscriptions = statSubService
                .getSubscriptions(context, e);

        ModelAndView mv = new ModelAndView(listView);
View Full Code Here


  @Override
  protected ModelAndView onSubmit(HttpServletRequest request,
      HttpServletResponse response, Object command, BindException errors)
      throws Exception {
    Context dspaceContext = UIUtil.obtainContext(request);

    ImportDTO object = (ImportDTO) command;
    MultipartFile fileDTO = object.getFile();

    // read folder from configuration and make dir
    String path = ConfigurationManager
        .getProperty(CrisConstants.CFG_MODULE,"researcherpage.file.import.path");
    File dir = new File(path);
    dir.mkdir();
    try {
      if (object.getModeXSD() != null) {
        response.setContentType("application/xml;charset=UTF-8");
        response.addHeader("Content-Disposition",
            "attachment; filename=rp.xsd");
        String nameXSD = "xsd-download-webuirequest.xsd";
        File filexsd = new File(dir, nameXSD);
        filexsd.createNewFile();
        ImportExportUtils.newGenerateXSD(response.getWriter(), dir, applicationService
            .findAllContainables(RPPropertiesDefinition.class), filexsd, new String[]{"crisobjects","crisobject"}, "rp:", "http://www.cilea.it/researcherpage/schemas", "http://www.cilea.it/researcherpage/schemas", new String[]{"publicID","uuid","businessID","type"}, new boolean[]{false,false,true,true});
        response.getWriter().flush();
        response.getWriter().close();
        return null;
      } else {
        if (fileDTO != null && !fileDTO.getOriginalFilename().isEmpty()) {
          Boolean defaultStatus = ConfigurationManager
              .getBooleanProperty(CrisConstants.CFG_MODULE,"researcherpage.file.import.rpdefaultstatus");
          if (AuthorizeManager.isAdmin(dspaceContext)) {
            dspaceContext.turnOffAuthorisationSystem();
          }
          ImportExportUtils.importResearchersXML(fileDTO.getInputStream(), dir,
              applicationService, dspaceContext, defaultStatus);
          saveMessage(
              request,
View Full Code Here

            throws SQLException, SolrServerException
    {
        String uid = arg0.getParameter("uid");
        int type = UIUtil.getIntParameter(arg0, "type");
        String feedType = arg0.getParameter("feedtype");
        Context context = UIUtil.obtainContext(arg0);
        int numsFeed = ConfigurationManager.getIntProperty("webui.feed.stats",
                4);
        SummaryStatBean summary = statSubscribeService.getStatBean(context,
                uid, type, freq, numsFeed);
        StatSyndicationFeed feed = new StatSyndicationFeed();
View Full Code Here

        int rpp = -1;
        int etAl = -1;
        String orderfield = "";
        boolean ascending = false;

        Context context = UIUtil.obtainContext(request);
        DiscoverResult docs = null;
        long docsNumFound = 0;

        if (types.keySet().contains(type))
        {
View Full Code Here

    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request,
            HttpServletResponse response) throws Exception
    {
        Context context = UIUtil.obtainContext(request);
        ACrisObject cris = getCRISObject(request);
        String relationType = getRelationType(request);
        String fQuery = getSearchQuery(request);
        String status = getFilterStatus(request);
        List<Sort> sorts = getSorts(request);
View Full Code Here

  }

  @Override
  protected Map referenceData(HttpServletRequest request) throws Exception {
    Map<String, Object> model = new HashMap<String, Object>();
    Context context = UIUtil.obtainContext(request);
    EPerson currUser = context.getCurrentUser();
    boolean isAdmin = AuthorizeManager.isAdmin(context);
    if (currUser != null) {
      model.put("researcher_page_menu", new Boolean(true));
    }
    if (isAdmin) {
View Full Code Here

    public void addSubscriptionStatus(ModelAndView modelAndView,
            HttpServletRequest request)
    {
        try
        {
            Context context = UIUtil.obtainContext(request);
            EPerson currUser = context.getCurrentUser();
            if (currUser != null)
            {
                List<StatSubscription> statSubs = applicationService
                        .getStatSubscriptionByEPersonIDAndUID(currUser.getID(), getObject(request).getHandle());                               
                for (StatSubscription sub : statSubs)
View Full Code Here

    }
 
  @Override
  public ModelAndView handleRequest(HttpServletRequest request,
      HttpServletResponse response) throws Exception {
      Context context = UIUtil.obtainContext(request);
      EPerson currUser = context.getCurrentUser();
        if (currUser == null)
        {
            throw new ServletException("Wrong data or configuration: access to the my rp servlet without a valid user: there is no user logged in or the user's netid is null");
        }
       
        if (AuthorizeManager.isAdmin(context))
        {
            response.sendRedirect(request.getContextPath()+ "/dspace-admin/");
        }
        else
        {
            Integer id = currUser.getID();
            ResearcherPage rp = applicationService.getResearcherPageByEPersonId(id);
            if (rp != null && rp.getStatus() != null && rp.getStatus().booleanValue())
            {
                response.sendRedirect(request.getContextPath() + "/rp/" + ResearcherPageUtils.getPersistentIdentifier(rp));
            }
            else
            {
                // the researcher page is not active so redirect the user to the home page
                response.sendRedirect(request.getContextPath() + "/");
            }
        }
        // nothing to save so abort the context to release resources
        context.abort();
        return null;       
  }
View Full Code Here

  @Override
  protected ModelAndView onSubmit(HttpServletRequest request,
      HttpServletResponse response, Object command, BindException errors)
      throws Exception {
    Context dspaceContext = UIUtil.obtainContext(request);

    ImportDTO object = (ImportDTO) command;
    MultipartFile fileDTO = object.getFile();

    // read folder from configuration and make dir
    String path = ConfigurationManager
        .getProperty(CrisConstants.CFG_MODULE,"researcherpage.file.import.path");
    File dir = new File(path);
    dir.mkdir();
    try {
      if (object.getModeXSD() != null) {
        response.setContentType("application/xml;charset=UTF-8");
        response.addHeader("Content-Disposition",
            "attachment; filename=rp.xsd");
        String nameXSD = "xsd-download-webuirequest.xsd";
        File filexsd = new File(dir, nameXSD);
        filexsd.createNewFile()
        ImportExportUtils.generateXSD(response.getWriter(), dir, applicationService
                        .findAllContainables(RPPropertiesDefinition.class), filexsd, null);
        response.getWriter().flush();
        response.getWriter().close();
        return null;
      } else {
        if (fileDTO != null && !fileDTO.getOriginalFilename().isEmpty()) {
          Boolean defaultStatus = ConfigurationManager
              .getBooleanProperty(CrisConstants.CFG_MODULE,"researcherpage.file.import.rpdefaultstatus");
          if (AuthorizeManager.isAdmin(dspaceContext)) {
            dspaceContext.turnOffAuthorisationSystem();
          }
          ImportExportUtils.importResearchersXML(fileDTO.getInputStream(), dir,
              applicationService, dspaceContext, defaultStatus);
          saveMessage(
              request,
View Full Code Here

        AnagraficaObjectAreaDTO anagraficaObjectDTO = (AnagraficaObjectAreaDTO) command;

        // check admin authorization
        boolean isAdmin = false;
        Context context = UIUtil.obtainContext(request);
        if (AuthorizeManager.isAdmin(context))
        {
            isAdmin = true;
        }
View Full Code Here

TOP

Related Classes of org.dspace.core.Context

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.