📄 baseportletparameterpeer.java
字号:
throw new TorqueException(e); } } /** * Method to do selects. * * @param criteria object used to create the SELECT statement. * @return List of selected Objects * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */ public static List doSelect(Criteria criteria) throws TorqueException { return populateObjects(doSelectVillageRecords(criteria)); } /** * Method to do selects within a transaction. * * @param criteria object used to create the SELECT statement. * @param con the connection to use * @return List of selected Objects * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */ public static List doSelect(Criteria criteria, Connection con) throws TorqueException { return populateObjects(doSelectVillageRecords(criteria, con)); } /** * Grabs the raw Village records to be formed into objects. * This method handles connections internally. The Record objects * returned by this method should be considered readonly. Do not * alter the data and call save(), your results may vary, but are * certainly likely to result in hard to track MT bugs. * * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */ public static List doSelectVillageRecords(Criteria criteria) throws TorqueException { return BasePortletParameterPeer .doSelectVillageRecords(criteria, (Connection) null); } /** * Grabs the raw Village records to be formed into objects. * This method should be used for transactions * * @param con the connection to use * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */ public static List doSelectVillageRecords(Criteria criteria, Connection con) throws TorqueException { if (criteria.getSelectColumns().size() == 0) { addSelectColumns(criteria); } // check for conversion from boolean to int if (criteria.containsKey(HIDDEN)) { Object possibleBoolean = criteria.get(HIDDEN); if (possibleBoolean instanceof Boolean) { if (((Boolean) possibleBoolean).booleanValue()) { criteria.add(HIDDEN, 1); } else { criteria.add(HIDDEN, 0); } } } // check for conversion from boolean to int if (criteria.containsKey(CACHEDONVALUE)) { Object possibleBoolean = criteria.get(CACHEDONVALUE); if (possibleBoolean instanceof Boolean) { if (((Boolean) possibleBoolean).booleanValue()) { criteria.add(CACHEDONVALUE, 1); } else { criteria.add(CACHEDONVALUE, 0); } } } // check for conversion from boolean to int if (criteria.containsKey(CACHEDONNAME)) { Object possibleBoolean = criteria.get(CACHEDONNAME); if (possibleBoolean instanceof Boolean) { if (((Boolean) possibleBoolean).booleanValue()) { criteria.add(CACHEDONNAME, 1); } else { criteria.add(CACHEDONNAME, 0); } } } // Set the correct dbName if it has not been overridden // criteria.getDbName will return the same object if not set to // another value so == check is okay and faster if (criteria.getDbName() == Torque.getDefaultDB()) { criteria.setDbName(DATABASE_NAME); } // BasePeer returns a List of Value (Village) arrays. The array // order follows the order columns were placed in the Select clause. if (con == null) { return BasePeer.doSelect(criteria); } else { return BasePeer.doSelect(criteria, con); } } /** * The returned List will contain objects of the default type or * objects that inherit from the default. * * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */ public static List populateObjects(List records) throws TorqueException { List results = new ArrayList(records.size()); // populate the object(s) for (int i = 0; i < records.size(); i++) { Record row = (Record) records.get(i); results.add(PortletParameterPeer.row2Object(row, 1, PortletParameterPeer.getOMClass())); } return results; } /** * The class that the Peer will make instances of. * If the BO is abstract then you must implement this method * in the BO. * * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */ public static Class getOMClass() throws TorqueException { return CLASS_DEFAULT; } /** * Method to do updates. * * @param criteria object containing data that is used to create the UPDATE * statement. * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */ public static void doUpdate(Criteria criteria) throws TorqueException { BasePortletParameterPeer .doUpdate(criteria, (Connection) null); } /** * Method to do updates. This method is to be used during a transaction, * otherwise use the doUpdate(Criteria) method. It will take care of * the connection details internally. * * @param criteria object containing data that is used to create the UPDATE * statement. * @param con the connection to use * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */ public static void doUpdate(Criteria criteria, Connection con) throws TorqueException { Criteria selectCriteria = new Criteria(DATABASE_NAME, 2); selectCriteria.put(ID, criteria.remove(ID)); // check for conversion from boolean to int if (criteria.containsKey(HIDDEN)) { Object possibleBoolean = criteria.get(HIDDEN); if (possibleBoolean instanceof Boolean) { if (((Boolean) possibleBoolean).booleanValue()) { criteria.add(HIDDEN, 1); } else { criteria.add(HIDDEN, 0); } } } // check for conversion from boolean to int if (criteria.containsKey(CACHEDONVALUE)) { Object possibleBoolean = criteria.get(CACHEDONVALUE); if (possibleBoolean instanceof Boolean) { if (((Boolean) possibleBoolean).booleanValue()) { criteria.add(CACHEDONVALUE, 1); } else { criteria.add(CACHEDONVALUE, 0); } } } // check for conversion from boolean to int if (criteria.containsKey(CACHEDONNAME)) { Object possibleBoolean = criteria.get(CACHEDONNAME); if (possibleBoolean instanceof Boolean) { if (((Boolean) possibleBoolean).booleanValue()) { criteria.add(CACHEDONNAME, 1); } else { criteria.add(CACHEDONNAME, 0); } } } // Set the correct dbName if it has not been overridden // criteria.getDbName will return the same object if not set to // another value so == check is okay and faster if (criteria.getDbName() == Torque.getDefaultDB()) { criteria.setDbName(DATABASE_NAME); } if (con == null) { BasePeer.doUpdate(selectCriteria, criteria); } else { BasePeer.doUpdate(selectCriteria, criteria, con); } } /** * Method to do deletes. * * @param criteria object containing data that is used DELETE from database. * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */ public static void doDelete(Criteria criteria) throws TorqueException { BasePortletParameterPeer .doDelete(criteria, (Connection) null); } /** * Method to do deletes. This method is to be used during a transaction, * otherwise use the doDelete(Criteria) method. It will take care of * the connection details internally. * * @param criteria object containing data that is used DELETE from database. * @param con the connection to use * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */ public static void doDelete(Criteria criteria, Connection con) throws TorqueException { // check for conversion from boolean to int if (criteria.containsKey(HIDDEN)) { Object possibleBoolean = criteria.get(HIDDEN); if (possibleBoolean instanceof Boolean) { if (((Boolean) possibleBoolean).booleanValue()) { criteria.add(HIDDEN, 1); } else { criteria.add(HIDDEN, 0); } } } // check for conversion from boolean to int if (criteria.containsKey(CACHEDONVALUE)) { Object possibleBoolean = criteria.get(CACHEDONVALUE); if (possibleBoolean instanceof Boolean) { if (((Boolean) possibleBoolean).booleanValue()) { criteria.add(CACHEDONVALUE, 1); } else { criteria.add(CACHEDONVALUE, 0); } } } // check for conversion from boolean to int if (criteria.containsKey(CACHEDONNAME)) { Object possibleBoolean = criteria.get(CACHEDONNAME); if (possibleBoolean instanceof Boolean) { if (((Boolean) possibleBoolean).booleanValue()) { criteria.add(CACHEDONNAME, 1); } else { criteria.add(CACHEDONNAME, 0); } } } // Set the correct dbName if it has not been overridden // criteria.getDbName will return the same object if not set to // another value so == check is okay and faster if (criteria.getDbName() == Torque.getDefaultDB()) { criteria.setDbName(DATABASE_NAME); } if (con == null) { BasePeer.doDelete(criteria); } else { BasePeer.doDelete(criteria, con); } } /** * Method to do selects * * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */ public static List doSelect(PortletParameter obj) throws TorqueException { return doSelect(buildCriteria(obj)); } /** * Method to do inserts * * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */ public static void doInsert(PortletParameter obj) throws TorqueException { obj.setPrimaryKey(doInsert(buildCriteria(obj))); obj.setNew(false); obj.setModified(false); } /** * @param obj the data object to update in the database. * @throws TorqueException Any exceptions caught during processing will be * rethrown wrapped into a TorqueException. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -