Package org.chromattic.core.mapping.jcr

Examples of org.chromattic.core.mapping.jcr.JCRPropertyMapping


            SimpleMapping pmdm = (SimpleMapping)pmvm;
            JCRMemberMapping jcrMember = pmdm.getJCRMember();

            //
            if (jcrMember instanceof JCRPropertyMapping) {
              JCRPropertyMapping jcrProperty = (JCRPropertyMapping)jcrMember;
              JCRPropertyPropertyMapper bilto = new JCRPropertyPropertyMapper((SingleValuedPropertyInfo<SimpleValueInfo>)pm.getInfo(), jcrProperty.getName());
              propertyMappers.add(bilto);
            } else if (jcrMember instanceof JCRNodeAttributeMapping) {
              JCRNodeAttributeMapping nam = (JCRNodeAttributeMapping)jcrMember;
              propertyMappers.add(new JCRNodeAttributePropertyMapper((SingleValuedPropertyInfo<SimpleValueInfo>)pm.getInfo(), nam.getType()));
            }
          } else if (pmvm instanceof RelationshipMapping) {
            RelationshipMapping pmhm = (RelationshipMapping)pmvm;

            //
            if (pmhm.getType() == RelationshipType.HIERARCHIC) {
              if (pmhm instanceof ManyToOneMapping) {
                JCRChildNodePropertyMapper bilto = new JCRAnyChildCollectionPropertyMapper((SingleValuedPropertyInfo<BeanValueInfo>)pm.getInfo());
                relatedProperties.get(pmhm.getRelatedType()).add(bilto);
                propertyMappers.add(bilto);
              } if (pmhm instanceof NamedOneToOneMapping) {
                NamedOneToOneMapping ncpmpm = (NamedOneToOneMapping)pmhm;
                if (ncpmpm.isOwner()) {
                  JCRNamedChildParentPropertyMapper bilto = new JCRNamedChildParentPropertyMapper((SingleValuedPropertyInfo<BeanValueInfo>)pm.getInfo(), ncpmpm.getName());
                  relatedProperties.get(pmhm.getRelatedType()).add(bilto);
                  propertyMappers.add(bilto);
                } else {
                  JCRChildNodePropertyMapper bilto = new JCRNamedChildPropertyMapper((SingleValuedPropertyInfo<BeanValueInfo>)pm.getInfo(), ncpmpm.getName());
                  relatedProperties.get(ncpmpm.getRelatedType()).add(bilto);
                  propertyMappers.add(bilto);
                }
              }
            }
          }

          //
          if (pmvm instanceof ManyToOneMapping) {
            if (pmvm instanceof NamedManyToOneMapping) {
              NamedManyToOneMapping nmtovm = (NamedManyToOneMapping)pmvm;
              LinkType linkType = relationshipToLinkMapping.get(nmtovm.getType());
              if (linkType != null) {
                JCRNamedReferentPropertyMapper blah = new JCRNamedReferentPropertyMapper(
                  (SingleValuedPropertyInfo<BeanValueInfo>)pm.getInfo(),
                  nmtovm.getRelatedName(),
                  linkType
                  );
                propertyMappers.add(blah);
                relatedProperties.get(nmtovm.getRelatedType()).add(blah);
              }
            }
          }
        } else if (pm.getInfo() instanceof MultiValuedPropertyInfo) {
          ValueMapping pmvm = pm.getValueMapping();

          //
          if (pmvm instanceof RelationshipMapping) {
            RelationshipMapping pmhm = (RelationshipMapping)pmvm;

            //
            if (pmhm instanceof OneToManyMapping) {

              //
              if (pmhm instanceof NamedOneToManyMapping) {
                LinkType linkType = relationshipToLinkMapping.get(pmhm.getType());
                if (linkType != null) {
                  NamedOneToManyMapping fff = (NamedOneToManyMapping)pmhm;
                  JCRReferentCollectionPropertyMapper bilto = new JCRReferentCollectionPropertyMapper(
                    (CollectionPropertyInfo<BeanValueInfo>)pm.getInfo(),
                    fff.getName(),
                    linkType);
                  relatedProperties.get(pmhm.getRelatedType()).add(bilto);
                  propertyMappers.add(bilto);
                }
              } else {
                if (pmhm.getType() == RelationshipType.HIERARCHIC) {

                  MultiValuedPropertyInfo<BeanValueInfo> mpi = (MultiValuedPropertyInfo<BeanValueInfo>)pm.getInfo();
                  AnyChildMultiValueMapper valueMapper;
                  if (mpi instanceof MapPropertyInfo) {
                    valueMapper = new AnyChildMultiValueMapper.Map();
                  } else if (mpi instanceof CollectionPropertyInfo) {
                    if (mpi instanceof ListPropertyInfo) {
                      valueMapper = new AnyChildMultiValueMapper.List();
                    } else {
                      valueMapper = new AnyChildMultiValueMapper.Collection();
                    }
                  } else {
                    throw new IllegalStateException();
                  }
                  JCRAnyChildParentPropertyMapper bilto = new JCRAnyChildParentPropertyMapper(mpi, valueMapper);
                  relatedProperties.get(pmhm.getRelatedType()).add(bilto);
                  propertyMappers.add(bilto);
                }
              }
            }
          } else if (pmvm instanceof SimpleMapping) {
            SimpleMapping sm = (SimpleMapping)pmvm;
            JCRMemberMapping jcrMember = sm.getJCRMember();

            //
            if (jcrMember instanceof JCRPropertyMapping) {
              JCRPropertyMapping jcrProperty = (JCRPropertyMapping)jcrMember;
              JCRPropertyListPropertyMapper bilto = new JCRPropertyListPropertyMapper((MultiValuedPropertyInfo<SimpleValueInfo>)pm.getInfo(), jcrProperty.getName());
              propertyMappers.add(bilto);
            }
          } else if (pmvm instanceof PropertyMapMapping) {
            JCRPropertyMapPropertyMapper bilto = new JCRPropertyMapPropertyMapper((MapPropertyInfo)pm.getInfo());
            propertyMappers.add(bilto);
View Full Code Here


        throw new IllegalStateException();
      }

      //
      if (value instanceof SimpleValueInfo) {
        JCRPropertyMapping memberMapping = new JCRPropertyMapping(propertyAnnotation.name());
        SimpleMapping<JCRPropertyMapping> simpleMapping = new SimpleMapping<JCRPropertyMapping>(memberMapping);
        PropertyMapping<SimpleMapping<JCRPropertyMapping>> propertyMapping = new PropertyMapping<SimpleMapping<JCRPropertyMapping>>(propertyInfo, simpleMapping);
        propertyMappings.add(propertyMapping);
      } else {
        throw new IllegalStateException("Cannot map property type " + value);
View Full Code Here

TOP

Related Classes of org.chromattic.core.mapping.jcr.JCRPropertyMapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.