I made the defaults public but then get > > 1) Error in custom provider, >> org.apache.isis.core.metamodel.specloader.validator.MetaModelInvalidException: >> 1: dom.todo.Transactions#default10NewTransaction has prefix default, has >> probably been orphaned. If not an orphan, then rename and use @Named >> annotation > > [exec] 2: dom.todo.Transactions#default3NewTransaction has prefix >> default, has probably been orphaned. If not an orphan, then rename and use >> @Named annotation > > [exec] > > [exec] at >> org.apache.isis.core.runtime.runner.IsisInjectModule.provideIsisSystem(IsisInjectModule.java:138) > > [exec] at >> org.apache.isis.core.runtime.runner.IsisInjectModule.provideIsisSystem(IsisInjectModule.java:138) > > [exec] while locating org.apache.isis.core.runtime.system.IsisSystem > > [exec] for field at >> org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.system(IsisWicketApplication.java:131) > > [exec] while locating app.QuickStartApplication > > [exec] > > [exec] 1 error > > [exec] at >> com.google.inject.internal.Errors.throwProvisionExceptionIfErrorsExist(Errors.java:451) > > [exec] at >> com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:65) > > [exec] at >> com.google.inject.internal.InjectorImpl.injectMembers(InjectorImpl.java:944) > > [exec] at >> org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.init(IsisWicketApplication.java:213) > > [exec] at >> org.apache.wicket.Application.initApplication(Application.java:818) > > [exec] at >> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:424) > > [exec] ... 19 more > > [exec] Caused by: >> org.apache.isis.core.metamodel.specloader.validator.MetaModelInvalidException: >> 1: dom.todo.Transactions#default10NewTransaction has prefix default, has >> probably been orphaned. If not an orphan, then rename and use @Named >> annotation > > [exec] 2: dom.todo.Transactions#default3NewTransaction has prefix >> default, has probably been orphaned. If not an orphan, then rename and use >> @Named annotation > > [exec] > > [exec] at >> org.apache.isis.core.metamodel.specloader.validator.ValidationFailures.assertNone(ValidationFailures.java:40) > > [exec] at >> org.apache.isis.core.metamodel.specloader.ObjectReflectorDefault.init(ObjectReflectorDefault.java:242) > > [exec] at >> org.apache.isis.core.runtime.system.session.IsisSessionFactoryAbstract.init(IsisSessionFactoryAbstract.java:202) > > [exec] at >> org.apache.isis.core.runtime.system.IsisSystemFixturesHookAbstract.init(IsisSystemFixturesHookAbstract.java:130) > > [exec] at >> org.apache.isis.core.runtime.runner.IsisInjectModule.provideIsisSystem(IsisInjectModule.java:139) > > [exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > [exec] at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > > [exec] at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > > [exec] at java.lang.reflect.Method.invoke(Method.java:597) > > [exec] at >> com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:104) > > [exec] at >> com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40) > > [exec] at >> com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) > > [exec] at >> com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031) > > [exec] at >> com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) > > [exec] at com.google.inject.Scopes$1$1.get(Scopes.java:65) > > [exec] at >> com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40) > > [exec] at >> com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:53) > > [exec] at >> com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:110) > > [exec] at >> com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:75) > > [exec] at >> com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:73) > > [exec] at >> com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024) > > [exec] at >> com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:73) > > [exec] at >> com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:60) > > [exec] ... 23 more > > >
On Sun, Sep 22, 2013 at 4:21 PM, james agada <[email protected]> wrote: > Ok. > > Sent from my iPhone > > On Sep 22, 2013, at 4:14 PM, Dan Haywood <[email protected]> > wrote: > > > The defaultNXxx() methods need to have public visibility. > > > > > > > > > > On 22 September 2013 15:39, james agada <[email protected]> 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; > >> > >> } > >> > >> // > >> >
