You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Erik de Hair <er...@pocos.nl> on 2014/10/17 12:19:27 UTC

error while updating entity using entity page

Hi,

Does any body know why I'm getting the following exception when saving a 
modified entity by using its entity page

Caused by: java.lang.NullPointerException
     at 
org.apache.isis.core.metamodel.specloader.specimpl.OneToOneAssociationImpl.clearValue(OneToOneAssociationImpl.java:199)
     at 
org.apache.isis.core.metamodel.specloader.specimpl.OneToOneAssociationImpl.set(OneToOneAssociationImpl.java:163)
     at 
org.apache.isis.viewer.wicket.model.models.EntityModel.apply(EntityModel.java:594)
     at 
org.apache.isis.viewer.wicket.ui.components.entity.properties.EntityPropertiesForm.applyFormChangesElse(EntityPropertiesForm.java:505)
     at 
org.apache.isis.viewer.wicket.ui.components.entity.properties.EntityPropertiesForm.access$500(EntityPropertiesForm.java:75)
     at 
org.apache.isis.viewer.wicket.ui.components.entity.properties.EntityPropertiesForm$AjaxButtonForValidate.onSubmit(EntityPropertiesForm.java:333)
     at 
org.apache.wicket.ajax.markup.html.form.AjaxButton$1.onSubmit(AjaxButton.java:108)
     at 
org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(AjaxFormSubmitBehavior.java:179)
     at 
org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1266)
     at org.apache.wicket.markup.html.form.Form.process(Form.java:938)
     at 
org.apache.isis.viewer.wicket.ui.panels.FormAbstract.process(FormAbstract.java:110)
     at 
org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:770)
     at 
org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:156)
     at 
org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:123)
     at 
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:633)

the objectAdapter param for 
OneToOneAssociationImpl.set(OneToOneAssociationImpl.java:163) is the 
editted entity and the new value is null. The underlying facet method is 
a getter method for a String property of the entity that indeed is empty.

Thanks,
Erik

Re: error while updating entity using entity page

Posted by Erik de Hair <er...@pocos.nl>.
Tried to use the element-annotation with Column but this gives all sorts 
of errors about the database scheme that doesn't match.

Met vriendelijke groet,

Erik de Hair

--
Pocos bv
Croy 9c - 5653 LC Eindhoven
Telefoon: 088 0100 700 - Fax: 088 0100 799
http://www.pocos.nl/ - http://www.sipo.nl/
K.v.K. nummer: 17097024
Follow Pocos bv 
<https://twitter.com/intent/follow?original_referer=https%3A%2F%2Ftwitter.com%2Fabout%2Fresources%2Fbuttons&region=follow_link&screen_name=Pocosbv&source=followbutton&variant=2.0>

Aanmelden van incidenten en/of changes graag via servicedesk@pocos.nl 
<ma...@pocos.nl>
On 10/20/2014 06:26 PM, Jeroen van der Wal wrote:
> You might want to try replace @Element(column = "role_id") with
> @Column(name="role_id")
>
> On Sun, Oct 19, 2014 at 8:56 PM, Erik de Hair <er...@pocos.nl> wrote:
>
>> Some extra information I found out:
>>
>> The exception only occurs when the Contact has NO role assigned.
>>
>> Erik
>>
>> ________________________________________
>> From: Dan Haywood [dan@haywood-associates.co.uk]
>> Sent: Friday, October 17, 2014 5:48 PM
>> To: users
>> Subject: Re: error while updating entity using entity page
>>
>> I'd be happy to do a TeamViewer session with you remotely one evening or
>> weekend to track down.  Contact me offline to arrange.
>>
>> In the meantime, when the exception occurs, can you tell (from the
>> OneToOneAssociation) which property it is that's being processed?
>>
>> Cheers
>> Dan
>>
>>
>> On 17 October 2014 16:23, Erik de Hair <er...@pocos.nl> wrote:
>>
>>> Tried to isolate the entity in the todoapp with its only 2 relations but
>>> that way I can't reproduce the problem...
>>>
>>>
>>> On 10/17/2014 04:34 PM, Erik de Hair wrote:
>>>
>>>> Hi Dan,
>>>>
>>>> The Isis version is 1.6.0
>>>>
>>>> I can't provide a simple demo app without almost putting all our domain
>>>> code and services on github. There are to much dependencies for that.
>> The
>>>> entity it's all about. Hope you can find something.
>>>>
>>>> @javax.jdo.annotations.PersistenceCapable(table = "contactpersonen",
>>>> identityType = IdentityType.APPLICATION)
>>>> @Bookmarkable
>>>> public class Contact extends PortalAbstractDomainObject implements
>>>> SecuredPerInstance, Comparable<Contact>
>>>> {
>>>>      private final static Logger LOG = LoggerFactory.getLogger(
>>>> Contact.class);
>>>>
>>>>      private int id;
>>>>      @Hidden
>>>>      @PrimaryKey
>>>>      @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>>>>      public int getId()
>>>>      {
>>>>          return id;
>>>>      }
>>>>
>>>>      public void setId(int id)
>>>>      {
>>>>          this.id = id;
>>>>      }
>>>>
>>>>      // ignored fields
>>>>      // id int(11) PK AI -> see identity above
>>>>
>>>>      private int internalCompany = 1;
>>>>
>>>>      @Hidden
>>>>      @Column(name = "bedrijf_id", allowsNull = "true")
>>>>      public int getInternalCompany()
>>>>      {
>>>>          return internalCompany;
>>>>      }
>>>>
>>>>      public void setInternalCompany(int internalCompany)
>>>>      {
>>>>          this.internalCompany = 1;
>>>>      }
>>>>
>>>>      private String enumGender;
>>>>
>>>>      @Named("Geslacht")
>>>>      @Column(name = "geslacht", allowsNull = "false", length = 9)
>>>>      @Disabled
>>>>      public String getEnumGender()
>>>>      {
>>>>          return enumGender;
>>>>      }
>>>>
>>>>      public void setEnumGender(String enumGender)
>>>>      {
>>>>          this.enumGender = enumGender;
>>>>      }
>>>>
>>>>      private String firstName;
>>>>
>>>>      @MaxLength(value = 50)
>>>>      @Named("Voornaam")
>>>>      @Column(name = "voornaam", allowsNull = "true")
>>>>      public String getFirstName()
>>>>      {
>>>>          return firstName;
>>>>      }
>>>>
>>>>      public void setFirstName(String firstName)
>>>>      {
>>>>          this.firstName = firstName;
>>>>      }
>>>>
>>>>      /**
>>>>       * Update complete name when updating first name
>>>>       *
>>>>       * @param firstName
>>>>       */
>>>>      public void modifyFirstName(String firstName)
>>>>      {
>>>>          setFirstName(firstName);
>>>>          resetName();
>>>>      }
>>>>
>>>>      private String namePrefix;
>>>>
>>>>      @MaxLength(value = 15)
>>>>      @Named("Tussenvoegsel(s)")
>>>>      @Column(name = "tussenvoegsels", allowsNull = "true")
>>>>      public String getNamePrefix()
>>>>      {
>>>>          return namePrefix;
>>>>      }
>>>>
>>>>      public void setNamePrefix(String namePrefix)
>>>>      {
>>>>          this.namePrefix = namePrefix;
>>>>      }
>>>>
>>>>      /**
>>>>       * Update complete name when updating name prefix
>>>>       *
>>>>       * @param namePrefix
>>>>       */
>>>>      public void modifyNamePrefix(String namePrefix)
>>>>      {
>>>>          setNamePrefix(namePrefix);
>>>>          resetName();
>>>>      }
>>>>
>>>>      private String lastName;
>>>>
>>>>      @MaxLength(value = 50)
>>>>      @Named("Achternaam")
>>>>      @Column(name = "achternaam", allowsNull = "true")
>>>>      public String getLastName()
>>>>      {
>>>>          return lastName;
>>>>      }
>>>>
>>>>      public void setLastName(String lastName)
>>>>      {
>>>>          this.lastName = lastName;
>>>>      }
>>>>
>>>>      /**
>>>>       * Update complete name when updating last name
>>>>       *
>>>>       * @param lastName
>>>>       */
>>>>      public void modifyLastName(String lastName)
>>>>      {
>>>>          setLastName(lastName);
>>>>          resetName();
>>>>      }
>>>>
>>>>      private String name;
>>>>      @Title
>>>>      @MaxLength(value = 100)
>>>>      @Named("Naam")
>>>>      @Column(name = "naam", allowsNull = "true")
>>>>      public String getName()
>>>>      {
>>>>          return this.name;
>>>>      }
>>>>
>>>>      public void setName(String name)
>>>>      {
>>>>          this.name = name;
>>>>      }
>>>>
>>>>      private void resetName()
>>>>      {
>>>>          StringBuffer name = new StringBuffer();
>>>>          if (this.getFirstName() != null &&
>> !this.getFirstName().isEmpty()
>>>> )
>>>>          {
>>>>              name.append(this.getFirstName());
>>>>          }
>>>>          if (this.getNamePrefix() != null &&
>> !this.getNamePrefix().isEmpty(
>>>> ))
>>>>          {
>>>>              if (name.length() > 0)
>>>>              {
>>>>                  name.append(" ");
>>>>              }
>>>>              name.append(this.getNamePrefix());
>>>>          }
>>>>          if (this.getLastName() != null && !this.getLastName().isEmpty())
>>>>          {
>>>>              if (name.length() > 0)
>>>>              {
>>>>                  name.append(" ");
>>>>              }
>>>>              name.append(getLastName());
>>>>          }
>>>>          setName(name.toString());
>>>>      }
>>>>
>>>>      private String street;
>>>>      @Column(name = "straat", allowsNull = "true")
>>>>      @MaxLength(value = 255)
>>>>      public String getStreet()
>>>>      {
>>>>          return street;
>>>>      }
>>>>
>>>>      public void setStreet(String address)
>>>>      {
>>>>          this.street = address;
>>>>      }
>>>>
>>>>      private String houseNumber;
>>>>
>>>>      @Column(name = "huisnummer", allowsNull = "true")
>>>>      public String getHouseNumber()
>>>>      {
>>>>          return houseNumber;
>>>>      }
>>>>      public void setHouseNumber(String houseNumber)
>>>>      {
>>>>          this.houseNumber = houseNumber;
>>>>      }
>>>>
>>>>      private String houseNumberExtension;
>>>>
>>>>      @Column(name = "huisnummertoevoeging", allowsNull = "true")
>>>>      public String getHouseNumberExtension()
>>>>      {
>>>>          return houseNumberExtension;
>>>>      }
>>>>      public void setHouseNumberExtension(String houseNumberExtension)
>>>>      {
>>>>          this.houseNumberExtension = houseNumberExtension;
>>>>      }
>>>>
>>>>
>>>>      private String postalCode;
>>>>
>>>>      @MaxLength(value = 7)
>>>>      @Named("Postcode")
>>>>      @Column(name = "postcode", allowsNull = "true")
>>>>      public String getPostalCode()
>>>>      {
>>>>          return postalCode;
>>>>      }
>>>>
>>>>      public void setPostalCode(String postalCode)
>>>>      {
>>>>          this.postalCode = postalCode;
>>>>      }
>>>>
>>>>      private String residence;
>>>>
>>>>      @MaxLength(value = 50)
>>>>      @Named("Plaats")
>>>>      @Column(name = "plaats", allowsNull = "true")
>>>>      public String getResidence()
>>>>      {
>>>>          return residence;
>>>>      }
>>>>
>>>>      public void setResidence(String residence)
>>>>      {
>>>>          this.residence = residence;
>>>>      }
>>>>
>>>>      private String country;
>>>>
>>>>      @MaxLength(value = 50)
>>>>      @Named("Land")
>>>>      @Column(name = "land", allowsNull = "true")
>>>>      public String getCountry()
>>>>      {
>>>>          return country;
>>>>      }
>>>>
>>>>      public void setCountry(String country)
>>>>      {
>>>>          this.country = country;
>>>>      }
>>>>
>>>>      private String locale;
>>>>
>>>>      @MaxLength(value = 10)
>>>>      @Named("Locale")
>>>>      @Column(name = "locale", allowsNull = "true")
>>>>      public String getLocale()
>>>>      {
>>>>          return locale;
>>>>      }
>>>>
>>>>      public void setLocale(String locale)
>>>>      {
>>>>          this.locale = locale;
>>>>      }
>>>>
>>>>      private LocalDate birthday;
>>>>
>>>>      @Named("Geboortedatum")
>>>>      @Column(name = "geb_datum", allowsNull = "true")
>>>>      public LocalDate getBirthday()
>>>>      {
>>>>          return birthday;
>>>>      }
>>>>
>>>>      public void setBirthday(LocalDate birthday)
>>>>      {
>>>>          this.birthday = birthday;
>>>>      }
>>>>
>>>>      private String phone;
>>>>
>>>>      @MaxLength(value = 20)
>>>>      @Named("Telefoon")
>>>>      @Column(name = "tel_vast", allowsNull = "true")
>>>>      public String getPhone()
>>>>      {
>>>>          return phone;
>>>>      }
>>>>
>>>>      public void setPhone(String phone)
>>>>      {
>>>>          this.phone = phone;
>>>>      }
>>>>
>>>>      private String phoneCompany;
>>>>
>>>>      @MaxLength(value = 20)
>>>>      @Named("Telefoon zakelijk")
>>>>      @Column(name = "tel_zaak", allowsNull = "true")
>>>>      public String getPhoneCompany()
>>>>      {
>>>>          return phoneCompany;
>>>>      }
>>>>
>>>>      public void setPhoneCompany(String phoneCompany)
>>>>      {
>>>>          this.phoneCompany = phoneCompany;
>>>>      }
>>>>
>>>>      private String cellPhone;
>>>>
>>>>      @MaxLength(value = 20)
>>>>      @Named("Mobiele telefoon")
>>>>      @Column(name = "tel_mobiel", allowsNull = "true")
>>>>      public String getCellPhone()
>>>>      {
>>>>          return cellPhone;
>>>>      }
>>>>
>>>>      public void setCellPhone(String cellPhone)
>>>>      {
>>>>          this.cellPhone = cellPhone;
>>>>      }
>>>>
>>>>      private String email;
>>>>
>>>>      @MaxLength(value = 100)
>>>>      @Named("E-mail")
>>>>      @Column(name = "email", allowsNull = "true")
>>>>      @RegEx(validation = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$",
>>>> caseSensitive = false)
>>>>      public String getEmail()
>>>>      {
>>>>          return email;
>>>>      }
>>>>
>>>>      public void setEmail(String email)
>>>>      {
>>>>          this.email = email;
>>>>      }
>>>>
>>>>      private String occupation;
>>>>
>>>>      @MaxLength(value = 100)
>>>>      @Named("Functie")
>>>>      @Column(name = "functie", allowsNull = "true")
>>>>      public String getOccupation()
>>>>      {
>>>>          return occupation;
>>>>      }
>>>>
>>>>      public void setOccupation(String occupation)
>>>>      {
>>>>          this.occupation = occupation;
>>>>      }
>>>>
>>>>      /**
>>>>       * The company the contact represents (is the contact for)
>>>>       */
>>>>      private PortalCompany representedCompany;
>>>>
>>>>      @Named("Werkzaam voor")
>>>>      @Column(name = "referentie", allowsNull = "true")
>>>>      public PortalCompany getRepresentedCompany()
>>>>      {
>>>>          return representedCompany;
>>>>      }
>>>>
>>>>      public void setRepresentedCompany(PortalCompany representedCompany)
>>>>      {
>>>>          this.representedCompany = representedCompany;
>>>>      }
>>>>
>>>>      private String belongsTo = "klant";
>>>>
>>>>      @MaxLength(value = 20)
>>>>      @Column(name = "hoort_bij", allowsNull = "true")
>>>>      public String getBelongsTo()
>>>>      {
>>>>          return belongsTo;
>>>>      }
>>>>
>>>>      public void setBelongsTo(String belongsTo)
>>>>      {
>>>>          this.belongsTo = belongsTo;
>>>>      }
>>>>
>>>>      private boolean active;
>>>>
>>>>      @Named("Actief")
>>>>      @Column(name = "actief", allowsNull = "false")
>>>>      public boolean isActive()
>>>>      {
>>>>          return active;
>>>>      }
>>>>
>>>>      public void setActive(boolean active)
>>>>      {
>>>>          this.active = active;
>>>>      }
>>>>
>>>>      private String ripehandle;
>>>>
>>>>      @MaxLength(value = 255)
>>>>      @Named("RIPE handle")
>>>>      @Column
>>>>      public String getRipehandle()
>>>>      {
>>>>          return ripehandle;
>>>>      }
>>>>
>>>>      public void setRipehandle(String ripehandle)
>>>>      {
>>>>          this.ripehandle = ripehandle;
>>>>      }
>>>>
>>>>      private String username;
>>>>
>>>>      @MemberOrder(name = "Gebruikersaccount", sequence = "2")
>>>>      @Unique
>>>>      @MaxLength(value = 45)
>>>>      @Named("Gebruikersnaam")
>>>>      @Column(name = "gebruikersnaam", allowsNull = "true")
>>>>      @Disabled
>>>>      public String getUsername()
>>>>      {
>>>>          return username;
>>>>      }
>>>>
>>>>      public void setUsername(String username)
>>>>      {
>>>>          this.username = username;
>>>>      }
>>>>
>>>>      private String password;
>>>>
>>>>      @Hidden(when = When.ALWAYS)
>>>>      @Disabled
>>>>      @MaxLength(value = 255)
>>>>      @Column(name = "wachtwoord", allowsNull = "true")
>>>>      public String getPassword()
>>>>      {
>>>>          return password;
>>>>      }
>>>>
>>>>      /**
>>>>       * @param password the password to set
>>>>       */
>>>>      public void setPassword(String password)
>>>>      {
>>>>          this.password = password;
>>>>      }
>>>>
>>>>      /**
>>>>       * Encrypt the password
>>>>       *
>>>>       * @param plaintextPassword
>>>>       */
>>>>      public void modifyPassword(String plaintextPassword)
>>>>      {
>>>>          DefaultPasswordService ps = new DefaultPasswordService();
>>>>          setPassword(ps.encryptPassword(plaintextPassword));
>>>>      }
>>>>
>>>>      /**
>>>>       * The user's application roles
>>>>       */
>>>>      private SortedSet<Role> roles = new TreeSet<Role>();
>>>>
>>>>      @Hidden
>>>>      @Persistent(table = "users_roles")
>>>>      @Join(column = "user_id")
>>>>      @Element(column = "role_id")
>>>>      public SortedSet<Role> getRoles()
>>>>      {
>>>>          return roles;
>>>>      }
>>>>
>>>>      public void setRoles(SortedSet<Role> roles)
>>>>      {
>>>>          this.roles = roles;
>>>>      }
>>>>
>>>>      @MemberOrder(name = "Gebruikersaccount", sequence = "3")
>>>>      @Named("Gebruikersrol")
>>>>      @Optional
>>>>      public String getRole()
>>>>      {
>>>>          return (this.getRoles().isEmpty() ? null :
>>>> this.getRoles().first().getDescription());
>>>>      }
>>>>
>>>>      private boolean isUser()
>>>>      {
>>>>          return this.getUsername() != null &&
>>>> !this.getUsername().isEmpty();
>>>>      }
>>>>
>>>>
>>>>
>>>>
>>>> On 10/17/2014 02:37 PM, Dan Haywood wrote:
>>>>
>>>>> Can you post the domain code for this?
>>>>>
>>>>> And which version of Isis?
>>>>>
>>>>> Ideally... can you provide a simple demo app on github?
>>>>>
>>>>> Thx
>>>>> Dan
>>>>>
>>>>>
>>>>>
>>>>> On 17 October 2014 11:19, Erik de Hair <er...@pocos.nl> wrote:
>>>>>
>>>>>   Hi,
>>>>>> Does any body know why I'm getting the following exception when
>> saving a
>>>>>> modified entity by using its entity page
>>>>>>
>>>>>> Caused by: java.lang.NullPointerException
>>>>>>       at org.apache.isis.core.metamodel.specloader.specimpl.
>>>>>> OneToOneAssociationImpl.clearValue(OneToOneAssociationImpl.java:199)
>>>>>>       at org.apache.isis.core.metamodel.specloader.specimpl.
>>>>>> OneToOneAssociationImpl.set(OneToOneAssociationImpl.java:163)
>>>>>>       at org.apache.isis.viewer.wicket.model.models.EntityModel.
>>>>>> apply(EntityModel.java:594)
>>>>>>       at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>>>>>>
>> EntityPropertiesForm.applyFormChangesElse(EntityPropertiesForm.java:505)
>>>>>>       at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>>>>>> EntityPropertiesForm.access$500(EntityPropertiesForm.java:75)
>>>>>>       at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>>>>>>
>> EntityPropertiesForm$AjaxButtonForValidate.onSubmit(EntityPropertiesForm.
>>>>>> java:333)
>>>>>>       at org.apache.wicket.ajax.markup.html.form.AjaxButton$1.
>>>>>> onSubmit(AjaxButton.java:108)
>>>>>>       at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(
>>>>>> AjaxFormSubmitBehavior.java:179)
>>>>>>       at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.
>>>>>> java:1266)
>>>>>>       at org.apache.wicket.markup.html.form.Form.process(Form.java:938)
>>>>>>       at org.apache.isis.viewer.wicket.ui.panels.FormAbstract.
>>>>>> process(FormAbstract.java:110)
>>>>>>       at org.apache.wicket.markup.html.form.Form.onFormSubmitted(
>>>>>> Form.java:770)
>>>>>>       at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(
>>>>>> AjaxFormSubmitBehavior.java:156)
>>>>>>       at org.apache.wicket.ajax.AjaxEventBehavior.respond(
>>>>>> AjaxEventBehavior.java:123)
>>>>>>       at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(
>>>>>> AbstractDefaultAjaxBehavior.java:633)
>>>>>>
>>>>>> the objectAdapter param for OneToOneAssociationImpl.set(
>>>>>> OneToOneAssociationImpl.java:163) is the editted entity and the new
>>>>>> value
>>>>>> is null. The underlying facet method is a getter method for a String
>>>>>> property of the entity that indeed is empty.
>>>>>>
>>>>>> Thanks,
>>>>>> Erik
>>>>>>
>>>>>>
>>>>


