isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From L Eder <eder200...@gmail.com>
Subject Unable to see ceated objects rendered in a collection
Date Fri, 24 Mar 2017 20:10:45 GMT
Hi members:

If i add existing child objects (Linha), that is ok.
However what i want is to create new ones (Posto).
Nothing is rendered, neither any errors is catched.

Thanks for any light on this issue, Eder

The source code is:
Parent entity: Modelo.java
"
package domainapp.dom.osd;

import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;

import javax.inject.Inject;
import javax.jdo.annotations.Column;
import javax.jdo.annotations.DatastoreIdentity;
import javax.jdo.annotations.Element;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.Join;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.Queries;
import javax.jdo.annotations.Query;
import javax.jdo.annotations.Unique;
import javax.jdo.annotations.Version;
import javax.jdo.annotations.VersionStrategy;

import com.google.common.collect.Lists;

import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.BookmarkPolicy;
import org.apache.isis.applib.annotation.Collection;
import org.apache.isis.applib.annotation.CollectionLayout;
import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.DomainObjectLayout;
import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.RenderType;
import org.apache.isis.applib.annotation.Title;

import lombok.Getter;
import lombok.Setter;


@PersistenceCapable(
        identityType = IdentityType.DATASTORE,
        schema = "osd",
        table = "Modelo"
)
@DatastoreIdentity(
        strategy = IdGeneratorStrategy.IDENTITY,
        column = "id")
@Version(
        strategy = VersionStrategy.VERSION_NUMBER,
        column = "version")
@Queries({
        @Query(
                name = "find", language = "JDOQL",
                value = "SELECT "
                        + "FROM domainapp.dom.osd.Modelo "),
        @Query(
                name = "findByNomeContains", language = "JDOQL",
                value = "SELECT "
                        + "FROM domainapp.dom.osd.Modelo "
                        + "WHERE nome.indexOf(:nome) >= 0 "),
        @Query(
                name = "findByNome", language = "JDOQL",
                value = "SELECT "
                        + "FROM domainapp.dom.osd.Modelo "
                        + "WHERE nome == :nome ")
})
@Unique(name = "Modelo_nome_UNQ", members = {"nome"})
@DomainObject(
        editing = Editing.DISABLED,
        bounded = true
)
@DomainObjectLayout(
        bookmarking = BookmarkPolicy.AS_ROOT
)
public class Modelo implements Comparable<Modelo> {

    @Title
    @Column(allowsNull = "false")
    @Property()
    @Getter
    @Setter
    private String nome;

    // ////////////////////////////////////////////////////////

    @Persistent(table = "ModeloLinhas")
    @Join(column = "modelo_id")
    @Element(column = "linha_id")
    @Collection()
    @CollectionLayout(render = RenderType.EAGERLY)
    @Getter
    @Setter
    private SortedSet<Linha> linhas = new TreeSet<Linha>();

    public Modelo addLinha(
     //       List<Linha> linhas) {
        Linha linha) {
        getLinhas().add(linha);
        return this;
    }
    public List<Linha> choices0AddLinha() {
        final List<Linha> outraslinhas = Lists.newArrayList();
        outraslinhas.addAll(linhaRepo.listAll());
        outraslinhas.remove(getLinhas());
        return outraslinhas;
    }

    public Modelo removeLinha(final Linha linha) {
        getLinhas().remove(linha);
        return this;
    }

    // ////////////////////////////////////////////////////////

    @Persistent(mappedBy ="modelo", dependentElement = "false")  //// true
    @Collection()
    @CollectionLayout(render = RenderType.EAGERLY)
    @Getter @Setter
    private SortedSet<Posto> postos = new TreeSet<Posto>();

