<commit_before>/*
 * Copyright 2000-2005 The Apache Software Foundation.
 * 
 * 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.apache.portals.graffito.jcr.persistence.collectionconverter.impl;

import java.util.Map;

import javax.jcr.ItemExistsException;
import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.version.VersionException;

import org.apache.portals.graffito.jcr.exception.JcrMappingException;
import org.apache.portals.graffito.jcr.exception.PersistenceException;
import org.apache.portals.graffito.jcr.mapper.Mapper;
import org.apache.portals.graffito.jcr.mapper.model.CollectionDescriptor;
import org.apache.portals.graffito.jcr.persistence.collectionconverter.CollectionConverter;
import org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection;
import org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter;

/** 
 * Abstract class used for all CollectionConverter
 * 
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'><NAME></a>
 */
public abstract class AbstractCollectionConverterImpl implements CollectionConverter {
    protected Map atomicTypeConverters;
	protected ObjectConverter objectConverter;    
    // NOT USED
    protected Mapper mapper;
    
    /**
     * Constructor
     * 
     * @param atomicTypeConverters The atomic type converter to used
     * @param objectConverter The object converter to used
     * @param mapper The mapper to used
     */
    public AbstractCollectionConverterImpl(Map atomicTypeConverters, 
                                           ObjectConverter objectConverter, 
                                           Mapper mapper) {
    	    this.atomicTypeConverters = atomicTypeConverters;
        this.objectConverter = objectConverter;
        this.mapper = mapper;
    }

    protected abstract void doInsertCollection(Session session,
                                               Node parentNode,
                                               CollectionDescriptor descriptor,
                                               ManageableCollection collection) throws RepositoryException;
    
    protected abstract void doUpdateCollection(Session session,
                                               Node parentNode,
                                               CollectionDescriptor descriptor,
                                               ManageableCollection collection) throws RepositoryException;
    
    protected abstract ManageableCollection  doGetCollection(Session session,
                                                             Node parentNode,
                                                             CollectionDescriptor collectionDescriptor,
                                                             Class collectionFieldClass) throws RepositoryException;
    
   /**
    * @see org.apache.portals.graffito.jcr.persistence.collectionconverter.CollectionConverter#insertCollection(javax.jcr.Session, javax.jcr.Node, org.apache.portals.graffito.jcr.mapper.model.CollectionDescriptor, org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection)
    */
   public void insertCollection(Session session,
                                Node parentNode,
                                CollectionDescriptor collectionDescriptor,<commit_msg>fixed formatting problem organized imports<commit_after>/*
 * Copyright 2000-2005 The Apache Software Foundation.
 * 
 * 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.apache.portals.graffito.jcr.persistence.collectionconverter.impl;

import java.util.Map;

import javax.jcr.ItemExistsException;
import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.version.VersionException;

import org.apache.portals.graffito.jcr.exception.JcrMappingException;
import org.apache.portals.graffito.jcr.exception.PersistenceException;
import org.apache.portals.graffito.jcr.mapper.Mapper;
import org.apache.portals.graffito.jcr.mapper.model.CollectionDescriptor;
import org.apache.portals.graffito.jcr.persistence.collectionconverter.CollectionConverter;
import org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection;
import org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter;

/** 
 * Abstract class used for all CollectionConverter
 * 
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'><NAME></a>
 */
public abstract class AbstractCollectionConverterImpl implements CollectionConverter {
    protected Map atomicTypeConverters;
	protected ObjectConverter objectConverter;    
    // NOT USED
    protected Mapper mapper;
    
    /**
     * Constructor
     * 
     * @param atomicTypeConverters The atomic type converter to used
     * @param objectConverter The object converter to used
     * @param mapper The mapper to used
     */
    public AbstractCollectionConverterImpl(Map atomicTypeConverters, 
                                           ObjectConverter objectConverter, 
                                           Mapper mapper) {
	    this.atomicTypeConverters = atomicTypeConverters;
        this.objectConverter = objectConverter;
        this.mapper = mapper;
    }

    protected abstract void doInsertCollection(Session session,
                                               Node parentNode,
                                               CollectionDescriptor descriptor,
                                               ManageableCollection collection) throws RepositoryException;
    
    protected abstract void doUpdateCollection(Session session,
                                               Node parentNode,
                                               CollectionDescriptor descriptor,
                                               ManageableCollection collection) throws RepositoryException;
    
    protected abstract ManageableCollection  doGetCollection(Session session,
                                                             Node parentNode,
                                                             CollectionDescriptor collectionDescriptor,
                                                             Class collectionFieldClass) throws RepositoryException;
    
   /**
    * @see org.apache.portals.graffito.jcr.persistence.collectionconverter.CollectionConverter#insertCollection(javax.jcr.Session, javax.jcr.Node, org.apache.portals.graffito.jcr.mapper.model.CollectionDescriptor, org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection)
    */
   public void insertCollection(Session session,
                                Node parentNode,
                                CollectionDescriptor collectionDescriptor,
{'fraction_non_alphanumeric': 0.06608738220536042, 'fraction_numerical': 0.0029372169869049075, 'mean_word_length': 2.452471482889734, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 44, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6726534', 'n_tokens_mistral': 1883, 'n_tokens_neox': 1850, 'n_words': 473}