Re: error while updating entity using entity page

Posted by Jeroen van der Wal <je...@stromboli.it>.
You might want to try replace @Element(column = "role_id") with
@Column(name="role_id")

On Sun, Oct 19, 2014 at 8:56 PM, Erik de Hair <er...@pocos.nl> wrote:

> Some extra information I found out:
>
> The exception only occurs when the Contact has NO role assigned.
>
> Erik
>
> ________________________________________
> From: Dan Haywood [dan@haywood-associates.co.uk]
> Sent: Friday, October 17, 2014 5:48 PM
> To: users
> Subject: Re: error while updating entity using entity page
>
> I'd be happy to do a TeamViewer session with you remotely one evening or
> weekend to track down.  Contact me offline to arrange.
>
> In the meantime, when the exception occurs, can you tell (from the
> OneToOneAssociation) which property it is that's being processed?
>
> Cheers
> Dan
>
>
> On 17 October 2014 16:23, Erik de Hair <er...@pocos.nl> wrote:
>
> > Tried to isolate the entity in the todoapp with its only 2 relations but
> > that way I can't reproduce the problem...
> >
> >
> > On 10/17/2014 04:34 PM, Erik de Hair wrote:
> >
> >> Hi Dan,
> >>
> >> The Isis version is 1.6.0
> >>
> >> I can't provide a simple demo app without almost putting all our domain
> >> code and services on github. There are to much dependencies for that.
> The
> >> entity it's all about. Hope you can find something.
> >>
> >> @javax.jdo.annotations.PersistenceCapable(table = "contactpersonen",
> >> identityType = IdentityType.APPLICATION)
> >> @Bookmarkable
> >> public class Contact extends PortalAbstractDomainObject implements
> >> SecuredPerInstance, Comparable<Contact>
> >> {
> >>     private final static Logger LOG = LoggerFactory.getLogger(
> >> Contact.class);
> >>
> >>     private int id;
> >>     @Hidden
> >>     @PrimaryKey
> >>     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> >>     public int getId()
> >>     {
> >>         return id;
> >>     }
> >>
> >>     public void setId(int id)
> >>     {
> >>         this.id = id;
> >>     }
> >>
> >>     // ignored fields
> >>     // id int(11) PK AI -> see identity above
> >>
> >>     private int internalCompany = 1;
> >>
> >>     @Hidden
> >>     @Column(name = "bedrijf_id", allowsNull = "true")
> >>     public int getInternalCompany()
> >>     {
> >>         return internalCompany;
> >>     }
> >>
> >>     public void setInternalCompany(int internalCompany)
> >>     {
> >>         this.internalCompany = 1;
> >>     }
> >>
> >>     private String enumGender;
> >>
> >>     @Named("Geslacht")
> >>     @Column(name = "geslacht", allowsNull = "false", length = 9)
> >>     @Disabled
> >>     public String getEnumGender()
> >>     {
> >>         return enumGender;
> >>     }
> >>
> >>     public void setEnumGender(String enumGender)
> >>     {
> >>         this.enumGender = enumGender;
> >>     }
> >>
> >>     private String firstName;
> >>
> >>     @MaxLength(value = 50)
> >>     @Named("Voornaam")
> >>     @Column(name = "voornaam", allowsNull = "true")
> >>     public String getFirstName()
> >>     {
> >>         return firstName;
> >>     }
> >>
> >>     public void setFirstName(String firstName)
> >>     {
> >>         this.firstName = firstName;
> >>     }
> >>
> >>     /**
> >>      * Update complete name when updating first name
> >>      *
> >>      * @param firstName
> >>      */
> >>     public void modifyFirstName(String firstName)
> >>     {
> >>         setFirstName(firstName);
> >>         resetName();
> >>     }
> >>
> >>     private String namePrefix;
> >>
> >>     @MaxLength(value = 15)
> >>     @Named("Tussenvoegsel(s)")
> >>     @Column(name = "tussenvoegsels", allowsNull = "true")
> >>     public String getNamePrefix()
> >>     {
> >>         return namePrefix;
> >>     }
> >>
> >>     public void setNamePrefix(String namePrefix)
> >>     {
> >>         this.namePrefix = namePrefix;
> >>     }
> >>
> >>     /**
> >>      * Update complete name when updating name prefix
> >>      *
> >>      * @param namePrefix
> >>      */
> >>     public void modifyNamePrefix(String namePrefix)
> >>     {
> >>         setNamePrefix(namePrefix);
> >>         resetName();
> >>     }
> >>
> >>     private String lastName;
> >>
> >>     @MaxLength(value = 50)
> >>     @Named("Achternaam")
> >>     @Column(name = "achternaam", allowsNull = "true")
> >>     public String getLastName()
> >>     {
> >>         return lastName;
> >>     }
> >>
> >>     public void setLastName(String lastName)
> >>     {
> >>         this.lastName = lastName;
> >>     }
> >>
> >>     /**
> >>      * Update complete name when updating last name
> >>      *
> >>      * @param lastName
> >>      */
> >>     public void modifyLastName(String lastName)
> >>     {
> >>         setLastName(lastName);
> >>         resetName();
> >>     }
> >>
> >>     private String name;
> >>     @Title
> >>     @MaxLength(value = 100)
> >>     @Named("Naam")
> >>     @Column(name = "naam", allowsNull = "true")
> >>     public String getName()
> >>     {
> >>         return this.name;
> >>     }
> >>
> >>     public void setName(String name)
> >>     {
> >>         this.name = name;
> >>     }
> >>
> >>     private void resetName()
> >>     {
> >>         StringBuffer name = new StringBuffer();
> >>         if (this.getFirstName() != null &&
> !this.getFirstName().isEmpty()
> >> )
> >>         {
> >>             name.append(this.getFirstName());
> >>         }
> >>         if (this.getNamePrefix() != null &&
> !this.getNamePrefix().isEmpty(
> >> ))
> >>         {
> >>             if (name.length() > 0)
> >>             {
> >>                 name.append(" ");
> >>             }
> >>             name.append(this.getNamePrefix());
> >>         }
> >>         if (this.getLastName() != null && !this.getLastName().isEmpty())
> >>         {
> >>             if (name.length() > 0)
> >>             {
> >>                 name.append(" ");
> >>             }
> >>             name.append(getLastName());
> >>         }
> >>         setName(name.toString());
> >>     }
> >>
> >>     private String street;
> >>     @Column(name = "straat", allowsNull = "true")
> >>     @MaxLength(value = 255)
> >>     public String getStreet()
> >>     {
> >>         return street;
> >>     }
> >>
> >>     public void setStreet(String address)
> >>     {
> >>         this.street = address;
> >>     }
> >>
> >>     private String houseNumber;
> >>
> >>     @Column(name = "huisnummer", allowsNull = "true")
> >>     public String getHouseNumber()
> >>     {
> >>         return houseNumber;
> >>     }
> >>     public void setHouseNumber(String houseNumber)
> >>     {
> >>         this.houseNumber = houseNumber;
> >>     }
> >>
> >>     private String houseNumberExtension;
> >>
> >>     @Column(name = "huisnummertoevoeging", allowsNull = "true")
> >>     public String getHouseNumberExtension()
> >>     {
> >>         return houseNumberExtension;
> >>     }
> >>     public void setHouseNumberExtension(String houseNumberExtension)
> >>     {
> >>         this.houseNumberExtension = houseNumberExtension;
> >>     }
> >>
> >>
> >>     private String postalCode;
> >>
> >>     @MaxLength(value = 7)
> >>     @Named("Postcode")
> >>     @Column(name = "postcode", allowsNull = "true")
> >>     public String getPostalCode()
> >>     {
> >>         return postalCode;
> >>     }
> >>
> >>     public void setPostalCode(String postalCode)
> >>     {
> >>         this.postalCode = postalCode;
> >>     }
> >>
> >>     private String residence;
> >>
> >>     @MaxLength(value = 50)
> >>     @Named("Plaats")
> >>     @Column(name = "plaats", allowsNull = "true")
> >>     public String getResidence()
> >>     {
> >>         return residence;
> >>     }
> >>
> >>     public void setResidence(String residence)
> >>     {
> >>         this.residence = residence;
> >>     }
> >>
> >>     private String country;
> >>
> >>     @MaxLength(value = 50)
> >>     @Named("Land")
> >>     @Column(name = "land", allowsNull = "true")
> >>     public String getCountry()
> >>     {
> >>         return country;
> >>     }
> >>
> >>     public void setCountry(String country)
> >>     {
> >>         this.country = country;
> >>     }
> >>
> >>     private String locale;
> >>
> >>     @MaxLength(value = 10)
> >>     @Named("Locale")
> >>     @Column(name = "locale", allowsNull = "true")
> >>     public String getLocale()
> >>     {
> >>         return locale;
> >>     }
> >>
> >>     public void setLocale(String locale)
> >>     {
> >>         this.locale = locale;
> >>     }
> >>
> >>     private LocalDate birthday;
> >>
> >>     @Named("Geboortedatum")
> >>     @Column(name = "geb_datum", allowsNull = "true")
> >>     public LocalDate getBirthday()
> >>     {
> >>         return birthday;
> >>     }
> >>
> >>     public void setBirthday(LocalDate birthday)
> >>     {
> >>         this.birthday = birthday;
> >>     }
> >>
> >>     private String phone;
> >>
> >>     @MaxLength(value = 20)
> >>     @Named("Telefoon")
> >>     @Column(name = "tel_vast", allowsNull = "true")
> >>     public String getPhone()
> >>     {
> >>         return phone;
> >>     }
> >>
> >>     public void setPhone(String phone)
> >>     {
> >>         this.phone = phone;
> >>     }
> >>
> >>     private String phoneCompany;
> >>
> >>     @MaxLength(value = 20)
> >>     @Named("Telefoon zakelijk")
> >>     @Column(name = "tel_zaak", allowsNull = "true")
> >>     public String getPhoneCompany()
> >>     {
> >>         return phoneCompany;
> >>     }
> >>
> >>     public void setPhoneCompany(String phoneCompany)
> >>     {
> >>         this.phoneCompany = phoneCompany;
> >>     }
> >>
> >>     private String cellPhone;
> >>
> >>     @MaxLength(value = 20)
> >>     @Named("Mobiele telefoon")
> >>     @Column(name = "tel_mobiel", allowsNull = "true")
> >>     public String getCellPhone()
> >>     {
> >>         return cellPhone;
> >>     }
> >>
> >>     public void setCellPhone(String cellPhone)
> >>     {
> >>         this.cellPhone = cellPhone;
> >>     }
> >>
> >>     private String email;
> >>
> >>     @MaxLength(value = 100)
> >>     @Named("E-mail")
> >>     @Column(name = "email", allowsNull = "true")
> >>     @RegEx(validation = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$",
> >> caseSensitive = false)
> >>     public String getEmail()
> >>     {
> >>         return email;
> >>     }
> >>
> >>     public void setEmail(String email)
> >>     {
> >>         this.email = email;
> >>     }
> >>
> >>     private String occupation;
> >>
> >>     @MaxLength(value = 100)
> >>     @Named("Functie")
> >>     @Column(name = "functie", allowsNull = "true")
> >>     public String getOccupation()
> >>     {
> >>         return occupation;
> >>     }
> >>
> >>     public void setOccupation(String occupation)
> >>     {
> >>         this.occupation = occupation;
> >>     }
> >>
> >>     /**
> >>      * The company the contact represents (is the contact for)
> >>      */
> >>     private PortalCompany representedCompany;
> >>
> >>     @Named("Werkzaam voor")
> >>     @Column(name = "referentie", allowsNull = "true")
> >>     public PortalCompany getRepresentedCompany()
> >>     {
> >>         return representedCompany;
> >>     }
> >>
> >>     public void setRepresentedCompany(PortalCompany representedCompany)
> >>     {
> >>         this.representedCompany = representedCompany;
> >>     }
> >>
> >>     private String belongsTo = "klant";
> >>
> >>     @MaxLength(value = 20)
> >>     @Column(name = "hoort_bij", allowsNull = "true")
> >>     public String getBelongsTo()
> >>     {
> >>         return belongsTo;
> >>     }
> >>
> >>     public void setBelongsTo(String belongsTo)
> >>     {
> >>         this.belongsTo = belongsTo;
> >>     }
> >>
> >>     private boolean active;
> >>
> >>     @Named("Actief")
> >>     @Column(name = "actief", allowsNull = "false")
> >>     public boolean isActive()
> >>     {
> >>         return active;
> >>     }
> >>
> >>     public void setActive(boolean active)
> >>     {
> >>         this.active = active;
> >>     }
> >>
> >>     private String ripehandle;
> >>
> >>     @MaxLength(value = 255)
> >>     @Named("RIPE handle")
> >>     @Column
> >>     public String getRipehandle()
> >>     {
> >>         return ripehandle;
> >>     }
> >>
> >>     public void setRipehandle(String ripehandle)
> >>     {
> >>         this.ripehandle = ripehandle;
> >>     }
> >>
> >>     private String username;
> >>
> >>     @MemberOrder(name = "Gebruikersaccount", sequence = "2")
> >>     @Unique
> >>     @MaxLength(value = 45)
> >>     @Named("Gebruikersnaam")
> >>     @Column(name = "gebruikersnaam", allowsNull = "true")
> >>     @Disabled
> >>     public String getUsername()
> >>     {
> >>         return username;
> >>     }
> >>
> >>     public void setUsername(String username)
> >>     {
> >>         this.username = username;
> >>     }
> >>
> >>     private String password;
> >>
> >>     @Hidden(when = When.ALWAYS)
> >>     @Disabled
> >>     @MaxLength(value = 255)
> >>     @Column(name = "wachtwoord", allowsNull = "true")
> >>     public String getPassword()
> >>     {
> >>         return password;
> >>     }
> >>
> >>     /**
> >>      * @param password the password to set
> >>      */
> >>     public void setPassword(String password)
> >>     {
> >>         this.password = password;
> >>     }
> >>
> >>     /**
> >>      * Encrypt the password
> >>      *
> >>      * @param plaintextPassword
> >>      */
> >>     public void modifyPassword(String plaintextPassword)
> >>     {
> >>         DefaultPasswordService ps = new DefaultPasswordService();
> >>         setPassword(ps.encryptPassword(plaintextPassword));
> >>     }
> >>
> >>     /**
> >>      * The user's application roles
> >>      */
> >>     private SortedSet<Role> roles = new TreeSet<Role>();
> >>
> >>     @Hidden
> >>     @Persistent(table = "users_roles")
> >>     @Join(column = "user_id")
> >>     @Element(column = "role_id")
> >>     public SortedSet<Role> getRoles()
> >>     {
> >>         return roles;
> >>     }
> >>
> >>     public void setRoles(SortedSet<Role> roles)
> >>     {
> >>         this.roles = roles;
> >>     }
> >>
> >>     @MemberOrder(name = "Gebruikersaccount", sequence = "3")
> >>     @Named("Gebruikersrol")
> >>     @Optional
> >>     public String getRole()
> >>     {
> >>         return (this.getRoles().isEmpty() ? null :
> >> this.getRoles().first().getDescription());
> >>     }
> >>
> >>     private boolean isUser()
> >>     {
> >>         return this.getUsername() != null &&
> >> !this.getUsername().isEmpty();
> >>     }
> >>
> >>
> >>
> >>
> >> On 10/17/2014 02:37 PM, Dan Haywood wrote:
> >>
> >>> Can you post the domain code for this?
> >>>
> >>> And which version of Isis?
> >>>
> >>> Ideally... can you provide a simple demo app on github?
> >>>
> >>> Thx
> >>> Dan
> >>>
> >>>
> >>>
> >>> On 17 October 2014 11:19, Erik de Hair <er...@pocos.nl> wrote:
> >>>
> >>>  Hi,
> >>>>
> >>>> Does any body know why I'm getting the following exception when
> saving a
> >>>> modified entity by using its entity page
> >>>>
> >>>> Caused by: java.lang.NullPointerException
> >>>>      at org.apache.isis.core.metamodel.specloader.specimpl.
> >>>> OneToOneAssociationImpl.clearValue(OneToOneAssociationImpl.java:199)
> >>>>      at org.apache.isis.core.metamodel.specloader.specimpl.
> >>>> OneToOneAssociationImpl.set(OneToOneAssociationImpl.java:163)
> >>>>      at org.apache.isis.viewer.wicket.model.models.EntityModel.
> >>>> apply(EntityModel.java:594)
> >>>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
> >>>>
> EntityPropertiesForm.applyFormChangesElse(EntityPropertiesForm.java:505)
> >>>>
> >>>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
> >>>> EntityPropertiesForm.access$500(EntityPropertiesForm.java:75)
> >>>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
> >>>>
> EntityPropertiesForm$AjaxButtonForValidate.onSubmit(EntityPropertiesForm.
> >>>>
> >>>> java:333)
> >>>>      at org.apache.wicket.ajax.markup.html.form.AjaxButton$1.
> >>>> onSubmit(AjaxButton.java:108)
> >>>>      at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(
> >>>> AjaxFormSubmitBehavior.java:179)
> >>>>      at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.
> >>>> java:1266)
> >>>>      at org.apache.wicket.markup.html.form.Form.process(Form.java:938)
> >>>>      at org.apache.isis.viewer.wicket.ui.panels.FormAbstract.
> >>>> process(FormAbstract.java:110)
> >>>>      at org.apache.wicket.markup.html.form.Form.onFormSubmitted(
> >>>> Form.java:770)
> >>>>      at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(
> >>>> AjaxFormSubmitBehavior.java:156)
> >>>>      at org.apache.wicket.ajax.AjaxEventBehavior.respond(
> >>>> AjaxEventBehavior.java:123)
> >>>>      at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(
> >>>> AbstractDefaultAjaxBehavior.java:633)
> >>>>
> >>>> the objectAdapter param for OneToOneAssociationImpl.set(
> >>>> OneToOneAssociationImpl.java:163) is the editted entity and the new
> >>>> value
> >>>> is null. The underlying facet method is a getter method for a String
> >>>> property of the entity that indeed is empty.
> >>>>
> >>>> Thanks,
> >>>> Erik
> >>>>
> >>>>
> >>
> >>
> >
>

