Package org.eurekastreams.server.search.modelview

Examples of org.eurekastreams.server.search.modelview.DisplayEntityModelView


    @Test
    public void testRepresent() throws ResourceException, IOException
    {
        final Variant variant = context.mock(Variant.class);
        setupCommonInitExpectations("abc");
        final DisplayEntityModelView femv = new DisplayEntityModelView();
        femv.setDisplayName("NameGoesHere");
        femv.setType(EntityType.PERSON);
        femv.setUniqueKey("KeyGoesHere");
        femv.setStreamScopeId(1L);
        final ArrayList<DisplayEntityModelView> results = new ArrayList<DisplayEntityModelView>(1);
        results.add(femv);

        SecurityContext originalContext = SecurityContextHolder.getContext();
        SecurityContextHolder.setContext(securityContext);
View Full Code Here


        // transform the list to DisplayEntityModelView
        List<DisplayEntityModelView> displayModelViews = new ArrayList<DisplayEntityModelView>();
        for (ModelView modelView : searchResults)
        {
            DisplayEntityModelView displayModelView = new DisplayEntityModelView();
            if (modelView instanceof PersonModelView)
            {
                PersonModelView person = (PersonModelView) modelView;

                if (log.isTraceEnabled())
                {
                    log.trace("Found person '" + person.getAccountId() + " with search prefix '" + searchText + "'");
                }

                displayModelView.setDisplayName(person.getDisplayName());
                displayModelView.setStreamScopeId(person.getStreamId());
                displayModelView.setType(EntityType.PERSON);
                displayModelView.setUniqueKey(person.getAccountId());
                displayModelView.setAccountLocked(person.isAccountLocked());
                displayModelViews.add(displayModelView);
            }
            else if (modelView instanceof DomainGroupModelView)
            {
                DomainGroupModelView group = (DomainGroupModelView) modelView;

                if (log.isTraceEnabled())
                {
                    log.trace("Found domain group '" + group.getShortName() + " with search prefix '" + searchText
                            + "'");
                }

                displayModelView.setDisplayName(group.getName());
                displayModelView.setStreamScopeId(group.getStreamId());
                displayModelView.setType(EntityType.GROUP);
                displayModelView.setUniqueKey(group.getShortName());
                displayModelViews.add(displayModelView);
            }
        }

        return displayModelViews;
View Full Code Here

TOP

Related Classes of org.eurekastreams.server.search.modelview.DisplayEntityModelView

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.