Package org.dspace.app.cris.model

Examples of org.dspace.app.cris.model.ResearcherPage


        String researcher = req.getParameter("researcher");

       
        EPerson currUser = context.getCurrentUser();
       
        ResearcherPage rp = service.get(ResearcherPage.class, ResearcherPageUtils
                .getRealPersistentIdentifier(researcher, ResearcherPage.class), true);

        try
        {
            if (rp == null  && // cv is hide
                    !(AuthorizeManager.isAdmin(context) || // the user logged in is
                                                           // not an admin
                    (currUser != null && (rp.getEpersonID() != null && currUser
                            .getID() == rp.getEpersonID())))) // the user logged
                                                                 // in is not the
                                                                 // rp owner
                   
            {
                resp.sendError(HttpServletResponse.SC_NOT_FOUND);
            }
        }
        catch (SQLException e1)
        {
            new AuthorizeException(e1.getMessage());
        }

        String rpName = rp.getFullName();

        String connection = req.getParameter("connection");

        NetworkPlugin plugin = (NetworkPlugin) PluginManager.getNamedPlugin(NetworkPlugin.CFG_MODULE,
                NetworkPlugin.class, connection);

        String showEXT = req.getParameter("showexternal");
        boolean showALL = true;
        if (showEXT != null)
        {
            showALL = Boolean.parseBoolean(showEXT);
        }

        String showSameDept = req.getParameter("showsamedept");
        boolean showALLDept = true;
        if (showSameDept != null)
        {
            showALLDept = Boolean.parseBoolean(showSameDept);
        }

        List<JsGraph> graph = new LinkedList<JsGraph>();
        // search data from connection
        try
        {

            Integer maxDepth = plugin.getCustomMaxDepth();
           
            log.info("Request build graph for: " + rp);
            RPGraphBuilderUtils builder = new RPGraphBuilderUtils();
            List<RestrictedFieldWithLock> orgUnit = rp.getOrgUnit();
            builder.buildGraph(service, researcher, rpName, plugin, graph, 0, maxDepth,
                    showALL, showALLDept, (orgUnit!=null && orgUnit.size()>0)?orgUnit.get(0).getValue():"");
           
            log.info("Build graph info:");
            log.info(" ->map contains " + graph.size() + " nodes");
View Full Code Here


            HttpServletResponse response, Object command, BindException errors)
            throws Exception
    {
        ResearcherPageDTO researcherDTO = (ResearcherPageDTO) command;
        String staffNo = researcherDTO.getSourceID();
        ResearcherPage researcher = null;
        if (staffNo != null && !staffNo.isEmpty())
        {
            researcher = applicationService
                    .getResearcherPageByStaffNo(researcherDTO.getSourceID());

            if (researcher != null)
            {

                return new ModelAndView("redirect:/cris/rp/"
                        + "administrator/index.htm?error=true");
            }

        }

        else
        {
            researcher = new ResearcherPage();
            researcher.setSourceID(staffNo);
            researcher.setStatus(false);
            researcher.getDynamicField().setResearcherPage(researcher);          
            applicationService.saveOrUpdate(ResearcherPage.class, researcher);

        }
        return new ModelAndView(getSuccessView() + researcher.getId());

    }
