<commit_before>/**
 * Copyright (C) <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jcrom.dao;

import java.util.List;

/**
 * The base interface for JCR Data Access Objects.
 * Normally, the interface will be implemented for each root object being
 * mapped to a Java Content Repository (JCR).
 * It is intended that such implementations will manage the JCR root path
 * for the entity being mapped. JCR session strategy is also to be 
 * declared by implementations.
 * <br/><br/>
 * Implementations should encapsulate exceptions in JcrMappingException, which
 * is a RuntimeException.
 * 
 * @author <NAME>
 */
public interface JcrDAO<T> {
	
	/**
	 * Creates a new JCR Node from the object supplied.
	 * The path to the parent node will be retrieved from the entity path.
	 * A path of "/" means that the entity will be created on root level.
	 * 
	 * @param entity the object to be mapped to a JCR node
	 * @return the newly created Object
	 */
	public T create( T entity );
	
	/**
	 * Creates a new JCR Node from the object supplied, under the parent
	 * node with the path specified.
	 * 
	 * @param parentNodePath path to the parent node
	 * @param entity the object to be mapped to a JCR node
	 * @return the newly created Object
	 */
	public T create( String parentNodePath, T entity );
	
	/**
	 * Updates an existing JCR Node with the values extracted
	 * from the object supplied.
	 * 
	 * @param entity the object to be mapped to a JCR node
	 * @return the name of the JCR Node that was updated
	 */
	public String update( T entity );
		
	/**
	 * Updates an existing JCR Node with the values extracted
	 * from the object supplied.
	 * 
	 * @param entity the object to be mapped to a JCR node
	 * @param childNameFilter comma separated list of names of child nodes to 
	 * load ("*" loads all, "none" loads no children, and "-" at the beginning
	 * makes it an exclusion filter)
	 * @param maxDepth the maximum depth of loaded child nodes (0 means no 
	 * child nodes are loaded, while a negative value means that no 
	 * restrictions are set on the depth).
	 * @return the name of the JCR Node that was updated
	 */
	public String update( T entity, String childNameFilter, int maxDepth );
	
	/**
	 * Updates an existing JCR Node with the values extracted
	 * from the object supplied. The node to update is loaded using the 
	 * UUID supplied.
	 * 
	 * @param entity the object to be mapped to a JCR node
	 * @param uuid the JCR UUID of the node to update
	 * @return the name of the node that was updated
	 */
	public String updateByUUID( T entity, String uuid );
	
	/**
	 * Updates an existing JCR Node with the values extracted
	 * from the object supplied. The node to update is loaded using the
	 * UUID supplied.
	 * 
	 * @param entity the object to be mapped to a JCR node
	 * @param uuid the UUID of the node to update
	 * @param childNameFilter comma separated list of names of child nodes to 
	 * load ("*" loads all, "none" loads no children, and "-" at the beginning
	 * makes it an exclusion filter)
	 * @param maxDepth the maximum depth of loaded child nodes (0 means no 
	 * child nodes are loaded, while a negative value means that no 
	 * restrictions are set on the depth).
	 * @return the name of the JCR Node that was updated
	 */
	public String updateByUUID( T entity, String uuid, String childNameFilter, int maxDepth );
    
    public void move( T entity, String newParentPath );
		
	/**
	 * Permanently remove the entity with the path supplied 
	 * (from a @JcrPath field).
	 * 
	 * @param path the full path of the entity
	 */
	public void remove( String path );
	
	/**
	 * Permanently remove the entity with the UUID supplied.
	 * 
	 * @param uuid the JCR UUID of the entity
	 */
	public void removeByUUID( String uuid );

	/**
	 * Check whether an entity with the path supplied exists in JCR.
	 * 
	 * @param path the path of the entity
	 * @return true if the entity exists, else false
	 */
	public boolean exists( String path );<commit_msg>added javadoc<commit_after>/**
 * Copyright (C) <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jcrom.dao;

import java.util.List;

/**
 * The base interface for JCR Data Access Objects.
 * Normally, the interface will be implemented for each root object being
 * mapped to a Java Content Repository (JCR).
 * It is intended that such implementations will manage the JCR root path
 * for the entity being mapped. JCR session strategy is also to be 
 * declared by implementations.
 * <br/><br/>
 * Implementations should encapsulate exceptions in JcrMappingException, which
 * is a RuntimeException.
 * 
 * @author <NAME>
 */
public interface JcrDAO<T> {
	
