Search in sources :

Example 11 with ActionLogRecord

use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord in project entando-core by entando.

the class TestActionLogDAO method testGetActionRecords.

public void testGetActionRecords() {
    IActionLogRecordSearchBean bean = null;
    List<Integer> ids = this._actionLoggerDAO.getActionRecords(bean);
    // this.compareIds(new Integer[]{}, ids);
    ActionLogRecord record1 = this._helper.createActionRecord(1, "username1", "actionName1", "namespace1", DateConverter.parseDate("01/01/2009 00:00", "dd/MM/yyyy HH:mm"), "params1");
    ActionLogRecord record2 = this._helper.createActionRecord(2, "username2", "actionName2", "namespace2", DateConverter.parseDate("01/01/2009 10:00", "dd/MM/yyyy HH:mm"), "params2");
    ActionLogRecord record3 = this._helper.createActionRecord(3, "username123", "actionName123", "namespace123", DateConverter.parseDate("02/01/2009 12:00", "dd/MM/yyyy HH:mm"), "params123");
    this._helper.addActionRecord(record1);
    this._helper.addActionRecord(record2);
    this._helper.addActionRecord(record3);
    // 
    // ids = this._actionLoggerDAO.getActionRecords(bean);
    // this.compareIds(new Integer[]{1, 2, 3}, ids);
    ActionLogRecordSearchBean searchBean = this._helper.createSearchBean("name", "Name", "space", "arams", null, null);
    ids = this._actionLoggerDAO.getActionRecords(searchBean);
    this.compareIds(new Integer[] { 1, 2, 3 }, ids);
    searchBean = this._helper.createSearchBean("name", "Name", "space", "arams", DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"), null);
    ids = this._actionLoggerDAO.getActionRecords(searchBean);
    this.compareIds(new Integer[] { 3 }, ids);
    searchBean = this._helper.createSearchBean(null, null, null, null, null, DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"));
    ids = this._actionLoggerDAO.getActionRecords(searchBean);
    this.compareIds(new Integer[] { 1, 2 }, ids);
    searchBean = this._helper.createSearchBean(null, "Name", null, null, DateConverter.parseDate("01/01/2009 09:01", "dd/MM/yyyy HH:mm"), DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"));
    ids = this._actionLoggerDAO.getActionRecords(searchBean);
    this.compareIds(new Integer[] { 2 }, ids);
}
Also used : ActionLogRecord(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord) IActionLogRecordSearchBean(org.entando.entando.aps.system.services.actionlog.model.IActionLogRecordSearchBean) IActionLogRecordSearchBean(org.entando.entando.aps.system.services.actionlog.model.IActionLogRecordSearchBean) ActionLogRecordSearchBean(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecordSearchBean)

Example 12 with ActionLogRecord

use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord in project entando-core by entando.

the class TestActionLogDAO method testAddGetDeleteActionRecord.

public void testAddGetDeleteActionRecord() {
    ActionLogRecord record1 = this._helper.createActionRecord(1, "username1", "actionName1", "namespace1", DateConverter.parseDate("01/01/2009 00:00", "dd/MM/yyyy HH:mm"), "params1");
    ActionLogRecord record2 = this._helper.createActionRecord(2, "username2", "actionName2", "namespace2", DateConverter.parseDate("01/02/2009 00:00", "dd/MM/yyyy HH:mm"), "params2");
    this._actionLoggerDAO.addActionRecord(record1);
    this._actionLoggerDAO.addActionRecord(record2);
    ActionLogRecord addedRecord1 = this._actionLoggerDAO.getActionRecord(record1.getId());
    this.compareActionRecords(record1, addedRecord1);
    ActionLogRecord addedRecord2 = this._actionLoggerDAO.getActionRecord(record2.getId());
    this.compareActionRecords(record2, addedRecord2);
    this._actionLoggerDAO.deleteActionRecord(record1.getId());
    assertNull(this._actionLoggerDAO.getActionRecord(record1.getId()));
    this._actionLoggerDAO.deleteActionRecord(record2.getId());
    assertNull(this._actionLoggerDAO.getActionRecord(record2.getId()));
}
Also used : ActionLogRecord(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord)

Example 13 with ActionLogRecord

use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord in project entando-core by entando.

the class TestActionLogManager method testGetActionRecords.

public void testGetActionRecords() throws Throwable {
    List<Integer> ids = this._actionLoggerManager.getActionRecords(null);
    this.compareIds(new Integer[] {}, ids);
    ActionLogRecord record1 = this._helper.createActionRecord(1, "username1", "actionName1", "namespace1", DateConverter.parseDate("01/01/2009 00:00", "dd/MM/yyyy HH:mm"), "params1");
    ActionLogRecord record2 = this._helper.createActionRecord(2, "username2", "actionName2", "namespace2", DateConverter.parseDate("01/01/2009 10:00", "dd/MM/yyyy HH:mm"), "params2");
    ActionLogRecord record3 = this._helper.createActionRecord(3, "username123", "actionName123", "namespace123", DateConverter.parseDate("02/01/2009 12:00", "dd/MM/yyyy HH:mm"), "params123");
    this._helper.addActionRecord(record1);
    this._helper.addActionRecord(record2);
    this._helper.addActionRecord(record3);
    ids = this._actionLoggerManager.getActionRecords(null);
    this.compareIds(new Integer[] { 1, 2, 3 }, ids);
    ActionLogRecordSearchBean searchBean = this._helper.createSearchBean("name", "Name", "space", "arams", null, null);
    ids = this._actionLoggerManager.getActionRecords(searchBean);
    this.compareIds(new Integer[] { 1, 2, 3 }, ids);
    searchBean = this._helper.createSearchBean("name", "Name", "space", "arams", DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"), null);
    ids = this._actionLoggerManager.getActionRecords(searchBean);
    this.compareIds(new Integer[] { 3 }, ids);
    searchBean = this._helper.createSearchBean(null, null, null, null, null, DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"));
    ids = this._actionLoggerManager.getActionRecords(searchBean);
    this.compareIds(new Integer[] { 1, 2 }, ids);
    searchBean = this._helper.createSearchBean(null, "Name", null, null, DateConverter.parseDate("01/01/2009 09:01", "dd/MM/yyyy HH:mm"), DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"));
    ids = this._actionLoggerManager.getActionRecords(searchBean);
    this.compareIds(new Integer[] { 2 }, ids);
}
Also used : ActionLogRecord(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord) ActionLogRecordSearchBean(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecordSearchBean)

Example 14 with ActionLogRecord

use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord in project entando-core by entando.

the class TestActionLogManager method testAddGetDeleteActionRecord.

public void testAddGetDeleteActionRecord() throws Throwable {
    ActionLogRecord record1 = this._helper.createActionRecord(0, "username1", "actionName1", "namespace1", null, "params1");
    ActionLogRecord record2 = this._helper.createActionRecord(0, "username2", "actionName2", "namespace2", null, "params2");
    this._actionLoggerManager.addActionRecord(record1);
    this._actionLoggerManager.addActionRecord(record2);
    super.waitThreads(IActionLogManager.LOG_APPENDER_THREAD_NAME_PREFIX);
    ActionLogRecord addedRecord1 = this._actionLoggerManager.getActionRecord(record1.getId());
    this.compareActionRecords(record1, addedRecord1);
    ActionLogRecord addedRecord2 = this._actionLoggerManager.getActionRecord(record2.getId());
    this.compareActionRecords(record2, addedRecord2);
    this._actionLoggerManager.deleteActionRecord(record1.getId());
    assertNull(this._actionLoggerManager.getActionRecord(record1.getId()));
    this._actionLoggerManager.deleteActionRecord(record2.getId());
    assertNull(this._actionLoggerManager.getActionRecord(record2.getId()));
}
Also used : ActionLogRecord(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord)

Example 15 with ActionLogRecord

use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord in project entando-core by entando.

the class ActionLoggerInterceptor method intercept.

@Override
public String intercept(ActionInvocation invocation) throws Exception {
    ActionLogRecord actionRecord = null;
    String result = null;
    try {
        actionRecord = this.buildActionRecord(invocation);
        result = invocation.invoke();
        List<ActivityStreamInfo> asiList = null;
        Object actionObject = invocation.getAction();
        if (actionObject instanceof BaseAction) {
            BaseAction action = (BaseAction) actionObject;
            asiList = action.getActivityStreamInfos();
        }
        if (null == asiList || asiList.isEmpty()) {
            this.getActionLoggerManager().addActionRecord(actionRecord);
        } else {
            for (int i = 0; i < asiList.size(); i++) {
                ActivityStreamInfo asi = asiList.get(i);
                ActionLogRecord clone = this.createClone(actionRecord);
                clone.setActivityStreamInfo(asi);
                this.getActionLoggerManager().addActionRecord(clone);
            }
        }
    } catch (Throwable t) {
        _logger.error("error in intercept", t);
    // ApsSystemUtils.logThrowable(t, this, "intercept");
    }
    return result;
}
Also used : ActionLogRecord(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord) ActivityStreamInfo(org.entando.entando.aps.system.services.actionlog.model.ActivityStreamInfo) BaseAction(com.agiletec.apsadmin.system.BaseAction)

Aggregations

ActionLogRecord (org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord)20 ActionLogRecordSearchBean (org.entando.entando.aps.system.services.actionlog.model.ActionLogRecordSearchBean)9 Date (java.util.Date)5 ActivityStreamInfo (org.entando.entando.aps.system.services.actionlog.model.ActivityStreamInfo)4 IActionLogRecordSearchBean (org.entando.entando.aps.system.services.actionlog.model.IActionLogRecordSearchBean)4 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)3 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)2 UserDetails (com.agiletec.aps.system.services.user.UserDetails)2 Properties (java.util.Properties)2 ActivityStreamSeachBean (org.entando.entando.aps.system.services.actionlog.model.ActivityStreamSeachBean)2 BaseAction (com.agiletec.apsadmin.system.BaseAction)1 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 Timestamp (java.sql.Timestamp)1 ActivityStreamComment (org.entando.entando.apsadmin.system.services.activitystream.model.ActivityStreamComment)1 CacheEvict (org.springframework.cache.annotation.CacheEvict)1