0

I add one "soc:music" (nt:file) child node (same as original "soc:avatar" node) into the exoplatform profile entity, but it fails when store into JCR. I google the error, seems little mentions about it. Do you know how to fix it? thanks. The weird thing is the original "soc:avatar" node works well.

<nodeType name="soc:profiledefinition" isMixin="false" hasOrderableChildNodes="false">
...
  <childNodeDefinition name="soc:avatar" defaultPrimaryType="nt:file" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
    <requiredPrimaryTypes>
      <requiredPrimaryType>nt:file</requiredPrimaryType>
    </requiredPrimaryTypes>
  </childNodeDefinition>

..
  <childNodeDefinition name="soc:music" defaultPrimaryType="nt:file" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
    <requiredPrimaryTypes>
      <requiredPrimaryType>nt:file</requiredPrimaryType>
    </requiredPrimaryTypes>
  </childNodeDefinition>
</childNodeDefinitions>

-----error message--

2013-07-23 10:58:27,401 | ERROR | Error during the processAction phase [portal:UIPortalApplication<http-nio-0.0.0.0-8080-exec-1>]
org.chromattic.api.UndeclaredRepositoryException: javax.jcr.nodetype.ConstraintViolationException: Can't add node soc:music to /production/soc:provid
rs/soc:organization/soc:test1/soc:profile node type nt:file is not allowed as child's node type for parent node type
        at org.chromattic.core.DomainSession.persist(DomainSession.java:470) ~[chromattic.core-1.2.1.jar:na]
        at org.chromattic.core.ObjectContext.addChild(ObjectContext.java:236) ~[chromattic.core-1.2.1.jar:na]
        at org.chromattic.core.mapper.onetoone.hierarchical.JCRNamedChildParentPropertyMapper.set(JCRNamedChildParentPropertyMapper.java:90) ~[chroma
tic.core-1.2.1.jar:na]
        at org.chromattic.core.mapper.PropertyMapper$2.invoke(PropertyMapper.java:88) ~[chromattic.core-1.2.1.jar:na]
        at org.chromattic.core.ObjectContext.invoke(ObjectContext.java:74) ~[chromattic.core-1.2.1.jar:na]
        at org.exoplatform.social.core.chromattic.entity.ProfileEntity_Chromattic.setMusic(ProfileEntity_Chromattic.java:102) ~[social-component-core
4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]
        at org.exoplatform.social.core.storage.impl.IdentityStorageImpl._saveProfile(IdentityStorageImpl.java:621) ~[social-component-core-4.0.0-SNAP
HOT.jar:4.0.0-SNAPSHOT]
Amal Murali
  • 75,622
  • 18
  • 128
  • 150

1 Answers1

1

Be careful when changing the nodetype definition like this, it may effects to the existing data in the system. You have to think about the "migration" for this modification. We're using Chromattic, therefore the nodetype's definition must be mapped with java class. You have changed soc:profiledefinition, therefore you have to added soc:music definition in the ProfileEntity.java as well (at package org.exoplatform.social.core.chromattic.entity).

Hope it helps, Minh

Minh Dang
  • 149
  • 1
  • 6
  • Thanks. Actually, I have added the soc:music definition in the ProfileEntity.java, but still can not pass the validation. So temporarily, I hardcode to not validate the new child node soc:music in the code. –  Aug 06 '13 at 17:01