<commit_before>package org.sagebionetworks.repo.model.jdo.persistence;

import java.util.Set;

import javax.jdo.annotations.Column;
import javax.jdo.annotations.Element;
import javax.jdo.annotations.ForeignKey;
import javax.jdo.annotations.ForeignKeyAction;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.NullValue;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import org.sagebionetworks.repo.model.query.jdo.SqlConstants;

@PersistenceCapable(detachable = "true", table=SqlConstants.TABLE_NODE)
public class JDONode {
		
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;
	
	@Persistent
	@Column(name=SqlConstants.COL_NODE_PARENT_ID)
    @ForeignKey(name="NODE_PARENT_FK", deleteAction=ForeignKeyAction.CASCADE)
	private JDONode parent;

	@Column(name=SqlConstants.COL_NODE_NAME)
	@Persistent(nullValue = NullValue.EXCEPTION) // cannot be null
	private String name;
	
	@Persistent (mappedBy = "parent")
	@Element(dependent = "true")
	private Set<JDONode> children;
		
	@Element(dependent = "true")
	private Set<JDOStringAnnotation> stringAnnotations;
	
	@Element(dependent = "true")
	private Set<JDOLongAnnotation> longAnnotations;
	
	@Element(dependent = "true")
	private Set<JDODoubleAnnotation> doubleAnnotations;
	
	@Element(dependent = "true")
	private Set<JDODateAnnotation> dateAnnotations;
	
	@Element(dependent = "true")
	private Set<JDOBlobAnnotation> blobAnnotations;

	@Persistent
	@Column(name=SqlConstants.COL_NODE_DESCRIPTION ,jdbcType="VARCHAR", length=3000)
	private String description;

	@Column(name=SqlConstants.COL_NODE_ETAG)
	@Persistent (nullValue = NullValue.EXCEPTION) //cannot be null
	private Long eTag = new Long(0);
	
	@Column(name=SqlConstants.COL_NODE_CREATED_BY)
	@Persistent (nullValue = NullValue.EXCEPTION) //cannot be null
	private String createdBy;
	
	@Column(name=SqlConstants.COL_NODE_CREATED_ON)
	@Persistent (nullValue = NullValue.EXCEPTION) //cannot be null
	private Long createdOn;
	
	@Column(name=SqlConstants.COL_NODE_MODIFIED_BY)
	@Persistent (nullValue = NullValue.EXCEPTION) //cannot be null
	private String modifiedBy;
	
	@Column(name=SqlConstants.COL_NODE_MODIFIED_ON)
	@Persistent (nullValue = NullValue.EXCEPTION) //cannot be null
	private Long modifiedOn;
	
	// The type is enforced by a Foreign key.
	@Column(name=SqlConstants.COL_NODE_TYPE)
	@Persistent (nullValue = NullValue.EXCEPTION) //cannot be null
	@ForeignKey(name="NODE_TYPE_FK", deleteAction=ForeignKeyAction.RESTRICT)<commit_msg>fix for foreign key problem in node annotations <commit_after>package org.sagebionetworks.repo.model.jdo.persistence;

import java.util.Set;

import javax.jdo.annotations.Column;
import javax.jdo.annotations.Element;
import javax.jdo.annotations.ForeignKey;
import javax.jdo.annotations.ForeignKeyAction;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.NullValue;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import org.sagebionetworks.repo.model.query.jdo.SqlConstants;

@PersistenceCapable(detachable = "true", table=SqlConstants.TABLE_NODE)
public class JDONode {
		
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;
	
	@Persistent
	@Column(name=SqlConstants.COL_NODE_PARENT_ID)
    @ForeignKey(name="NODE_PARENT_FK", deleteAction=ForeignKeyAction.CASCADE)
	private JDONode parent;

	@Column(name=SqlConstants.COL_NODE_NAME)
	@Persistent(nullValue = NullValue.EXCEPTION) // cannot be null
	private String name;
	
	@Persistent (mappedBy = "parent")
	@Element(dependent = "true")
	private Set<JDONode> children;
		
    @Persistent(serialized="false", mappedBy = "owner")
	@Element(dependent = "true")
	private Set<JDOStringAnnotation> stringAnnotations;
	
    @Persistent(serialized="false", mappedBy = "owner")
	@Element(dependent = "true")
	private Set<JDOLongAnnotation> longAnnotations;
	
    @Persistent(serialized="false", mappedBy = "owner")
	@Element(dependent = "true")
	private Set<JDODoubleAnnotation> doubleAnnotations;
	
    @Persistent(serialized="false", mappedBy = "owner")
	@Element(dependent = "true")
	private Set<JDODateAnnotation> dateAnnotations;
	
    @Persistent(serialized="false", mappedBy = "owner")
	@Element(dependent = "true")
	private Set<JDOBlobAnnotation> blobAnnotations;

	@Persistent
	@Column(name=SqlConstants.COL_NODE_DESCRIPTION ,jdbcType="VARCHAR", length=3000)
	private String description;

	@Column(name=SqlConstants.COL_NODE_ETAG)
	@Persistent (nullValue = NullValue.EXCEPTION) //cannot be null
	private Long eTag = new Long(0);
	
	@Column(name=SqlConstants.COL_NODE_CREATED_BY)
	@Persistent (nullValue = NullValue.EXCEPTION) //cannot be null
	private String createdBy;
	
	@Column(name=SqlConstants.COL_NODE_CREATED_ON)
	@Persistent (nullValue = NullValue.EXCEPTION) //cannot be null
	private Long createdOn;
	
	@Column(name=SqlConstants.COL_NODE_MODIFIED_BY)
	@Persistent (nullValue = NullValue.EXCEPTION) //cannot be null
	private String modifiedBy;
	
	@Column(name=SqlConstants.COL_NODE_MODIFIED_ON)
	@Persistent (nullValue = NullValue.EXCEPTION) //cannot be null
	private Long modifiedOn;
	
	// The type is enforced by a Foreign key.
	@Column(name=SqlConstants.COL_NODE_TYPE)
	@Persistent (nullValue = NullValue.EXCEPTION) //cannot be null
	@ForeignKey(name="NODE_TYPE_FK", deleteAction=ForeignKeyAction.RESTRICT)
{'fraction_non_alphanumeric': 0.10537751222161869, 'fraction_numerical': 0.001810610175629187, 'mean_word_length': 6.577503429355281, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1797679', 'n_tokens_mistral': 1858, 'n_tokens_neox': 1739, 'n_words': 358}