This is my definition
//region > cancellationTime (Property)
private DateTime cancellationTime;
@Property(
editing = Editing.DISABLED,
editingDisabledReason = "Cancellation time is automatically set when
using actions"
)
@Column(allowsNull = "true")
@MemberOrder(name="Status",sequence = "8")
public DateTime getCancellationTime() {
return cancellationTime;
}
public void setCancellationTime(DateTime cancellationTime) {
this.cancellationTime = cancellationTime;
}
//endregion
//region > creationTime (Property)
private DateTime creationTime;
@Property(
editing = Editing.DISABLED,
editingDisabledReason = "Creation time is automatically set when using
actions"
)
@Column(allowsNull = "false")
@MemberOrder(name="Status",sequence = "9")
@Persistent
public DateTime getCreationTime() {
return creationTime;
}
public void setCreationTime(DateTime creationTime) {
this.creationTime = creationTime;
}
//endregion
//region > shoppingCartItems (collection)
@Persistent(mappedBy = "shoppingCart", dependentElement = "false")
private SortedSet<ShoppingCartItem> shoppingCartItems = new
TreeSet<ShoppingCartItem>();
@CollectionLayout(render = RenderType.EAGERLY)
@MemberOrder(sequence = "100")
public SortedSet<ShoppingCartItem> getShoppingCartItems() {
return shoppingCartItems;
}
public void setShoppingCartItems(final SortedSet<ShoppingCartItem>
shoppingCartItems) {
this.shoppingCartItems = shoppingCartItems;
}
//endregion
________________________________________
De: Dan Haywood <[email protected]>
Enviado: viernes, 19 de febrero de 2016 02:08 p. m.
Para: users
Asunto: Re: instanceId
Hmm, presumably is the Shopping cart that has the instance Id that you
quoted?
Perhaps you could show us the definition on that class too?
---
Unrelated to your original query, now that you should be able to inject
your AytoNumberRepository. Just ensure that it is annotated with
@DomainService and is in a package specified by your AppManifest.
On 19 Feb 2016 19:08, "Arturo Ulises Castañeda Estrada" <
[email protected]> wrote:
> As I understand the persist is after the return obj.
>
> @DomainService(repositoryFor = ShoppingCart.class,
> nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY)
>
> public class ShoppingCartRepository {
>
> //region > newShoppingCart (action)
> public static class CreateDomainEvent extends
> ActionDomainEvent<ShoppingCartRepository> {
> public CreateDomainEvent(final ShoppingCartRepository source,
> final Identifier identifier, final Object... arguments) {
> super(source, identifier, arguments);
> }
> }
>
> @Action(
> domainEvent = CreateDomainEvent.class
> )
> @MemberOrder(name="shoppingCarts",sequence = "1")
> public ShoppingCart newShoppingCart(
> //final @ParameterLayout(named="Shopping Cart Id") Long
> shoppingCartId,
> final @ParameterLayout(named="Customer Subscription")
> CustomerSubscription customerSubscription
> )
> {
> final ShoppingCart obj =
> container.newTransientInstance(ShoppingCart.class);
>
> //Obtener Folio
> autoNumberRepository = new AutoNumberRepository();
> autoNumberRepository.setContainer(container);
> Long shoppingCartId =
> autoNumberRepository.nextAutoNumber("SHOPPING CART ID" , null);
> obj.setShoppingCartId(shoppingCartId);
> obj.setCustomerSubscription(customerSubscription);
> obj.setCreationTime(clockService.nowAsDateTime());
> obj.setStatus(ShoppingCartStatus.SHOPPING);
> container.persistIfNotAlready(obj);
> return obj;
> }
> //endregion
> ________________________________________
> De: Dan Haywood <[email protected]>
> Enviado: viernes, 19 de febrero de 2016 12:52 p. m.
> Para: users
> Asunto: Re: instanceId
>
> I suspect that's actually the instanceId of a domain object that's neither
> a view model nor a persistent entity, ie is a "transient" entity (not yet
> persisted to the DB).
>
> The RO viewer doesn't support such things (in fact, nor does the Wicket
> viewer anymore; they are a legacy of an earlier time). The fix, I expect,
> will be to make sure the entity is a properly annotated view model.
>
> HTH
> Dan
>
>
>
>
> On 19 February 2016 at 18:50, Arturo Ulises Castañeda Estrada <
> [email protected]> wrote:
>
> > Hi Dan, I have a problem, when i insert data, I get return the resource
> > and i get all JSON, I need the instanceId but for any reason the
> instanceId
> > it's encrypted.
> >
> >
> > "instanceId" : "ec263491-bb79-4a11-a205-f1dfd2840f36"
> >
> >
> >