How do i raise the defect?
On Thu, Aug 15, 2013 at 1:38 PM, Dan Haywood <[email protected]>wrote: > Huh. Annoying. That's probably a defect in the Wicket viewer. > > Could you raise a ticket for that in JIRA? > > And in the meantime, as you say... use the other syntax. > > Sorry for the run-around. > > Dan > > > > > On 15 August 2013 13:35, james agada <[email protected]> wrote: > > > Ok. Done that. Now the error goes away but then no defaults come up. For > > instance eventhough I set the default TransactionType, it does not show > up > > neither does the default date. Does this method of doing defaults work or > > should i just do it parameter by parameter. > > > > > > On Thu, Aug 15, 2013 at 1:09 PM, Dan Haywood > > <[email protected]>wrote: > > > > > The documentation [1] is wrong (or was wrong if you read this after the > > > edit I'm about to do...) > > > > > > Looking at the code [2], we expect the defaultXxx method to take > no-args. > > > In other words, we don't account for overloaded actions (which are > very > > > rare anyway, also not advisable because it is confusing in the UI). > > > > > > So, to fix, just remove the parameters from the default method. > > > > > > I'll fix the documentation right now. > > > > > > Dan > > > > > > > > > [1] > > > > > > > > > http://isis.apache.org/applib-guide/how-tos/how-to-03-050-How-to-specify-default-values-for-an-action-parameter.html > > > [2] > > > > > > > > > https://github.com/apache/isis/blob/255ef5146bdcea69a5b0a3acb1d29ddc87d927cd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/defaults/method/ActionDefaultsFacetFactory.java > > > > > > > > > > > > On 15 August 2013 12:07, james agada <[email protected]> wrote: > > > > > > > > > > > > > /* > > > > > > > > > > * Licensed to the Apache Software Foundation (ASF) under one > > > > > > > > > > * or more contributor license agreements. See the NOTICE file > > > > > > > > > > * distributed with this work for additional information > > > > > > > > > > * regarding copyright ownership. The ASF licenses this file > > > > > > > > > > * to you under the Apache License, Version 2.0 (the > > > > > > > > > > * "License"); you may not use this file except in compliance > > > > > > > > > > * with the License. You may obtain a copy of the License at > > > > > > > > > > * > > > > > > > > > > * http://www.apache.org/licenses/LICENSE-2.0 > > > > > > > > > > * > > > > > > > > > > * Unless required by applicable law or agreed to in writing, > > > > > > > > > > * software distributed under the License is distributed on an > > > > > > > > > > * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > > > > > > > > > > * KIND, either express or implied. See the License for the > > > > > > > > > > * specific language governing permissions and limitations > > > > > > > > > > * under the License. > > > > > > > > > > */ > > > > > > > > > > package dom.todo; > > > > > > > > > > > > > > > import java.math.BigDecimal; > > > > > > > > > > import java.util.Collections; > > > > > > > > > > import java.util.List; > > > > > > > > > > > > > > > import com.google.common.base.Objects; > > > > > > > > > > > > > > > import org.joda.time.LocalDate; > > > > > > > > > > import org.joda.time.*; > > > > > > > > > > > > > > > import org.apache.isis.applib.AbstractFactoryAndRepository; > > > > > > > > > > import org.apache.isis.applib.annotation.ActionSemantics; > > > > > > > > > > import org.apache.isis.applib.annotation.ActionSemantics.Of; > > > > > > > > > > import org.apache.isis.applib.annotation.Hidden; > > > > > > > > > > import org.apache.isis.applib.annotation.MemberOrder; > > > > > > > > > > import org.apache.isis.applib.annotation.Named; > > > > > > > > > > import org.apache.isis.applib.annotation.NotInServiceMenu; > > > > > > > > > > import org.apache.isis.applib.annotation.Optional; > > > > > > > > > > import org.apache.isis.applib.annotation.Programmatic; > > > > > > > > > > import org.apache.isis.applib.annotation.RegEx; > > > > > > > > > > import org.apache.isis.applib.clock.Clock; > > > > > > > > > > import org.apache.isis.applib.filter.Filter; > > > > > > > > > > > > > > > @Named("Transactions") > > > > > > > > > > public class Transactions extends AbstractFactoryAndRepository { > > > > > > > > > > > > > > > // {{ Id, iconName > > > > > > > > > > @Override > > > > > > > > > > public String getId() { > > > > > > > > > > return "Transactions"; > > > > > > > > > > } > > > > > > > > > > > > > > > public String iconName() { > > > > > > > > > > return "Transactions"; > > > > > > > > > > } > > > > > > > > > > // }} > > > > > > > > > > > > > > > > > > > > // {{ 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); > > > > > > > > > > } > > > > > > > > > > > > > > > // }} > > > > > > > > > > // default new transaction > > > > > > > > > > public Object[] defaultNewTransaction( > > > > > > > > > > String description, > > > > > > > > > > Transaction.TransactionType transactiontype, > > > > > > > > > > Party fromParty, > > > > > > > > > > Party toParty, > > > > > > > > > > VoucherDenomination voucherDenomination, > > > > > > > > > > BigDecimal quantity, > > > > > > > > > > Sku sku, > > > > > > > > > > String voucherCode, > > > > > > > > > > String serialNo, > > > > > > > > > > LocalDate transactionDate, > > > > > > > > > > LocalDate validTo, > > > > > > > > > > BigDecimal faceValue) { > > > > > > > > > > return new Object[] { > > > > > > > > > > "New Sale", > > > > > > > > > > Transaction.TransactionType.SALE, > > > > > > > > > > getPartyFromCurrentUser(currentUserName()), > > > > > > > > > > getDefaultToPartyForCurrentUser(currentUserName()), > > > > > > > > > > getDefaultDenominationForCurrentUser(currentUserName()), > > > > > > > > > > new BigDecimal(0), > > > > > > > > > > getDefaultSkuForDenomination(currentUserName()), > > > > > > > > > > getDefaultVoucherCode(currentUserName()), > > > > > > > > > > getDefaultSerialNo(currentUserName()), > > > > > > > > > > new DateTime(), > > > > > > > > > > new BigDecimal(0) > > > > > > > > > > }; > > > > > > > > > > } > > > > > > > > > > // > > > > > > > > > > //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; > > > > > > > > > > } > > > > > > > > > > // > > > > > > > > > > // > > > > > > > > > > // {{ newTransaction (hidden) > > > > > > > > > > @Hidden // for use by fixtures > > > > > > > > > > public Transaction newTransaction( > > > > > > > > > > final String description, > > > > > > > > > > final Transaction.TransactionType transactiontype, > > > > > > > > > > final Party fromParty, > > > > > > > > > > final Party toParty, > > > > > > > > > > final VoucherDenomination voucherDenomination, > > > > > > > > > > final BigDecimal quantity, > > > > > > > > > > final Sku sku, > > > > > > > > > > final String voucherCode, > > > > > > > > > > final String serialNo, > > > > > > > > > > final LocalDate transactionDate, > > > > > > > > > > final LocalDate validTo, > > > > > > > > > > final BigDecimal faceValue, > > > > > > > > > > final String ownedBy) { > > > > > > > > > > final Transaction t = > > newTransientInstance(Transaction.class); > > > > > > > > > > t.setDescription(description); > > > > > > > > > > t.setTransactionType(transactiontype); > > > > > > > > > > t.setFromParty(fromParty); > > > > > > > > > > t.setToParty(toParty); > > > > > > > > > > t.setVoucherDenomination(voucherDenomination); > > > > > > > > > > t.setQuantity(quantity); > > > > > > > > > > t.setSku(sku); > > > > > > > > > > t.setVoucherCode(voucherCode); > > > > > > > > > > t.setSerialNumber(serialNo); > > > > > > > > > > t.setTransactionDate(transactionDate); > > > > > > > > > > t.setValidTo(validTo); > > > > > > > > > > t.setFaceValue(faceValue); > > > > > > > > > > t.setOwnedBy(ownedBy); > > > > > > > > > > persist(t); > > > > > > > > > > return t; > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > protected String currentUserName() { > > > > > > > > > > return getContainer().getUser().getName(); > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > } > > > > > > > > > > > > > >> > > > > > > > > On Wed, Aug 14, 2013 at 6:23 PM, james agada <[email protected]> > > > wrote: > > > > > > > > > I have created an action in a service Transactions.java attached > and > > > > added > > > > > the defaultNewTransaction method in ordr to populate default > values. > > It > > > > > compiles alright but when I try to run, I get this error > > > > > > > > > > [exec] 1) Error in custom provider, > > > > > > > > > > > > > > > org.apache.isis.core.metamodel.specloader.validator.MetaModelInvalidException: > > > > > 1: dom.todo.Transactions#defaultNewTransaction has prefix default, > > has > > > > > probably been orphaned. If not an orphan, then rename and use > @Named > > > > > annotation > > > > > > > > > > May be I am doing it wrong but can some one help. Is it only inside > > > > entity > > > > > that you can use default? > > > > > > > > > > > > > > >
