Projects >> guvnor >>6fbccef80550389768c570021ecdd66e6c2ee07a

Chunk
Conflicting content
package org.drools.repository;

<<<<<<< HEAD
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import javax.annotation.PreDestroy;
import javax.jcr.ImportUUIDBehavior;
import javax.jcr.InvalidItemStateException;
import javax.jcr.ItemExistsException;
import javax.jcr.ItemNotFoundException;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.PathNotFoundException;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.query.Query;
import javax.jcr.query.QueryResult;

=======
>>>>>>> 3c461ad2ee0e28f86952981f213e7dec96ed4f32
import org.drools.repository.events.StorageEventManager;
import org.drools.repository.migration.MigrateDroolsPackage;
import org.drools.repository.utils.NodeUtils;
Solution content
package org.drools.repository;

import org.drools.repository.events.StorageEventManager;
import org.drools.repository.migration.MigrateDroolsPackage;
import org.drools.repository.utils.NodeUtils;
File
RulesRepository.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.drools.repository.RulesRepository;
import org.jboss.seam.solder.beanManager.BeanManagerLocator;

<<<<<<< HEAD
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;

=======
>>>>>>> 3c461ad2ee0e28f86952981f213e7dec96ed4f32
public class ConfigurationServiceImplementation
        extends RemoteServiceServlet
        implements ConfigurationService {
Solution content
import org.drools.repository.RulesRepository;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;

public class ConfigurationServiceImplementation
        extends RemoteServiceServlet
        implements ConfigurationService {
File
ConfigurationServiceImplementation.java
Developer's decision
Combination
Kind of conflict
Import
Chunk
Conflicting content
        extends RemoteServiceServlet
        implements ConfigurationService {

<<<<<<< HEAD
    private final ServiceSecurity serviceSecurity = new ServiceSecurity();

    @Inject
    private RulesRepository repository;

    public String save(IFramePerspectiveConfiguration configuration) {
        serviceSecurity.checkSecurityIsAdmin();

        if (isNewConfiguration(configuration)) {
            IFramePerspectiveConfigurationItem perspectiveConfigurationItem = repository.createPerspectivesConfiguration(configuration.getName(), configuration.getUrl());
            return perspectiveConfigurationItem.getUuid();
        } else {
            String uuid = configuration.getUuid();
            IFramePerspectiveConfigurationItem perspectiveConfigurationItem = repository.loadPerspectivesConfiguration(uuid);
            perspectiveConfigurationItem.setName(configuration.getName());
            perspectiveConfigurationItem.setUrl(configuration.getUrl());
            repository.save();
            return uuid;
        }
    }

    private boolean isNewConfiguration(IFramePerspectiveConfiguration configuration) {
        return configuration.getUuid() == null;
    }

    public IFramePerspectiveConfiguration load(String uuid) throws SerializationException {
        serviceSecurity.checkSecurityIsAdmin();

        validateUuid(uuid);

        IFramePerspectiveConfigurationItem perspectiveConfigurationItem = repository.loadPerspectivesConfiguration(uuid);

        return prepareResult(perspectiveConfigurationItem);
    }

    public Collection loadPerspectiveConfigurations() {
        Collection perspectiveConfigurationItems = repository.listPerspectiveConfigurations();
        Collection result = new ArrayList(perspectiveConfigurationItems.size());
        for (IFramePerspectiveConfigurationItem perspectiveConfigurationItem : perspectiveConfigurationItems) {
            result.add(configurationItemToConfiguration(perspectiveConfigurationItem));
        }

        return result;
    }

    public void remove(String uuid) {
        serviceSecurity.checkSecurityIsAdmin();
        IFramePerspectiveConfigurationItem perspectiveConfigurationItem = repository.loadPerspectivesConfiguration(uuid);
        perspectiveConfigurationItem.remove();
        repository.save();
    }

=======
>>>>>>> 3c461ad2ee0e28f86952981f213e7dec96ed4f32
    public Map loadPreferences() {
        Map preferences = ApplicationPreferencesLoader.load();
        ApplicationPreferencesInitializer.setSystemProperties(preferences);
Solution content
        extends RemoteServiceServlet
        implements ConfigurationService {
    
    @Inject
    private RulesRepository repository;

    public Map loadPreferences() {
        Map preferences = ApplicationPreferencesLoader.load();
        ApplicationPreferencesInitializer.setSystemProperties(preferences);
File
ConfigurationServiceImplementation.java
Developer's decision
Combination
Kind of conflict
Annotation
Attribute
Method declaration
Method invocation
Chunk
Conflicting content
        return preferences;
    }

<<<<<<< HEAD
    private IFramePerspectiveConfiguration prepareResult(IFramePerspectiveConfigurationItem perspectiveConfigurationItem) {
        if (perspectiveConfigurationItem == null) {
            return null;
        } else {
            return configurationItemToConfiguration(perspectiveConfigurationItem);
        }
    }

    private void validateUuid(String uuid) throws SerializationException {
        if (uuid == null) {
            throw new SerializationException("Invalid parameter: Uuid for the perspective was null");
        }
    }

//    protected RulesRepository getRepository() {
//        BeanManager beanManager = (BeanManager) getServletContext()
//                .getAttribute("org.jboss.weld.environment.servlet.javax.enterprise.inject.spi.BeanManager");
//        return (RulesRepository) beanManager.getBeans("repository").iterator().next();
//        BeanManagerLocator beanManagerLocator = new BeanManagerLocator();
//        if (beanManagerLocator.isBeanManagerAvailable()) {
//            return (RulesRepository) BeanManagerUtils.getInstance("repository");
//        } else {
//            try {
//                return new RulesRepository(TestEnvironmentSessionHelper.getSession(false));
//            } catch (Exception e) {
//                throw new IllegalStateException("Unable to get repo to run tests", e);
//            }
//
//        }
//    }

    private IFramePerspectiveConfiguration configurationItemToConfiguration(IFramePerspectiveConfigurationItem perspectiveConfigurationItem) {
        IFramePerspectiveConfiguration configuration = new IFramePerspectiveConfiguration();
        configuration.setUuid(perspectiveConfigurationItem.getUuid());
        configuration.setName(perspectiveConfigurationItem.getName());
        configuration.setUrl(perspectiveConfigurationItem.getUrl());
        return configuration;
    }
=======
    protected RulesRepository getRepository() {
        if (Contexts.isApplicationContextActive()) {
            return (RulesRepository) Component.getInstance("repository");
        } else {
            try {
                return new RulesRepository(TestEnvironmentSessionHelper.getSession(false));
            } catch (Exception e) {
                throw new IllegalStateException("Unable to get repo to run tests", e);
            }

        }
    }
>>>>>>> 3c461ad2ee0e28f86952981f213e7dec96ed4f32
}
Solution content
        return preferences;
    }

//    protected RulesRepository getRepository() {
//        BeanManager beanManager = (BeanManager) getServletContext()
//                .getAttribute("org.jboss.weld.environment.servlet.javax.enterprise.inject.spi.BeanManager");
//        return (RulesRepository) beanManager.getBeans("repository").iterator().next();
//        BeanManagerLocator beanManagerLocator = new BeanManagerLocator();
//        if (beanManagerLocator.isBeanManagerAvailable()) {
//            return (RulesRepository) BeanManagerUtils.getInstance("repository");
//        } else {
//            try {
//                return new RulesRepository(TestEnvironmentSessionHelper.getSession(false));
//            } catch (Exception e) {
//                throw new IllegalStateException("Unable to get repo to run tests", e);
//            }
//
//        }
//    }

}
File
ConfigurationServiceImplementation.java
Developer's decision
Combination
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
import org.drools.guvnor.server.contenthandler.IRuleAsset;
import org.drools.guvnor.server.repository.MailboxService;
import org.drools.guvnor.server.security.RoleType;
<<<<<<< HEAD
import org.drools.guvnor.server.util.AssetEditorConfiguration;
import org.drools.guvnor.server.util.AssetEditorConfigurationParser;
import org.drools.guvnor.server.util.AssetFormatHelper;
import org.drools.guvnor.server.util.AssetLockManager;
import org.drools.guvnor.server.util.Discussion;
import org.drools.guvnor.server.util.LoggingHelper;
import org.drools.guvnor.server.util.MetaDataMapper;
import org.drools.guvnor.server.util.TableDisplayHandler;
import org.drools.repository.AssetItem;
import org.drools.repository.AssetItemIterator;
import org.drools.repository.CategoryItem;
import org.drools.repository.PackageItem;
import org.drools.repository.RepositoryFilter;
import org.drools.repository.RulesRepository;
import org.drools.repository.VersionableItem;

import javax.inject.Inject;
import javax.inject.Named;

import org.jboss.seam.security.Credentials;
import org.jboss.seam.solder.beanManager.BeanManagerLocator;
=======
import org.drools.guvnor.server.util.*;
import org.drools.repository.*;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.contexts.Contexts;
>>>>>>> 3c461ad2ee0e28f86952981f213e7dec96ed4f32
import org.jboss.seam.security.Identity;

import java.text.DateFormat;
Solution content
import org.drools.guvnor.server.contenthandler.IRuleAsset;
import org.drools.guvnor.server.repository.MailboxService;
import org.drools.guvnor.server.security.RoleType;
import org.drools.guvnor.server.util.*;
import org.drools.repository.*;

import javax.inject.Inject;
import javax.inject.Named;

import org.jboss.seam.security.Credentials;
import org.jboss.seam.solder.beanManager.BeanManagerLocator;
import org.jboss.seam.security.Identity;

import java.text.DateFormat;
File
RepositoryAssetOperations.java
Developer's decision
Combination
Kind of conflict
Import
Chunk
Conflicting content
    private static final LoggingHelper log = LoggingHelper.getLogger(RepositoryAssetOperations.class);

<<<<<<< HEAD
    @Inject
    private Credentials credentials;

    private String[]                   registeredFormats;
=======
    private final String[] registeredFormats;
>>>>>>> 3c461ad2ee0e28f86952981f213e7dec96ed4f32

    public RepositoryAssetOperations() {
        //Load recognised formats from configuration file
Solution content
    private static final LoggingHelper log = LoggingHelper.getLogger(RepositoryAssetOperations.class);

    @Inject
    private Credentials credentials;

    private String[]                   registeredFormats;

    public RepositoryAssetOperations() {
        //Load recognised formats from configuration file
File
RepositoryAssetOperations.java
Developer's decision
Version 1
Kind of conflict
Annotation
Attribute
Chunk
Conflicting content
        AssetLockManager lockManager = AssetLockManager.instance();

        String userName;
<<<<<<< HEAD
        BeanManagerLocator beanManagerLocator = new BeanManagerLocator();
        if ( beanManagerLocator.isBeanManagerAvailable() ) {
            userName = credentials.getUsername();
=======
        if (Contexts.isApplicationContextActive()) {
            userName = Identity.instance().getCredentials().getUsername();
>>>>>>> 3c461ad2ee0e28f86952981f213e7dec96ed4f32
        } else {
            userName = "anonymous";
        }
Solution content
        AssetLockManager lockManager = AssetLockManager.instance();

        String userName;
        BeanManagerLocator beanManagerLocator = new BeanManagerLocator();
        if ( beanManagerLocator.isBeanManagerAvailable() ) {
            userName = credentials.getUsername();
        } else {
            userName = "anonymous";
        }
File
RepositoryAssetOperations.java
Developer's decision
Version 1
Kind of conflict
If statement
Method invocation
Variable
Chunk
Conflicting content
    }

    public java.lang.String createPackage(java.lang.String p0,
<<<<<<< HEAD
                                          java.lang.String p1) throws com.google.gwt.user.client.rpc.SerializationException {
        return packageService.createPackage( p0,
                p1 );
=======
                                          java.lang.String p1,
                                          java.lang.String p2) throws com.google.gwt.user.client.rpc.SerializationException {
        return getPackageService().createPackage( p0,
                p1, p2);
>>>>>>> 3c461ad2ee0e28f86952981f213e7dec96ed4f32
    }

    public java.lang.String createSubPackage(java.lang.String p0,
Solution content
    }

    public java.lang.String createPackage(java.lang.String p0,
                                          java.lang.String p1,
                                          java.lang.String p2) throws com.google.gwt.user.client.rpc.SerializationException {
        return packageService.createPackage( p0,
                p1, p2);
    }

    public java.lang.String createSubPackage(java.lang.String p0,
File
RepositoryServiceServlet.java
Developer's decision
Combination
Kind of conflict
Method invocation
Return statement
Variable