Package org.eurekastreams.server.search.modelview

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


    @Override
    public PersonModelView execute(final PrincipalActionContext inActionContext)
    {
        String accountId = inActionContext.getPrincipal().getAccountId();

        PersonModelView person = getPersonModelViewByAccountIdMapper.execute(accountId);

        List<Long> systemAdminIds = systemAdminIdsMapper.execute(null);
        if (systemAdminIds.contains(person.getEntityId()))
        {
            log.debug("User " + accountId + " is a system administrator.");
            person.getRoles().add(Role.SYSTEM_ADMIN);
        }

        person.setTosAcceptance(toSAcceptanceStrategy.isValidTermsOfServiceAcceptanceDate(person
                .getLastAcceptedTermsOfService()));

        // set authentication type (for determining whether to display a "log out" option)
        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        if (principal instanceof ExtendedUserDetails)
        {
            person.setAuthenticationType(((ExtendedUserDetails) principal).getAuthenticationType());
        }

        return person;
    }
View Full Code Here


    {
        SendPrebuiltNotificationRequest params = (SendPrebuiltNotificationRequest) inActionContext.getParams();
        ValidationException ve = new ValidationException();

        // insure valid recipient
        PersonModelView recipient = personMapper.execute(params.getRecipientAccountId());
        if (recipient == null)
        {
            ve.addError("recipientAccountId", "Unknown or missing recipient account id.");
        }
        else if (recipient.isAccountLocked())
        {
            ve.addError("recipientAccountId", "Cannot send notifications to locked users.");
        }
        else
        {
View Full Code Here

        testDestinationStream.setId(1L);
        testDestinationStream.setUniqueIdentifier("fordp");
        testDestinationStream.setType(EntityType.PERSON);
        testActivity.setDestinationStream(testDestinationStream);

        PersonModelView testPersonModelView = new PersonModelView();
        testPersonModelView.setEntityId(TEST_PERSON_ID);

        final Long fordpId = 42L;

        final List<Long> followerIds = new ArrayList<Long>();
        followerIds.add(TEST_PERSON_ID);
View Full Code Here

     *            the person's id
     * @return a PersonModelView for testing
     */
    private PersonModelView buildPersonModelView(final long id)
    {
        PersonModelView p = new PersonModelView();
        p.setEntityId(id);
        p.setAccountId("accountid" + id);
        p.setDisplayName("display" + id);
        p.setAvatarId("avatar" + id);
        p.setLastName("FOO");
        return p;
    }
View Full Code Here

                    .execute(Collections.singletonList(uniqueKey)).get(0);

            getCache().addToTopOfList(CacheKeys.ENTITY_STREAM_BY_SCOPE_ID + group.getStreamId(), activityId);
            break;
        case PERSON:
            PersonModelView person = getPersonModelViewByAccountIdMapper.execute(uniqueKey);

            getCache().addToTopOfList(CacheKeys.ENTITY_STREAM_BY_SCOPE_ID + person.getStreamId(), activityId);
            break;
        case RESOURCE:
            StreamScope scope = getResourceStreamScopeIdByKeyMapper.execute(uniqueKey);
            if (scope != null)
            {
                getCache().addToTopOfList(CacheKeys.ENTITY_STREAM_BY_SCOPE_ID + scope.getId(), activityId);
            }

            // if showInStream is true and author is person, add to actors (author)'s stream also.
            if (activity.getShowInStream() && activity.getActor().getType() == EntityType.PERSON)
            {
                PersonModelView actor = getPersonModelViewByAccountIdMapper.execute(activity.getActor()
                        .getUniqueIdentifier());
                getCache().addToTopOfList(CacheKeys.ENTITY_STREAM_BY_SCOPE_ID + actor.getStreamId(), activityId);
            }

            break;
        default:
            break;
View Full Code Here

        for (DomainGroupModelView result : inResults)
        {
            if (result.getPersonCreatedById() != null)
            {
                PersonModelView person = peopleByIdMap.get(result.getPersonCreatedById());
                result.setPersonCreatedByAccountId(person.getAccountId());
                result.setPersonCreatedByDisplayName(person.getDisplayName());
                result.setPersonCreatedByCompanyName(person.getCompanyName());
            }
        }
    }
View Full Code Here

        String recipientUniqueKey = activity.getRecipientStreamScope().getUniqueKey();
        long activityId = activity.getId();

        if (type == ScopeType.PERSON)
        {
            PersonModelView person = getPersonModelViewByAccountIdMapper.execute(recipientUniqueKey);

            updateActivitiesByFollowingCacheLists(person.getEntityId(), activityId);

        }
        else if (type == ScopeType.RESOURCE && activity.getActorType() == EntityType.PERSON)
        {
            if (activity.getShowInStream())
            {
                PersonModelView person = getPersonModelViewByAccountIdMapper.execute(activity.getActorId());
                updateActivitiesByFollowingCacheLists(person.getEntityId(), activityId);
            }
        }
        else if (type == ScopeType.GROUP)
        {
            // no-op
View Full Code Here

     */
    @Test
    public void testExecute()
    {
        final FeaturedStreamDTO featuredDTO = new FeaturedStreamDTO();
        final StreamDTO mostActiveDTO = new PersonModelView();
        final Long mostActiveCount = 82L;
        final StreamDTO mostViewedDTO = new PersonModelView();
        final StreamDTO mostFollowedDTO = new PersonModelView();
        final StreamDTO mostRecentDTO = new PersonModelView();

        final List<FeaturedStreamDTO> featuredDTOs = new ArrayList<FeaturedStreamDTO>();
        featuredDTOs.add(featuredDTO);

        final SublistWithResultCount<StreamDTO> mostActiveDTOs = new SublistWithResultCount<StreamDTO>();
View Full Code Here

        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;
View Full Code Here

    {
        final FlowPanel widget = new FlowPanel();
        widget.addStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectShareWidgetContainer());
        initWidget(widget);

        PersonModelView person = Session.getInstance().getCurrentPerson();

        StreamScope defaultStreamScope = new StreamScope(person.getDisplayName(), ScopeType.PERSON,
                person.getAccountId(), person.getStreamId());

        final PostToPanel postToPanel = new PostToPanel(defaultStreamScope);
        widget.add(postToPanel);

        // -- Setup the link display panel (thumbnail selector, field to update title) --
View Full Code Here

TOP

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

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.