List of usage examples for org.hibernate Session getNamedQuery
org.hibernate.Query getNamedQuery(String queryName);
From source file:com.ibm.tap.misld.delegate.baseline.MsInstalledSoftwareBaselineReadDelegate.java
/** * @param podName//from w ww.ja va 2 s. c o m * @param remoteUser * @return * @throws HibernateException * @throws NamingException */ public static List getPodBaselineReport(String podName, String remoteUser) throws HibernateException, NamingException { List baseline = null; Session session = getHibernateSession(); baseline = session.getNamedQuery("getMsInstalledSoftwareBaselineByPod").setString("podName", podName) .list(); session.close(); Vector baselineVector = new Vector(); if (baseline != null) { Iterator j = baseline.iterator(); while (j.hasNext()) { MsInstalledSoftwareBaseline msInstalledSoftwareBaseline = (MsInstalledSoftwareBaseline) j.next(); Vector tempList = new Vector(); tempList.add( msInstalledSoftwareBaseline.getMsHardwareBaseline().getCustomer().getPod().getPodName()); tempList.add(msInstalledSoftwareBaseline.getMsHardwareBaseline().getCustomer().getIndustry() .getIndustryName()); tempList.add(msInstalledSoftwareBaseline.getMsHardwareBaseline().getCustomer().getSector() .getSectorName()); tempList.add(msInstalledSoftwareBaseline.getMsHardwareBaseline().getCustomer().getCustomerType() .getCustomerTypeName()); if (msInstalledSoftwareBaseline.getMsHardwareBaseline().getCustomer() .getMisldAccountSettings() != null) { if (msInstalledSoftwareBaseline.getMsHardwareBaseline().getCustomer().getMisldAccountSettings() .getLicenseAgreementType() == null) { tempList.add(""); } else { tempList.add(msInstalledSoftwareBaseline.getMsHardwareBaseline().getCustomer() .getMisldAccountSettings().getLicenseAgreementType().getLicenseAgreementTypeName()); } } else { tempList.add(""); } tempList.add( "" + msInstalledSoftwareBaseline.getMsHardwareBaseline().getCustomer().getAccountNumber()); tempList.add(msInstalledSoftwareBaseline.getMsHardwareBaseline().getCustomer().getCustomerName()); tempList.add(msInstalledSoftwareBaseline.getMsHardwareBaseline().getNodeName()); tempList.add(msInstalledSoftwareBaseline.getMsHardwareBaseline().getSerialNumber()); if (msInstalledSoftwareBaseline.getUserCount() == null) { tempList.add(""); } else { tempList.add(new String("" + msInstalledSoftwareBaseline.getUserCount())); } tempList.add(msInstalledSoftwareBaseline.getStatus()); tempList.add(msInstalledSoftwareBaseline.getSoftware().getSoftwareName()); tempList.add(msInstalledSoftwareBaseline.getAuthenticated()); tempList.add(msInstalledSoftwareBaseline.getSoftwareOwner()); tempList.add(msInstalledSoftwareBaseline.getSoftwareBuyer()); baselineVector.add(tempList); } } return baselineVector; }
From source file:com.ibm.tap.misld.delegate.baseline.MsInstalledSoftwareBaselineReadDelegate.java
/** * @return//ww w. j av a 2 s . c om * @throws NamingException * @throws HibernateException */ public static List getNoOperatingSystemBaseline() throws HibernateException, NamingException { List serverList = null; Session session = getHibernateSession(); serverList = session.getNamedQuery("getNoOperatingSystemBaseline").list(); session.close(); return serverList; }
From source file:com.ibm.tap.misld.delegate.baseline.MsInstalledSoftwareBaselineReadDelegate.java
/** * @param msHardwareBaseline/*ww w . j av a2 s . co m*/ * @return * @throws NamingException * @throws HibernateException */ /*public static InstalledSoftware getUnknownInstalledSoftware(SoftwareLpar softwareLpar, Product software) throws HibernateException, NamingException { InstalledSoftware installedSoftware = null; Session session = getHibernateSession(); installedSoftware = (InstalledSoftware)session.getNamedQuery("getUnknowns").setEntity( "softwareLpar", softwareLpar).setEntity("software", software).uniqueResult(); session.close(); return installedSoftware; }*/ public static InstalledSoftware getUnknownInstalledSoftware(SoftwareLpar softwareLpar, Software software) throws HibernateException, NamingException { InstalledSoftware installedSoftware = null; Session session = getHibernateSession(); installedSoftware = (InstalledSoftware) session.getNamedQuery("getUnknowns") .setEntity("softwareLpar", softwareLpar).setEntity("software", software).uniqueResult(); session.close(); return installedSoftware; }
From source file:com.ibm.tap.misld.delegate.baseline.MsInstalledSoftwareBaselineReadDelegate.java
public static List getHigherSoftwareVersion(Customer customer, SoftwareLpar softwareLpar, SoftwareCategory softwareCategory, int priority) throws HibernateException, NamingException { List software = null;//from ww w. j a v a2 s.c o m Session session = getHibernateSession(); software = session.getNamedQuery("getHigherSoftwareVersion").setEntity("customer", customer) .setEntity("softwareLpar", softwareLpar).setEntity("softwareCategory", softwareCategory) .setInteger("priority", priority).list(); session.close(); return software; }
From source file:com.ibm.tap.misld.delegate.customerSettings.MisldAccountSettingsWriteDelegate.java
/** * @param customers/*from w ww . j a v a2 s .com*/ * @param remoteUser * @throws NamingException * @throws HibernateException * @throws SQLException * */ public static String unlockAccounts(Vector unlockCustomers) throws NamingException, HibernateException, SQLException { String pod = null; Session session = getHibernateSession(); Transaction tx = session.beginTransaction(); Vector unlockCustomerIds = new Vector(); Customer customer = new Customer(); for (int i = 0; i < unlockCustomers.size(); i++) { customer = (Customer) unlockCustomers.get(i); unlockCustomerIds.add(customer.getCustomerId()); } if (!unlockCustomers.isEmpty()) { session.getNamedQuery("unlockAccountSettings").setParameterList("customers", unlockCustomerIds) .executeUpdate(); session.getNamedQuery("inactivatePriceReportCycle").setParameterList("customers", unlockCustomers) .executeUpdate(); session.getNamedQuery("inactivateNotifications").setParameterList("customers", unlockCustomers) .executeUpdate(); } tx.commit(); session.close(); return pod; }
From source file:com.ibm.tap.misld.delegate.customerSettings.MisldAccountSettingsWriteDelegate.java
/** * @param customers//w w w . java2s. co m * @param remoteUser * @throws NamingException * @throws HibernateException * @throws SQLException * */ public static String lockAccounts(Vector lockCustomers) throws NamingException, HibernateException, SQLException { String pod = null; Session session = getHibernateSession(); Transaction tx = session.beginTransaction(); if (!lockCustomers.isEmpty()) { session.getNamedQuery("lockAccountSettings").setParameterList("customers", lockCustomers) .executeUpdate(); session.getNamedQuery("inactivatePriceReportCycle").setParameterList("customers", lockCustomers) .executeUpdate(); } tx.commit(); session.close(); return pod; }
From source file:com.ibm.tap.misld.delegate.customerSettings.MisldAccountSettingsWriteDelegate.java
/** * @throws NamingException/*from w w w . j a va 2s . co m*/ * @throws HibernateException * @throws SQLException * */ public static void unlockAllAccounts() throws NamingException, HibernateException, SQLException { Session session = getHibernateSession(); Transaction tx = session.beginTransaction(); session.getNamedQuery("unlockAllAccountSettings").executeUpdate(); tx.commit(); session.close(); }
From source file:com.ibm.tap.misld.delegate.customerSettings.MisldRegistrationReadDelegate.java
/** * @return/*from w w w . j a v a 2s .co m*/ * @throws NamingException * @throws HibernateException */ public static List getUnlockedAccountReport() throws HibernateException, NamingException { List baseline = null; Session session = getHibernateSession(); baseline = session.getNamedQuery("getUnlockedReport").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 TYPE"); baselineVector.add(tempList); 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.licenseAgreementType.LicenseAgreementTypeReadDelegate.java
/** * @return/*www .j a v a2s . c o m*/ * @throws NamingException * @throws HibernateException */ public static LicenseAgreementType getLicenseAgreementTypeByName(String licenseAgreementTypeName) throws HibernateException, NamingException { LicenseAgreementType licenseAgreementType = null; Session session = getHibernateSession(); licenseAgreementType = (LicenseAgreementType) session.getNamedQuery("getLicenseAgreementTypeByName") .setString("licenseAgreementTypeName", licenseAgreementTypeName).uniqueResult(); session.close(); return licenseAgreementType; }
From source file:com.ibm.tap.misld.delegate.licenseAgreementType.LicenseAgreementTypeReadDelegate.java
/** * @return//from w ww . j a va 2s .c o m * @throws NamingException * @throws HibernateException */ public static List getLicenseAgreementTypes() throws HibernateException, NamingException { List licenseAgreementTypes = null; Session session = getHibernateSession(); licenseAgreementTypes = session.getNamedQuery("getLicenseAgreementTypes").list(); return licenseAgreementTypes; }