RE: error while updating entity using entity page

Posted by Erik de Hair <er...@pocos.nl>.
Some extra information I found out:

The exception only occurs when the Contact has NO role assigned.

Erik

________________________________________
From: Dan Haywood [dan@haywood-associates.co.uk]
Sent: Friday, October 17, 2014 5:48 PM
To: users
Subject: Re: error while updating entity using entity page

I'd be happy to do a TeamViewer session with you remotely one evening or
weekend to track down.  Contact me offline to arrange.

In the meantime, when the exception occurs, can you tell (from the
OneToOneAssociation) which property it is that's being processed?

Cheers
Dan


On 17 October 2014 16:23, Erik de Hair <er...@pocos.nl> wrote:

> Tried to isolate the entity in the todoapp with its only 2 relations but
> that way I can't reproduce the problem...
>
>
> On 10/17/2014 04:34 PM, Erik de Hair wrote:
>
>> Hi Dan,
>>
>> The Isis version is 1.6.0
>>
>> I can't provide a simple demo app without almost putting all our domain
>> code and services on github. There are to much dependencies for that. The
>> entity it's all about. Hope you can find something.
>>
>> @javax.jdo.annotations.PersistenceCapable(table = "contactpersonen",
>> identityType = IdentityType.APPLICATION)
>> @Bookmarkable
>> public class Contact extends PortalAbstractDomainObject implements
>> SecuredPerInstance, Comparable<Contact>
>> {
>>     private final static Logger LOG = LoggerFactory.getLogger(
>> Contact.class);
>>
>>     private int id;
>>     @Hidden
>>     @PrimaryKey
>>     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>>     public int getId()
>>     {
>>         return id;
>>     }
>>
>>     public void setId(int id)
>>     {
>>         this.id = id;
>>     }
>>
>>     // ignored fields
>>     // id int(11) PK AI -> see identity above
>>
>>     private int internalCompany = 1;
>>
>>     @Hidden
>>     @Column(name = "bedrijf_id", allowsNull = "true")
>>     public int getInternalCompany()
>>     {
>>         return internalCompany;
>>     }
>>
>>     public void setInternalCompany(int internalCompany)
>>     {
>>         this.internalCompany = 1;
>>     }
>>
>>     private String enumGender;
>>
>>     @Named("Geslacht")
>>     @Column(name = "geslacht", allowsNull = "false", length = 9)
>>     @Disabled
>>     public String getEnumGender()
>>     {
>>         return enumGender;
>>     }
>>
>>     public void setEnumGender(String enumGender)
>>     {
>>         this.enumGender = enumGender;
>>     }
>>
>>     private String firstName;
>>
>>     @MaxLength(value = 50)
>>     @Named("Voornaam")
>>     @Column(name = "voornaam", allowsNull = "true")
>>     public String getFirstName()
>>     {
>>         return firstName;
>>     }
>>
>>     public void setFirstName(String firstName)
>>     {
>>         this.firstName = firstName;
>>     }
>>
>>     /**
>>      * Update complete name when updating first name
>>      *
>>      * @param firstName
>>      */
>>     public void modifyFirstName(String firstName)
>>     {
>>         setFirstName(firstName);
>>         resetName();
>>     }
>>
>>     private String namePrefix;
>>
>>     @MaxLength(value = 15)
>>     @Named("Tussenvoegsel(s)")
>>     @Column(name = "tussenvoegsels", allowsNull = "true")
>>     public String getNamePrefix()
>>     {
>>         return namePrefix;
>>     }
>>
>>     public void setNamePrefix(String namePrefix)
>>     {
>>         this.namePrefix = namePrefix;
>>     }
>>
>>     /**
>>      * Update complete name when updating name prefix
>>      *
>>      * @param namePrefix
>>      */
>>     public void modifyNamePrefix(String namePrefix)
>>     {
>>         setNamePrefix(namePrefix);
>>         resetName();
>>     }
>>
>>     private String lastName;
>>
>>     @MaxLength(value = 50)
>>     @Named("Achternaam")
>>     @Column(name = "achternaam", allowsNull = "true")
>>     public String getLastName()
>>     {
>>         return lastName;
>>     }
>>
>>     public void setLastName(String lastName)
>>     {
>>         this.lastName = lastName;
>>     }
>>
>>     /**
>>      * Update complete name when updating last name
>>      *
>>      * @param lastName
>>      */
>>     public void modifyLastName(String lastName)
>>     {
>>         setLastName(lastName);
>>         resetName();
>>     }
>>
>>     private String name;
>>     @Title
>>     @MaxLength(value = 100)
>>     @Named("Naam")
>>     @Column(name = "naam", allowsNull = "true")
>>     public String getName()
>>     {
>>         return this.name;
>>     }
>>
>>     public void setName(String name)
>>     {
>>         this.name = name;
>>     }
>>
>>     private void resetName()
>>     {
>>         StringBuffer name = new StringBuffer();
>>         if (this.getFirstName() != null && !this.getFirstName().isEmpty()
>> )
>>         {
>>             name.append(this.getFirstName());
>>         }
>>         if (this.getNamePrefix() != null && !this.getNamePrefix().isEmpty(
>> ))
>>         {
>>             if (name.length() > 0)
>>             {
>>                 name.append(" ");
>>             }
>>             name.append(this.getNamePrefix());
>>         }
>>         if (this.getLastName() != null && !this.getLastName().isEmpty())
>>         {
>>             if (name.length() > 0)
>>             {
>>                 name.append(" ");
>>             }
>>             name.append(getLastName());
>>         }
>>         setName(name.toString());
>>     }
>>
>>     private String street;
>>     @Column(name = "straat", allowsNull = "true")
>>     @MaxLength(value = 255)
>>     public String getStreet()
>>     {
>>         return street;
>>     }
>>
>>     public void setStreet(String address)
>>     {
>>         this.street = address;
>>     }
>>
>>     private String houseNumber;
>>
>>     @Column(name = "huisnummer", allowsNull = "true")
>>     public String getHouseNumber()
>>     {
>>         return houseNumber;
>>     }
>>     public void setHouseNumber(String houseNumber)
>>     {
>>         this.houseNumber = houseNumber;
>>     }
>>
>>     private String houseNumberExtension;
>>
>>     @Column(name = "huisnummertoevoeging", allowsNull = "true")
>>     public String getHouseNumberExtension()
>>     {
>>         return houseNumberExtension;
>>     }
>>     public void setHouseNumberExtension(String houseNumberExtension)
>>     {
>>         this.houseNumberExtension = houseNumberExtension;
>>     }
>>
>>
>>     private String postalCode;
>>
>>     @MaxLength(value = 7)
>>     @Named("Postcode")
>>     @Column(name = "postcode", allowsNull = "true")
>>     public String getPostalCode()
>>     {
>>         return postalCode;
>>     }
>>
>>     public void setPostalCode(String postalCode)
>>     {
>>         this.postalCode = postalCode;
>>     }
>>
>>     private String residence;
>>
>>     @MaxLength(value = 50)
>>     @Named("Plaats")
>>     @Column(name = "plaats", allowsNull = "true")
>>     public String getResidence()
>>     {
>>         return residence;
>>     }
>>
>>     public void setResidence(String residence)
>>     {
>>         this.residence = residence;
>>     }
>>
>>     private String country;
>>
>>     @MaxLength(value = 50)
>>     @Named("Land")
>>     @Column(name = "land", allowsNull = "true")
>>     public String getCountry()
>>     {
>>         return country;
>>     }
>>
>>     public void setCountry(String country)
>>     {
>>         this.country = country;
>>     }
>>
>>     private String locale;
>>
>>     @MaxLength(value = 10)
>>     @Named("Locale")
>>     @Column(name = "locale", allowsNull = "true")
>>     public String getLocale()
>>     {
>>         return locale;
>>     }
>>
>>     public void setLocale(String locale)
>>     {
>>         this.locale = locale;
>>     }
>>
>>     private LocalDate birthday;
>>
>>     @Named("Geboortedatum")
>>     @Column(name = "geb_datum", allowsNull = "true")
>>     public LocalDate getBirthday()
>>     {
>>         return birthday;
>>     }
>>
>>     public void setBirthday(LocalDate birthday)
>>     {
>>         this.birthday = birthday;
>>     }
>>
>>     private String phone;
>>
>>     @MaxLength(value = 20)
>>     @Named("Telefoon")
>>     @Column(name = "tel_vast", allowsNull = "true")
>>     public String getPhone()
>>     {
>>         return phone;
>>     }
>>
>>     public void setPhone(String phone)
>>     {
>>         this.phone = phone;
>>     }
>>
>>     private String phoneCompany;
>>
>>     @MaxLength(value = 20)
>>     @Named("Telefoon zakelijk")
>>     @Column(name = "tel_zaak", allowsNull = "true")
>>     public String getPhoneCompany()
>>     {
>>         return phoneCompany;
>>     }
>>
>>     public void setPhoneCompany(String phoneCompany)
>>     {
>>         this.phoneCompany = phoneCompany;
>>     }
>>
>>     private String cellPhone;
>>
>>     @MaxLength(value = 20)
>>     @Named("Mobiele telefoon")
>>     @Column(name = "tel_mobiel", allowsNull = "true")
>>     public String getCellPhone()
>>     {
>>         return cellPhone;
>>     }
>>
>>     public void setCellPhone(String cellPhone)
>>     {
>>         this.cellPhone = cellPhone;
>>     }
>>
>>     private String email;
>>
>>     @MaxLength(value = 100)
>>     @Named("E-mail")
>>     @Column(name = "email", allowsNull = "true")
>>     @RegEx(validation = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$",
>> caseSensitive = false)
>>     public String getEmail()
>>     {
>>         return email;
>>     }
>>
>>     public void setEmail(String email)
>>     {
>>         this.email = email;
>>     }
>>
>>     private String occupation;
>>
>>     @MaxLength(value = 100)
>>     @Named("Functie")
>>     @Column(name = "functie", allowsNull = "true")
>>     public String getOccupation()
>>     {
>>         return occupation;
>>     }
>>
>>     public void setOccupation(String occupation)
>>     {
>>         this.occupation = occupation;
>>     }
>>
>>     /**
>>      * The company the contact represents (is the contact for)
>>      */
>>     private PortalCompany representedCompany;
>>
>>     @Named("Werkzaam voor")
>>     @Column(name = "referentie", allowsNull = "true")
>>     public PortalCompany getRepresentedCompany()
>>     {
>>         return representedCompany;
>>     }
>>
>>     public void setRepresentedCompany(PortalCompany representedCompany)
>>     {
>>         this.representedCompany = representedCompany;
>>     }
>>
>>     private String belongsTo = "klant";
>>
>>     @MaxLength(value = 20)
>>     @Column(name = "hoort_bij", allowsNull = "true")
>>     public String getBelongsTo()
>>     {
>>         return belongsTo;
>>     }
>>
>>     public void setBelongsTo(String belongsTo)
>>     {
>>         this.belongsTo = belongsTo;
>>     }
>>
>>     private boolean active;
>>
>>     @Named("Actief")
>>     @Column(name = "actief", allowsNull = "false")
>>     public boolean isActive()
>>     {
>>         return active;
>>     }
>>
>>     public void setActive(boolean active)
>>     {
>>         this.active = active;
>>     }
>>
>>     private String ripehandle;
>>
>>     @MaxLength(value = 255)
>>     @Named("RIPE handle")
>>     @Column
>>     public String getRipehandle()
>>     {
>>         return ripehandle;
>>     }
>>
>>     public void setRipehandle(String ripehandle)
>>     {
>>         this.ripehandle = ripehandle;
>>     }
>>
>>     private String username;
>>
>>     @MemberOrder(name = "Gebruikersaccount", sequence = "2")
>>     @Unique
>>     @MaxLength(value = 45)
>>     @Named("Gebruikersnaam")
>>     @Column(name = "gebruikersnaam", allowsNull = "true")
>>     @Disabled
>>     public String getUsername()
>>     {
>>         return username;
>>     }
>>
>>     public void setUsername(String username)
>>     {
>>         this.username = username;
>>     }
>>
>>     private String password;
>>
>>     @Hidden(when = When.ALWAYS)
>>     @Disabled
>>     @MaxLength(value = 255)
>>     @Column(name = "wachtwoord", allowsNull = "true")
>>     public String getPassword()
>>     {
>>         return password;
>>     }
>>
>>     /**
>>      * @param password the password to set
>>      */
>>     public void setPassword(String password)
>>     {
>>         this.password = password;
>>     }
>>
>>     /**
>>      * Encrypt the password
>>      *
>>      * @param plaintextPassword
>>      */
>>     public void modifyPassword(String plaintextPassword)
>>     {
>>         DefaultPasswordService ps = new DefaultPasswordService();
>>         setPassword(ps.encryptPassword(plaintextPassword));
>>     }
>>
>>     /**
>>      * The user's application roles
>>      */
>>     private SortedSet<Role> roles = new TreeSet<Role>();
>>
>>     @Hidden
>>     @Persistent(table = "users_roles")
>>     @Join(column = "user_id")
>>     @Element(column = "role_id")
>>     public SortedSet<Role> getRoles()
>>     {
>>         return roles;
>>     }
>>
>>     public void setRoles(SortedSet<Role> roles)
>>     {
>>         this.roles = roles;
>>     }
>>
>>     @MemberOrder(name = "Gebruikersaccount", sequence = "3")
>>     @Named("Gebruikersrol")
>>     @Optional
>>     public String getRole()
>>     {
>>         return (this.getRoles().isEmpty() ? null :
>> this.getRoles().first().getDescription());
>>     }
>>
>>     private boolean isUser()
>>     {
>>         return this.getUsername() != null &&
>> !this.getUsername().isEmpty();
>>     }
>>
>>
>>
>>
>> On 10/17/2014 02:37 PM, Dan Haywood wrote:
>>
>>> Can you post the domain code for this?
>>>
>>> And which version of Isis?
>>>
>>> Ideally... can you provide a simple demo app on github?
>>>
>>> Thx
>>> Dan
>>>
>>>
>>>
>>> On 17 October 2014 11:19, Erik de Hair <er...@pocos.nl> wrote:
>>>
>>>  Hi,
>>>>
>>>> Does any body know why I'm getting the following exception when saving a
>>>> modified entity by using its entity page
>>>>
>>>> Caused by: java.lang.NullPointerException
>>>>      at org.apache.isis.core.metamodel.specloader.specimpl.
>>>> OneToOneAssociationImpl.clearValue(OneToOneAssociationImpl.java:199)
>>>>      at org.apache.isis.core.metamodel.specloader.specimpl.
>>>> OneToOneAssociationImpl.set(OneToOneAssociationImpl.java:163)
>>>>      at org.apache.isis.viewer.wicket.model.models.EntityModel.
>>>> apply(EntityModel.java:594)
>>>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>>>> EntityPropertiesForm.applyFormChangesElse(EntityPropertiesForm.java:505)
>>>>
>>>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>>>> EntityPropertiesForm.access$500(EntityPropertiesForm.java:75)
>>>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>>>> EntityPropertiesForm$AjaxButtonForValidate.onSubmit(EntityPropertiesForm.
>>>>
>>>> java:333)
>>>>      at org.apache.wicket.ajax.markup.html.form.AjaxButton$1.
>>>> onSubmit(AjaxButton.java:108)
>>>>      at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(
>>>> AjaxFormSubmitBehavior.java:179)
>>>>      at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.
>>>> java:1266)
>>>>      at org.apache.wicket.markup.html.form.Form.process(Form.java:938)
>>>>      at org.apache.isis.viewer.wicket.ui.panels.FormAbstract.
>>>> process(FormAbstract.java:110)
>>>>      at org.apache.wicket.markup.html.form.Form.onFormSubmitted(
>>>> Form.java:770)
>>>>      at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(
>>>> AjaxFormSubmitBehavior.java:156)
>>>>      at org.apache.wicket.ajax.AjaxEventBehavior.respond(
>>>> AjaxEventBehavior.java:123)
>>>>      at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(
>>>> AbstractDefaultAjaxBehavior.java:633)
>>>>
>>>> the objectAdapter param for OneToOneAssociationImpl.set(
>>>> OneToOneAssociationImpl.java:163) is the editted entity and the new
>>>> value
>>>> is null. The underlying facet method is a getter method for a String
>>>> property of the entity that indeed is empty.
>>>>
>>>> Thanks,
>>>> Erik
>>>>
>>>>
>>
>>
>

