Skip to content

AM Resource Selection dialog returns nothing #499

@dhakehurst

Description

@dhakehurst
in class co.oslc.refimpl.am.gen.RestDelegate, selecting a resource is 'TODO"
    public List<Resource> ResourceSelector(HttpServletRequest httpServletRequest, String terms)
    {
        List<Resource> resources = null;
        
        
        // Start of user code ResourceSelector
        // TODO Implement code to return a set of resources, based on search criteria
        // End of user code
        return resources;
    }

maybe this will help

    public List<Resource> ResourceSelector(HttpServletRequest httpServletRequest, String terms)
    {
        List<Resource> resources = new ArrayList<>();
        
        
        // Start of user code ResourceSelector
        if (terms != null && !terms.isEmpty()) {
            // Get all resources and filter by terms
            List<Resource> allResources = resourceRepository.fetchResourcesForSP(SP_DEFAULT);
            if (allResources != null) {
                String lowerTerms = terms.toLowerCase();
                for (Resource resource : allResources) {
                    // Search in identifier and title/toString
                    if ((resource.getIdentifier() != null && resource.getIdentifier().toLowerCase().contains(lowerTerms)) ||
                        (resource.toString() != null && resource.toString().toLowerCase().contains(lowerTerms))) {
                        resources.add(resource);
                    }
                }
            }
        }
        // End of user code
        
        return resources;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions