Package org.dspace.app.cris.model

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


        OUDisplayTagData dto = (OUDisplayTagData) command;
        boolean check_change = false;
        for (OrganizationUnitDTO researcher : dto.getList())
        {
            OrganizationUnit realResearcher = applicationService
                .get(OrganizationUnit.class, researcher.getId());
            if (realResearcher.getStatus() != null
                    && realResearcher.getStatus() != researcher.getStatus())
            {
                realResearcher.setStatus(researcher.getStatus());
                applicationService.saveOrUpdate(OrganizationUnit.class,
                        realResearcher);
                check_change = true;
            }
        }
View Full Code Here


    public ModelAndView handleDetails(HttpServletRequest request,
            HttpServletResponse response) throws Exception
    {
        Map<String, Object> model = new HashMap<String, Object>();

        OrganizationUnit ou = extractOrganizationUnit(request);

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

        Context context = UIUtil.obtainContext(request);
        EPerson currentUser = context.getCurrentUser();
        if ((ou.getStatus() == null || ou.getStatus().booleanValue() == false)
                && !AuthorizeManager.isAdmin(context))
        {
           
            if (currentUser != null
                    || Authenticate.startAuthentication(context, request,
View Full Code Here

    }

    @Override
    protected Integer getAnagraficaId(HttpServletRequest request)
    {
        OrganizationUnit ou = null;
        try
        {
            ou = extractOrganizationUnit(request);
        }
        catch (NumberFormatException e)
        {
            return -1;
        }
        return ou.getDynamicField().getId();
    }
View Full Code Here

            HttpServletResponse response, Object command, BindException errors)
            throws Exception
    {
        OrganizationUnitDTO orgunitDTO = (OrganizationUnitDTO) command;
        String code = orgunitDTO.getSourceID();
        OrganizationUnit orgunit = null;
        if (code != null && !code.isEmpty())
        {
            orgunit = applicationService.getOrganizationUnitByCode(code);
            if (orgunit != null)
            {

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

            orgunit = new OrganizationUnit();
            orgunit.setSourceID(code);
            orgunit.setStatus(false);
            orgunit.getDynamicField().setOrganizationUnit(orgunit);           
            applicationService.saveOrUpdate(OrganizationUnit.class, orgunit);

        }
        return new ModelAndView(getSuccessView() + orgunit.getId());
    }
View Full Code Here

    public int countBoxPublicMetadata(Integer objectID,
            BoxOrganizationUnit box, boolean b)
    {       
        int result = 0;
       
        OrganizationUnit p = getApplicationService().get(OrganizationUnit.class, objectID);
        for (IContainable cont : box.getMask())
        {


            if (cont instanceof DecoratorOUTypeNested)
            {
                DecoratorOUTypeNested decorator = (DecoratorOUTypeNested) cont;
                OUTypeNestedObject real = (OUTypeNestedObject)decorator.getReal();
                List<OUNestedObject> results = getApplicationService()
                        .getNestedObjectsByParentIDAndTypoID(Integer
                                .parseInt(p.getIdentifyingValue()),
                                (real.getId()), OUNestedObject.class);
               
                external: for (OUNestedObject object : results)
                {
                    for (OUNestedPropertiesDefinition rpp : real
                            .getMask())
                    {                  
                       
                       
                            for (OUNestedProperty pp : object.getAnagrafica4view().get(rpp.getShortName()))
                            {
                                if (pp.getVisibility() == 1)
                                {
                                    result++;
                                    break external;
                                }
                            }

                       
                       
                    }
                }

            }

            
            if (cont instanceof DecoratorOUPropertiesDefinition)
            {
                DecoratorOUPropertiesDefinition decorator = (DecoratorOUPropertiesDefinition) cont;
                result += ResearcherTagLibraryFunctions.countDynamicPublicMetadata(
                        p.getDynamicField(), decorator.getShortName(),
                        decorator.getRendering(), decorator.getReal(),
                        false);
            }
            
View Full Code Here

        Boolean isAdmin = false;
        if (paramId != null)
        {
            id = Integer.parseInt(paramId);
        }
        OrganizationUnit grant = getApplicationService().get(OrganizationUnit.class, id);
        Context context = UIUtil.obtainContext(request);
        if (!AuthorizeManager.isAdmin(context))
        {
            throw new AuthorizeException("Only system admin can edit");
        }
        else
        {
            isAdmin = true;
        }

        Integer areaId;
        if (paramTabId == null)
        {
            if (paramFuzzyTabId == null)
            {
                List<EditTabOrganizationUnit> tabs = getApplicationService()
                        .getTabsByVisibility(EditTabOrganizationUnit.class, isAdmin);
                if (tabs.isEmpty())
                {
                    throw new AuthorizeException("No tabs defined!!");
                }
                areaId = tabs.get(0).getId();
            }
            else
            {
                EditTabOrganizationUnit fuzzyEditTab = (EditTabOrganizationUnit) ((ApplicationService) getApplicationService())
                        .<BoxOrganizationUnit, TabOrganizationUnit, EditTabOrganizationUnit>getEditTabByDisplayTab(
                                Integer.parseInt(paramFuzzyTabId),
                                EditTabOrganizationUnit.class);
                areaId = fuzzyEditTab.getId();
            }
        }
        else
        {
            areaId = Integer.parseInt(paramTabId);
        }

        EditTabOrganizationUnit editT = getApplicationService().get(
                EditTabOrganizationUnit.class, areaId);
        List<BoxOrganizationUnit> propertyHolders = new LinkedList<BoxOrganizationUnit>();
        if (editT.getDisplayTab() != null)
        {
            for (BoxOrganizationUnit box : editT.getDisplayTab().getMask())
            {
                propertyHolders.add(box);
            }
        }
        else
        {
            propertyHolders = getApplicationService().findPropertyHolderInTab(
                    getClazzTab(), areaId);
        }

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

        for (BoxOrganizationUnit iph : propertyHolders)
        {
            if (editT.getDisplayTab() != null)
            {
                tipProprietaInArea
                        .addAll(getApplicationService()
                                .<BoxOrganizationUnit, it.cilea.osd.jdyna.web.Tab<BoxOrganizationUnit>> findContainableInPropertyHolder(
                                        BoxOrganizationUnit.class, iph.getId()));
            }
            else
            {
                tipProprietaInArea
                        .addAll(getApplicationService()
                                .<BoxOrganizationUnit, it.cilea.osd.jdyna.web.Tab<BoxOrganizationUnit>> findContainableInPropertyHolder(
                                        getClazzBox(), iph.getId()));
            }
        }
        OUAdditionalFieldStorage dynamicObject = grant.getDynamicField();
        OUAnagraficaObjectDTO anagraficaObjectDTO = new OUAnagraficaObjectDTO(
                grant);
        anagraficaObjectDTO.setTabId(areaId);
        anagraficaObjectDTO.setObjectId(grant.getId());
        anagraficaObjectDTO.setParentId(grant.getId());
   

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

        {
            return new ModelAndView(exitPage);
        }
       
       
        OrganizationUnit grant = getApplicationService().get(OrganizationUnit.class,
                anagraficaObjectDTO.getParentId());
        OUAdditionalFieldStorage myObject = grant.getDynamicField();
       
        List<BoxOrganizationUnit> propertyHolders = new LinkedList<BoxOrganizationUnit>();
        if (editT.getDisplayTab() != null)
        {
            for (BoxOrganizationUnit box : editT.getDisplayTab().getMask())
            {
                propertyHolders.add(box);
            }
        }
        else
        {
            propertyHolders = getApplicationService().findPropertyHolderInTab(
                    getClazzTab(), anagraficaObjectDTO.getTabId());
        }

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

        for (BoxOrganizationUnit iph : propertyHolders)
        {

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

        }

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

        AnagraficaUtils.reverseDTO(anagraficaObjectDTO, myObject, realTPS);
       
        myObject.pulisciAnagrafica();
        grant.setSourceID(anagraficaObjectDTO.getSourceID());
        grant.setStatus(anagraficaObjectDTO.getStatus());
       
        getApplicationService().saveOrUpdate(OrganizationUnit.class, grant);
        EditTabOrganizationUnit 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;
        OrganizationUnit researcher = getApplicationService().get(OrganizationUnit.class,
                dto.getParentId());
        OUAdditionalFieldStorage myObject = researcher.getDynamicField();

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

    {
        Map<String, Object> reference = new HashMap<String, Object>();
       
        String id_s = request.getParameter("id");
        Integer id = Integer.parseInt(id_s);
        OrganizationUnit researcher = getApplicationService().get(
                    OrganizationUnit.class, id);
        Context context = UIUtil.obtainContext(request);
       
        if (AuthorizeManager.isAdmin(context))
        {
View Full Code Here

TOP

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

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.