Projects >> jcommune >>72e0b166b1ab3abc6feceeceed7b789133f1d72d

Chunk
Conflicting content
 * @author Vitaliy Kravchenko
 * @author Pavel Vervenko
 */
<<<<<<< HEAD:jcommune/jcommune-model/src/main/java/org/jtalks/jcommune/model/dao/hibernate/BranchHibernateDao.java
public class BranchHibernateDao extends ParentRepositoryImpl implements BranchDao {
=======
public class BranchHibernateDao extends AbstractHibernateDao implements BranchDao {

>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-model/src/main/java/org/jtalks/poulpe/model/dao/hibernate/BranchHibernateDao.java
    /**
     * {@inheritDoc}
     */
Solution content
 * @author Vitaliy Kravchenko
 * @author Pavel Vervenko
 */
public class BranchHibernateDao extends AbstractHibernateDao implements BranchDao {

    /**
     * {@inheritDoc}
     */
File
BranchHibernateDao.java
Developer's decision
Version 2
Kind of conflict
Other
Chunk
Conflicting content
    /**
 * 
 * @author Pavel Vervenko
 */
<<<<<<< HEAD:jcommune/jcommune-model/src/main/java/org/jtalks/jcommune/model/dao/hibernate/PostHibernateDao.java
public class PostHibernateDao extends AbstractHibernateChildRepository implements PostDao {
=======
public class ComponentHibernateDao extends AbstractHibernateDao implements ComponentDao {
>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-model/src/main/java/org/jtalks/poulpe/model/dao/hibernate/ComponentHibernateDao.java
     * {@inheritDoc}
Solution content
 * 
 * @author Pavel Vervenko
 */
public class ComponentHibernateDao extends AbstractHibernateDao implements ComponentDao {

    /**
     * {@inheritDoc}
File
ComponentHibernateDao.java
Developer's decision
Version 2
Kind of conflict
Class signature
Chunk
Conflicting content
     */
    @Override
    @SuppressWarnings("unchecked")
<<<<<<< HEAD:jcommune/jcommune-model/src/main/java/org/jtalks/jcommune/model/dao/hibernate/PostHibernateDao.java
    public List getPostRangeInTopic(long topicId, int start, int max) {
        return getSession().getNamedQuery("getAllPostsInTopic")
                .setCacheable(true)
                .setLong("topicId", topicId)
                .setFirstResult(start)
                .setMaxResults(max)
                .list();
=======
    public List getAll() {
        return getSession().createQuery("from Component").list();
>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-model/src/main/java/org/jtalks/poulpe/model/dao/hibernate/ComponentHibernateDao.java
    }

    /**
Solution content
     */
    @Override
    @SuppressWarnings("unchecked")
    public List getAll() {
        return getSession().createQuery("from Component").list();
    }

    /**
File
ComponentHibernateDao.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Method signature
Return statement
Chunk
Conflicting content
     * {@inheritDoc}
     */
    @Override
<<<<<<< HEAD:jcommune/jcommune-model/src/main/java/org/jtalks/jcommune/model/dao/hibernate/PostHibernateDao.java
    public int getPostsInTopicCount(long topicId) {
        return ((Number) getSession().createQuery("select count(*) from Post p where p.topic = ?")
                .setCacheable(true).setLong(0, topicId).uniqueResult()).intValue();
=======
    public Set getAvailableTypes() {
        Set result = new LinkedHashSet(Arrays.asList(ComponentType.values()));
        for (Component current : getAll()) {
            result.remove(current.getComponentType());
        }
        return result;
>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-model/src/main/java/org/jtalks/poulpe/model/dao/hibernate/ComponentHibernateDao.java
    }
}
Solution content
     * {@inheritDoc}
     */
    @Override
    public Set getAvailableTypes() {
        Set result = new LinkedHashSet(Arrays.asList(ComponentType.values()));
        for (Component current : getAll()) {
            result.remove(current.getComponentType());
        }
        return result;
    }
}
File
ComponentHibernateDao.java
Developer's decision
Version 2
Kind of conflict
For statement
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
/**
 * Forum branch that contains topics related to branch theme.
 *
<<<<<<< HEAD:jcommune/jcommune-model/src/main/java/org/jtalks/jcommune/model/entity/Branch.java
 * @author Vitaliy Kravchenko
 * @author Kirill Afonin
=======
 * @author Pavel Vervenko
>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-model/src/main/java/org/jtalks/poulpe/model/entity/Branch.java
 */
public class Branch extends Entity {
Solution content
/**
 * Forum branch that contains topics related to branch theme.
 *
 * @author Pavel Vervenko
 */
public class Branch extends Persistent {
File
Branch.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
    private String name;
    private String description;
<<<<<<< HEAD:jcommune/jcommune-model/src/main/java/org/jtalks/jcommune/model/entity/Branch.java
    private List topics = new ArrayList();
=======
    private boolean deleted;
>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-model/src/main/java/org/jtalks/poulpe/model/entity/Branch.java