View Full Code Here

        return clazz.isAssignableFrom(arg0);
    }

    public void validate(Object arg0, Errors arg1)
    {
        ResearcherPage researcher = (ResearcherPage) arg0;

        ValidationUtils.rejectIfEmptyOrWhitespace(arg1, "staffNo",
                "error.staffNo.mandatory", "StaffNo is mandatory");
        ValidationUtils.rejectIfEmptyOrWhitespace(arg1, "fullName",
                "error.fullName.mandatory", "FullName is mandatory");

       
        String staffNo = researcher.getSourceID();
        if (staffNo!=null)
        {
            ResearcherPage temp = applicationService
                    .getResearcherPageByStaffNo(staffNo);
            if (temp != null)
            {
                if (!researcher.getId().equals(temp.getId()))
                {
                    arg1.reject("staffNo",
                            "Staff No is already in use by another researcher");
                }
            }
View Full Code Here

            response.sendError(HttpServletResponse.SC_NOT_FOUND,
                    "Researcher page not found");
            return null;
        }

        ResearcherPage researcher = null;
        try
        {

            researcher = ((ApplicationService) applicationService).get(
                    ResearcherPage.class, objectId);

        }
        catch (NumberFormatException e)
        {
        }

        if (researcher == null)
        {
            response.sendError(HttpServletResponse.SC_NOT_FOUND,
                    "Researcher page not found");
            return null;
        }

        Context context = UIUtil.obtainContext(request);
        EPerson currUser = context.getCurrentUser();

        boolean isAdmin = AuthorizeManager.isAdmin(context);
     
        if (isAdmin
                || (currUser != null && (researcher.getEpersonID() != null && currUser
                        .getID() == researcher.getEpersonID())))
        {
            model.put("researcher_page_menu", new Boolean(true));
            model.put("authority_key",
                    ResearcherPageUtils.getPersistentIdentifier(researcher));

            if (isAdmin)
            {
                AuthorityDAO dao = AuthorityDAOFactory.getInstance(context);
                long pendingItems = dao
                        .countIssuedItemsByAuthorityValueInAuthority(
                                RPAuthority.RP_AUTHORITY_NAME,
                                ResearcherPageUtils
                                        .getPersistentIdentifier(researcher));
                model.put("pendingItems", new Long(pendingItems));
            }
        }
       
        else if ((researcher.getStatus() == null || researcher.getStatus()
                .booleanValue() == false))
        {
            if (context.getCurrentUser() != null
                    || Authenticate.startAuthentication(context, request,
                            response))
            {
                // Log the error
                log.info(LogManager
                        .getHeader(context, "authorize_error",
                                "Only system administrator can access to disabled researcher page"));

                JSPManager
                        .showAuthorizeError(
                                request,
                                response,
                                new AuthorizeException(
                                        "Only system administrator can access to disabled researcher page"));
            }
            return null;
        }

       
        if (subscribeService != null)
        {
            boolean subscribed = subscribeService.isSubscribed(currUser,
                    researcher);
            model.put("subscribed", subscribed);
            EPerson eperson = EPerson.findByNetid(context, researcher.getSourceID());
            if (eperson != null) {
              model.put("subscriptions", subscribeService.getSubscriptions(eperson));
            }
        }
View Full Code Here

        }

        Pattern patt = Pattern.compile("rp[0-9]{5}$");
        Matcher matcher = patt.matcher(authority);

        ResearcherPage researcherFocus = new ResearcherPage();
        if (matcher.find())
        {
            researcherFocus = applicationService.get(ResearcherPage.class, ResearcherPageUtils
                    .getRealPersistentIdentifier(authority, ResearcherPage.class), true);
           
        }
        else
        {
            researcherFocus.setFullName(authority);
        }

        ResearcherPage researcherTarget = new ResearcherPage();
        String authorityTarget = target;
        if (target != null)
        {
            matcher = patt.matcher(target);
            if (matcher.find())
            {

                researcherTarget = applicationService.get(ResearcherPage.class, ResearcherPageUtils
                        .getRealPersistentIdentifier(target, ResearcherPage.class), true);

            }
            else
            {
                researcherTarget.setFullName(target);
            }
        }
        request.setAttribute("researchertarget", researcherTarget);
        request.setAttribute("authoritytarget", authorityTarget);
        request.setAttribute("authority", authority);
View Full Code Here

        Integer id = null;
        if (id_s != null)
        {
            id = Integer.parseInt(id_s);
        }
        ResearcherPage researcher = applicationService.get(
                ResearcherPage.class, id);
        MailDTO dto = new MailDTO();
        dto.setSubmitter(researcher.getId());
        dto.setRp(ResearcherPageUtils.getPersistentIdentifier(researcher));
        Locale supportedLocale = request.getLocale();
        ResourceBundle labels = ResourceBundle.getBundle("Messages",
                supportedLocale);
        switch (mode)
