📄 customerbmpbmp.java
字号:
return dao; } else { try{ javax.naming.InitialContext ctx = new javax.naming.InitialContext(); Object ref = ctx.lookup("java:comp/env/dao"); String daoStr = (String) javax.rmi.PortableRemoteObject.narrow(ref, String.class); dao = (test.dao.CustomerDAO) Class.forName(daoStr).newInstance(); } catch (javax.naming.NamingException e) { throw new IllegalStateException("DAO not defined in JNDI 'java:comp/env/dao': " + e.getLocalizedMessage()); } catch (Exception e) { throw new IllegalStateException("Exception while looking in JNDI for 'java:comp/env/dao': " + e.getLocalizedMessage()); } dao.init(); return dao; } } public void ejbHomeCopyToArchive(test.interfaces.CustomerPK pk) { super.ejbHomeCopyToArchive(pk); getDao().backup(pk); } /* Value Objects BEGIN */ public void addAccount(test.interfaces.AccountValue added) throws javax.ejb.FinderException { try { test.interfaces.AccountPK pk = new test.interfaces.AccountPK(added.getId()); test.interfaces.AccountLocalHome home = test.interfaces.AccountUtil.getLocalHome(); test.interfaces.AccountLocal relation = home.findByPrimaryKey(pk); getAccounts().add(relation); makeDirty(); } catch (Exception e){ if (e instanceof javax.ejb.FinderException) throw (javax.ejb.FinderException)e; else throw new javax.ejb.EJBException(e); } } public void removeAccount(test.interfaces.AccountValue removed) throws javax.ejb.RemoveException { try { test.interfaces.AccountPK pk = new test.interfaces.AccountPK(removed.getId()); test.interfaces.AccountLocalHome home = test.interfaces.AccountUtil.getLocalHome(); test.interfaces.AccountLocal relation = home.findByPrimaryKey(pk); getAccounts().remove(relation); makeDirty(); } catch (Exception e){ if (e instanceof javax.ejb.RemoveException) throw (javax.ejb.RemoveException)e; else throw new javax.ejb.EJBException(e); } } public void addShippingAddress(test.interfaces.AddressValue added) throws javax.ejb.CreateException { try { java.lang.String pk = added.getId(); test.interfaces.AddressLocalHome home = test.interfaces.AddressUtil.getLocalHome(); test.interfaces.AddressLocal relation = home.create(added); getShippingAddresses().add(relation); makeDirty(); } catch (Exception e){ if (e instanceof javax.ejb.CreateException) throw (javax.ejb.CreateException)e; else throw new javax.ejb.EJBException(e); } } public void removeShippingAddress(test.interfaces.AddressValue removed) throws javax.ejb.RemoveException { try { java.lang.String pk = removed.getId(); test.interfaces.AddressLocalHome home = test.interfaces.AddressUtil.getLocalHome(); test.interfaces.AddressLocal relation = home.findByPrimaryKey(pk); getShippingAddresses().remove(relation); makeDirty(); relation.remove(); } catch (Exception e){ if (e instanceof javax.ejb.RemoveException) throw (javax.ejb.RemoveException)e; else throw new javax.ejb.EJBException(e); } } public void updateShippingAddress(test.interfaces.AddressValue updated) throws javax.ejb.FinderException { try { java.lang.String pk = updated.getId(); test.interfaces.AddressLocalHome home = test.interfaces.AddressUtil.getLocalHome(); test.interfaces.AddressLocal relation = home.findByPrimaryKey(pk); relation.setAddressValue(updated); } catch (Exception e){ if (e instanceof javax.ejb.FinderException) throw (javax.ejb.FinderException)e; else throw new javax.ejb.EJBException(e); } } private test.interfaces.CustomerLightValue CustomerLightValue = null; public test.interfaces.CustomerLightValue getCustomerLightValue() { CustomerLightValue = new test.interfaces.CustomerLightValue(); try { CustomerLightValue.setCredit( getCredit() ); CustomerLightValue.setId( getId() ); CustomerLightValue.setVersion(getVersion()); } catch (Exception e) { throw new javax.ejb.EJBException(e); } return CustomerLightValue; } private test.interfaces.CustomerNormalValue CustomerNormalValue = null; public test.interfaces.CustomerNormalValue getCustomerNormalValue() { CustomerNormalValue = new test.interfaces.CustomerNormalValue(); try { CustomerNormalValue.setCredit( getCredit() ); CustomerNormalValue.setId( getId() ); CustomerNormalValue.setName( getName() ); CustomerNormalValue.setFirstName( getFirstName() ); CustomerNormalValue.clearAccountViews(); java.util.Iterator iAccountView = getAccounts().iterator(); while (iAccountView.hasNext()){ CustomerNormalValue.addAccountView( ((test.interfaces.AccountLocal)iAccountView.next()).getAccountValue() ); } CustomerNormalValue.cleanAccountView(); CustomerNormalValue.clearShippingAddressValues(); java.util.Iterator iShippingAddressValue = getShippingAddresses().iterator(); while (iShippingAddressValue.hasNext()){ CustomerNormalValue.addShippingAddressValue( ((test.interfaces.AddressLocal)iShippingAddressValue.next()).getAddressValue() ); } CustomerNormalValue.cleanShippingAddressValue(); CustomerNormalValue.setVersion(getVersion()); } catch (Exception e) { throw new javax.ejb.EJBException(e); } return CustomerNormalValue; } private test.interfaces.CustomerValue CustomerValue = null; public test.interfaces.CustomerValue getCustomerValue() { CustomerValue = new test.interfaces.CustomerValue(); try { CustomerValue.setCredit( getCredit() ); CustomerValue.setId( getId() ); CustomerValue.setName( getName() ); CustomerValue.setFirstName( getFirstName() ); CustomerValue.setPhone( getPhone() ); CustomerValue.setFax( getFax() ); CustomerValue.clearAccountViews(); java.util.Iterator iAccountView = getAccounts().iterator(); while (iAccountView.hasNext()){ CustomerValue.addAccountView( ((test.interfaces.AccountLocal)iAccountView.next()).getAccountValue() ); } CustomerValue.cleanAccountView(); CustomerValue.clearShippingAddressValues(); java.util.Iterator iShippingAddressValue = getShippingAddresses().iterator(); while (iShippingAddressValue.hasNext()){ CustomerValue.addShippingAddressValue( ((test.interfaces.AddressLocal)iShippingAddressValue.next()).getAddressValue() ); } CustomerValue.cleanShippingAddressValue(); CustomerValue.setVersion(getVersion()); } catch (Exception e) { throw new javax.ejb.EJBException(e); } return CustomerValue; } public void setCustomerNormalValue( test.interfaces.CustomerNormalValue valueHolder ) throws test.interfaces.ApplicationException{ validate(valueHolder); if( getVersion() != valueHolder.getVersion() ) throw new IllegalStateException( "Wrong version. Had " + getVersion() + ", got " + valueHolder.getVersion() ); try { setCredit( valueHolder.getCredit() ); setName( valueHolder.getName() ); setFirstName( valueHolder.getFirstName() ); { java.util.Iterator iAccountView = valueHolder.getAddedAccountViews().iterator(); while (iAccountView.hasNext()) { test.interfaces.AccountValue o = (test.interfaces.AccountValue)iAccountView.next(); addAccount(o); } iAccountView = valueHolder.getRemovedAccountViews().iterator(); while (iAccountView.hasNext()) { test.interfaces.AccountValue o = (test.interfaces.AccountValue)iAccountView.next(); removeAccount(o); } } // Anonymous block to allow variable declations without conflicts { java.util.Iterator iShippingAddressValue = valueHolder.getUpdatedShippingAddressValues().iterator(); while (iShippingAddressValue.hasNext()) { test.interfaces.AddressValue o = (test.interfaces.AddressValue)iShippingAddressValue.next(); updateShippingAddress(o); } iShippingAddressValue = valueHolder.getAddedShippingAddressValues().iterator(); while (iShippingAddressValue.hasNext()) { test.interfaces.AddressValue o = (test.interfaces.AddressValue)iShippingAddressValue.next(); addShippingAddress(o); } iShippingAddressValue = valueHolder.getRemovedShippingAddressValues().iterator(); while (iShippingAddressValue.hasNext()) { test.interfaces.AddressValue o = (test.interfaces.AddressValue)iShippingAddressValue.next(); removeShippingAddress(o); } } } catch (Exception e) { throw new javax.ejb.EJBException(e); } }/* Value Objects END */}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -