List of usage examples for org.hibernate Session getNamedQuery
org.hibernate.Query getNamedQuery(String queryName);
From source file:com.ibm.tap.misld.delegate.baseline.MsHardwareBaselineReadDelegate.java
/** * @param remoteUser//from w w w . j av a2 s.c o m * @return * @throws NamingException * @throws HibernateException */ public static List getDuplicatePrefixReport(String remoteUser) throws HibernateException, NamingException { List baseline = null; Session session = getHibernateSession(); baseline = session.getNamedQuery("getDuplicatePrefixes").list(); session.close(); Vector baselineVector = new Vector(); if (baseline != null) { Iterator j = baseline.iterator(); while (j.hasNext()) { Vector tempList = new Vector(); Object[] pair = (Object[]) j.next(); tempList.add(pair[0]); tempList.add(pair[1]); tempList.add(pair[2]); tempList.add(pair[3]); tempList.add("" + pair[4]); tempList.add(pair[5]); tempList.add(pair[6]); tempList.add(pair[7]); tempList.add(pair[8]); tempList.add(pair[9]); tempList.add(pair[10]); tempList.add(pair[11]); baselineVector.add(tempList); } } return baselineVector; }
From source file:com.ibm.tap.misld.delegate.baseline.MsHardwareBaselineReadDelegate.java
/** * @param customer//w ww.j ava2s. c o m * @return * @throws NamingException * @throws HibernateException */ public static List getScanReport(Customer customer) throws HibernateException, NamingException { Session session = getHibernateSession(); List baseline = session.getNamedQuery("getMsHardwareBaselineByCustomer").setEntity("customer", customer) .list(); session.close(); Vector baselineVector = new Vector(); if (baseline != null) { Iterator j = baseline.iterator(); while (j.hasNext()) { MsHardwareBaseline msHardwareBaseline = (MsHardwareBaseline) j.next(); Vector tempList = new Vector(); tempList.add(customer.getPod().getPodName()); tempList.add(customer.getCustomerName()); tempList.add(customer.getCustomerType().getCustomerTypeName()); tempList.add(msHardwareBaseline.getNodeName()); tempList.add(msHardwareBaseline.getSerialNumber()); tempList.add("" + msHardwareBaseline.getScanTime()); baselineVector.add(tempList); } } return baselineVector; }
From source file:com.ibm.tap.misld.delegate.baseline.MsHardwareBaselineReadDelegate.java
/** * @param remoteUser/*from w ww . j av a 2s .co m*/ * @return * @throws NamingException * @throws HibernateException */ public static List getMissingScanCustomers(String remoteUser) throws HibernateException, NamingException { Session session = getHibernateSession(); List baseline = session.getNamedQuery("getMissingScanCustomers").list(); session.close(); Vector baselineVector = new Vector(); if (baseline != null) { Iterator j = baseline.iterator(); Vector tempList = new Vector(); tempList.add("ASSET DEPARTMENT"); tempList.add("ACCOUNT NAME"); tempList.add("ACCOUNT TYPE"); tempList.add("CUSTOMER AGREEMENT"); while (j.hasNext()) { Customer customer = (Customer) j.next(); tempList = new Vector(); tempList.add(customer.getPod().getPodName()); tempList.add(customer.getCustomerName()); tempList.add(customer.getCustomerType().getCustomerTypeName()); tempList.add( customer.getMisldAccountSettings().getLicenseAgreementType().getLicenseAgreementTypeName()); baselineVector.add(tempList); } } return baselineVector; }
From source file:com.ibm.tap.misld.delegate.baseline.MsInstalledSoftwareBaselineReadDelegate.java
/** * @param customer//from www. j ava2 s . co m * @return * @throws NamingException * @throws HibernateException */ public static List getMsInstalledSoftwareBaseline(Customer customer) throws HibernateException, NamingException { List hardwareBaselineList = null; Session session = getHibernateSession(); hardwareBaselineList = session.getNamedQuery("getActiveMsInstalledSoftwareBaseline") .setEntity("customer", customer).list(); session.close(); return hardwareBaselineList; }
From source file:com.ibm.tap.misld.delegate.baseline.MsInstalledSoftwareBaselineReadDelegate.java
/** * @param msHardwareBaseline/*from ww w .j a v a2s. c o m*/ * @return * @throws NamingException * @throws HibernateException */ public static List getAllSoftware(int id) throws HibernateException, NamingException { List softwareList = null; Session session = getHibernateSession(); softwareList = session.getNamedQuery("getMsInstalledSoftwareBaselineByHardware").setInteger("id", id) .list(); session.close(); return softwareList; }
From source file:com.ibm.tap.misld.delegate.baseline.MsInstalledSoftwareBaselineReadDelegate.java
/** * @param installedSoftwareId//ww w.j a v a 2 s. c o m * @return * @throws NamingException * @throws HibernateException */ public static InstalledSoftware getInstalledSoftware(int id) throws HibernateException, NamingException { Session session = getHibernateSession(); InstalledSoftware installedSoftware = (InstalledSoftware) session.getNamedQuery("getInstalledSoftwareById") .setInteger("id", id).uniqueResult(); session.close(); return installedSoftware; }
From source file:com.ibm.tap.misld.delegate.baseline.MsInstalledSoftwareBaselineReadDelegate.java
/** * @param customer/*from w w w . ja v a2 s . co m*/ * @return * @throws NamingException * @throws HibernateException */ public static List getActiveMsInstalledSoftwareBaseline(Customer customer) throws HibernateException, NamingException { List softwareList = null; Session session = getHibernateSession(); softwareList = session.getNamedQuery("getActiveMsInstalledSoftwareBaseline").setEntity("customer", customer) .list(); session.close(); return softwareList; }
From source file:com.ibm.tap.misld.delegate.baseline.MsInstalledSoftwareBaselineReadDelegate.java
/** * @param customer/*from w ww. j a v a2s .com*/ * @param remoteUser * @return * @throws NamingException * @throws HibernateException */ public static List getBaselineReport(Customer customer, String remoteUser) throws HibernateException, NamingException { List baseline = null; Session session = getHibernateSession(); baseline = session.getNamedQuery("getInstalledSoftwareReport").setEntity("customer", customer).list(); session.close(); Vector baselineVector = new Vector(); if (baseline != null) { Iterator j = baseline.iterator(); while (j.hasNext()) { InstalledSoftware installedSoftware = (InstalledSoftware) j.next(); InstalledSoftwareEff installedSoftwareEff = installedSoftware.getInstalledSoftwareEff(); Vector tempList = new Vector(); tempList.add(new String("" + customer.getAccountNumber())); tempList.add(installedSoftware.getSoftwareLpar().getName()); if (installedSoftwareEff == null || installedSoftwareEff.getUserCount() == null) { if (installedSoftware.getUserCount() == null) { tempList.add(""); } else { tempList.add(new String("" + installedSoftware.getUserCount())); } } else { if (installedSoftwareEff.getUserCount() == null) { tempList.add(""); } else { tempList.add(new String("" + installedSoftwareEff.getUserCount())); } } //tempList.add(installedSoftware.getStatus()); tempList.add(installedSoftware.getSoftware().getSoftwareName()); String authenticated = null; if (installedSoftwareEff == null || installedSoftwareEff.getAuthenticated() == null) { authenticated = installedSoftware.getAuthenticated().toString(); //tempList.add("" + installedSoftware.getAuthenticated()); } else { if (installedSoftwareEff.getAuthenticated() == null) { authenticated = null; //tempList.add(""); } else { authenticated = installedSoftwareEff.getAuthenticated().toString(); //tempList.add(new String("" + installedSoftwareEff.getAuthenticated())); } } if (authenticated.equals("0")) { authenticated = "N"; } else { authenticated = "Y"; } tempList.add(authenticated); if (installedSoftwareEff == null || installedSoftwareEff.getOwner() == null) { tempList.add(installedSoftware.getSoftwareOwner()); } else { if (installedSoftwareEff.getOwner() == null) { tempList.add(""); } else { tempList.add(new String("" + installedSoftwareEff.getOwner())); } } baselineVector.add(tempList); } } return baselineVector; }
From source file:com.ibm.tap.misld.delegate.baseline.MsInstalledSoftwareBaselineReadDelegate.java
/** * @param msHardwareBaseline//from w w w. j ava2s. c om * @param softwareCategory * @return * @throws NamingException * @throws HibernateException */ public static InstalledSoftware getInstalledSoftwareBySoftwareCategory(SoftwareLpar softwareLpar, SoftwareCategory softwareCategory) throws HibernateException, NamingException { Session session = getHibernateSession(); InstalledSoftware installedSoftware = (InstalledSoftware) session .getNamedQuery("getInstalledSoftwareBySoftwareCategory").setEntity("softwareLpar", softwareLpar) .setEntity("softwareCategory", softwareCategory).uniqueResult(); session.close(); return installedSoftware; }
From source file:com.ibm.tap.misld.delegate.baseline.MsInstalledSoftwareBaselineReadDelegate.java
/** * @param msHardwareBaseline/*from ww w .j a va2 s . c o m*/ * @param softwareCategory * @return * @throws NamingException * @throws HibernateException */ //Change Bravo to use Software View instead of Product Object Start /*public static InstalledSoftware getInstalledSoftwareBySoftwareName( SoftwareLpar softwareLpar, Product software) throws HibernateException, NamingException { Session session = getHibernateSession(); InstalledSoftware installedSoftware = (InstalledSoftware) session .getNamedQuery( "getInstalledSoftwareBySoftwareName") .setEntity("softwareLpar", softwareLpar).setEntity( "software", software).uniqueResult(); session.close(); return installedSoftware; }*/ public static InstalledSoftware getInstalledSoftwareBySoftwareName(SoftwareLpar softwareLpar, Software software) throws HibernateException, NamingException { Session session = getHibernateSession(); InstalledSoftware installedSoftware = (InstalledSoftware) session .getNamedQuery("getInstalledSoftwareBySoftwareName").setEntity("softwareLpar", softwareLpar) .setEntity("software", software).uniqueResult(); session.close(); return installedSoftware; }