    public Modelo newPosto(
            @ParameterLayout(named="Numero")
            final String numero,
            //@Parameter(optionality = Optionality.OPTIONAL)
            @ParameterLayout(named="Habilidades Requeridas")
            final List<Habilidade> habilidadesRequeridas) {

        postoRepo.create(numero, OperadorPostoStatus.FREE,
habilidadesRequeridas);
        return this;
    }
    public List<String> choices0NewPosto() {
        return Arrays.asList("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
    }
public List<Habilidade> choices1NewPosto() {
        return habilRepo.listAll();
    }

    public Modelo deletePosto(final Posto posto) {
        getPostos().remove(posto);
        return this;
    }

"


Child 1: Linha.java
"
package domainapp.dom.osd;

import javax.inject.Inject;
import javax.jdo.annotations.Column;
import javax.jdo.annotations.DatastoreIdentity;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Queries;
import javax.jdo.annotations.Query;
import javax.jdo.annotations.Unique;
import javax.jdo.annotations.Version;
import javax.jdo.annotations.VersionStrategy;

import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.BookmarkPolicy;
import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.DomainObjectLayout;
import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Title;

import lombok.Getter;
import lombok.Setter;


@PersistenceCapable(
        identityType = IdentityType.DATASTORE,
        schema = "osd",
        table = "Linha"
)
@DatastoreIdentity(
        strategy = IdGeneratorStrategy.IDENTITY,
        column = "id")
@Version(
        strategy = VersionStrategy.VERSION_NUMBER,
        column = "version")
@Queries({
        @Query(
                name = "find", language = "JDOQL",
                value = "SELECT "
                        + "FROM domainapp.dom.osd.Linha "),
        @Query(
                name = "findByNomeContains", language = "JDOQL",
                value = "SELECT "
                        + "FROM domainapp.dom.osd.Linha "
                        + "WHERE nome.indexOf(:nome) >= 0 "),
        @Query(
                name = "findByNome", language = "JDOQL",
                value = "SELECT "
                        + "FROM domainapp.dom.osd.Linha "
                        + "WHERE nome == :nome ")
})
@Unique(name = "Linha_nome_UNQ", members = {"nome"})
@DomainObject(
        editing = Editing.DISABLED,
        bounded = true

)
@DomainObjectLayout(
        bookmarking = BookmarkPolicy.AS_ROOT
)
public class Linha implements Comparable<Linha> {


    @Title
    @Column(allowsNull = "false")
    @Property()
    @Getter
    @Setter
    @MemberOrder(sequence="1")
    private String nome;

    // ////////////////////////////////////////////////////////

    @Column(allowsNull = "true")
    @Getter @Setter
    @MemberOrder(sequence="2")
    @PropertyLayout(named = "Modelo Em Produção")
    private Modelo modeloemproducao;

    // ////////////////////////////////////////////////////////
.
.
.
"

Child 2: Posto.java
"
package domainapp.dom.osd;

import javax.jdo.annotations.Column;
import javax.jdo.annotations.DatastoreIdentity;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Queries;
import javax.jdo.annotations.Query;
import javax.jdo.annotations.Unique;
import javax.jdo.annotations.Version;
import javax.jdo.annotations.VersionStrategy;

import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.BookmarkPolicy;
import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.DomainObjectLayout;
import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.Title;

import lombok.Getter;
import lombok.Setter;

@PersistenceCapable(
        identityType = IdentityType.DATASTORE,
        schema = "osd",
        table = "Posto"
)
@DatastoreIdentity(
        strategy = IdGeneratorStrategy.IDENTITY,
        column = "id")
@Version(
        strategy = VersionStrategy.VERSION_NUMBER,
        column = "version")
@Queries({
        @Query(
                name = "find", language = "JDOQL",
                value = "SELECT "
                        + "FROM domainapp.dom.osd.Posto "),
        @Query(
                name = "findByNumeroContains", language = "JDOQL",
                value = "SELECT "
                        + "FROM domainapp.dom.osd.Posto "
                        + "WHERE numero.indexOf(:numero) >= 0 "),
        @Query(
                name = "findByNumero", language = "JDOQL",
                value = "SELECT "
                        + "FROM domainapp.dom.osd.Posto "
                        + "WHERE numero == :numero ")
})
@Unique(name = "Posto_numero_UNQ", members = { "numero" })
@DomainObject(
        editing = Editing.DISABLED,
        bounded = true
)
@DomainObjectLayout(
        bookmarking = BookmarkPolicy.AS_ROOT
)
public class Posto implements Comparable<Posto> {

    // ///////////////////////////

    @Title
    @Column(allowsNull = "false")
    @Property()
    @Getter @Setter
    private String numero;


    @Column(allowsNull = "true")
    @Getter @Setter
    private OperadorPostoStatus statusOperador;

    @Column(allowsNull = "true")
    @Getter @Setter
    private Operador operador;

    @Column(allowsNull = "true")
    @Property()
    @Getter @Setter
    private Modelo modelo;

    // ///////////////////////////

    //region > compareTo, toString
    @Override
    public int compareTo(final Posto other) {
        return org.apache.isis.applib.util.ObjectContracts.compare(this,
other, "numero");
    }

    @Override
    public String toString() {
        return org.apache.isis.applib.util.ObjectContracts.toString(this,
"numero");
    }
    //endregion

    // ///////////////////////////

    @javax.inject.Inject
    HabilidadeRepository habilrepository;

    @javax.inject.Inject
    PostoRepository postorepository;

    @javax.inject.Inject
    OperadorRepository operadorrepository;
"

Mime
View raw message