	/**
	 * Creates a new JCR Node from the object supplied.
	 * The path to the parent node will be retrieved from the entity path.
	 * A path of "/" means that the entity will be created on root level.
	 * 
	 * @param entity the object to be mapped to a JCR node
	 * @return the newly created Object
	 */
	public T create( T entity );
	
	/**
	 * Creates a new JCR Node from the object supplied, under the parent
	 * node with the path specified.
	 * 
	 * @param parentNodePath path to the parent node
	 * @param entity the object to be mapped to a JCR node
	 * @return the newly created Object
	 */
	public T create( String parentNodePath, T entity );
	
	/**
	 * Updates an existing JCR Node with the values extracted
	 * from the object supplied.
	 * 
	 * @param entity the object to be mapped to a JCR node
	 * @return the name of the JCR Node that was updated
	 */
	public String update( T entity );
		
	/**
	 * Updates an existing JCR Node with the values extracted
	 * from the object supplied.
	 * 
	 * @param entity the object to be mapped to a JCR node
	 * @param childNameFilter comma separated list of names of child nodes to 
	 * load ("*" loads all, "none" loads no children, and "-" at the beginning
	 * makes it an exclusion filter)
	 * @param maxDepth the maximum depth of loaded child nodes (0 means no 
	 * child nodes are loaded, while a negative value means that no 
	 * restrictions are set on the depth).
	 * @return the name of the JCR Node that was updated
	 */
	public String update( T entity, String childNameFilter, int maxDepth );
	
	/**
	 * Updates an existing JCR Node with the values extracted
	 * from the object supplied. The node to update is loaded using the 
	 * UUID supplied.
	 * 
	 * @param entity the object to be mapped to a JCR node
	 * @param uuid the JCR UUID of the node to update
	 * @return the name of the node that was updated
	 */
	public String updateByUUID( T entity, String uuid );
	
	/**
	 * Updates an existing JCR Node with the values extracted
	 * from the object supplied. The node to update is loaded using the
	 * UUID supplied.
	 * 
	 * @param entity the object to be mapped to a JCR node
	 * @param uuid the UUID of the node to update
	 * @param childNameFilter comma separated list of names of child nodes to 
	 * load ("*" loads all, "none" loads no children, and "-" at the beginning
	 * makes it an exclusion filter)
	 * @param maxDepth the maximum depth of loaded child nodes (0 means no 
	 * child nodes are loaded, while a negative value means that no 
	 * restrictions are set on the depth).
	 * @return the name of the JCR Node that was updated
	 */
	public String updateByUUID( T entity, String uuid, String childNameFilter, int maxDepth );
    
    /**
     * Move an entity to the parent with the path specified.
     * Handles checkout and checkin for mix:versionable parents.
     * 
     * @param entity
     * @param newParentPath
     */
    public void move( T entity, String newParentPath );
		
	/**
	 * Permanently remove the entity with the path supplied 
	 * (from a @JcrPath field).
	 * 
	 * @param path the full path of the entity
	 */
	public void remove( String path );
	
	/**
	 * Permanently remove the entity with the UUID supplied.
	 * 
	 * @param uuid the JCR UUID of the entity
	 */
	public void removeByUUID( String uuid );

	/**
	 * Check whether an entity with the path supplied exists in JCR.
	 * 
	 * @param path the path of the entity
	 * @return true if the entity exists, else false
	 */
	public boolean exists( String path );
{'fraction_non_alphanumeric': 0.06884961509270303, 'fraction_numerical': 0.0013010950883660414, 'mean_word_length': 3.171867933061963, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6336211', 'n_tokens_mistral': 2578, 'n_tokens_neox': 2363, 'n_words': 1342}