    /**
     * Set branch name which briefly describes the topics contained in it.
Solution content
    private String name;
    private String description;
    private boolean deleted;

    /**
     * Set branch name which briefly describes the topics contained in it.
File
Branch.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
    }

    /**
<<<<<<< HEAD:jcommune/jcommune-model/src/main/java/org/jtalks/jcommune/model/entity/Branch.java
     * @return list of topics
     */
    protected List getTopics() {
        return topics;
    }

    /**
     * @param topics list of topics
     */
    protected void setTopics(List topics) {
        this.topics = topics;
    }

    /**
     * Add topic to branch.
     *
     * @param topic topic
     */
    public void addTopic(Topic topic) {
        topic.setBranch(this);
        this.topics.add(topic);
    }

    /**
     * Delete topic from branch.
     *
     * @param topic topic
     */
    public void deleteTopic(Topic topic) {
        this.topics.remove(topic);
    }

    /**
     * @return number of topics in branch
     */
    public int topicCount() {
        return topics.size();
=======
     * Check if branch marked is deleted.
     * @return deleted
     */
    public boolean getDeleted() {
        return deleted;
    }

    /**
     * Mark branch as deleted.
     * @param deleted 
     */
    public void setDeleted(boolean deleted) {
        this.deleted = deleted;
>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-model/src/main/java/org/jtalks/poulpe/model/entity/Branch.java
    }
}
Solution content
    }

    /**
     * Check if branch marked is deleted.
     * @return deleted
     */
    public boolean getDeleted() {
        return deleted;
    }

    /**
     * Mark branch as deleted.
     * @param deleted 
     */
    public void setDeleted(boolean deleted) {
        this.deleted = deleted;
    }
}
File
Branch.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
Method declaration
Method invocation
Method signature
Return statement
Chunk
Conflicting content
import org.jtalks.poulpe.model.dao.BranchDao;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
<<<<<<< HEAD:jcommune/jcommune-model/src/test/java/org/jtalks/jcommune/model/dao/hibernate/BranchHibernateDaoTest.java
import org.jtalks.jcommune.model.dao.BranchDao;
import org.jtalks.jcommune.model.entity.Branch;
import org.jtalks.jcommune.model.entity.Post;
import org.jtalks.jcommune.model.entity.Topic;
import org.jtalks.jcommune.model.entity.User;
=======

>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-model/src/test/java/org/jtalks/poulpe/model/dao/hibernate/BranchHibernateDaoTest.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.test.context.ContextConfiguration;
Solution content
import org.jtalks.poulpe.model.dao.BranchDao;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.test.context.ContextConfiguration;
File
BranchHibernateDaoTest.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
 * License as published by the Free Software Foundation; either
<<<<<<< HEAD:jcommune/jcommune-model/src/main/java/org/jtalks/jcommune/model/dao/TopicDao.java
/**
 * Copyright (C) 2011  jtalks.org Team
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * Also add information on how to contact you by electronic and paper mail.
 * Creation date: Apr 12, 2011 / 8:05:19 PM
 * The jtalks.org Project
 */
package org.jtalks.jcommune.model.dao;

import org.jtalks.jcommune.model.entity.Topic;

import java.util.List;

/**
 * DAO for the {@link Topic} objects.
 * Besides the basic CRUD methods it provides a method to load any Topics with associated Posts.
 *
 * @author Pavel Vervenko
 * @author Kirill Afonin
 * @author Vitaliy Kravchenko
 * @see org.jtalks.jcommune.model.dao.hibernate.TopicHibernateDao
 */
public interface TopicDao extends ChildRepository {

