isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Haywood <...@haywood-associates.co.uk>
Subject Re: Default action parameter values
Date Sun, 22 Sep 2013 15:13:14 GMT
The defaultNXxx() methods need to have public visibility.




On 22 September 2013 15:39, james agada <okwuiagada@gmail.com> wrote:

> I am trying to use this code to have default values when creating a new
> object. It compiles quiet alright but the default values never show. What
> am I doing wrong
>
>
>
> >   // {{ newTransaction  (action)
>
>  @ActionSemantics(Of.SAFE)
>
> @MemberOrder(sequence = "1")
>
> @Named("New Transaction")
>
> public Transaction newTransaction(
>
> // @RegEx(validation = "\\w[@&:\\-\\,\\.\\+ \\w]*") // words, spaces and
> selected punctuation
>
> @Named("Description") String description,
>
> @Named("Type") Transaction.TransactionType transactiontype,
>
> @Named("Issuing Party")Party fromParty,
>
> @Named("Receiving Party ") Party toParty,
>
> @Named("Denomination") VoucherDenomination voucherDenomination,
>
> @Named("Quantity ") BigDecimal quantity,
>
> @Named("In Units Of ") Sku sku,
>
> @Optional
>
> @Named("VoucherCode ") String voucherCode,
>
> @Optional
>
> @Named("Serial Number ") String serialNo,
>
> @Named("Transaction Date") LocalDate transactionDate,
>
> @Optional
>
> @Named("Ticket valid to") LocalDate validTo,
>
> @Named("Face Value") BigDecimal faceValue ){
>
> final String ownedBy = currentUserName();
>
> return newTransaction(description, transactiontype, fromParty, toParty,
> voucherDenomination,
>
> quantity, sku, voucherCode,serialNo, transactionDate,validTo, faceValue,
> ownedBy);
>
> }
>
>
>  // }}
>
> // defaults
>
> //
>
> private String default0NewTransaction(){
>
> return "New Sale";
>
> }
>
> private Transaction.TransactionType deafault1NewTransaction(){
>
> return Transaction.TransactionType.SALE;
>
> }
>
> private Party default2NewTransaction(){
>
> return getPartyFromCurrentUser(currentUserName());
>
> }
>
> private VoucherDenomination default3NewTransaction(){
>
> return getDefaultDenominationForCurrentUser(currentUserName());
>
> }
>
> private VoucherDenomination default4NewTransaction(){
>
> return getDefaultDenominationForCurrentUser(currentUserName());
>
> }
>
> private BigDecimal default5NewTransaction(){
>
> return new BigDecimal(0);
>
> }
>
> private Sku default6NewTransaction(){
>
> return getDefaultSkuForDenomination(currentUserName());
>
> }
>
> private String default7NewTransaction(){
>
> return getDefaultVoucherCode(currentUserName());
>
> }
>
> private String default8NewTransaction(){
>
> return getDefaultSerialNo(currentUserName());
>
> }
>
> private LocalDate default9NewTransaction(){
>
> return new LocalDate();
>
> }
>
> private BigDecimal default10NewTransaction(){
>
> return new BigDecimal(1);
>
> }
>
>   //helpers
>
> private Party getPartyFromCurrentUser(String currentUser){
>
> // find the party that is attached to this current user. In reality we look
> through all the parties and find which one has the same user name
>
> return null;
>
> }
>
> private Party getDefaultToPartyForCurrentUser(String currentUser) {
>
> // find the person he normally transacts with
>
> return null;
>
> }
>
> private VoucherDenomination getDefaultDenominationForCurrentUser(String
> currentUser){
>
> //find the most common denominator he deals with
>
> return null;
>
> }
>
> private Sku getDefaultSkuForDenomination(String currentUser){
>
> //find the default sku
>
> return null;
>
> }
>
> private String getDefaultVoucherCode(String currentUser) {
>
> //find default vouchercode
>
> return null;
>
> }
>
> private String getDefaultSerialNo(String currentUser){
>
> //default serial number
>
> return null;
>
> }
>
> //
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message