Good afternoon.
I am trying to create a domain service with a method to finish a purchase.
So, I have to set in the purchase a list of items, and I don't know how I
do this.
I imagine the interface with a field to find items and a table or a list
showing the selected items by the user.
Any tips?
Thank you.
Gabriel Malimpensa.
Sao Carlos, Sao Paulo, Brazil.
Gabriel Malimpensa 's gravatar image asked Nov 1 2014 at 12:26 in Isis-Users by Gabriel Malimpensa

4 Answers

Hi,
Are you aware of DomainObjectContainer ?
See http://isis.apache.org/reference/DomainObjectContainer.html and all
links in "Object management" section at
http://isis.apache.org/documentation.html
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
Martin Grigorov 's gravatar image answered Nov 1 2014 at 13:18 by Martin Grigorov
Yes, I am aware of this.
My doubt is how to create a form to persist an entity like the others, but
I need to persist such entity with a list of items.
My example is: an entity Purchase and many entities PurchaseItem. I need
that Isis renders a list or a table, something like this.
I don't know if I explained correctly. I hope so.
Sorry for my english.
Gabriel Malimpensa.
Sao Carlos, Sao Paulo, Brazil.
2014-11-01 18:18 GMT-02:00 Martin Grigorov
Gabriel Malimpensa 's gravatar image answered Nov 1 2014 at 13:59 by Gabriel Malimpensa
See ToDoItems class in the Todo app demo.
It is a domain service and a repository for ToDoItem objects.
I think you need a Purchase repository for PurchaseItem objects.
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
Martin Grigorov 's gravatar image answered Nov 1 2014 at 14:12 by Martin Grigorov
It sounds like you want to obtain a reference to an existing domain object
(probably "Product" from your description) so that your new "Purchase" (or
"Order") object references it...
public class Order {
private Product product; // I'm guessing this is what needs to be set
up.
private int quantity;
/// other fields
/// getters and setters omitted
}
So you could use an action to create, with an autoComplete supporting
method [1] for the appropriate action parameter , eg:
public class Orders { // the domain service
public Order createOrder(Product p, @Named("Quantity") int quantity) {
Order o = container.newTransientInstance(Order.class);
o.setProduct(p);
o.setQuantity(quantity);
container.persist(p);
}
public Collection<Product> autoComplete0CreateOrder(String
productRefOrDescription) {
return products.findByRefOrDescription(productRefOrDescription);
}
@Inject private DomainObjectContainer container;
@Inject private Products products;
}
where Products is a repository for the Product class letting you locate
products by their reference or description.
HTH
Dan
[1]
http://isis.apache.org/how-tos/how-to-03-025-How-to-specify-an-autocomplete-for-an-action-parameter.html
Dan Haywood 's gravatar image answered Nov 3 2014 at 00:23 by Dan Haywood

