Package org.apache.rave.portal.model

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


    @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

        validateApplicationData(applicationData);
    }

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

        validateApplicationData(applicationData);
    }

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

    @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

    @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

    @Test
    @Transactional(readOnly=false)
    @Rollback(true)
    public void delete_implObject() {
        ApplicationData applicationData = repository.get(VALID_APPLICATION_DATA_ID);
        assertThat(applicationData, is(notNullValue()));
        ApplicationDataImpl impl = new ApplicationDataImpl(applicationData.getId());
        repository.delete(impl);
        applicationData = repository.get(VALID_APPLICATION_DATA_ID);
        assertThat(applicationData, is(nullValue()));
    }
View Full Code Here

    @Autowired
    private JpaApplicationDataConverter applicationDataConverter;

    @Test
    public void noConversion() {
        ApplicationData applicationData = new JpaApplicationData();
        assertThat(applicationDataConverter.convert(applicationData), is(sameInstance(applicationData)));
    }
View Full Code Here

        assertThat(applicationDataConverter.convert(applicationData), is(sameInstance(applicationData)));
    }

    @Test
    public void nullConversion() {
        ApplicationData applicationData = null;
        assertThat(applicationDataConverter.convert(applicationData), is(nullValue()));
    }
View Full Code Here

        assertThat(applicationDataConverter.convert(applicationData), is(nullValue()));
    }

    @Test
    public void newApplicationData() {
        ApplicationData applicationData = new ApplicationDataImpl();
        applicationData.setId(1L);
        applicationData.setAppUrl("url");
        applicationData.setData(new HashMap<String, String>());
        applicationData.setUserId("userid");

        JpaApplicationData converted = applicationDataConverter.convert(applicationData);
        assertThat(converted, is(not(sameInstance(applicationData))));
        assertThat(converted, is(instanceOf(JpaApplicationData.class)));
        assertThat(converted.getId(), is(equalTo(applicationData.getId())));
        assertThat(converted.getEntityId(), is(equalTo(applicationData.getId())));
        assertThat(converted.getAppUrl(), is(equalTo(applicationData.getAppUrl())));
        assertThat(converted.getData(), is(equalTo(applicationData.getData())));
        assertThat(converted.getUserId(), is(equalTo(applicationData.getUserId())));
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.ApplicationData

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.