package com.capgemini.framework.teamcenter.authent;

import com.teamcenter.soa.client.model.ModelEventListener;
import com.teamcenter.soa.client.model.ModelObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;

/**
 * Events logger: object creation, modification and suppression trigger a call to this object's corresponding method.
 */
public class KurtModelEventListener extends ModelEventListener {
    private static final Logger LOGGER = LoggerFactory.getLogger(KurtModelEventListener.class);

    @Override
    public void localObjectCreate(ModelObject[] createdObjs) {
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Local objects created: {}", Arrays.toString(createdObjs));
        }
    }

    @Override
    public void localObjectChange(ModelObject[] changedObjs) {
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Local objects modified: {}", Arrays.toString(changedObjs));
        }
    }

    @Override
    public void localObjectDelete(String[] uids) {
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Local objects deleted: {}", Arrays.toString(uids));
        }
    }

    @Override
    public void sharedObjectCreate(ModelObject[] createdObjs) {
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Shared objects created: {}", Arrays.toString(createdObjs));
        }
    }

    @Override
    public void sharedObjectChange(ModelObject[] changedObjs) {
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Shared objects modified: {}", Arrays.toString(changedObjs));
        }
    }

    @Override
    public void sharedObjectDelete(String[] uids) {
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Shared objects deleted: {}", Arrays.toString(uids));
        }
    }
}