Related Discussions

  • How To Add A Password Text Field In Apache Isis in Isis-users

  • Hi everyone, I'm developing a demo User Account Management app. Domain object is a UserAccount. I went through the simpleApp, todoApp archetypes and some of the docs in Isis web page. I have a service called UserAccountService, where I need to add a Signup action for new UserAccounts. So Here I need to add a Password field to add a new account. In my service class I have method as below...

  • How To Trigger A Domain-event in Isis-users

  • Hi, I've registered a property domain event for some property for which the setter is called by an action (exposed in the wicket viewer) calling another service that eventually calls the setter. The subscriber doesn't catch the property event. EntityA.actionA(){ service.methodX(); } Service.methodX(){ EntityB.setPropertyWithRegisteredEvent('foo'); } EntityB.setPropertyWithRegisteredEvent...

  • How Do I Get To Set Defaults For Action Parameter In A Service? in Isis-users

  • 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...

  • Grouping Domain Services In A Single Menu Item in Isis-users

  • Hi, I need to put several domain services into a single menu item to save some space in the navigation bar (the header). So I use the same value for @DomainServiceLayout#named attribute. This is easy for services defined in my app, but not so obvious how to do for services contributed by 3rd party modules (e.g. security, sessionlogger, etc.). The only way I see is to suppress the service ...

  • Using Externalized Configuration Parameter In A Domain Service in Isis-users

  • Hi guys, I have question how to deal with application specific configuration parameters... I use elasticsearch to put/get specific documents and use them in a domain model. So I defined a domain service "EsClient" to access to elasticsearch - I use service lifecycle to connect/disconnect to elasticseach. According to ((https://isis.apache.org/reference/configuration-files.html) ) my first...

  • A New Domain Service For Mucking About With Word .docx in Isis-users

  • dev I've been doing a little work recently implementing ISIS-172 ... to provide the facility to generate Word .docx documents. The idea is that this is a domain service that can be injected into domain entities; the data that feeds into the service would be extracted from a graph of domain objects. Since our git repo is in the process of being set up [2], I've popped the code up onto...

  • Dashboard Service (ISIS-554) in Isis-users

  • Folks, a further new feature... it is now possible to annotate a (single) domain service with a new @Dashboard annotation [1]. This domain service is then rendered in the same way as a regular domain object. Unlike other domain services, the dashboard domain service may contain properties and collections; these can be to regular entities or to view models (ISIS-553). The ToDo app has been...

  • Using JDO Helper Methods To Check Existence Of An Object For A Test in Isis-users

  • I'm playing around with the cucumber support tools in isis (a testing framework for behavior driven development, for those who don't know), and have created a test that basically looks like this: Scenario: A new service class is added Given these service classes: | service class name | | Insurance | | Product Manufacturer | When new service classes are created: | service class...

  • ViewModel As Return Value Of Domain Service in Isis-users

  • Hi everybody, here my second question today. I need to provide a domain service which handles multiple elasticsearch and database queries and builds a "non persistent domain object" and gives that as a response to the 3rd party client thru REST API. So my idea is to define a ViewModel classes representing my "non-persistent domain model" and use them as method return value of a domain service...

  • Wicket Viewer - Clob/Blob As Return Value Of An Domain Service Action, Download File... in Isis-users

  • Hi there, I'm trying to implement an action on Domain Service (callable form menu) with an Clob return value e.g. String content = "HiThere"; return new org.apache.isis.applib.value.Clob("addresses.txt", new MimeType("text", "plain"), content.toCharArray()); Would expect to get an "Save As" dialog to store a file. Would that make sense? At the moment I get in wicket (1.7.0) Stack...

  • Possibility To Define Order For Invoking @PostConstruct in Isis-users

  • Hello, I'm looking for a way to ensure initialization order for domain service annotated with @PostConstruct. I have a self defined domain service for application settings that uses the one of isis enhanced with caching. During unit tests I found that always a other domain service is instantiated that uses my application settings domain service. Class name for my application settings: SettingsClient...

  • How To Shutdown Application in Isis-users

  • Hi, I am nirbhay, I am working in one project where we are using apache isis. In one domain service class I need to check some condition in init method (during initialization) and depending upon result I need to shutdown the application completely. Which is the proper way to do the shutdown process? Thanks, Nirbhay...

  • Just Put Together A Little String Interpolation Service... in Isis-users

  • ... which Estatio is gonna use to build URLs off to a report server. More info at [1] Dan [1] http://isis.apache.org/reference/services/third-party/danhaywood-isis-domainservice-stringinterpolator.html...

  • Services Still Not Injected When Entering @PostConstruct Methods On A Service in Isis-users

  • Hi to all. I have an Isis service that needs to initialize a "server" upon creation (it's a Drools session, but it would be the same with an email server, for instance). For initializing that "server", I need to pass it references to other Isis services (in this case Drools globals). If, as per [1], I try like this: @PostConstruct public void init(final Map props) { server...

  • Isis Add Ons in Isis-users

  • Hello, I am having an issue with gmap3 Isis add-ons , with Isis 1.9.0 and all ad-ons also 1.9.0. The gmap3 add-on used to work fine, now at run time, when calling the location service lookup, it issues an error. I didn't make changes to that code. Stack trace: * org.apache.wicket.WicketRuntimeException * Method onRequest of interface org.apache.wicket.behavior.IBehaviorListener...

  • ISIS-832 And ISIS-833: Reorganizing Artifacts And Modules in Isis-users

  • Hi folks, At the IsisCon meeting we held recently, we talked about simplifying and modularizing the framework; see the write-up here [1]. I've now started tackling some of the bigger issues listed, specifically: ISIS-832 [2] - addressing point (1) of [1], namely to simplify the framework by bringing RO, JDO and Shiro into core, and ISIS-833 [3] - addressing point (5) of [1], namely re-...

  • ISIS Service / ViewModel Method Calling Twice in Isis-users

  • Hi, Isis service or ViewModel method getting called twice. For ex: I have one Hidden service which has lookup method with @HomePage returning a ViewModel instance using newViewModelInstance(..) method and that renders one action method taking Blob parameter as button. It's basically upload button to upload a file. When I click on upload button, this upload method called and completed the uploading...

  • Setting Up REST Client ISIS 1.9.0: Guideline? in Isis-users

  • A simple question: Where can I find a guideline for how to set up a REST web client in Apache ISIS? I mean, just having a button which calls a REST web service using simple HTTP GET/POST/UPDATE/DELETE, and then displaying the result? And what is best to use to generate the class files from the xsd fetched from the REST web service? Apache axis2? cxf? Using Eclipse, ISIS 1.9.0, and wicket ...

  • New Screencast On Bulk Updates Using The Excel Domain Service in Isis-users

  • Hi folks, just a heads-up that the Isis website now contains a new page and screencast [1] showing how Estatio [2] uses the Excel domainservice [3] that I recently put together. I've also updated some of the existing pages which have screencasts for them, and updated the main documentation page [4] so it is easier (through a little icon) to see which pages have screencasts on them. Any...

  • Updated Package Names; Renaming Of "dflt" Security Service. in Isis-users

  • I've now updated all package names so that they tie in with the renaming of artifacts. For example, oai.runtimes.dflt.runtime.system.context.IsisContext is now oai.core.runtime.system.context.IsisContext. I haven't renamed the packages in the applib; even though this artifact is now oai.core:isis-core-applib, I've left the package name as oai.applib. Reply here if this annoys you or think...