EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
Query q;
AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(APPLICATION_INPUT);
List results;
if (fieldName.equals(AppInputConstants.INTERFACE_ID)) {
generator.setParameter(AppInputConstants.INTERFACE_ID, value);
q = generator.selectQuery(em);
results = q.getResultList();
if (results.size() != 0) {
for (Object result : results) {
ApplicationInput applicationInput = (ApplicationInput) result;
ApplicationInputResource applicationInputResource =
(ApplicationInputResource) AppCatalogJPAUtils.getResource(
AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
appInputResources.add(applicationInputResource);
}
}
} else if (fieldName.equals(AppInputConstants.INPUT_KEY)) {
generator.setParameter(AppInputConstants.INPUT_KEY, value);
q = generator.selectQuery(em);
results = q.getResultList();
if (results.size() != 0) {
for (Object result : results) {
ApplicationInput applicationInput = (ApplicationInput) result;
ApplicationInputResource applicationInputResource =
(ApplicationInputResource) AppCatalogJPAUtils.getResource(
AppCatalogResourceType.APPLICATION_INPUT, applicationInput);
appInputResources.add(applicationInputResource);
}
}
} else if (fieldName.equals(AppInputConstants.DATA_TYPE)) {
generator.setParameter(AppInputConstants.DATA_TYPE, value);
q = generator.selectQuery(em);
results = q.getResultList();
if (results.size() != 0) {
for (Object result : results) {
ApplicationInput applicationInput = (ApplicationInput) result;
ApplicationInputResource applicationInputResource =