View Full Code Here

    public ModelAndView handleRequest(HttpServletRequest arg0,
            HttpServletResponse arg1) throws Exception
    {               
        String id_s = arg0.getParameter("id");
        Integer id = null;
        ResearcherPage researcher = null;
        if(id_s!=null && !id_s.isEmpty()) {
            id = Integer.parseInt(id_s);
            researcher = applicationService.get(ResearcherPage.class, id);
        }
        List<ResearcherPage> r = new LinkedList<ResearcherPage>();
View Full Code Here

        Boolean isAdmin = false;
        if (paramId != null)
        {
            id = Integer.parseInt(paramId);
        }
        ResearcherPage researcher = getApplicationService().get(
                ResearcherPage.class, id);
        Context context = UIUtil.obtainContext(request);
        EPerson currentUser = context.getCurrentUser();
        if ((currentUser==null || (researcher.getEpersonID()!=null && currentUser.getID()!=researcher.getEpersonID()))
               && !AuthorizeManager.isAdmin(context))
        {
            throw new AuthorizeException(
                    "Only system admin can edit not personal researcher page");
        }

        if (AuthorizeManager.isAdmin(context))
        {
            isAdmin = true;
        }

        Integer areaId;
        if (paramTabId == null)
        {
            if (paramFuzzyTabId == null)
            {
                List<EditTabResearcherPage> tabs = getApplicationService()
                        .getTabsByVisibility(
                                EditTabResearcherPage.class, isAdmin);
                if (tabs.isEmpty())
                {
                    throw new AuthorizeException("No tabs defined!!");
                }
                areaId = tabs.get(0).getId();
            }
            else
            {
                EditTabResearcherPage fuzzyEditTab = (EditTabResearcherPage)((ApplicationService)getApplicationService()).<BoxResearcherPage, TabResearcherPage, EditTabResearcherPage>getEditTabByDisplayTab(Integer.parseInt(paramFuzzyTabId),EditTabResearcherPage.class);
                areaId = fuzzyEditTab.getId();
            }
        }
        else
        {
            areaId = Integer.parseInt(paramTabId);
        }
       
        EditTabResearcherPage editT = getApplicationService().get(
                EditTabResearcherPage.class, areaId);
        List<BoxResearcherPage> propertyHolders = new LinkedList<BoxResearcherPage>();
        if (editT.getDisplayTab() != null)
        {
            for (BoxResearcherPage box : editT.getDisplayTab()
                    .getMask())
            {
                propertyHolders.add(box);
            }
        }
        else
        {
            propertyHolders = getApplicationService().findPropertyHolderInTab(
                    getClazzTab(), areaId);
        }

        List<IContainable> tipProprietaInArea = new LinkedList<IContainable>();

        for (BoxResearcherPage iph : propertyHolders)
        {
            if (editT.getDisplayTab() != null)
            {
                tipProprietaInArea
                        .addAll(getApplicationService()
                                .<BoxResearcherPage, it.cilea.osd.jdyna.web.Tab<BoxResearcherPage>> findContainableInPropertyHolder(
                                        BoxResearcherPage.class,
                                        iph.getId()));
            }
            else
            {
                tipProprietaInArea
                        .addAll(getApplicationService()
                                .<BoxResearcherPage, it.cilea.osd.jdyna.web.Tab<BoxResearcherPage>> findContainableInPropertyHolder(
                                        getClazzBox(), iph.getId()));
            }
        }

        RPAdditionalFieldStorage dynamicObject = researcher.getDynamicField();
        RPAnagraficaObjectDTO anagraficaObjectDTO = new RPAnagraficaObjectDTO(
                researcher);
        anagraficaObjectDTO.setTabId(areaId);
        anagraficaObjectDTO.setObjectId(dynamicObject.getId());
        anagraficaObjectDTO.setParentId(researcher.getId());

        List<RPPropertiesDefinition> realTPS = new LinkedList<RPPropertiesDefinition>();
        List<IContainable> structuralField = new LinkedList<IContainable>();
        for (IContainable c : tipProprietaInArea)
        {
View Full Code Here

        if (request.getParameter("cancel") != null)
        {
            return new ModelAndView(exitPage);
        }

        ResearcherPage researcher = getApplicationService().get(
                ResearcherPage.class, anagraficaObjectDTO.getParentId());
        RPAdditionalFieldStorage myObject = researcher.getDynamicField();

        List<BoxResearcherPage> propertyHolders = new LinkedList<BoxResearcherPage>();
        if (editT.getDisplayTab() != null)
        {
            for (BoxResearcherPage box : editT.getDisplayTab()
                    .getMask())
            {
                propertyHolders.add(box);
            }
        }
        else
        {
            propertyHolders = getApplicationService().findPropertyHolderInTab(
                    getClazzTab(), anagraficaObjectDTO.getTabId());
        }

        List<IContainable> tipProprietaInArea = new LinkedList<IContainable>();

        for (BoxResearcherPage iph : propertyHolders)
        {

            tipProprietaInArea
                    .addAll(getApplicationService()
                            .<BoxResearcherPage, it.cilea.osd.jdyna.web.Tab<BoxResearcherPage>> findContainableInPropertyHolder(
                                    getClazzBox(), iph.getId()));

        }

        List<RPPropertiesDefinition> realTPS = new LinkedList<RPPropertiesDefinition>();
        List<IContainable> structuralField = new LinkedList<IContainable>();
        for (IContainable c : tipProprietaInArea)
        {
            RPPropertiesDefinition rpPd = getApplicationService()
                    .findPropertiesDefinitionByShortName(
                            RPPropertiesDefinition.class, c.getShortName());
            if (rpPd != null)
            {
                realTPS.add(rpPd);
            }
            else
            {
                structuralField.add(c);
            }
        }

        AnagraficaUtils.reverseDTO(anagraficaObjectDTO, myObject, realTPS);

        myObject.pulisciAnagrafica();
        researcher.setSourceID(anagraficaObjectDTO.getSourceID());
        researcher.setStatus(anagraficaObjectDTO.getStatus());
        researcher.setEpersonID(anagraficaObjectDTO.getEpersonID());
       
        getApplicationService().saveOrUpdate(ResearcherPage.class, researcher);
        EditTabResearcherPage area = getApplicationService().get(
                getClazzTab(), anagraficaObjectDTO.getTabId());
        final String areaTitle = area.getTitle();
View Full Code Here

    protected void onBindAndValidate(HttpServletRequest request,
            Object command, BindException errors) throws Exception
    {

        AnagraficaObjectAreaDTO dto = (AnagraficaObjectAreaDTO) command;
        ResearcherPage researcher = getApplicationService().get(
                ResearcherPage.class, dto.getParentId());
        RPAdditionalFieldStorage myObject = researcher.getDynamicField();

        EditTabResearcherPage editT = getApplicationService().get(
                EditTabResearcherPage.class, dto.getTabId());
        List<BoxResearcherPage> propertyHolders = new LinkedList<BoxResearcherPage>();
        if (editT.getDisplayTab() != null)
View Full Code Here

TOP

Related Classes of org.dspace.app.cris.model.ResearcherPage

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.