    /**
     * Get posts range from branch.
     *
     * @param branchId branch id from which we obtain topics
     * @param start    start index of topic
     * @param max      number of topics
     * @return list of {@code Topic} objects with size {@code max}
     */
    List getTopicRangeInBranch(Long branchId, int start, int max);

    /**
     * Get number of topics in branch.
     *
     * @param branchId branch id where you have to count topics
     * @return number of topics in branch
     */
    int getTopicsInBranchCount(long branchId);
}
=======
/**
 * Copyright (C) 2011  jtalks.org Team
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * Also add information on how to contact you by electronic and paper mail.
 * Creation date: Apr 12, 2011 / 8:05:19 PM
 * The jtalks.org Project
 */
package org.jtalks.poulpe.service;

import org.jtalks.poulpe.service.exceptions.NotUniqueException;
import org.jtalks.poulpe.model.entity.Branch;

import java.util.List;

/**
 * @author Vitaliy Kravchenko
 * @author Kirill Afonin
 */
public interface BranchService extends EntityService {

    /**
     * Get list of all persistence objects T currently present in database.
     *
     * @return - list of persistence objects T.
     */
    List getAll();

    /**
     * Mark the branch as deleted.
     * @param selectedBranch branch to delete
     */
    void deleteBranch(Branch selectedBranch);

    /**
     * Save or update branch.
     * @param selectedBranch instance to save
     * @throws NotUniqueException if branch with the same name already exists
     */
    void saveBranch(Branch selectedBranch) throws NotUniqueException;
    
    /**
     * Check if branch with given name exists.
     * @param branchName
     * @return true if exists
     */
    boolean isBranchNameExists(String branchName);
}
>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-service/src/main/java/org/jtalks/poulpe/service/BranchService.java
Solution content
/**
 * Copyright (C) 2011  jtalks.org Team
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * Also add information on how to contact you by electronic and paper mail.
 * Creation date: Apr 12, 2011 / 8:05:19 PM
 * The jtalks.org Project
 */
package org.jtalks.poulpe.service;

import org.jtalks.poulpe.service.exceptions.NotUniqueException;
import org.jtalks.poulpe.model.entity.Branch;

import java.util.List;

/**
 * @author Vitaliy Kravchenko
 * @author Kirill Afonin
 */
public interface BranchService extends EntityService {

    /**
     * Get list of all persistence objects T currently present in database.
     *
     * @return - list of persistence objects T.
     */
    List getAll();

    /**
     * Mark the branch as deleted.
     * @param selectedBranch branch to delete
     */
    void deleteBranch(Branch selectedBranch);

    /**
     * Save or update branch.
     * @param selectedBranch instance to save
     * @throws NotUniqueException if branch with the same name already exists
     */
    void saveBranch(Branch selectedBranch) throws NotUniqueException;
    
    /**
     * Check if branch with given name exists.
     * @param branchName
     * @return true if exists
     */
    boolean isBranchNameExists(String branchName);
}
File
BranchService.java
Developer's decision
Version 2
Kind of conflict
Comment
Import
Interface declaration
Method interface
Package declaration
Chunk
Conflicting content
}
    T get(Long id) throws NotFoundException;
<<<<<<< HEAD:jcommune/jcommune-service/src/main/java/org/jtalks/jcommune/service/EntityService.java
/**
 * Copyright (C) 2011  jtalks.org Team
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * Also add information on how to contact you by electronic and paper mail.
 * Creation date: Apr 12, 2011 / 8:05:19 PM
 * The jtalks.org Project
 */
package org.jtalks.jcommune.service;

import org.jtalks.jcommune.model.entity.Entity;
import org.jtalks.jcommune.service.exceptions.NotFoundException;

/**
 * This is generic interface for services which would interact with database entities via DAO object.
 * This interface include all base method declaration which straightly based on database CRUD operations.
 *
 * @author Osadchuck Eugeny
 * @author Kirill Afonin
 */
public interface EntityService {

