Search in sources :

Example 1 with ActionLogRecord

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

the class ActionLoggerTestHelper method createActionRecord.

public ActionLogRecord createActionRecord(int id, String username, String actionName, String namespace, Date date, String parameter) {
    ActionLogRecord record = new ActionLogRecord();
    record.setId(id);
    record.setUsername(username);
    record.setActionName(actionName);
    record.setNamespace(namespace);
    record.setActionDate(date);
    record.setParameters(parameter);
    return record;
}
Also used : ActionLogRecord(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord)

Example 2 with ActionLogRecord

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

the class TestActionLogDAO method testActionLogSearch.

public void testActionLogSearch() {
    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);
    ActionLogRecordSearchBean searchBean = this._helper.createSearchBean(null, "Name", null, null, DateConverter.parseDate("02/01/2009 10:01", "dd/MM/yyyy HH:mm"), DateConverter.parseDate("02/01/2009 14:01", "dd/MM/yyyy HH:mm"));
    ids = this._actionLoggerDAO.getActionRecords(searchBean);
    this.compareIds(new Integer[] { 3 }, 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 3 with ActionLogRecord

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

the class ActionLogManager method lastUpdateDate.

@Override
public Date lastUpdateDate(UserDetails loggedUser) throws ApsSystemException {
    List<Integer> actionRecordIds = null;
    Date lastUpdate = new Date();
    try {
        ActivityStreamSeachBean searchBean = new ActivityStreamSeachBean();
        searchBean.setUserGroupCodes(this.extractUserGroupCodes(loggedUser));
        searchBean.setEndUpdate(lastUpdate);
        actionRecordIds = this.getActionRecords(searchBean);
        if (null != actionRecordIds && actionRecordIds.size() > 0) {
            ActionLogRecord actionRecord = this.getActionRecord(actionRecordIds.get(0));
            lastUpdate = actionRecord.getUpdateDate();
        }
    } catch (Throwable t) {
        _logger.error("Error on loading updated activities", t);
        throw new ApsSystemException("Error on loading updated activities", t);
    }
    return lastUpdate;
}
Also used : ActionLogRecord(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord) ActivityStreamSeachBean(org.entando.entando.aps.system.services.actionlog.model.ActivityStreamSeachBean) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) Date(java.util.Date)

Example 4 with ActionLogRecord

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

the class ActionLoggerInterceptor method createClone.

private ActionLogRecord createClone(ActionLogRecord record) {
    ActionLogRecord clone = new ActionLogRecord();
    clone.setActionDate(new Date());
    clone.setActionName(record.getActionName());
    clone.setId(-1);
    clone.setNamespace(record.getNamespace());
    clone.setParameters(record.getParameters());
    clone.setUsername(record.getUsername());
    return clone;
}
Also used : ActionLogRecord(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord) Date(java.util.Date)

Example 5 with ActionLogRecord

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

the class TestActivityStream method testLastUpdate.

public void testLastUpdate() throws Throwable {
    // "coach" group
    Content content = this._contentManager.loadContent("EVN41", false);
    String contentOnSessionMarker = AbstractContentAction.buildContentOnSessionMarker(content, ApsAdminSystemConstants.ADD);
    content.setId(null);
    String contentId = null;
    Thread.sleep(1000);
    try {
        this.getRequest().getSession().setAttribute(ContentActionConstants.SESSION_PARAM_NAME_CURRENT_CONTENT_PREXIX + contentOnSessionMarker, content);
        this.initContentAction("/do/jacms/Content", "save", contentOnSessionMarker);
        this.setUserOnSession("admin");
        String result = this.executeAction();
        assertEquals(Action.SUCCESS, result);
        contentId = content.getId();
        assertNotNull(this._contentManager.loadContent(contentId, false));
        super.waitThreads(IActionLogManager.LOG_APPENDER_THREAD_NAME_PREFIX);
        ActionLogRecordSearchBean searchBean = this._helper.createSearchBean("admin", null, null, null, null, null);
        List<Integer> ids = this._actionLoggerManager.getActionRecords(searchBean);
        assertEquals(1, ids.size());
        Thread.sleep(1000);
        this.getRequest().getSession().setAttribute(ContentActionConstants.SESSION_PARAM_NAME_CURRENT_CONTENT_PREXIX + contentOnSessionMarker, content);
        this.initContentAction("/do/jacms/Content", "save", contentOnSessionMarker);
        this.setUserOnSession("admin");
        result = this.executeAction();
        assertEquals(Action.SUCCESS, result);
        contentId = content.getId();
        assertNotNull(this._contentManager.loadContent(contentId, false));
        super.waitThreads(IActionLogManager.LOG_APPENDER_THREAD_NAME_PREFIX);
        List<Integer> actionRecords = this._actionLoggerManager.getActionRecords(null);
        assertNotNull(actionRecords);
        assertEquals(2, actionRecords.size());
        ActionLogRecord actionRecord = this._actionLoggerManager.getActionRecord(actionRecords.get(1));
        UserDetails adminUser = this.getUser("admin", "admin");
        Date lastUpdateDate = this._actionLoggerManager.lastUpdateDate(adminUser);
        assertEquals(actionRecord.getUpdateDate(), lastUpdateDate);
    } catch (Throwable t) {
        throw t;
    } finally {
        this._contentManager.deleteContent(content);
        assertNull(this._contentManager.loadContent(contentId, false));
    }
}
Also used : ActionLogRecord(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord) UserDetails(com.agiletec.aps.system.services.user.UserDetails) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ActionLogRecordSearchBean(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecordSearchBean) Date(java.util.Date)

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