Re: @Value and JDO

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Yeah, that's the one.

It's also necessary to add a few more JDO annotations in the dom... the
todoapp example shows how.

Cheers
Dan

On 19 October 2014 17:41, Kevin Meyer <ke...@kmz.co.za> wrote:

> >
> >> - (optionally, but recommended), you need to implement the appropriate
> >> JDO
> >> API so that the value type is persisted in some meaningful fashion,
> >> rather than just a byte[] or blob.
> >
> > Right, so if I want to encode it as 2 fields in the underlying table, to
> > aid queries, for example.
> >
> >> The latter involves implementing an SPI and registering in
> >> META-INF/MANIFEST; have a look at how this is done for
> >> org.apache.isis.applib.annotations.Clob, for example.
> >
> > Umm... I can't find such a class definition in Eclipse.
>
> I did find:
> org.apache.isis.objectstore.jdo.datanucleus.valuetypes.IsisClobMapping
> with nearby plugin.xml
>
> Anyway, I can put that off for the moment.
>
> Thanks,
> Kevin
>
>

Re: @Value and JDO

Posted by Kevin Meyer <ke...@kmz.co.za>.
>
>> - (optionally, but recommended), you need to implement the appropriate
>> JDO
>> API so that the value type is persisted in some meaningful fashion,
>> rather than just a byte[] or blob.
>
> Right, so if I want to encode it as 2 fields in the underlying table, to
> aid queries, for example.
>
>> The latter involves implementing an SPI and registering in
>> META-INF/MANIFEST; have a look at how this is done for
>> org.apache.isis.applib.annotations.Clob, for example.
>
> Umm... I can't find such a class definition in Eclipse.