    /**
     * Get persistent object by id. Method is trying to find persistent object with current primary id and return it.
     *
     * @param id primary id of persistent object to find, id could not be negative.
     *           If negative id value will be put IllegalAgrumentEception will be thrown.
     * @return persistent object T or null if row with primary id = id is absent.
     * @throws org.jtalks.jcommune.service.exceptions.NotFoundException
     *          when entity not found
     */
    T get(Long id) throws NotFoundException;

}
=======
/**
 * Copyright (C) 2011  jtalks.org Team
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * Also add information on how to contact you by electronic and paper mail.
 * Creation date: Apr 12, 2011 / 8:05:19 PM
 * The jtalks.org Project
 */
package org.jtalks.poulpe.service;

import org.jtalks.poulpe.model.entity.Persistent;
import org.jtalks.poulpe.service.exceptions.NotFoundException;

/**
 * This is generic interface for services which would interact with database entities via DAO object.
 * This interface include all base method declaration which straightly based on database CRUD operations.
 *
 * @author Osadchuck Eugeny
 * @author Kirill Afonin
 */
public interface EntityService {

    /**
     * Get persistent object by id. Method is trying to find persistent object with current primary id and return it.
     *
     * @param id primary id of persistent object to find, id could not be negative.
     *           If negative id value will be put IllegalAgrumentEception will be thrown.
     * @return persistent object T or null if row with primary id = id is absent.
     * @throws org.jtalks.poulpe.service.exceptions.NotFoundException
     *          when entity not found
     */

>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-service/src/main/java/org/jtalks/poulpe/service/EntityService.java
Solution content
/**
 * Copyright (C) 2011  jtalks.org Team
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * Also add information on how to contact you by electronic and paper mail.
 * Creation date: Apr 12, 2011 / 8:05:19 PM
 * The jtalks.org Project
 */
package org.jtalks.poulpe.service;

import org.jtalks.poulpe.model.entity.Persistent;
import org.jtalks.poulpe.service.exceptions.NotFoundException;

/**
 * This is generic interface for services which would interact with database entities via DAO object.
 * This interface include all base method declaration which straightly based on database CRUD operations.
 *
 * @author Osadchuck Eugeny
 * @author Kirill Afonin
 */
public interface EntityService {

