Projects >> jcommune >>35a70573601b3e8d1278885282b328885399768b

Chunk
Conflicting content
<<<<<<< HEAD
/*
 * JTalks for uniting people
 * Copyright (C) 2011  JavaTalks 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.
 *
 * This file creation date: Apr 12, 2011 / 8:05:19 PM
 * The JTalks Project
 * http://www.jtalks.org
 */
package org.jtalks.jcommune.model.dao;

import org.jtalks.jcommune.model.dao.hibernate.TopicHibernateDao;
import org.jtalks.jcommune.model.entity.Topic;

/**
 * DAO for the {@link Topic} objects.
 * Besides the basic CRUD methods it provides a method to load any Topics with associated Posts.
 * @see TopicHibernateDao 
 * @author Pavel Vervenko
 */
public interface TopicDao extends Dao {

    /**
     * Load the Topic with userCreated and related posts.
     * @param id Topic id
     * @return loaded Topic or null if the appropriate topic wasn't found
     */
    Topic getTopicWithPosts(Long id);

    /**
     * Load the Topic with userCreated field initialized. The method doesn't load related posts.
     * @deprecated This method is not needed any more. Use {@link get(id)} instead,
     * it returns Topic with associated User now.
     * @param id Topic id
     * @return the Topic or null if the appropriate topic wasn't found
    
     */
    Topic getTopicWithUser(Long 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.jcommune.model.dao;

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

/**
 * DAO for the {@link Topic} objects.
 * Besides the basic CRUD methods it provides a method to load any Topics with associated Posts.
 * @see TopicHibernateDao 
 * @author Pavel Vervenko
 */
public interface TopicDao extends Dao {

    /**
     * Load the Topic with userCreated and related posts.
     * @param id Topic id
     * @return loaded Topic or null if the appropriate topic wasn't found
     */
    Topic getTopicWithPosts(Long id);

    /**
     * Load the Topic with userCreated field initialized. The method doesn't load related posts.
     * @deprecated This method is not needed any more. Use {@link get(id)} instead,
     * it returns Topic with associated User now.
     * @param id Topic id
     * @return the Topic or null if the appropriate topic wasn't found
    
     */
    Topic getTopicWithUser(Long id);
}
>>>>>>> 739fc5205d59b52d3615d0201a2d3c11087d9048
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.jcommune.model.dao;

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

/**
 * DAO for the {@link Topic} objects.
 * Besides the basic CRUD methods it provides a method to load any Topics with associated Posts.
 * @see TopicHibernateDao 
 * @author Pavel Vervenko
 */
public interface TopicDao extends Dao {

    /**
     * Load the Topic with userCreated and related posts.
     * @param id Topic id
     * @return loaded Topic or null if the appropriate topic wasn't found
     */
    Topic getTopicWithPosts(Long id);

    /**
     * Load the Topic with userCreated field initialized. The method doesn't load related posts.
     * @deprecated This method is not needed any more. Use {@link get(id)} instead,
     * it returns Topic with associated User now.
     * @param id Topic id
     * @return the Topic or null if the appropriate topic wasn't found
    
     */
    Topic getTopicWithUser(Long id);
}
File
TopicDao.java
Developer's decision
Version 2
Kind of conflict
Comment
Import
Interface declaration
Package declaration
Chunk
Conflicting content
<<<<<<< HEAD
/* 
 * JTalks for uniting people
 * Copyright (C) 2011  JavaTalks 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.
 * 
 * This file creation date: Apr 12, 2011 / 8:05:19 PM
 * The JTalks Project
 * http://www.jtalks.org
 */
package org.jtalks.jcommune.model.dao.hibernate;

import org.jtalks.jcommune.model.dao.TopicDao;
import org.jtalks.jcommune.model.entity.Topic;
import java.util.List;
import org.hibernate.Query;

/**
 * Hibernate DAO implementation from the {@link Topic}.
 * 
 * @author Pavel Vervenko
 */
public class TopicHibernateDao extends AbstractHibernateDao implements TopicDao {

    /**
     * Save or update the Topic to the database. 
     * The operation apples cascadely to the associated Posts.
     * @param topic Topic to save
     */
    @Override
    public void saveOrUpdate(Topic topic) {
        getSession().save(topic);
    }

    /**
     * Delete the Topic from the database. 
     * Associated Posts will be also deleted cascadely.
     * @param id The id of the Topic
     */
    @Override
    public void delete(Long id) {
        Query query = getSession().createQuery("delete Topic where id= :topicId");
        query.setLong("topicId", id);
        query.executeUpdate();
    }

    /**
     * Load the topic form the DB by it's id.
     * The associated User created the topic will be loaded too.
     * @param id The id of the Topic
     */
    @Override
    public Topic get(Long id) {
        return (Topic) getSession().get(Topic.class, id);
    }

    /**
     * Load the full list of Topics. 
    /**
     * {@inheritDoc}
     * The topicStarter field will be populated, but related posts will not be loaded.
     * @return the list of Topics
     */
    @Override
    public List getAll() {
        return getSession().createQuery("from Topic").list();
    }

    /**
     * {@inheritDoc}
     * @deprecated This method is not needed any more. Use {@link get(id)} instead,
     * it returns Topic with User now.
     */
    @Override
    public Topic getTopicWithUser(Long id) {
        return get(id);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Topic getTopicWithPosts(Long id) {
        Query query = getSession().getNamedQuery("getTopicWithPosts");
        query.setLong("topicId", id);
        return (Topic) query.uniqueResult();
    }
}
=======
/**
 * 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.hibernate;

import org.jtalks.jcommune.model.dao.TopicDao;
import org.jtalks.jcommune.model.entity.Topic;
import java.util.List;
import org.hibernate.Query;

/**
 * Hibernate DAO implementation from the {@link Topic}.
 * 
 * @author Pavel Vervenko
 */
public class TopicHibernateDao extends AbstractHibernateDao implements TopicDao {

    /**
     * Save or update the Topic to the database. 
     * The operation apples cascadely to the associated Posts.
     * @param topic Topic to save
     */
    @Override
    public void saveOrUpdate(Topic topic) {
        getSession().save(topic);
    }

    /**
     * Delete the Topic from the database. 
     * Associated Posts will be also deleted cascadely.
     * @param id The id of the Topic
     */
    @Override
    public void delete(Long id) {
        Query query = getSession().createQuery("delete Topic where id= :topicId");
        query.setLong("topicId", id);
        query.executeUpdate();
    }

    /**
     * Load the topic form the DB by it's id.
     * The associated User created the topic will be loaded too.
     * @param id The id of the Topic
     * @return loaded Topic
     */
    @Override
    public Topic get(Long id) {
        return (Topic) getSession().get(Topic.class, id);
    }

    /**
     * Load the full list of Topics. 
     * The topicStarter field will be populated, but related posts will not be loaded.
     * @return the list of Topics
     */
    @Override
    public List getAll() {
        return getSession().createQuery("from Topic").list();
    }

     * @deprecated This method is not needed any more. Use {@link get(id)} instead,
     * it returns Topic with User now.
     */
    @Override
    public Topic getTopicWithUser(Long id) {
        return get(id);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Topic getTopicWithPosts(Long id) {
        Query query = getSession().getNamedQuery("getTopicWithPosts");
        query.setLong("topicId", id);
        return (Topic) query.uniqueResult();
    }
}
>>>>>>> 739fc5205d59b52d3615d0201a2d3c11087d9048
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.jcommune.model.dao.hibernate;

import org.jtalks.jcommune.model.dao.TopicDao;
import org.jtalks.jcommune.model.entity.Topic;
import java.util.List;
import org.hibernate.Query;

/**
 * Hibernate DAO implementation from the {@link Topic}.
 * 
 * @author Pavel Vervenko
 */
public class TopicHibernateDao extends AbstractHibernateDao implements TopicDao {

    /**
     * Save or update the Topic to the database. 
     * The operation apples cascadely to the associated Posts.
     * @param topic Topic to save
     */
    @Override
    public void saveOrUpdate(Topic topic) {
        getSession().save(topic);
    }

    /**
     * Delete the Topic from the database. 
     * Associated Posts will be also deleted cascadely.
     * @param id The id of the Topic
     */
    @Override
    public void delete(Long id) {
        Query query = getSession().createQuery("delete Topic where id= :topicId");
        query.setLong("topicId", id);
        query.executeUpdate();
    }

    /**
     * Load the topic form the DB by it's id.
     * The associated User created the topic will be loaded too.
     * @param id The id of the Topic
     * @return loaded Topic
     */
    @Override
    public Topic get(Long id) {
        return (Topic) getSession().get(Topic.class, id);
    }

    /**
     * Load the full list of Topics. 
     * The topicStarter field will be populated, but related posts will not be loaded.
     * @return the list of Topics
     */
    @Override
    public List getAll() {
        return getSession().createQuery("from Topic").list();
    }

    /**
     * {@inheritDoc}
     * @deprecated This method is not needed any more. Use {@link get(id)} instead,
     * it returns Topic with User now.
     */
    @Override
    public Topic getTopicWithUser(Long id) {
        return get(id);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Topic getTopicWithPosts(Long id) {
        Query query = getSession().getNamedQuery("getTopicWithPosts");
        query.setLong("topicId", id);
        return (Topic) query.uniqueResult();
    }
}
File
TopicHibernateDao.java
Developer's decision
Version 2
Kind of conflict
Class declaration
Comment
Import
Package declaration
Chunk
Conflicting content
<<<<<<< HEAD
/* 
 * JTalks for uniting people
 * Copyright (C) 2011  JavaTalks 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.
 * 
 * This file creation date: Apr 12, 2011 / 8:05:19 PM
 * The JTalks Project
 * http://www.jtalks.org
 */
package org.jtalks.jcommune.model.dao.hibernate;

import java.util.List;
import org.hibernate.Query;
import org.jtalks.jcommune.model.dao.UserDao;
import org.jtalks.jcommune.model.entity.User;

/**
 * Hibernate implementation of UserDao.
 * 
 * @author Pavel Vervenko
 */
public class UserHibernateDao extends AbstractHibernateDao implements UserDao {

    /**
     * {@inheritDoc}
     */
    @Override
    public void saveOrUpdate(User user) {
        getSession().save(user);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void delete(Long userId) {
        Query query = getSession().createQuery("delete User where id= :authorId");
        query.setLong("authorId", userId);
        query.executeUpdate();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public User get(Long id) {
        return (User) getSession().load(User.class, id);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List getAll() {
        return getSession().createQuery("from User").list();
    }
}
=======
/**
 * 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.hibernate;

import java.util.List;
import org.hibernate.Query;
import org.jtalks.jcommune.model.dao.UserDao;
import org.jtalks.jcommune.model.entity.User;

/**
 * Hibernate implementation of UserDao.
 * 
 * @author Pavel Vervenko
 */
public class UserHibernateDao extends AbstractHibernateDao implements UserDao {

    /**
     * {@inheritDoc}
     */
    @Override
    public void saveOrUpdate(User user) {
        getSession().save(user);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void delete(Long userId) {
        Query query = getSession().createQuery("delete User where id= :authorId");
        query.setLong("authorId", userId);
        query.executeUpdate();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public User get(Long id) {
        return (User) getSession().load(User.class, id);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List getAll() {
        return getSession().createQuery("from User").list();
    }
}
>>>>>>> 739fc5205d59b52d3615d0201a2d3c11087d9048
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.jcommune.model.dao.hibernate;

import java.util.List;
import org.hibernate.Query;
import org.jtalks.jcommune.model.dao.UserDao;
import org.jtalks.jcommune.model.entity.User;

/**
 * Hibernate implementation of UserDao.
 * 
 * @author Pavel Vervenko
 */
public class UserHibernateDao extends AbstractHibernateDao implements UserDao {

    /**
     * {@inheritDoc}
     */
    @Override
    public void saveOrUpdate(User user) {
        getSession().save(user);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void delete(Long userId) {
        Query query = getSession().createQuery("delete User where id= :authorId");
        query.setLong("authorId", userId);
        query.executeUpdate();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public User get(Long id) {
        return (User) getSession().load(User.class, id);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List getAll() {
        return getSession().createQuery("from User").list();
    }
}
File
UserHibernateDao.java
Developer's decision
Version 2
Kind of conflict
Class declaration
Comment
Import
Package declaration
Chunk
Conflicting content
<<<<<<< HEAD
/* 
 * JTalks for uniting people
 * Copyright (C) 2011  JavaTalks 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.
 * 
 * This file creation date: Apr 12, 2011 / 8:05:19 PM
 * The JTalks Project
 * http://www.jtalks.org
 */
package org.jtalks.jcommune.model.entity;

/**
 * Basic class for persistent objects.
 * 
 * @author Pavel Vervenko
 */
public abstract class Persistent {

    private long id;

    /**
     * Get the primary id of the persistent object.
     * @return the id
     */
    public long getId() {
        return id;
    }

    /**
     * Set the id for the persistent object.
     * @param id id to set
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        Persistent other = (Persistent) obj;
        return id == other.id;
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public int hashCode() {
        int hash = 5;
        hash = 53 * hash + (int) (this.id ^ (this.id >>> 32));
        return hash;
    }
}
=======
/**
 * 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.entity;

/**
 * Basic class for persistent objects.
 * 
 * @author Pavel Vervenko
 */
public abstract class Persistent {

    private long id;

    /**
     * Get the primary id of the persistent object.
     * @return the id
     */
    public long getId() {
        return id;
    }

    /**
     * Set the id for the persistent object.
     * @param id id to set
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        Persistent other = (Persistent) obj;
        return id == other.id;
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public int hashCode() {
        int hash = 5;
        hash = 53 * hash + (int) (this.id ^ (this.id >>> 32));
        return hash;
    }
}
>>>>>>> 739fc5205d59b52d3615d0201a2d3c11087d9048
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.jcommune.model.entity;

/**
 * Basic class for persistent objects.
 * 
 * @author Pavel Vervenko
 */
public abstract class Persistent {

    private long id;

    /**
     * Get the primary id of the persistent object.
     * @return the id
     */
    public long getId() {
        return id;
    }

    /**
     * Set the id for the persistent object.
     * @param id id to set
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        Persistent other = (Persistent) obj;
        return id == other.id;
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public int hashCode() {
        int hash = 5;
        hash = 53 * hash + (int) (this.id ^ (this.id >>> 32));
        return hash;
    }
}
File
Persistent.java
Developer's decision
Version 2
Kind of conflict
Class declaration
Comment
Package declaration
Chunk
Conflicting content
    /**

<<<<<<< HEAD
/* 
 * JTalks for uniting people
 * Copyright (C) 2011  JavaTalks 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.
 * 
 * This file creation date: Apr 12, 2011 / 8:05:19 PM
 * The JTalks Project
 * http://www.jtalks.org
 */
package org.jtalks.jcommune.model.entity;

import org.joda.time.DateTime;

/**
 * Represents the simple version of post of the forum
 * with String content.
* Contains in some {@link Topic}.
* All fields of this object are required and can't be null.
* The topic field will be updated automatically when called Topic.addPost(Post).
* The Post deletes automatically if the parent Topic deleted. * Use the static method Post.createNewPost() to create new post with current creationDate. * @author Pavel Vervenko */ public class Post extends Persistent { /** * Creation date and time */ private DateTime creationDate; private User userCreated; private String postContent; private Topic topic; public Post() { } public Post(DateTime creationDate) { this.creationDate = creationDate; } /** * Creates the new instance with the creationDate initialized with current time. * @return */ public static Post createNewPost() { return new Post(new DateTime()); } /** * @return the postDate */ public DateTime getCreationDate() { return creationDate; } /** * @param postDate the postDate to set */ public void setCreationDate(DateTime postDate) { this.creationDate = postDate; } /** * @return the userCreated */ public User getUserCreated() { return userCreated; } /** * Set the User who create this post. * @param userCreated the userCreated to set */ public void setUserCreated(User userCreated) { this.userCreated = userCreated; } /** * @return the postContent */ public String getPostContent() { return postContent; } /** * @param postContent the postContent to set */ public void setPostContent(String postContent) { this.postContent = postContent; } /** * @return the post */ public Topic getTopic() { return topic; } /** * @param post the post to set */ public void setTopic(Topic topic) { this.topic = topic; } } ======= /** * 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.entity; import org.joda.time.DateTime; /** * Represents the simple version of post of the forum * with String content.
* Contains in some {@link Topic}.
* All fields of this object are required and can't be null.
* The topic field will be updated automatically when called Topic.addPost(Post).
* The Post deletes automatically if the parent Topic deleted. * Use the static method Post.createNewPost() to create new post with current creationDate. * @author Pavel Vervenko */ public class Post extends Persistent { /** * Creation date and time */ private DateTime creationDate; private User userCreated; private String postContent; private Topic topic; /** * Constructs the instance with initialised fields. */ public Post() { } /** * Construct the instance with the specified creation date. * @param creationDate the creation date of the post */ public Post(DateTime creationDate) { this.creationDate = creationDate; } /** * Creates the new instance with the creationDate initialized with current time. * @return new Post instance */ public static Post createNewPost() { return new Post(new DateTime()); } /** * @return the postDate */ public DateTime getCreationDate() { return creationDate; } /** * @param postDate the postDate to set */ public void setCreationDate(DateTime postDate) { this.creationDate = postDate; } /** * @return the userCreated */ public User getUserCreated() { return userCreated; } /** * Set the User who create this post. * @param userCreated the userCreated to set */ public void setUserCreated(User userCreated) { this.userCreated = userCreated; } /** * @return the postContent */ public String getPostContent() { return postContent; } /** * @param postContent the postContent to set */ public void setPostContent(String postContent) { this.postContent = postContent; } /** * @return the topic */ public Topic getTopic() { return topic; } * @param topic the Topic to set */ public void setTopic(Topic topic) { this.topic = topic; } } >>>>>>> 739fc5205d59b52d3615d0201a2d3c11087d9048
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.jcommune.model.entity;

import org.joda.time.DateTime;

/**
 * Represents the simple version of post of the forum
 * with String content.
* Contains in some {@link Topic}.
* All fields of this object are required and can't be null.
* The topic field will be updated automatically when called Topic.addPost(Post).
* The Post deletes automatically if the parent Topic deleted. * Use the static method Post.createNewPost() to create new post with current creationDate. * @author Pavel Vervenko */ public class Post extends Persistent { /** * Creation date and time */ private DateTime creationDate; private User userCreated; private String postContent; private Topic topic; /** * Constructs the instance with initialised fields. */ public Post() { } /** * Construct the instance with the specified creation date. * @param creationDate the creation date of the post */ public Post(DateTime creationDate) { this.creationDate = creationDate; } /** * Creates the new instance with the creationDate initialized with current time. * @return new Post instance */ public static Post createNewPost() { return new Post(new DateTime()); } /** * @return the postDate */ public DateTime getCreationDate() { return creationDate; } /** * @param postDate the postDate to set */ public void setCreationDate(DateTime postDate) { this.creationDate = postDate; } /** * @return the userCreated */ public User getUserCreated() { return userCreated; } /** * Set the User who create this post. * @param userCreated the userCreated to set */ public void setUserCreated(User userCreated) { this.userCreated = userCreated; } /** * @return the postContent */ public String getPostContent() { return postContent; } /** * @param postContent the postContent to set */ public void setPostContent(String postContent) { this.postContent = postContent; } /** * @return the topic */ public Topic getTopic() { return topic; } /** * @param topic the Topic to set */ public void setTopic(Topic topic) { this.topic = topic; } }
File
Post.java
Developer's decision
Version 2
Kind of conflict
Class declaration
Comment
Import
Package declaration
Chunk
Conflicting content
    /**
<<<<<<< HEAD
/* 
 * JTalks for uniting people
 * Copyright (C) 2011  JavaTalks 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.
 * 
 * This file creation date: Apr 12, 2011 / 8:05:19 PM
 * The JTalks Project
 * http://www.jtalks.org
 */
package org.jtalks.jcommune.model.entity;

import java.util.ArrayList;
import java.util.List;
import org.joda.time.DateTime;

/**
 * Represents the topic of the forum.
 * Contains the list of related {@link Post}.
 * All Posts will be cascade deleted with the associated Topic.
 * The fields creationDate, topicStarter and Title are required and can't be null
 * @author Pavel Vervenko
 */
public class Topic extends Persistent {

    /**
     * The creation date of the topic. 
     */
    private DateTime creationDate;
    /**
     * The user who create the topic
     */
    private User topicStarter;
    private String title;
    /**
     * The list of topic's posts
     */
    private List posts = new ArrayList();
    
    public Topic() {
    }
    
    public Topic(DateTime creationDate) {
        this.creationDate = creationDate;
    }
    
    /**
     * Creates a new Topic with the creationDate initialized with current time.
     * @return 
     */
    public static Topic createNewTopic() {
        return new Topic(new DateTime());
    }
    /**
     * Add new {@link Post} to the topic.
     * The method sets Posts.topic field to this Topic.
     * @param newPost 
     */
    public void addPost(Post newPost) {
        posts.add(newPost);
        newPost.setTopic(this);
    }

    /**
     * Remove the post from the topic.
     * @param postToRemove 
     */
    public void removePost(Post postToRemove) {
        posts.remove(postToRemove);
    }

    /**
     * Get the post creation date.
     * @return the creationDate
     */
    public DateTime getCreationDate() {
        return creationDate;
    }

    /**
     * Set the post creation date.
     * @param creationDate the creationDate to set
     */
    public void setCreationDate(DateTime creationDate) {
        this.creationDate = creationDate;
    }

     * Get the user who created the post.
     * @return the userCreated
     */
    public User getTopicStarter() {
        return topicStarter;
    }

    /**
     * The the author of the post.
     * @param userCreated the user who create the post
     */
    public void setTopicStarter(User userCreated) {
        this.topicStarter = userCreated;
    }

    /**
     * Gets the topic name.
     * @return the topicName
     */
    public String getTitle() {
        return title;
    }

    /**
     * Sets the topic title.
     * @param newTitle the title to set
     */
    public void setTitle(String newTitle) {
        this.title = newTitle;
    }

    /**
     * Get the list of the posts.
     * @return the list of posts
     */
    public List getPosts() {
        return posts;
    }

    /**
     * Set the list of posts
     * @param posts the posts to set
     */
    public void setPosts(List posts) {
        this.posts = posts;
    }
 }
=======
/**
 * 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.entity;

import java.util.ArrayList;
import java.util.List;
import org.joda.time.DateTime;

/**
 * Represents the topic of the forum.
 * Contains the list of related {@link Post}.
 * All Posts will be cascade deleted with the associated Topic.
 * The fields creationDate, topicStarter and Title are required and can't be null
 * @author Pavel Vervenko
 */
public class Topic extends Persistent {

    /**
     * The creation date of the topic. 
     */
    private DateTime creationDate;
    /**
     * The user who create the topic
     */
    private User topicStarter;
    private String title;
    /**
     * The list of topic's posts
     */
    private List posts = new ArrayList();

    /**
     * Creates the Topic instance. All fields values are null.
     */
    public Topic() {
    }

    /**
     * Creates the Topic with the specified creation date.
     * @param creationDate the topic's creation date
     */
    public Topic(DateTime creationDate) {
        this.creationDate = creationDate;
    }

    /**
     * Creates a new Topic with the creationDate initialized with current time.
     * @return newly created Topic
     */
    public static Topic createNewTopic() {
        return new Topic(new DateTime());
    }

    /**
     * Add new {@link Post} to the topic.
     * The method sets Posts.topic field to this Topic.
     * @param newPost 
     */
    public void addPost(Post newPost) {
        posts.add(newPost);
        newPost.setTopic(this);
    }

    /**
     * Remove the post from the topic.
     * @param postToRemove 
     */
    public void removePost(Post postToRemove) {
        posts.remove(postToRemove);
    }

    /**
     * Get the post creation date.
     * @return the creationDate
     */
    public DateTime getCreationDate() {
        return creationDate;
    }

    /**
     * Set the post creation date.
     * @param creationDate the creationDate to set
     */
    public void setCreationDate(DateTime creationDate) {
        this.creationDate = creationDate;
    }

    /**
     * Get the user who created the post.
     * @return the userCreated
     */
    public User getTopicStarter() {
        return topicStarter;
    }

    /**
     * The the author of the post.
     * @param userCreated the user who create the post
     */
    public void setTopicStarter(User userCreated) {
        this.topicStarter = userCreated;
    }

    /**
     * Gets the topic name.
     * @return the topicName
     */
    public String getTitle() {
        return title;
    }

    /**
     * Sets the topic title.
     * @param newTitle the title to set
     */
    public void setTitle(String newTitle) {
        this.title = newTitle;
    }

    /**
     * Get the list of the posts.
     * @return the list of posts
     */
    public List getPosts() {
        return posts;
    }

    /**
     * Set the list of posts
     * @param posts the posts to set
     */
    public void setPosts(List posts) {
        this.posts = posts;
    }
}
>>>>>>> 739fc5205d59b52d3615d0201a2d3c11087d9048
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.jcommune.model.entity;

import java.util.ArrayList;
import java.util.List;
import org.joda.time.DateTime;

/**
 * Represents the topic of the forum.
 * Contains the list of related {@link Post}.
 * All Posts will be cascade deleted with the associated Topic.
 * The fields creationDate, topicStarter and Title are required and can't be null
 * @author Pavel Vervenko
 */
public class Topic extends Persistent {

    /**
     * The creation date of the topic. 
     */
    private DateTime creationDate;
    /**
     * The user who create the topic
     */
    private User topicStarter;
    private String title;
    /**
     * The list of topic's posts
     */
    private List posts = new ArrayList();

    /**
     * Creates the Topic instance. All fields values are null.
     */
    public Topic() {
    }

    /**
     * Creates the Topic with the specified creation date.
     * @param creationDate the topic's creation date
     */
    public Topic(DateTime creationDate) {
        this.creationDate = creationDate;
    }

    /**
     * Creates a new Topic with the creationDate initialized with current time.
     * @return newly created Topic
     */
    public static Topic createNewTopic() {
        return new Topic(new DateTime());
    }

    /**
     * Add new {@link Post} to the topic.
     * The method sets Posts.topic field to this Topic.
     * @param newPost 
     */
    public void addPost(Post newPost) {
        posts.add(newPost);
        newPost.setTopic(this);
    }

    /**
     * Remove the post from the topic.
     * @param postToRemove 
     */
    public void removePost(Post postToRemove) {
        posts.remove(postToRemove);
    }

    /**
     * Get the post creation date.
     * @return the creationDate
     */
    public DateTime getCreationDate() {
        return creationDate;
    }

    /**
     * Set the post creation date.
     * @param creationDate the creationDate to set
     */
    public void setCreationDate(DateTime creationDate) {
        this.creationDate = creationDate;
    }

    /**
     * Get the user who created the post.
     * @return the userCreated
     */
    public User getTopicStarter() {
        return topicStarter;
    }

    /**
     * The the author of the post.
     * @param userCreated the user who create the post
     */
    public void setTopicStarter(User userCreated) {
        this.topicStarter = userCreated;
    }

    /**
     * Gets the topic name.
     * @return the topicName
     */
    public String getTitle() {
        return title;
    }

    /**
     * Sets the topic title.
     * @param newTitle the title to set
     */
    public void setTitle(String newTitle) {
        this.title = newTitle;
    }

    /**
     * Get the list of the posts.
     * @return the list of posts
     */
    public List getPosts() {
        return posts;
    }

    /**
     * Set the list of posts
     * @param posts the posts to set
     */
    public void setPosts(List posts) {
        this.posts = posts;
    }
}
File
Topic.java
Developer's decision
Version 2
Kind of conflict
Class declaration
Comment
Import
Package declaration