EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
Query q;
AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(GATEWAY_PROFILE);
List results;
if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) {
generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value);
q = generator.selectQuery(em);
results = q.getResultList();
if (results.size() != 0) {
for (Object result : results) {
GatewayProfile gatewayProfile = (GatewayProfile) result;
GatewayProfileResource gatewayProfileResource =
(GatewayProfileResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.GATEWAY_PROFILE, gatewayProfile);
gatewayProfileResources.add(gatewayProfileResource);
}
}
} else if (fieldName.equals(GatewayProfileConstants.GATEWAY_NAME)) {
generator.setParameter(GatewayProfileConstants.GATEWAY_NAME, value);
q = generator.selectQuery(em);
results = q.getResultList();
if (results.size() != 0) {
for (Object result : results) {
GatewayProfile gatewayProfile = (GatewayProfile) result;
GatewayProfileResource gatewayProfileResource =