    /**
     * Get persistent object by id. Method is trying to find persistent object with current primary id and return it.
     *
     * @param id primary id of persistent object to find, id could not be negative.
     *           If negative id value will be put IllegalAgrumentEception will be thrown.
     * @return persistent object T or null if row with primary id = id is absent.
     * @throws org.jtalks.poulpe.service.exceptions.NotFoundException
     *          when entity not found
     */
    T get(Long id) throws NotFoundException;

}
File
EntityService.java
Developer's decision
Version 2
Kind of conflict
Comment
Import
Interface declaration
Package declaration
Chunk
Conflicting content
     * ChildRepository object implementation.
     * {@inheritDoc}
     */
<<<<<<< HEAD:jcommune/jcommune-service/src/main/java/org/jtalks/jcommune/service/transactional/AbstractTransactionalEntityService.java
/**
 * Copyright (C) 2011  jtalks.org Team
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * Also add information on how to contact you by electronic and paper mail.
 * Creation date: Apr 12, 2011 / 8:05:19 PM
 * The jtalks.org Project
 */
package org.jtalks.jcommune.service.transactional;

import org.jtalks.jcommune.model.dao.ChildRepository;
import org.jtalks.jcommune.model.entity.Entity;
import org.jtalks.jcommune.service.EntityService;
import org.jtalks.jcommune.service.exceptions.NotFoundException;

/**
 * Generic implementation of all entity based services.
 * Most of the implementations of the methods are basing on straightforward calls
 * of the same named method from DAO interface.
 *
 * @author Osadchuck Eugeny
 * @author Kirill Afonin
 */
public abstract class AbstractTransactionalEntityService
        implements EntityService {
    /**
    protected Y dao;

    /**
     * {@inheritDoc}
     */
    @Override
    public T get(Long id) throws NotFoundException {
        if (!dao.isExist(id)) {
            throw new NotFoundException("Entity with id: " + id + " not found");
        }
        return (T) dao.get(id);
    }
}
=======
/**
 * Copyright (C) 2011  jtalks.org Team
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * Also add information on how to contact you by electronic and paper mail.
 * Creation date: Apr 12, 2011 / 8:05:19 PM
 * The jtalks.org Project
 */
package org.jtalks.poulpe.service.transactional;

import org.jtalks.poulpe.model.dao.Dao;
import org.jtalks.poulpe.model.entity.Persistent;
import org.jtalks.poulpe.service.EntityService;
import org.jtalks.poulpe.service.exceptions.NotFoundException;

/**
 * Generic implementation of all entity based services.
 * Most of the implementations of the methods are basing on straightforward calls
 * of the same named method from DAO interface.
 *
 * @author Osadchuck Eugeny
 * @author Kirill Afonin
 */
public abstract class AbstractTransactionalEntityService>
        implements EntityService {
    /**
     * Dao object implementation.
     */
    protected Y dao;

    /**
     */
    @Override
    public T get(Long id) throws NotFoundException {
        if (!dao.isExist(id)) {
            throw new NotFoundException("Entity with id: " + id + " not found");
        }
        return (T) dao.get(id);
    }
    
    /**
     * Set the DAO.
     * 
     * @param dao Data Access Object
     */
    public void setDao(Y dao) {
		this.dao = dao;
	}
    
}
>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-service/src/main/java/org/jtalks/poulpe/service/transactional/AbstractTransactionalEntityService.java
Solution content
/**
 * Copyright (C) 2011  jtalks.org Team
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * Also add information on how to contact you by electronic and paper mail.
 * Creation date: Apr 12, 2011 / 8:05:19 PM
 * The jtalks.org Project
 */
package org.jtalks.poulpe.service.transactional;

import org.jtalks.poulpe.model.dao.Dao;
import org.jtalks.poulpe.model.entity.Persistent;
import org.jtalks.poulpe.service.EntityService;
import org.jtalks.poulpe.service.exceptions.NotFoundException;

/**
 * Generic implementation of all entity based services.
 * Most of the implementations of the methods are basing on straightforward calls
 * of the same named method from DAO interface.
 *
 * @author Osadchuck Eugeny
 * @author Kirill Afonin
 */
public abstract class AbstractTransactionalEntityService>
        implements EntityService {
    /**
     * Dao object implementation.
     */
    protected Y dao;

    /**
     * {@inheritDoc}
     */
    @Override
    public T get(Long id) throws NotFoundException {
        if (!dao.isExist(id)) {
            throw new NotFoundException("Entity with id: " + id + " not found");
        }
        return (T) dao.get(id);
    }
    
    /**
     * Set the DAO.
     * 
     * @param dao Data Access Object
     */
    public void setDao(Y dao) {
		this.dao = dao;
	}
    
}
File
AbstractTransactionalEntityService.java
Developer's decision
Version 2
Kind of conflict
Class declaration
Comment
Import
Package declaration
Chunk
Conflicting content
 *
 * @author Pavel Vervenko
 */
<<<<<<< HEAD:jcommune/jcommune-model/src/main/java/org/jtalks/jcommune/model/dao/hibernate/UserHibernateDao.java
public class UserHibernateDao extends ParentRepositoryImpl implements UserDao {
=======
public class TransactionalComponentService extends AbstractTransactionalEntityService
        implements ComponentService {

    /**
     * Create new instance of the service.
     * @param dao need it for CRUD operations
     */
    public TransactionalComponentService(ComponentDao dao) {
        this.dao = dao;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List getAll() {
        return dao.getAll();
    }

>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-service/src/main/java/org/jtalks/poulpe/service/transactional/TransactionalComponentService.java
    /**
     * {@inheritDoc}
     */
Solution content
 *
 * @author Pavel Vervenko
 */
public class TransactionalComponentService extends AbstractTransactionalEntityService
        implements ComponentService {

    /**
     * Create new instance of the service.
     * @param dao need it for CRUD operations
     */
    public TransactionalComponentService(ComponentDao dao) {
        this.dao = dao;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List getAll() {
        return dao.getAll();
    }

    /**
     * {@inheritDoc}
     */
File
TransactionalComponentService.java
Developer's decision
Version 2
Kind of conflict
Annotation
Class signature
Comment
Method declaration
Chunk
Conflicting content
     * {@inheritDoc}
     */
    @Override
<<<<<<< HEAD:jcommune/jcommune-model/src/main/java/org/jtalks/jcommune/model/dao/hibernate/UserHibernateDao.java
    public User getByUsername(String username) {
        return (User) getSession()
                .createQuery("from User u where u.username = ?")
                .setCacheable(true)
                .setString(0, username)
                .uniqueResult();
=======
    public void deleteComponent(Component component) {
        dao.delete(component.getId());
>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-service/src/main/java/org/jtalks/poulpe/service/transactional/TransactionalComponentService.java
    }

    /**
Solution content
     * {@inheritDoc}
     */
    @Override
    public void deleteComponent(Component component) {
        dao.delete(component.getId());
    }

    /**
File
TransactionalComponentService.java
Developer's decision
Version 2
Kind of conflict
Cast expression
Method invocation
Method signature
Return statement
Chunk
Conflicting content
     * {@inheritDoc}
     */
    @Override
<<<<<<< HEAD:jcommune/jcommune-model/src/main/java/org/jtalks/jcommune/model/dao/hibernate/UserHibernateDao.java
    public User getByEncodedUsername(String encodedUsername) {
        return (User) getSession()
                .createQuery("from User u where u.encodedUsername = ?")
                .setCacheable(true)
                .setString(0, encodedUsername)
                .uniqueResult();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isUserWithUsernameExist(String username) {
        return ((Number) getSession()
                .createQuery("select count(*) from User u where u.username = ?")
                .setCacheable(true)
                .setString(0, username)
                .uniqueResult()).intValue() != 0;
=======
    public void saveComponent(Component component) {
        dao.saveOrUpdate(component);
>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-service/src/main/java/org/jtalks/poulpe/service/transactional/TransactionalComponentService.java
    }

    /**
Solution content
     * {@inheritDoc}
     */
    @Override
    public void saveComponent(Component component) {
        dao.saveOrUpdate(component);
    }

    /**
File
TransactionalComponentService.java
Developer's decision
Version 2
Kind of conflict
Annotation
Comment
Method declaration
Method invocation
Method signature
Return statement
Chunk
Conflicting content
     * {@inheritDoc}
     */
    @Override
<<<<<<< HEAD:jcommune/jcommune-model/src/main/java/org/jtalks/jcommune/model/dao/hibernate/UserHibernateDao.java
    public boolean isUserWithEmailExist(String email) {
        return ((Number) getSession()
                .createQuery("select count(*) from User u where u.email = ?")
                .setCacheable(true)
                .setString(0, email)
                .uniqueResult()).intValue() != 0;
=======
    public Set getAvailableTypes() {
        return dao.getAvailableTypes();
>>>>>>> 7d95ab1c278958efbd5dd67028d5546a63996d02:poulpe/poulpe-service/src/main/java/org/jtalks/poulpe/service/transactional/TransactionalComponentService.java
    }
}
Solution content
     * {@inheritDoc}
     */
    @Override
    public Set getAvailableTypes() {
        return dao.getAvailableTypes();
    }
}
File
TransactionalComponentService.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Method signature
Return statement