Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleload(CRMDOBank bank)
collapsetrue
	/**
	 * Loads a bank branch by an alternative code.
	 * 
	 * @param altCode - the alternative code to load by
	 * @param associations - a list of associated objects
	 * @return a bank branch with the given alternative code
	 * @throws Exception
	 */
	public CRMDOBankBranch loadByAltCode(String altCode, ArrayList<String> associations) throws Exception {
		
		ArrayList<String> values = new ArrayList<String>();
		values.add(altCode);
		
		return (CRMDOBankBranch)load(
				getDOName().toLowerCase() + ".altCode=:p1 and " +
				getDOName().toLowerCase() + ".isDeleted=0", 
				values, 
				associations);
	}

 

The following method loads a list of non-terminated accounts that have a given bank branch defined in their payment preferences set. This method is implemented in com.crm.businessobject.accounts.CRMBOAccountReceivableBean class.

Code Block
languagejava
titleloadNonTerminated(CRMDOBankBranch bankBranch)
collapsetrue
/**
     * Loads a list of non terminated accounts by a given bank branch
     * 
     * @param bankBranch - the bank branch to load the accounts for
     * @return a list of non terminated accounts
     * @throws Exception
     */
	public ArrayList<CRMDO> loadNonTerminated(CRMDOBankBranch bankBranch) throws Exception {
		
		ArrayList<String> values = new ArrayList<String>();
		
		String criteria = "";		
		
		
		if (bankBranch!=null)
		{
			values.add(bankBranch.getId());
			
			criteria += 
					" and exists ( " + 
					"   select accountpaymentpreference.id from " + CRMDOAccountPaymentPreference.class.getSimpleName() + " accountpaymentpreference " +
					"   left join accountpaymentpreference.account " +
					"   left join accountpaymentpreference.bankBranch " +
					"   where accountpaymentpreference.bankBranch.id=:p" + values.size() + " and " +
					"   accountpaymentpreference.account.id=" + getDOName().toLowerCase() + ".id and " +
					"   accountpaymentpreference.isDeleted=0 " + 
					" )";
		}
				
		return load(
				getDOName().toLowerCase() + ".lifeCycleState!='" + AccountReceivableLifeCycleState.TERMINATED + "' and " + 
				getDOName().toLowerCase() + ".isDeleted=0" + criteria, 
				values, 
				associations, 
				null, 
				null);
	}

 

To start implementing the controller layer, go to Developing the Controller layer