Reguły opisujące warstwę logiki EJB projektu.
Rule 1:
TxController.checkAccountArgs(BigDecimal amount, String description, Long accountId, Account account)
if amount > 0
and !isEmpty(description)
and exists(accountId)
then account is selectAccount(accountId).
Rule 2:
TxController.withdraw(BigDecimal amount, String description, Long accountId, UserPrincipal userPrincipal)
if userPrincipal = 'bankCustomer'
and amount > 0
and checkAccountArgs(amount, description, accountId, account)
and !isCreditAccount(account.type)
and account.balance - amount > 0
then executeTx(-amount, description, account.balance - amount, account).
Rule 3:
TxController.deposit(BigDecimal amount, String description, Long accountId, UserPrincipal userPrincipal)
if userPrincipal = 'bankCustomer'
and amount > 0
and checkAccountArgs(amount, description, accountId, account)
and !isCreditAccount(account.type)
then executeTx(amount, description, account.balance + amount, account).
Rule 4:
TxController.makeCharge(BigDecimal amount, String description, Long accountId, UserPrincipal userPrincipal)
if userPrincipal = 'bankCustomer'
and amount > 0
and checkAccountArgs(amount, description, accountId, account)
and isCreditAccount(account.type)
and account.balance + amount > account.creditLine
then executeTx(amount, description, account.balance + amount, account).
Rule 5:
TxController.makePayment(BigDecimal amount, String description, Long accountId, UserPrincipal userPrincipal)
if userPrincipal = 'bankCustomer'
and amount > 0
and checkAccountArgs(amount, description, accountId, account)
and isCreditAccount(account.type)
then executeTx(amount, description, account.balance - amount, account).
Rule 6:
TxController.transferFunds.rule1(BigDecimal amount, String description, Long fromAccountId, Long toAccountId, UserPrincipal userPrincipal)
if userPrincipal = 'bankCustomer'
and amount > 0
and checkAccountArgs(amount, description, fromAccountId, fromAccount)
and checkAccountArgs(amount, description, toAccountId, toAccount)
and isCreditAccount(fromAccount.type)
and isCreditAccount(toAccount.type)
and fromAccount.balance + amount <= fromAccount.creditLine
then executeTx(amount, description, fromAccount.balance + amount, fromAccount),
executeTx(-amount, description, toAccount.balance - amount, toAccount).
Rule 7:
TxController.transferFunds.rule2(BigDecimal amount, String description, Long fromAccountId, Long toAccountId, UserPrincipal userPrincipal)
if userPrincipal = 'bankCustomer'
and amount > 0
and checkAccountArgs(amount, description, fromAccountId, fromAccount)
and checkAccountArgs(amount, description, toAccountId, toAccount)
and isCreditAccount(fromAccount.type)
and !isCreditAccount(toAccount.type)
and fromAccount.balance + amount <= fromAccount.creditLine
then executeTx(amount, description, fromAccount.balance + amount, fromAccount),
executeTx(amount, description, toAccount.balance + amount, toAccount).
Rule 8:
TxController.transferFunds.rule3(BigDecimal amount, String description, Long fromAccountId, Long toAccountId, UserPrincipal userPrincipal)
if userPrincipal = 'bankCustomer'
and amount > 0
and checkAccountArgs(amount, description, fromAccountId, fromAccount)
and checkAccountArgs(amount, description, toAccountId, toAccount)
and !isCreditAccount(fromAccount.type)
and isCreditAccount(toAccount.type)
and fromAccount.balance - amount >= 0
then executeTx(-amount, description, fromAccount.balance - amount, fromAccount),
executeTx(-amount, description, toAccount.balance - amount, toAccount).
Rule 9:
TxController.transferFunds.rule4(BigDecimal amount, String description, Long fromAccountId, Long toAccountId, UserPrincipal userPrincipal)
if userPrincipal = 'bankCustomer'
and amount > 0
and checkAccountArgs(amount, description, fromAccountId, fromAccount)
and checkAccountArgs(amount, description, toAccountId, toAccount)
and !isCreditAccount(fromAccount.type)
and !isCreditAccount(toAccount.type)
and fromAccount.balance - amount >= 0
then executeTx(-amount, description, fromAccount.balance - amount, fromAccount),
executeTx(amount, description, toAccount.balance + amount, toAccount).
Rule 10:
TxController.executeTx(BigDecimal amount, String description, BigDecimal newBalance, Account account, UserPrincipal userPricipal)
if userPrincipal = 'bankCustomer'
then tx is Tx(account, TimeNow, amount, newBalance, description), persist(tx).
Rule 11:
AccountController.createAccount(AccountDetails details, Long customerId, UserPrincipal userPrincipal)
if userPrincipal = 'bankAdmin'
and !isEmpty(details.type)
and !isEmpty(details.description)
and !isEmpty(details.beginBalanceTimeStamp)
and exists(cusomerId)
then account is Account(details), persist(account), add(customerId, account).
Rule 12:
AccountController.removeAccount(Long accountId, UserPrincipal userPrincipal)
if userPrincipal = 'bankAdmin'
then remove(accountId).
Rule 13:
AccountController.addCustomerToAccount(Long customerId, Long accountId, UserPrincipal userPrincipal)
if userPrincipal = 'bankAdmin'
and exists(customerId)
and exists(accountId)
then add(customerId, accountId).
Rule 14:
AccountController.removeCustomerFromAccount(Long customerId, Long accountId, UserPrincipal userPrincipal)
if userPrincipal = 'bankAdmin'
and exists(customerId)
and exists(accountId)
then remove(customerId, accountId).
Rule 15:
AccountController.getAccountsOfCustomer(Long customerId, List<AccountDetails> accountDetails)
if exists(customerId)
then accountDetails is selectAccountByCustomer(customerId).
Rule 16:
AccountController.getCustomerIds(Long accountId, List<Long> customers)
if exists(accountId)
then customers is selectAccountCustomers(customerId).
Rule 17:
AccountController.getDetails(Long accountId, AccountDetails accountDetails)
if exists(accountId)
then accountDetails is selectAccount(accountId).
Rule 18:
CustomerController.createCustomer(CustomerDetails details, UserPrincipal userPrincipal)
if userPrincipal = 'bankAdmin'
and !isEmpty(details.firstName)
and !isEmpty(details.lastName)
then customer is Customer(details), persist(customer).
Rule 19:
CustomerController.removeCustomer(Long customerId, UserPrincipal userPrincipal)
if userPrincipal = 'bankAdmin'
and exists(customerId)
then remove(customerId).
Rule 20:
CustomerController.getDetails(Long customerId, CustomerDetails customerDetails)
if exists(customerId)
then Customer(customerDetails) is selectCustomer(customerId).
Rule 21:
CustomerController.getCustomersOfAccount(Long accountId, List<CustomerDetails> customerDetails)
if exists(accountId)
then account is selectAccount(accountId), Customer(customerDetails) is account.customers.
Rule 22:
CustomerController.getCustomersOfLastName(String lastName, List<CustomerDetails> customerDetails, UserPrincipal userPrincipal)
if userPrincipal = 'bankAdmin'
and !isEmpty(lastName)
then Customer(customerDetails) is selectCustomerByName(lastName).
Rule 1:
EProtocolEditForSecretariatBean.editEProtocol.rule1(EProtocolEditForSecretariatBean bean, Boolean isEditingEnabled)
if isEditingEnabled = true
then bean.cancelEditingEProtocol().
Rule 2:
EProtocolEditForSecretariatBean.enableEditingEProtocol.rule1(List assignedLecturersList, Boolean isEditingEnabled)
if assignedLecturersList.length > 0
then isEditingEnabled is false.
Rule 3:
EProtocolEditForSecretariatBean.enableEditingEProtocol.rule2(List assignedLecturersList, Boolean isEditingEnabled)
if assignedLecturersList.length = 0
then isEditingEnabled is true.
Rule 4:
EProtocolEditForSecretariatBean.chooseTheLecturer.rule1(EProtocol selectedEProtocol)
if selectedEProtocol.state = ACCEPTED
then selectedEProtocol.state is NEW.
Rule 5:
EProtocolEditForSecretariatBean.prepareToDeleteTheAssigment.rule1(List lecturersMark, Boolean deletingEnabled)
if markToDelete.length > 0
then deletingEnabled is false.
Rule 6:
EProtocolEditForSecretariatBean.prepareToDeleteTheAssigment.rule2(List lecturersMark, Boolean deletingEnabled)
if markToDelete.length = 0
then deletingEnabled is true.
Rule 7:
EProtocolEditForSecretariatBean.deleteTheAssigment.rule2(List courseUserRels, EProtocol selectedEProtocol)
if courseUserRel.length = 0 and
if selectedEProtocol.state = ACCEPTED
then selectedEProtocol.state is NEW.
Rule 8:
EProtocolEditForSecretariatBean.deleteTheAssigment.rule3(List courseUserRels, List courseUserRelsNotAccepted, EProtocol selectedEProtocol)
if courseUserRel.length > 0 and
if courseUserRelsNotAccepted.length = 0 and
if selectedEProtocol.state = NEW
then selectedEProtocol.state is ACCEPTED.
Rule 9:
EProtocolEditForSecretariatBean.isChangingEnabled.rule1(EProtocol selectedEProtocol, Boolean changing)
if selectedEProtocol.state = CLOSED
then changing is true.
Rule 10:
EProtocolEditForSecretariatBean.isChangingEnabled.rule2(EProtocol selectedEProtocol, Boolean changing)
if selectedEProtocol.state != CLOSED
then changing is false.
Rule 11:
EProtocolEditForLecturerBean.acceptEProtocol.rule1(CourseUserRel rel, Boolean isAcceptedByLecturer)
if rel.state != ACCEPTED
then rel.state is ACCEPTED, isAcceptedByLecturer is true.
Rule 12:
EProtocolEditForLecturerBean.acceptEProtocol.rule1(CourseUserRel rel, Boolean isAcceptedByLecturer)
if rel.state = ACCEPTED
then isAcceptedByLecturer is true.
Rule 13:
EProtocolEditForLecturerBean.acceptEProtocol.rule2(List courseUserRels, EProtocol selectedEProtocol)
if courseUserRel = 0
then selectedEProtocol.state is ACCEPTED.
Rule 14:
EProtocolEditForLecturerBean.acceptEProtocol.rule3(List courseUserRels, List courseUserRelsNotAccepted, EProtocol selectedEProtocol)
if courseUserRel.length > 0 and
if courseUserRelsNotAccepted.length = 0
then selectedEProtocol.state is ACCEPTED.
Rule 15:
EProtocolEditForLecturerBean.unAcceptEProtocol.rule1(CourseUserRel rel, Boolean isAcceptedByLecturer, EProtocol selectedEProtocol)
if selectedEProtocol.state = ACCEPTED
then selectedEProtocol.state is NEW, rel.state is NEW, isAcceptedByLecturer is false.
Rule 16:
EProtocolEditForLecturerBean.addMarkDateType.rule1(Mark addingMark, Utils util)
if addingMark.date.isSet() = false
then addingMark.date is util.getFormattedNowDate().
Rule 17:
EProtocolPrintBean.unlockEProtocol.rule1(EProtocol eProtocol, List courseUserRelsNotAccepted)
if eProtocol.state = CLOSED and
if courseUserRelsNotAccepted = 0
then eProtocol.state is ACCEPTED.
Rule 18:
EProtocolPrintBean.unlockEProtocol.rule2(EProtocol eProtocol, List courseUserRelsNotAccepted)
if eProtocol.state = CLOSED and
if courseUserRelsNotAccepted > 0
then eProtocol.state is NEW.
Rule 19:
EProtocolPrintBean.isClosed.rule1(EProtocol eProtocol, Boolean isClosed)
if eProtocol.state = CLOSED
then isClosed is true.
Rule 20:
EProtocolPrintBean.isClosed.rule2(EProtocol eProtocol, Boolean isClosed)
if eProtocol.state != CLOSED
then isClosed is false.
Rule 21:
EProtocolStudentListBean.prepareToDeleteStudent.rule1(List studentMarks, Boolean isDeleteEnabled)
if studentMarks.length > 0
then isDeleteEnabled is false.
Rule 22:
EProtocolStudentListBean.prepareToDeleteStudent.rule2(List studentMarks, Boolean isDeleteEnabled)
if studentMarks.length = 0
then isDeleteEnabled is true.
Rule 23:
EProtocolStudentListForCourseBean.prepareToDeleteStudent.rule1(List studentMarksForCourse, Boolean isDeleteEnabled)
if studentMarksForCourse.length > 0
then isDeleteEnabled is false.
Rule 24:
EProtocolStudentListForCourseBean.prepareToDeleteStudent.rule2(List studentMarksForCourse, Boolean isDeleteEnabled)
if studentMarksForCourse.length = 0
then isDeleteEnabled is true.