コード例 #1
0
  @Override
  public void verify() {
    super.verify();
    doWithProperties(
        new PropertyHandler<Neo4jPersistentProperty>() {
          Neo4jPersistentProperty unique = null;

          public void doWithPersistentProperty(Neo4jPersistentProperty persistentProperty) {
            if (persistentProperty.isUnique()) {
              if (unique != null)
                throw new MappingException(
                    "Duplicate unique property "
                        + persistentProperty.getName()
                        + ", "
                        + unique.getName()
                        + " has already been defined. Only one unique property is allowed per type");
              unique = persistentProperty;
            }
          }
        });
    if (isManaged() || getType().isInterface()) {
      return;
    }
    final Neo4jPersistentProperty idProperty = getIdProperty();
    if (idProperty == null) throw new MappingException("No id property in " + this);
    if (idProperty.getType().isPrimitive())
      throw new MappingException(
          "The type of the id-property in "
              + idProperty
              + " must not be a primitive type but an object type like java.lang.Long");
  }
コード例 #2
0
 @Override
 public void addAssociation(
     Association<Neo4jPersistentProperty> neo4jPersistentPropertyAssociation) {
   super.addAssociation(neo4jPersistentPropertyAssociation);
   final Neo4jPersistentProperty property = neo4jPersistentPropertyAssociation.getInverse();
   if (property.isAnnotationPresent(StartNode.class)) {
     this.startNodeProperty = property;
   }
   if (property.isAnnotationPresent(EndNode.class)) {
     this.endNodeProperty = property;
   }
 }
コード例 #3
0
 @Override
 public void addPersistentProperty(Neo4jPersistentProperty property) {
   super.addPersistentProperty(property);
   if (property.isAnnotationPresent(RelationshipType.class)) {
     this.relationshipType = property;
   }
   if (property.isUnique()) {
     if (this.uniqueProperty == null) {
       this.uniqueProperty = property;
     }
   }
 }