I did find:
org.apache.isis.objectstore.jdo.datanucleus.valuetypes.IsisClobMapping
with nearby plugin.xml

Anyway, I can put that off for the moment.

Thanks,
Kevin


Re: @Value and JDO

Posted by Kevin Meyer <ke...@kmz.co.za>.
On Sun, October 19, 2014 18:00, Dan Haywood wrote:
> Hi Kevin,
>
>
> Two things:
> - you need to annotate the field as @javax.jdo.annotations.Persistent

Great! Thanks, that get's it loaded as a BLOB. Good start..

> - (optionally, but recommended), you need to implement the appropriate JDO
>  API so that the value type is persisted in some meaningful fashion,
> rather than just a byte[] or blob.

Right, so if I want to encode it as 2 fields in the underlying table, to
aid queries, for example.

> The latter involves implementing an SPI and registering in
> META-INF/MANIFEST; have a look at how this is done for
> org.apache.isis.applib.annotations.Clob, for example.

Umm... I can't find such a class definition in Eclipse.

Thanks for the quick help!

Regards,
Kevin


Re: @Value and JDO

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Kevin,

Two things:
- you need to annotate the field as @javax.jdo.annotations.Persistent
- (optionally, but recommended), you need to implement the appropriate JDO
API so that the value type is persisted in some meaningful fashion, rather
than just a byte[] or blob.

The latter involves implementing an SPI and registering in
META-INF/MANIFEST; have a look at how this is done for
org.apache.isis.applib.annotations.Clob, for example.

I can dig out some further references if the above is too vague.

Cheers
Dan



On 19 October 2014 16:57, Kevin Meyer <ke...@kmz.co.za> wrote:

> Hi guys,
>
> I'm trying to define a custom value type, Location, similar to the gmap
> example, but working only with integer values (to specify a position on a
> floor plan), but I'm having issues getting the resulting value to work
> with JDO.
>
> I have:
> {code}
> @Value(semanticsProviderClass = BlueprintLocationSemanticsProvider.class)
> public class BlueprintLocation implements Serializable {
> {code}
> with just two fields: and X and a Y..
>
> where
> {code}
> public class BlueprintLocationSemanticsProvider implements
> ValueSemanticsProvider<BlueprintLocation> {
> {code}
>
> But the JDO introspection does not pick up the property:
> On my SimpleObject:
>
> {code}
>         private BlueprintLocation blueprintLocation;
>         @javax.jdo.annotations.Column(allowsNull="true")
>         public BlueprintLocation getLocation() {
>                 return blueprintLocation;
>         }
>         public void setLocation(BlueprintLocation location) {
>                 this.blueprintLocation = location;
>         }
>
> {code}
>
> In the log:
>
> 17:52:38,921  [Schema               main       DEBUG]  CREATE TABLE
> "SimpleObject"
> (
>     "id" BIGINT GENERATED BY DEFAULT AS IDENTITY,
>     "blueprint_id_OID" BIGINT NULL,
>     "name" NVARCHAR(255) NOT NULL,
>     "plan_id_OID" BIGINT NULL,
>     "attachment_name" NVARCHAR(255) NULL,
>     "attachment_mimetype" NVARCHAR(255) NULL,
>     "attachment_chars" CLOB NULL,
>     "version" BIGINT NOT NULL,
>     "friends_id_OID" BIGINT NULL,
>     "friends_INTEGER_IDX" INTEGER NULL,
>     CONSTRAINT "SimpleObject_PK" PRIMARY KEY ("id")
> )
>
> If I annotate BlueprintLocation with @PersistenceCapable, JDO treats it as
> an entity. Using @PersistenceAware has no effect.
>
> What am I missing?
>
> (Does the ToDo app show an example ValueType?  I have not checked...)
>
> Thanks,
> Kevin
>
>

@Value and JDO

Posted by Kevin Meyer <ke...@kmz.co.za>.
Hi guys,

I'm trying to define a custom value type, Location, similar to the gmap
example, but working only with integer values (to specify a position on a
floor plan), but I'm having issues getting the resulting value to work
with JDO.

I have:
{code}
@Value(semanticsProviderClass = BlueprintLocationSemanticsProvider.class)
public class BlueprintLocation implements Serializable {
{code}
with just two fields: and X and a Y..

where
{code}
public class BlueprintLocationSemanticsProvider implements
ValueSemanticsProvider<BlueprintLocation> {
{code}

But the JDO introspection does not pick up the property:
On my SimpleObject:

{code}
	private BlueprintLocation blueprintLocation;
	@javax.jdo.annotations.Column(allowsNull="true")
	public BlueprintLocation getLocation() {
		return blueprintLocation;
	}
	public void setLocation(BlueprintLocation location) {
		this.blueprintLocation = location;
	}

{code}

In the log:

17:52:38,921  [Schema               main       DEBUG]  CREATE TABLE
"SimpleObject"
(
    "id" BIGINT GENERATED BY DEFAULT AS IDENTITY,
    "blueprint_id_OID" BIGINT NULL,
    "name" NVARCHAR(255) NOT NULL,
    "plan_id_OID" BIGINT NULL,
    "attachment_name" NVARCHAR(255) NULL,
    "attachment_mimetype" NVARCHAR(255) NULL,
    "attachment_chars" CLOB NULL,
    "version" BIGINT NOT NULL,
    "friends_id_OID" BIGINT NULL,
    "friends_INTEGER_IDX" INTEGER NULL,
    CONSTRAINT "SimpleObject_PK" PRIMARY KEY ("id")
)

If I annotate BlueprintLocation with @PersistenceCapable, JDO treats it as
an entity. Using @PersistenceAware has no effect.

What am I missing?

(Does the ToDo app show an example ValueType?  I have not checked...)

Thanks,
Kevin


Re: error while updating entity using entity page

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
I'd be happy to do a TeamViewer session with you remotely one evening or
weekend to track down.  Contact me offline to arrange.

In the meantime, when the exception occurs, can you tell (from the
OneToOneAssociation) which property it is that's being processed?

Cheers
Dan


On 17 October 2014 16:23, Erik de Hair <er...@pocos.nl> wrote:

> Tried to isolate the entity in the todoapp with its only 2 relations but
> that way I can't reproduce the problem...
>
>
> On 10/17/2014 04:34 PM, Erik de Hair wrote:
>
>> Hi Dan,
>>
>> The Isis version is 1.6.0
>>
>> I can't provide a simple demo app without almost putting all our domain
>> code and services on github. There are to much dependencies for that. The
>> entity it's all about. Hope you can find something.
>>
>> @javax.jdo.annotations.PersistenceCapable(table = "contactpersonen",
>> identityType = IdentityType.APPLICATION)
>> @Bookmarkable
>> public class Contact extends PortalAbstractDomainObject implements
>> SecuredPerInstance, Comparable<Contact>
>> {
>>     private final static Logger LOG = LoggerFactory.getLogger(
>> Contact.class);
>>
>>     private int id;
>>     @Hidden
>>     @PrimaryKey
>>     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>>     public int getId()
>>     {
>>         return id;
>>     }
>>
>>     public void setId(int id)
>>     {
>>         this.id = id;
>>     }
>>
>>     // ignored fields
>>     // id int(11) PK AI -> see identity above
>>
>>     private int internalCompany = 1;
>>
>>     @Hidden
>>     @Column(name = "bedrijf_id", allowsNull = "true")
>>     public int getInternalCompany()
>>     {
>>         return internalCompany;
>>     }
>>
>>     public void setInternalCompany(int internalCompany)
>>     {
>>         this.internalCompany = 1;
>>     }
>>
>>     private String enumGender;
>>
>>     @Named("Geslacht")
>>     @Column(name = "geslacht", allowsNull = "false", length = 9)
>>     @Disabled
>>     public String getEnumGender()
>>     {
>>         return enumGender;
>>     }
>>
>>     public void setEnumGender(String enumGender)
>>     {
>>         this.enumGender = enumGender;
>>     }
>>
>>     private String firstName;
>>
>>     @MaxLength(value = 50)
>>     @Named("Voornaam")
>>     @Column(name = "voornaam", allowsNull = "true")
>>     public String getFirstName()
>>     {
>>         return firstName;
>>     }
>>
>>     public void setFirstName(String firstName)
>>     {
>>         this.firstName = firstName;
>>     }
>>
>>     /**
>>      * Update complete name when updating first name
>>      *
>>      * @param firstName
>>      */
>>     public void modifyFirstName(String firstName)
>>     {
>>         setFirstName(firstName);
>>         resetName();
>>     }
>>
>>     private String namePrefix;
>>
>>     @MaxLength(value = 15)
>>     @Named("Tussenvoegsel(s)")
>>     @Column(name = "tussenvoegsels", allowsNull = "true")
>>     public String getNamePrefix()
>>     {
>>         return namePrefix;
>>     }
>>
>>     public void setNamePrefix(String namePrefix)
>>     {
>>         this.namePrefix = namePrefix;
>>     }
>>
>>     /**
>>      * Update complete name when updating name prefix
>>      *
>>      * @param namePrefix
>>      */
>>     public void modifyNamePrefix(String namePrefix)
>>     {
>>         setNamePrefix(namePrefix);
>>         resetName();
>>     }
>>
>>     private String lastName;
>>
>>     @MaxLength(value = 50)
>>     @Named("Achternaam")
>>     @Column(name = "achternaam", allowsNull = "true")
>>     public String getLastName()
>>     {
>>         return lastName;
>>     }
>>
>>     public void setLastName(String lastName)
>>     {
>>         this.lastName = lastName;
>>     }
>>
>>     /**
>>      * Update complete name when updating last name
>>      *
>>      * @param lastName
>>      */
>>     public void modifyLastName(String lastName)
>>     {
>>         setLastName(lastName);
>>         resetName();
>>     }
>>
>>     private String name;
>>     @Title
>>     @MaxLength(value = 100)
>>     @Named("Naam")
>>     @Column(name = "naam", allowsNull = "true")
>>     public String getName()
>>     {
>>         return this.name;
>>     }
>>
>>     public void setName(String name)
>>     {
>>         this.name = name;
>>     }
>>
>>     private void resetName()
>>     {
>>         StringBuffer name = new StringBuffer();
>>         if (this.getFirstName() != null && !this.getFirstName().isEmpty()
>> )
>>         {
>>             name.append(this.getFirstName());
>>         }
>>         if (this.getNamePrefix() != null && !this.getNamePrefix().isEmpty(
>> ))
>>         {
>>             if (name.length() > 0)
>>             {
>>                 name.append(" ");
>>             }
>>             name.append(this.getNamePrefix());
>>         }
>>         if (this.getLastName() != null && !this.getLastName().isEmpty())
>>         {
>>             if (name.length() > 0)
>>             {
>>                 name.append(" ");
>>             }
>>             name.append(getLastName());
>>         }
>>         setName(name.toString());
>>     }
>>
>>     private String street;
>>     @Column(name = "straat", allowsNull = "true")
>>     @MaxLength(value = 255)
>>     public String getStreet()
>>     {
>>         return street;
>>     }
>>
>>     public void setStreet(String address)
>>     {
>>         this.street = address;
>>     }
>>
>>     private String houseNumber;
>>
>>     @Column(name = "huisnummer", allowsNull = "true")
>>     public String getHouseNumber()
>>     {
>>         return houseNumber;
>>     }
>>     public void setHouseNumber(String houseNumber)
>>     {
>>         this.houseNumber = houseNumber;
>>     }
>>
>>     private String houseNumberExtension;
>>
>>     @Column(name = "huisnummertoevoeging", allowsNull = "true")
>>     public String getHouseNumberExtension()
>>     {
>>         return houseNumberExtension;
>>     }
>>     public void setHouseNumberExtension(String houseNumberExtension)
>>     {
>>         this.houseNumberExtension = houseNumberExtension;
>>     }
>>
>>
>>     private String postalCode;
>>
>>     @MaxLength(value = 7)
>>     @Named("Postcode")
>>     @Column(name = "postcode", allowsNull = "true")
>>     public String getPostalCode()
>>     {
>>         return postalCode;
>>     }
>>
>>     public void setPostalCode(String postalCode)
>>     {
>>         this.postalCode = postalCode;
>>     }
>>
>>     private String residence;
>>
>>     @MaxLength(value = 50)
>>     @Named("Plaats")
>>     @Column(name = "plaats", allowsNull = "true")
>>     public String getResidence()
>>     {
>>         return residence;
>>     }
>>
>>     public void setResidence(String residence)
>>     {
>>         this.residence = residence;
>>     }
>>
>>     private String country;
>>
>>     @MaxLength(value = 50)
>>     @Named("Land")
>>     @Column(name = "land", allowsNull = "true")
>>     public String getCountry()
>>     {
>>         return country;
>>     }
>>
>>     public void setCountry(String country)
>>     {
>>         this.country = country;
>>     }
>>
>>     private String locale;
>>
>>     @MaxLength(value = 10)
>>     @Named("Locale")
>>     @Column(name = "locale", allowsNull = "true")
>>     public String getLocale()
>>     {
>>         return locale;
>>     }
>>
>>     public void setLocale(String locale)
>>     {
>>         this.locale = locale;
>>     }
>>
>>     private LocalDate birthday;
>>
>>     @Named("Geboortedatum")
>>     @Column(name = "geb_datum", allowsNull = "true")
>>     public LocalDate getBirthday()
>>     {
>>         return birthday;
>>     }
>>
>>     public void setBirthday(LocalDate birthday)
>>     {
>>         this.birthday = birthday;
>>     }
>>
>>     private String phone;
>>
>>     @MaxLength(value = 20)
>>     @Named("Telefoon")
>>     @Column(name = "tel_vast", allowsNull = "true")
>>     public String getPhone()
>>     {
>>         return phone;
>>     }
>>
>>     public void setPhone(String phone)
>>     {
>>         this.phone = phone;
>>     }
>>
>>     private String phoneCompany;
>>
>>     @MaxLength(value = 20)
>>     @Named("Telefoon zakelijk")
>>     @Column(name = "tel_zaak", allowsNull = "true")
>>     public String getPhoneCompany()
>>     {
>>         return phoneCompany;
>>     }
>>
>>     public void setPhoneCompany(String phoneCompany)
>>     {
>>         this.phoneCompany = phoneCompany;
>>     }
>>
>>     private String cellPhone;
>>
>>     @MaxLength(value = 20)
>>     @Named("Mobiele telefoon")
>>     @Column(name = "tel_mobiel", allowsNull = "true")
>>     public String getCellPhone()
>>     {
>>         return cellPhone;
>>     }
>>
>>     public void setCellPhone(String cellPhone)
>>     {
>>         this.cellPhone = cellPhone;
>>     }
>>
>>     private String email;
>>
>>     @MaxLength(value = 100)
>>     @Named("E-mail")
>>     @Column(name = "email", allowsNull = "true")
>>     @RegEx(validation = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$",
>> caseSensitive = false)
>>     public String getEmail()
>>     {
>>         return email;
>>     }
>>
>>     public void setEmail(String email)
>>     {
>>         this.email = email;
>>     }
>>
>>     private String occupation;
>>
>>     @MaxLength(value = 100)
>>     @Named("Functie")
>>     @Column(name = "functie", allowsNull = "true")
>>     public String getOccupation()
>>     {
>>         return occupation;
>>     }
>>
>>     public void setOccupation(String occupation)
>>     {
>>         this.occupation = occupation;
>>     }
>>
>>     /**
>>      * The company the contact represents (is the contact for)
>>      */
>>     private PortalCompany representedCompany;
>>
>>     @Named("Werkzaam voor")
>>     @Column(name = "referentie", allowsNull = "true")
>>     public PortalCompany getRepresentedCompany()
>>     {
>>         return representedCompany;
>>     }
>>
>>     public void setRepresentedCompany(PortalCompany representedCompany)
>>     {
>>         this.representedCompany = representedCompany;
>>     }
>>
>>     private String belongsTo = "klant";
>>
>>     @MaxLength(value = 20)
>>     @Column(name = "hoort_bij", allowsNull = "true")
>>     public String getBelongsTo()
>>     {
>>         return belongsTo;
>>     }
>>
>>     public void setBelongsTo(String belongsTo)
>>     {
>>         this.belongsTo = belongsTo;
>>     }
>>
>>     private boolean active;
>>
>>     @Named("Actief")
>>     @Column(name = "actief", allowsNull = "false")
>>     public boolean isActive()
>>     {
>>         return active;
>>     }
>>
>>     public void setActive(boolean active)
>>     {
>>         this.active = active;
>>     }
>>
>>     private String ripehandle;
>>
>>     @MaxLength(value = 255)
>>     @Named("RIPE handle")
>>     @Column
>>     public String getRipehandle()
>>     {
>>         return ripehandle;
>>     }
>>
>>     public void setRipehandle(String ripehandle)
>>     {
>>         this.ripehandle = ripehandle;
>>     }
>>
>>     private String username;
>>
>>     @MemberOrder(name = "Gebruikersaccount", sequence = "2")
>>     @Unique
>>     @MaxLength(value = 45)
>>     @Named("Gebruikersnaam")
>>     @Column(name = "gebruikersnaam", allowsNull = "true")
>>     @Disabled
>>     public String getUsername()
>>     {
>>         return username;
>>     }
>>
>>     public void setUsername(String username)
>>     {
>>         this.username = username;
>>     }
>>
>>     private String password;
>>
>>     @Hidden(when = When.ALWAYS)
>>     @Disabled
>>     @MaxLength(value = 255)
>>     @Column(name = "wachtwoord", allowsNull = "true")
>>     public String getPassword()
>>     {
>>         return password;
>>     }
>>
>>     /**
>>      * @param password the password to set
>>      */
>>     public void setPassword(String password)
>>     {
>>         this.password = password;
>>     }
>>
>>     /**
>>      * Encrypt the password
>>      *
>>      * @param plaintextPassword
>>      */
>>     public void modifyPassword(String plaintextPassword)
>>     {
>>         DefaultPasswordService ps = new DefaultPasswordService();
>>         setPassword(ps.encryptPassword(plaintextPassword));
>>     }
>>
>>     /**
>>      * The user's application roles
>>      */
>>     private SortedSet<Role> roles = new TreeSet<Role>();
>>
>>     @Hidden
>>     @Persistent(table = "users_roles")
>>     @Join(column = "user_id")
>>     @Element(column = "role_id")
>>     public SortedSet<Role> getRoles()
>>     {
>>         return roles;
>>     }
>>
>>     public void setRoles(SortedSet<Role> roles)
>>     {
>>         this.roles = roles;
>>     }
>>
>>     @MemberOrder(name = "Gebruikersaccount", sequence = "3")
>>     @Named("Gebruikersrol")
>>     @Optional
>>     public String getRole()
>>     {
>>         return (this.getRoles().isEmpty() ? null :
>> this.getRoles().first().getDescription());
>>     }
>>
>>     private boolean isUser()
>>     {
>>         return this.getUsername() != null &&
>> !this.getUsername().isEmpty();
>>     }
>>
>>
>>
>>
>> On 10/17/2014 02:37 PM, Dan Haywood wrote:
>>
>>> Can you post the domain code for this?
>>>
>>> And which version of Isis?
>>>
>>> Ideally... can you provide a simple demo app on github?
>>>
>>> Thx
>>> Dan
>>>
>>>
>>>
>>> On 17 October 2014 11:19, Erik de Hair <er...@pocos.nl> wrote:
>>>
>>>  Hi,
>>>>
>>>> Does any body know why I'm getting the following exception when saving a
>>>> modified entity by using its entity page
>>>>
>>>> Caused by: java.lang.NullPointerException
>>>>      at org.apache.isis.core.metamodel.specloader.specimpl.
>>>> OneToOneAssociationImpl.clearValue(OneToOneAssociationImpl.java:199)
>>>>      at org.apache.isis.core.metamodel.specloader.specimpl.
>>>> OneToOneAssociationImpl.set(OneToOneAssociationImpl.java:163)
>>>>      at org.apache.isis.viewer.wicket.model.models.EntityModel.
>>>> apply(EntityModel.java:594)
>>>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>>>> EntityPropertiesForm.applyFormChangesElse(EntityPropertiesForm.java:505)
>>>>
>>>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>>>> EntityPropertiesForm.access$500(EntityPropertiesForm.java:75)
>>>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>>>> EntityPropertiesForm$AjaxButtonForValidate.onSubmit(EntityPropertiesForm.
>>>>
>>>> java:333)
>>>>      at org.apache.wicket.ajax.markup.html.form.AjaxButton$1.
>>>> onSubmit(AjaxButton.java:108)
>>>>      at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(
>>>> AjaxFormSubmitBehavior.java:179)
>>>>      at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.
>>>> java:1266)
>>>>      at org.apache.wicket.markup.html.form.Form.process(Form.java:938)
>>>>      at org.apache.isis.viewer.wicket.ui.panels.FormAbstract.
>>>> process(FormAbstract.java:110)
>>>>      at org.apache.wicket.markup.html.form.Form.onFormSubmitted(
>>>> Form.java:770)
>>>>      at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(
>>>> AjaxFormSubmitBehavior.java:156)
>>>>      at org.apache.wicket.ajax.AjaxEventBehavior.respond(
>>>> AjaxEventBehavior.java:123)
>>>>      at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(
>>>> AbstractDefaultAjaxBehavior.java:633)
>>>>
>>>> the objectAdapter param for OneToOneAssociationImpl.set(
>>>> OneToOneAssociationImpl.java:163) is the editted entity and the new
>>>> value
>>>> is null. The underlying facet method is a getter method for a String
>>>> property of the entity that indeed is empty.
>>>>
>>>> Thanks,
>>>> Erik
>>>>
>>>>
>>
>>
>

Re: error while updating entity using entity page

Posted by Erik de Hair <er...@pocos.nl>.
Tried to isolate the entity in the todoapp with its only 2 relations but 
that way I can't reproduce the problem...

On 10/17/2014 04:34 PM, Erik de Hair wrote:
> Hi Dan,
>
> The Isis version is 1.6.0
>
> I can't provide a simple demo app without almost putting all our 
> domain code and services on github. There are to much dependencies for 
> that. The entity it's all about. Hope you can find something.
>
> @javax.jdo.annotations.PersistenceCapable(table = "contactpersonen", 
> identityType = IdentityType.APPLICATION)
> @Bookmarkable
> public class Contact extends PortalAbstractDomainObject implements 
> SecuredPerInstance, Comparable<Contact>
> {
>     private final static Logger LOG = 
> LoggerFactory.getLogger(Contact.class);
>
>     private int id;
>     @Hidden
>     @PrimaryKey
>     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>     public int getId()
>     {
>         return id;
>     }
>
>     public void setId(int id)
>     {
>         this.id = id;
>     }
>
>     // ignored fields
>     // id int(11) PK AI -> see identity above
>
>     private int internalCompany = 1;
>
>     @Hidden
>     @Column(name = "bedrijf_id", allowsNull = "true")
>     public int getInternalCompany()
>     {
>         return internalCompany;
>     }
>
>     public void setInternalCompany(int internalCompany)
>     {
>         this.internalCompany = 1;
>     }
>
>     private String enumGender;
>
>     @Named("Geslacht")
>     @Column(name = "geslacht", allowsNull = "false", length = 9)
>     @Disabled
>     public String getEnumGender()
>     {
>         return enumGender;
>     }
>
>     public void setEnumGender(String enumGender)
>     {
>         this.enumGender = enumGender;
>     }
>
>     private String firstName;
>
>     @MaxLength(value = 50)
>     @Named("Voornaam")
>     @Column(name = "voornaam", allowsNull = "true")
>     public String getFirstName()
>     {
>         return firstName;
>     }
>
>     public void setFirstName(String firstName)
>     {
>         this.firstName = firstName;
>     }
>
>     /**
>      * Update complete name when updating first name
>      *
>      * @param firstName
>      */
>     public void modifyFirstName(String firstName)
>     {
>         setFirstName(firstName);
>         resetName();
>     }
>
>     private String namePrefix;
>
>     @MaxLength(value = 15)
>     @Named("Tussenvoegsel(s)")
>     @Column(name = "tussenvoegsels", allowsNull = "true")
>     public String getNamePrefix()
>     {
>         return namePrefix;
>     }
>
>     public void setNamePrefix(String namePrefix)
>     {
>         this.namePrefix = namePrefix;
>     }
>
>     /**
>      * Update complete name when updating name prefix
>      *
>      * @param namePrefix
>      */
>     public void modifyNamePrefix(String namePrefix)
>     {
>         setNamePrefix(namePrefix);
>         resetName();
>     }
>
>     private String lastName;
>
>     @MaxLength(value = 50)
>     @Named("Achternaam")
>     @Column(name = "achternaam", allowsNull = "true")
>     public String getLastName()
>     {
>         return lastName;
>     }
>
>     public void setLastName(String lastName)
>     {
>         this.lastName = lastName;
>     }
>
>     /**
>      * Update complete name when updating last name
>      *
>      * @param lastName
>      */
>     public void modifyLastName(String lastName)
>     {
>         setLastName(lastName);
>         resetName();
>     }
>
>     private String name;
>     @Title
>     @MaxLength(value = 100)
>     @Named("Naam")
>     @Column(name = "naam", allowsNull = "true")
>     public String getName()
>     {
>         return this.name;
>     }
>
>     public void setName(String name)
>     {
>         this.name = name;
>     }
>
>     private void resetName()
>     {
>         StringBuffer name = new StringBuffer();
>         if (this.getFirstName() != null && 
> !this.getFirstName().isEmpty())
>         {
>             name.append(this.getFirstName());
>         }
>         if (this.getNamePrefix() != null && 
> !this.getNamePrefix().isEmpty())
>         {
>             if (name.length() > 0)
>             {
>                 name.append(" ");
>             }
>             name.append(this.getNamePrefix());
>         }
>         if (this.getLastName() != null && !this.getLastName().isEmpty())
>         {
>             if (name.length() > 0)
>             {
>                 name.append(" ");
>             }
>             name.append(getLastName());
>         }
>         setName(name.toString());
>     }
>
>     private String street;
>     @Column(name = "straat", allowsNull = "true")
>     @MaxLength(value = 255)
>     public String getStreet()
>     {
>         return street;
>     }
>
>     public void setStreet(String address)
>     {
>         this.street = address;
>     }
>
>     private String houseNumber;
>
>     @Column(name = "huisnummer", allowsNull = "true")
>     public String getHouseNumber()
>     {
>         return houseNumber;
>     }
>     public void setHouseNumber(String houseNumber)
>     {
>         this.houseNumber = houseNumber;
>     }
>
>     private String houseNumberExtension;
>
>     @Column(name = "huisnummertoevoeging", allowsNull = "true")
>     public String getHouseNumberExtension()
>     {
>         return houseNumberExtension;
>     }
>     public void setHouseNumberExtension(String houseNumberExtension)
>     {
>         this.houseNumberExtension = houseNumberExtension;
>     }
>
>
>     private String postalCode;
>
>     @MaxLength(value = 7)
>     @Named("Postcode")
>     @Column(name = "postcode", allowsNull = "true")
>     public String getPostalCode()
>     {
>         return postalCode;
>     }
>
>     public void setPostalCode(String postalCode)
>     {
>         this.postalCode = postalCode;
>     }
>
>     private String residence;
>
>     @MaxLength(value = 50)
>     @Named("Plaats")
>     @Column(name = "plaats", allowsNull = "true")
>     public String getResidence()
>     {
>         return residence;
>     }
>
>     public void setResidence(String residence)
>     {
>         this.residence = residence;
>     }
>
>     private String country;
>
>     @MaxLength(value = 50)
>     @Named("Land")
>     @Column(name = "land", allowsNull = "true")
>     public String getCountry()
>     {
>         return country;
>     }
>
>     public void setCountry(String country)
>     {
>         this.country = country;
>     }
>
>     private String locale;
>
>     @MaxLength(value = 10)
>     @Named("Locale")
>     @Column(name = "locale", allowsNull = "true")
>     public String getLocale()
>     {
>         return locale;
>     }
>
>     public void setLocale(String locale)
>     {
>         this.locale = locale;
>     }
>
>     private LocalDate birthday;
>
>     @Named("Geboortedatum")
>     @Column(name = "geb_datum", allowsNull = "true")
>     public LocalDate getBirthday()
>     {
>         return birthday;
>     }
>
>     public void setBirthday(LocalDate birthday)
>     {
>         this.birthday = birthday;
>     }
>
>     private String phone;
>
>     @MaxLength(value = 20)
>     @Named("Telefoon")
>     @Column(name = "tel_vast", allowsNull = "true")
>     public String getPhone()
>     {
>         return phone;
>     }
>
>     public void setPhone(String phone)
>     {
>         this.phone = phone;
>     }
>
>     private String phoneCompany;
>
>     @MaxLength(value = 20)
>     @Named("Telefoon zakelijk")
>     @Column(name = "tel_zaak", allowsNull = "true")
>     public String getPhoneCompany()
>     {
>         return phoneCompany;
>     }
>
>     public void setPhoneCompany(String phoneCompany)
>     {
>         this.phoneCompany = phoneCompany;
>     }
>
>     private String cellPhone;
>
>     @MaxLength(value = 20)
>     @Named("Mobiele telefoon")
>     @Column(name = "tel_mobiel", allowsNull = "true")
>     public String getCellPhone()
>     {
>         return cellPhone;
>     }
>
>     public void setCellPhone(String cellPhone)
>     {
>         this.cellPhone = cellPhone;
>     }
>
>     private String email;
>
>     @MaxLength(value = 100)
>     @Named("E-mail")
>     @Column(name = "email", allowsNull = "true")
>     @RegEx(validation = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", 
> caseSensitive = false)
>     public String getEmail()
>     {
>         return email;
>     }
>
>     public void setEmail(String email)
>     {
>         this.email = email;
>     }
>
>     private String occupation;
>
>     @MaxLength(value = 100)
>     @Named("Functie")
>     @Column(name = "functie", allowsNull = "true")
>     public String getOccupation()
>     {
>         return occupation;
>     }
>
>     public void setOccupation(String occupation)
>     {
>         this.occupation = occupation;
>     }
>
>     /**
>      * The company the contact represents (is the contact for)
>      */
>     private PortalCompany representedCompany;
>
>     @Named("Werkzaam voor")
>     @Column(name = "referentie", allowsNull = "true")
>     public PortalCompany getRepresentedCompany()
>     {
>         return representedCompany;
>     }
>
>     public void setRepresentedCompany(PortalCompany representedCompany)
>     {
>         this.representedCompany = representedCompany;
>     }
>
>     private String belongsTo = "klant";
>
>     @MaxLength(value = 20)
>     @Column(name = "hoort_bij", allowsNull = "true")
>     public String getBelongsTo()
>     {
>         return belongsTo;
>     }
>
>     public void setBelongsTo(String belongsTo)
>     {
>         this.belongsTo = belongsTo;
>     }
>
>     private boolean active;
>
>     @Named("Actief")
>     @Column(name = "actief", allowsNull = "false")
>     public boolean isActive()
>     {
>         return active;
>     }
>
>     public void setActive(boolean active)
>     {
>         this.active = active;
>     }
>
>     private String ripehandle;
>
>     @MaxLength(value = 255)
>     @Named("RIPE handle")
>     @Column
>     public String getRipehandle()
>     {
>         return ripehandle;
>     }
>
>     public void setRipehandle(String ripehandle)
>     {
>         this.ripehandle = ripehandle;
>     }
>
>     private String username;
>
>     @MemberOrder(name = "Gebruikersaccount", sequence = "2")
>     @Unique
>     @MaxLength(value = 45)
>     @Named("Gebruikersnaam")
>     @Column(name = "gebruikersnaam", allowsNull = "true")
>     @Disabled
>     public String getUsername()
>     {
>         return username;
>     }
>
>     public void setUsername(String username)
>     {
>         this.username = username;
>     }
>
>     private String password;
>
>     @Hidden(when = When.ALWAYS)
>     @Disabled
>     @MaxLength(value = 255)
>     @Column(name = "wachtwoord", allowsNull = "true")
>     public String getPassword()
>     {
>         return password;
>     }
>
>     /**
>      * @param password the password to set
>      */
>     public void setPassword(String password)
>     {
>         this.password = password;
>     }
>
>     /**
>      * Encrypt the password
>      *
>      * @param plaintextPassword
>      */
>     public void modifyPassword(String plaintextPassword)
>     {
>         DefaultPasswordService ps = new DefaultPasswordService();
>         setPassword(ps.encryptPassword(plaintextPassword));
>     }
>
>     /**
>      * The user's application roles
>      */
>     private SortedSet<Role> roles = new TreeSet<Role>();
>
>     @Hidden
>     @Persistent(table = "users_roles")
>     @Join(column = "user_id")
>     @Element(column = "role_id")
>     public SortedSet<Role> getRoles()
>     {
>         return roles;
>     }
>
>     public void setRoles(SortedSet<Role> roles)
>     {
>         this.roles = roles;
>     }
>
>     @MemberOrder(name = "Gebruikersaccount", sequence = "3")
>     @Named("Gebruikersrol")
>     @Optional
>     public String getRole()
>     {
>         return (this.getRoles().isEmpty() ? null : 
> this.getRoles().first().getDescription());
>     }
>
>     private boolean isUser()
>     {
>         return this.getUsername() != null && 
> !this.getUsername().isEmpty();
>     }
>
>
>
>
> On 10/17/2014 02:37 PM, Dan Haywood wrote:
>> Can you post the domain code for this?
>>
>> And which version of Isis?
>>
>> Ideally... can you provide a simple demo app on github?
>>
>> Thx
>> Dan
>>
>>
>>
>> On 17 October 2014 11:19, Erik de Hair <er...@pocos.nl> wrote:
>>
>>> Hi,
>>>
>>> Does any body know why I'm getting the following exception when 
>>> saving a
>>> modified entity by using its entity page
>>>
>>> Caused by: java.lang.NullPointerException
>>>      at org.apache.isis.core.metamodel.specloader.specimpl.
>>> OneToOneAssociationImpl.clearValue(OneToOneAssociationImpl.java:199)
>>>      at org.apache.isis.core.metamodel.specloader.specimpl.
>>> OneToOneAssociationImpl.set(OneToOneAssociationImpl.java:163)
>>>      at org.apache.isis.viewer.wicket.model.models.EntityModel.
>>> apply(EntityModel.java:594)
>>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>>> EntityPropertiesForm.applyFormChangesElse(EntityPropertiesForm.java:505) 
>>>
>>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>>> EntityPropertiesForm.access$500(EntityPropertiesForm.java:75)
>>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>>> EntityPropertiesForm$AjaxButtonForValidate.onSubmit(EntityPropertiesForm. 
>>>
>>> java:333)
>>>      at org.apache.wicket.ajax.markup.html.form.AjaxButton$1.
>>> onSubmit(AjaxButton.java:108)
>>>      at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(
>>> AjaxFormSubmitBehavior.java:179)
>>>      at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.
>>> java:1266)
>>>      at org.apache.wicket.markup.html.form.Form.process(Form.java:938)
>>>      at org.apache.isis.viewer.wicket.ui.panels.FormAbstract.
>>> process(FormAbstract.java:110)
>>>      at org.apache.wicket.markup.html.form.Form.onFormSubmitted(
>>> Form.java:770)
>>>      at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(
>>> AjaxFormSubmitBehavior.java:156)
>>>      at org.apache.wicket.ajax.AjaxEventBehavior.respond(
>>> AjaxEventBehavior.java:123)
>>>      at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(
>>> AbstractDefaultAjaxBehavior.java:633)
>>>
>>> the objectAdapter param for OneToOneAssociationImpl.set(
>>> OneToOneAssociationImpl.java:163) is the editted entity and the new 
>>> value
>>> is null. The underlying facet method is a getter method for a String
>>> property of the entity that indeed is empty.
>>>
>>> Thanks,
>>> Erik
>>>
>
>


Re: error while updating entity using entity page

Posted by Erik de Hair <er...@pocos.nl>.
Hi Dan,

The Isis version is 1.6.0

I can't provide a simple demo app without almost putting all our domain 
code and services on github. There are to much dependencies for that. 
The entity it's all about. Hope you can find something.

@javax.jdo.annotations.PersistenceCapable(table = "contactpersonen", 
identityType = IdentityType.APPLICATION)
@Bookmarkable
public class Contact extends PortalAbstractDomainObject implements 
SecuredPerInstance, Comparable<Contact>
{
     private final static Logger LOG = 
LoggerFactory.getLogger(Contact.class);

     private int id;
     @Hidden
     @PrimaryKey
     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
     public int getId()
     {
         return id;
     }

     public void setId(int id)
     {
         this.id = id;
     }

     // ignored fields
     // id int(11) PK AI -> see identity above

     private int internalCompany = 1;

     @Hidden
     @Column(name = "bedrijf_id", allowsNull = "true")
     public int getInternalCompany()
     {
         return internalCompany;
     }

     public void setInternalCompany(int internalCompany)
     {
         this.internalCompany = 1;
     }

     private String enumGender;

     @Named("Geslacht")
     @Column(name = "geslacht", allowsNull = "false", length = 9)
     @Disabled
     public String getEnumGender()
     {
         return enumGender;
     }

     public void setEnumGender(String enumGender)
     {
         this.enumGender = enumGender;
     }

     private String firstName;

     @MaxLength(value = 50)
     @Named("Voornaam")
     @Column(name = "voornaam", allowsNull = "true")
     public String getFirstName()
     {
         return firstName;
     }

     public void setFirstName(String firstName)
     {
         this.firstName = firstName;
     }

     /**
      * Update complete name when updating first name
      *
      * @param firstName
      */
     public void modifyFirstName(String firstName)
     {
         setFirstName(firstName);
         resetName();
     }

     private String namePrefix;

     @MaxLength(value = 15)
     @Named("Tussenvoegsel(s)")
     @Column(name = "tussenvoegsels", allowsNull = "true")
     public String getNamePrefix()
     {
         return namePrefix;
     }

     public void setNamePrefix(String namePrefix)
     {
         this.namePrefix = namePrefix;
     }

     /**
      * Update complete name when updating name prefix
      *
      * @param namePrefix
      */
     public void modifyNamePrefix(String namePrefix)
     {
         setNamePrefix(namePrefix);
         resetName();
     }

     private String lastName;

     @MaxLength(value = 50)
     @Named("Achternaam")
     @Column(name = "achternaam", allowsNull = "true")
     public String getLastName()
     {
         return lastName;
     }

     public void setLastName(String lastName)
     {
         this.lastName = lastName;
     }

     /**
      * Update complete name when updating last name
      *
      * @param lastName
      */
     public void modifyLastName(String lastName)
     {
         setLastName(lastName);
         resetName();
     }

     private String name;
     @Title
     @MaxLength(value = 100)
     @Named("Naam")
     @Column(name = "naam", allowsNull = "true")
     public String getName()
     {
         return this.name;
     }

     public void setName(String name)
     {
         this.name = name;
     }

     private void resetName()
     {
         StringBuffer name = new StringBuffer();
         if (this.getFirstName() != null && !this.getFirstName().isEmpty())
         {
             name.append(this.getFirstName());
         }
         if (this.getNamePrefix() != null && 
!this.getNamePrefix().isEmpty())
         {
             if (name.length() > 0)
             {
                 name.append(" ");
             }
             name.append(this.getNamePrefix());
         }
         if (this.getLastName() != null && !this.getLastName().isEmpty())
         {
             if (name.length() > 0)
             {
                 name.append(" ");
             }
             name.append(getLastName());
         }
         setName(name.toString());
     }

     private String street;
     @Column(name = "straat", allowsNull = "true")
     @MaxLength(value = 255)
     public String getStreet()
     {
         return street;
     }

     public void setStreet(String address)
     {
         this.street = address;
     }

     private String houseNumber;

     @Column(name = "huisnummer", allowsNull = "true")
     public String getHouseNumber()
     {
         return houseNumber;
     }
     public void setHouseNumber(String houseNumber)
     {
         this.houseNumber = houseNumber;
     }

     private String houseNumberExtension;

     @Column(name = "huisnummertoevoeging", allowsNull = "true")
     public String getHouseNumberExtension()
     {
         return houseNumberExtension;
     }
     public void setHouseNumberExtension(String houseNumberExtension)
     {
         this.houseNumberExtension = houseNumberExtension;
     }


     private String postalCode;

     @MaxLength(value = 7)
     @Named("Postcode")
     @Column(name = "postcode", allowsNull = "true")
     public String getPostalCode()
     {
         return postalCode;
     }

     public void setPostalCode(String postalCode)
     {
         this.postalCode = postalCode;
     }

     private String residence;

     @MaxLength(value = 50)
     @Named("Plaats")
     @Column(name = "plaats", allowsNull = "true")
     public String getResidence()
     {
         return residence;
     }

     public void setResidence(String residence)
     {
         this.residence = residence;
     }

     private String country;

     @MaxLength(value = 50)
     @Named("Land")
     @Column(name = "land", allowsNull = "true")
     public String getCountry()
     {
         return country;
     }

     public void setCountry(String country)
     {
         this.country = country;
     }

     private String locale;

     @MaxLength(value = 10)
     @Named("Locale")
     @Column(name = "locale", allowsNull = "true")
     public String getLocale()
     {
         return locale;
     }

     public void setLocale(String locale)
     {
         this.locale = locale;
     }

     private LocalDate birthday;

     @Named("Geboortedatum")
     @Column(name = "geb_datum", allowsNull = "true")
     public LocalDate getBirthday()
     {
         return birthday;
     }

     public void setBirthday(LocalDate birthday)
     {
         this.birthday = birthday;
     }

     private String phone;

     @MaxLength(value = 20)
     @Named("Telefoon")
     @Column(name = "tel_vast", allowsNull = "true")
     public String getPhone()
     {
         return phone;
     }

     public void setPhone(String phone)
     {
         this.phone = phone;
     }

     private String phoneCompany;

     @MaxLength(value = 20)
     @Named("Telefoon zakelijk")
     @Column(name = "tel_zaak", allowsNull = "true")
     public String getPhoneCompany()
     {
         return phoneCompany;
     }

     public void setPhoneCompany(String phoneCompany)
     {
         this.phoneCompany = phoneCompany;
     }

     private String cellPhone;

     @MaxLength(value = 20)
     @Named("Mobiele telefoon")
     @Column(name = "tel_mobiel", allowsNull = "true")
     public String getCellPhone()
     {
         return cellPhone;
     }

     public void setCellPhone(String cellPhone)
     {
         this.cellPhone = cellPhone;
     }

     private String email;

     @MaxLength(value = 100)
     @Named("E-mail")
     @Column(name = "email", allowsNull = "true")
     @RegEx(validation = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", 
caseSensitive = false)
     public String getEmail()
     {
         return email;
     }

     public void setEmail(String email)
     {
         this.email = email;
     }

     private String occupation;

     @MaxLength(value = 100)
     @Named("Functie")
     @Column(name = "functie", allowsNull = "true")
     public String getOccupation()
     {
         return occupation;
     }

     public void setOccupation(String occupation)
     {
         this.occupation = occupation;
     }

     /**
      * The company the contact represents (is the contact for)
      */
     private PortalCompany representedCompany;

     @Named("Werkzaam voor")
     @Column(name = "referentie", allowsNull = "true")
     public PortalCompany getRepresentedCompany()
     {
         return representedCompany;
     }

     public void setRepresentedCompany(PortalCompany representedCompany)
     {
         this.representedCompany = representedCompany;
     }

     private String belongsTo = "klant";

     @MaxLength(value = 20)
     @Column(name = "hoort_bij", allowsNull = "true")
     public String getBelongsTo()
     {
         return belongsTo;
     }

     public void setBelongsTo(String belongsTo)
     {
         this.belongsTo = belongsTo;
     }

     private boolean active;

     @Named("Actief")
     @Column(name = "actief", allowsNull = "false")
     public boolean isActive()
     {
         return active;
     }

     public void setActive(boolean active)
     {
         this.active = active;
     }

     private String ripehandle;

     @MaxLength(value = 255)
     @Named("RIPE handle")
     @Column
     public String getRipehandle()
     {
         return ripehandle;
     }

     public void setRipehandle(String ripehandle)
     {
         this.ripehandle = ripehandle;
     }

     private String username;

     @MemberOrder(name = "Gebruikersaccount", sequence = "2")
     @Unique
     @MaxLength(value = 45)
     @Named("Gebruikersnaam")
     @Column(name = "gebruikersnaam", allowsNull = "true")
     @Disabled
     public String getUsername()
     {
         return username;
     }

     public void setUsername(String username)
     {
         this.username = username;
     }

     private String password;

     @Hidden(when = When.ALWAYS)
     @Disabled
     @MaxLength(value = 255)
     @Column(name = "wachtwoord", allowsNull = "true")
     public String getPassword()
     {
         return password;
     }

     /**
      * @param password the password to set
      */
     public void setPassword(String password)
     {
         this.password = password;
     }

     /**
      * Encrypt the password
      *
      * @param plaintextPassword
      */
     public void modifyPassword(String plaintextPassword)
     {
         DefaultPasswordService ps = new DefaultPasswordService();
         setPassword(ps.encryptPassword(plaintextPassword));
     }

     /**
      * The user's application roles
      */
     private SortedSet<Role> roles = new TreeSet<Role>();

     @Hidden
     @Persistent(table = "users_roles")
     @Join(column = "user_id")
     @Element(column = "role_id")
     public SortedSet<Role> getRoles()
     {
         return roles;
     }

     public void setRoles(SortedSet<Role> roles)
     {
         this.roles = roles;
     }

     @MemberOrder(name = "Gebruikersaccount", sequence = "3")
     @Named("Gebruikersrol")
     @Optional
     public String getRole()
     {
         return (this.getRoles().isEmpty() ? null : 
this.getRoles().first().getDescription());
     }

     private boolean isUser()
     {
         return this.getUsername() != null && !this.getUsername().isEmpty();
     }




On 10/17/2014 02:37 PM, Dan Haywood wrote:
> Can you post the domain code for this?
>
> And which version of Isis?
>
> Ideally... can you provide a simple demo app on github?
>
> Thx
> Dan
>
>
>
> On 17 October 2014 11:19, Erik de Hair <er...@pocos.nl> wrote:
>
>> Hi,
>>
>> Does any body know why I'm getting the following exception when saving a
>> modified entity by using its entity page
>>
>> Caused by: java.lang.NullPointerException
>>      at org.apache.isis.core.metamodel.specloader.specimpl.
>> OneToOneAssociationImpl.clearValue(OneToOneAssociationImpl.java:199)
>>      at org.apache.isis.core.metamodel.specloader.specimpl.
>> OneToOneAssociationImpl.set(OneToOneAssociationImpl.java:163)
>>      at org.apache.isis.viewer.wicket.model.models.EntityModel.
>> apply(EntityModel.java:594)
>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>> EntityPropertiesForm.applyFormChangesElse(EntityPropertiesForm.java:505)
>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>> EntityPropertiesForm.access$500(EntityPropertiesForm.java:75)
>>      at org.apache.isis.viewer.wicket.ui.components.entity.properties.
>> EntityPropertiesForm$AjaxButtonForValidate.onSubmit(EntityPropertiesForm.
>> java:333)
>>      at org.apache.wicket.ajax.markup.html.form.AjaxButton$1.
>> onSubmit(AjaxButton.java:108)
>>      at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(
>> AjaxFormSubmitBehavior.java:179)
>>      at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.
>> java:1266)
>>      at org.apache.wicket.markup.html.form.Form.process(Form.java:938)
>>      at org.apache.isis.viewer.wicket.ui.panels.FormAbstract.
>> process(FormAbstract.java:110)
>>      at org.apache.wicket.markup.html.form.Form.onFormSubmitted(
>> Form.java:770)
>>      at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(
>> AjaxFormSubmitBehavior.java:156)
>>      at org.apache.wicket.ajax.AjaxEventBehavior.respond(
>> AjaxEventBehavior.java:123)
>>      at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(
>> AbstractDefaultAjaxBehavior.java:633)
>>
>> the objectAdapter param for OneToOneAssociationImpl.set(
>> OneToOneAssociationImpl.java:163) is the editted entity and the new value
>> is null. The underlying facet method is a getter method for a String
>> property of the entity that indeed is empty.
>>
>> Thanks,
>> Erik
>>


Re: error while updating entity using entity page

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Can you post the domain code for this?

And which version of Isis?

Ideally... can you provide a simple demo app on github?

Thx
Dan



On 17 October 2014 11:19, Erik de Hair <er...@pocos.nl> wrote:

> Hi,
>
> Does any body know why I'm getting the following exception when saving a
> modified entity by using its entity page
>
> Caused by: java.lang.NullPointerException
>     at org.apache.isis.core.metamodel.specloader.specimpl.
> OneToOneAssociationImpl.clearValue(OneToOneAssociationImpl.java:199)
>     at org.apache.isis.core.metamodel.specloader.specimpl.
> OneToOneAssociationImpl.set(OneToOneAssociationImpl.java:163)
>     at org.apache.isis.viewer.wicket.model.models.EntityModel.
> apply(EntityModel.java:594)
>     at org.apache.isis.viewer.wicket.ui.components.entity.properties.
> EntityPropertiesForm.applyFormChangesElse(EntityPropertiesForm.java:505)
>     at org.apache.isis.viewer.wicket.ui.components.entity.properties.
> EntityPropertiesForm.access$500(EntityPropertiesForm.java:75)
>     at org.apache.isis.viewer.wicket.ui.components.entity.properties.
> EntityPropertiesForm$AjaxButtonForValidate.onSubmit(EntityPropertiesForm.
> java:333)
>     at org.apache.wicket.ajax.markup.html.form.AjaxButton$1.
> onSubmit(AjaxButton.java:108)
>     at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(
> AjaxFormSubmitBehavior.java:179)
>     at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.
> java:1266)
>     at org.apache.wicket.markup.html.form.Form.process(Form.java:938)
>     at org.apache.isis.viewer.wicket.ui.panels.FormAbstract.
> process(FormAbstract.java:110)
>     at org.apache.wicket.markup.html.form.Form.onFormSubmitted(
> Form.java:770)
>     at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(
> AjaxFormSubmitBehavior.java:156)
>     at org.apache.wicket.ajax.AjaxEventBehavior.respond(
> AjaxEventBehavior.java:123)
>     at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(
> AbstractDefaultAjaxBehavior.java:633)
>
> the objectAdapter param for OneToOneAssociationImpl.set(
> OneToOneAssociationImpl.java:163) is the editted entity and the new value
> is null. The underlying facet method is a getter method for a String
> property of the entity that indeed is empty.
>
> Thanks,
> Erik
>