Package org.dspace.app.cris.model

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


    @Override
    protected ModelAndView onSubmit(HttpServletRequest request,
            HttpServletResponse response, Object command, BindException errors)
            throws Exception
    {
        ResearchObject object = (ResearchObject) command;
        String sourceId = object.getSourceID();

        String path = Utils.getAdminSpecificPath(request, null);

        if (sourceId != null && !sourceId.isEmpty())
        {
            object = applicationService.getEntityBySourceId(sourceId,
                    ResearchObject.class);

            if (object != null)
            {

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

        }

        else
        {
            object = new ResearchObject();
            object.setSourceID(sourceId);
            object.setStatus(false);
            object.getDynamicField().setDynamicObject(object);
            object.setTypo(applicationService.findTypoByShortName(
                    DynamicObjectType.class, path));
            applicationService.saveOrUpdate(ResearchObject.class, object);

        }
        return new ModelAndView(getSuccessView() + object.getId() + "&path="
                + path);

    }
View Full Code Here


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


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

                       
                       
                    }
                }

            }

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

            HttpServletResponse response) throws Exception
    {
        Map<String, Object> model = new HashMap<String, Object>();
       
        setSpecificPartPath(Utils.getSpecificPath(request, null));
        ResearchObject dyn = extractDynamicObject(request);

        if (dyn == null)
        {
            response.sendError(HttpServletResponse.SC_NOT_FOUND,
                    getSpecificPartPath() + " page not found");
            return null;
        }

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

    }

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

        Boolean isAdmin = false;
        if (paramId != null)
        {
            id = Integer.parseInt(paramId);
        }
        ResearchObject entity = getApplicationService().get(ResearchObject.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<EditTabDynamicObject> tabs = getApplicationService()
                        .<BoxDynamicObject, DynamicObjectType, DynamicPropertiesDefinition, TabDynamicObject, EditTabDynamicObject>getEditTabsByVisibilityAndType(EditTabDynamicObject.class,
                                isAdmin, entity.getTypo());
                if (tabs.isEmpty())
                {
                    throw new AuthorizeException("No tabs defined!!");
                }
                areaId = tabs.get(0).getId();
            }
            else
            {
                EditTabDynamicObject fuzzyEditTab = (EditTabDynamicObject) ((ApplicationService) getApplicationService())
                        .<BoxDynamicObject, TabDynamicObject, EditTabDynamicObject>getEditTabByDisplayTab(
                                Integer.parseInt(paramFuzzyTabId),
                                EditTabDynamicObject.class);
                areaId = fuzzyEditTab.getId();
            }
        }
        else
        {
            areaId = Integer.parseInt(paramTabId);
        }

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

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

        for (BoxDynamicObject iph : propertyHolders)
        {
            if (editT.getDisplayTab() != null)
            {
                tipProprietaInArea
                        .addAll(getApplicationService()
                                .<BoxDynamicObject, it.cilea.osd.jdyna.web.Tab<BoxDynamicObject>> findContainableInPropertyHolder(
                                        BoxDynamicObject.class, iph.getId()));
            }
            else
            {
                tipProprietaInArea
                        .addAll(getApplicationService()
                                .<BoxDynamicObject, it.cilea.osd.jdyna.web.Tab<BoxDynamicObject>> findContainableInPropertyHolder(
                                        getClazzBox(), iph.getId()));
            }
        }
        DynamicAdditionalFieldStorage dynamicObject = entity.getDynamicField();
        DynamicAnagraficaObjectDTO anagraficaObjectDTO = new DynamicAnagraficaObjectDTO(
                entity);
        anagraficaObjectDTO.setTabId(areaId);
        anagraficaObjectDTO.setObjectId(entity.getId());
        anagraficaObjectDTO.setParentId(entity.getId());
        anagraficaObjectDTO.setTipologiaId(entity.getTypo().getId());
       
        List<DynamicPropertiesDefinition> realTPS = new LinkedList<DynamicPropertiesDefinition>();
        List<IContainable> structuralField = new LinkedList<IContainable>();
        for (IContainable c : tipProprietaInArea)
        {
View Full Code Here

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

        ResearchObject entity = getApplicationService().get(ResearchObject.class,
                anagraficaObjectDTO.getParentId());
        DynamicAdditionalFieldStorage myObject = entity.getDynamicField();

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

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

        for (BoxDynamicObject iph : propertyHolders)
        {

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

        }

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

        AnagraficaUtils.reverseDTO(anagraficaObjectDTO, myObject, realTPS);

        myObject.pulisciAnagrafica();
        entity.setSourceID(anagraficaObjectDTO.getSourceID());
        entity.setStatus(anagraficaObjectDTO.getStatus());
        entity.setTypo(getApplicationService().get(DynamicObjectType.class, anagraficaObjectDTO.getTipologiaId()));

        getApplicationService().saveOrUpdate(ResearchObject.class, entity);
        EditTabDynamicObject 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;
        ResearchObject researcher = getApplicationService().get(
                ResearchObject.class, dto.getParentId());
        DynamicAdditionalFieldStorage myObject = researcher.getDynamicField();

        EditTabDynamicObject editT = getApplicationService().get(
                EditTabDynamicObject.class, dto.getTabId());
        List<BoxDynamicObject> propertyHolders = new LinkedList<BoxDynamicObject>();
        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);
        ResearchObject entity = getApplicationService().get(
                    ResearchObject.class, id);
        Context context = UIUtil.obtainContext(request);
       
        if (AuthorizeManager.isAdmin(context))
        {
View Full Code Here

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

TOP

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

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.