Examples of ApplicationData


Examples of org.apache.rave.opensocial.model.ApplicationData

        validApplicationDataMap = new HashMap<String, String>();
        validApplicationDataMap.put("color", "blue");
        validApplicationDataMap.put("speed", "fast");
        validApplicationDataMap.put("state", "MA");
        validApplicationData = new ApplicationData(VALID_APPLICATION_DATA_ID, VALID_VIEWER_ID, VALID_APPLICATION_ID,
                validApplicationDataMap);

        validPerson = new Person();
        validPerson.setEntityId(Long.valueOf(VALID_VIEWER_ID));
    }
View Full Code Here

Examples of org.apache.rave.opensocial.model.ApplicationData

        testDeletePersonDataNoAppDataExpected(null);
    }

    @Test
    public void deletePersonData_validRequest_emptyApplicationData() throws Exception {
        ApplicationData applicationData = new ApplicationData();
        testDeletePersonDataNoAppDataExpected(applicationData);
    }
View Full Code Here

Examples of org.apache.rave.opensocial.model.ApplicationData

        Lock lock = getApplicationDataLock(personId, appId);
        try {
            lock.lock();

            //get the application data for this user and application
            ApplicationData applicationData = applicationDataRepository.getApplicationData(personId, appId);

            //if there is no data, there's nothing to delete, so we're done...
            if (applicationData == null || applicationData.getData() == null) {
                return ImmediateFuture.newInstance(null);
            }

            //remove the fields specified -- empty field set implies remove all, otherwise remove just the fields specified
            Map<String, String> data = applicationData.getData();
            if (fields == null || fields.size() == 0) {
                data.clear();
            } else {
                data.keySet().removeAll(fields);
            }
View Full Code Here

Examples of org.apache.rave.opensocial.model.ApplicationData

        //lock on this user and this application to avoid any potential concurrency issues
        Lock lock = getApplicationDataLock(personId, appId);
        try {
            lock.lock();
            //get the application data for this user and application
            ApplicationData applicationData = applicationDataRepository.getApplicationData(personId, appId);

            //if there is no data, create an empty object to store the data in that we'll save when we're done
            if (applicationData == null) {
                applicationData = new ApplicationData(null, personId, appId, new HashMap<String, String>());
            }

            //if the fields parameter is empty, we can just use the values map directly since this is a full update
            if (fields == null || fields.size() == 0) {
                applicationData.setData(values);
            }
            //if there are keys in the values map that aren't in the fields set, its a bad request
            else if (!fields.containsAll(values.keySet())) {
                throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Fields parameter must either be empty or contain keys " +
                        "for all name value pairs sent in request.");
            }
            //we have a partial update - we know that the fields set contains keys for all the entries in the values
            //map (due to the check above), so we can just enumerate over it now to finish our work.  So we want to remove
            //any fields found in the fields set that are not found in the values map and update the rest.
            else {
                Map<String, String> data = applicationData.getData();
                for (String field : fields) {
                    //if this field is not in the values map, its a delete
                    if (!values.containsKey(field)) {
                        data.remove(field);
                    } else {
View Full Code Here

Examples of org.apache.rave.portal.model.ApplicationData

    @Override
    public List<ApplicationData> getApplicationData(List<String> userIds, String appId) {
        //if the call is only looking for data for a single user use the more efficient single user variant transparently
        if (userIds.size() == 1) {
            List<ApplicationData> data = new ArrayList<ApplicationData>();
            ApplicationData applicationData = getApplicationData(userIds.get(0), appId);
            if (applicationData != null) {
                data.add(applicationData);
            }
            return data;
        }

        TypedQuery<JpaSerializableApplicationData> query = manager.createNamedQuery(JpaApplicationData.FIND_BY_USER_IDS_AND_APP_ID,
                JpaSerializableApplicationData.class);
        query.setParameter(JpaApplicationData.USER_IDS_PARAM, userIds);
        query.setParameter(JpaApplicationData.APP_URL_PARAM, appId);
        List<JpaSerializableApplicationData> results = query.getResultList();
        for (JpaSerializableApplicationData applicationData : results) {
            applicationData.deserializeData();
        }
        return CollectionUtils.<ApplicationData>toBaseTypedList(results);
    }
View Full Code Here

Examples of org.apache.rave.portal.model.ApplicationData

    @Override
    public List<ApplicationData> getApplicationData(List<String> userIds, String appId) {
        //if the call is only looking for data for a single user use the more efficient single user variant transparently
        if (userIds.size() == 1) {
            List<ApplicationData> data = new ArrayList<ApplicationData>();
            ApplicationData applicationData = getApplicationData(userIds.get(0), appId);
            if (applicationData != null) {
                data.add(applicationData);
            }
            return data;
        }

        TypedQuery<JpaSerializableApplicationData> query = manager.createNamedQuery(JpaApplicationData.FIND_BY_USER_IDS_AND_APP_ID,
                JpaSerializableApplicationData.class);
        query.setParameter(JpaApplicationData.USER_IDS_PARAM, userIds);
        query.setParameter(JpaApplicationData.APP_URL_PARAM, appId);
        List<JpaSerializableApplicationData> results = query.getResultList();
        for (JpaSerializableApplicationData applicationData : results) {
            applicationData.deserializeData();
        }
        return CollectionUtils.<ApplicationData>toBaseTypedList(results);
    }
View Full Code Here

Examples of org.apache.rave.portal.model.ApplicationData

        validateApplicationData(applicationData);
    }

    @Test
    public void get_invalid() {
        ApplicationData applicationData = repository.get(-1L);
        assertThat(applicationData, is(nullValue()));
    }
View Full Code Here

Examples of org.apache.rave.portal.model.ApplicationData

        validateApplicationData(applicationData);
    }

    @Test
    public void getApplicationData_byUserIdAndApplicationId_invalid() {
        ApplicationData applicationData = repository.getApplicationData("-1", VALID_APPLICATION_ID);
        assertThat(applicationData, is(nullValue()));
    }
View Full Code Here

Examples of org.apache.rave.portal.model.ApplicationData

    @Test
    @Transactional
    @Rollback(true)
    public void save_newEntity() {
        ApplicationData applicationData = new JpaApplicationData(null, VALID_USER_ID, SECOND_VALID_APPLICATION_ID,
                validApplicationDataMap);

        JpaApplicationData saved = (JpaApplicationData)repository.save(applicationData);
        manager.flush();
        assertThat(saved.getEntityId(), is(notNullValue()));
View Full Code Here

Examples of org.apache.rave.portal.model.ApplicationData

    @Test
    @Transactional(readOnly=false)
    @Rollback(true)
    public void delete_jpaObject() {
        ApplicationData applicationData = repository.get(VALID_APPLICATION_DATA_ID);
        assertThat(applicationData, is(notNullValue()));
        repository.delete(applicationData);
        applicationData = repository.get(VALID_APPLICATION_DATA_ID);
        assertThat(applicationData, is(nullValue()));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.