EntityManager em = null;
try {
em = AppCatalogJPAUtils.getEntityManager();
em.getTransaction().begin();
Query q;
AppCatalogQueryGenerator generator = new AppCatalogQueryGenerator(HOST_IPADDRESS);
List results;
if (fieldName.equals(HostIPAddressConstants.IP_ADDRESS)) {
generator.setParameter(HostIPAddressConstants.IP_ADDRESS, value);
q = generator.selectQuery(em);
results = q.getResultList();
if (results.size() != 0) {
for (Object result : results) {
HostIPAddress hostIPAddress = (HostIPAddress) result;
HostIPAddressResource hostIPAddressResource =
(HostIPAddressResource) AppCatalogJPAUtils.getResource(AppCatalogResourceType.HOST_IPADDRESS, hostIPAddress);
hostIPAddressResources.add(hostIPAddressResource);
}
}
} else if (fieldName.equals(HostIPAddressConstants.RESOURCE_ID)) {
generator.setParameter(HostIPAddressConstants.RESOURCE_ID, value);
q = generator.selectQuery(em);
results = q.getResultList();
if (results.size() != 0) {
for (Object result : results) {
HostIPAddress hostIPAddress = (HostIPAddress) result;
HostIPAddressResource hostIPAddressResource =