Search in sources :

Example 16 with ActionLogRecord

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

the class ActionLoggerInterceptor method buildActionRecord.

/**
 * Build an {@link ActionLoggerRecord} object related to the current action
 * @param invocation
 * @return an {@link ActionLoggerRecord} for the current action
 */
private ActionLogRecord buildActionRecord(ActionInvocation invocation) {
    ActionLogRecord record = new ActionLogRecord();
    String username = this.getCurrentUsername();
    String namespace = invocation.getProxy().getNamespace();
    String actionName = invocation.getProxy().getActionName();
    String parameters = this.getParameters();
    record.setUsername(username);
    record.setNamespace(namespace);
    record.setActionName(actionName);
    record.setParameters(parameters);
    return record;
}
Also used : ActionLogRecord(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord)

Example 17 with ActionLogRecord

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

the class SocialActivityStreamManager method addActionCommentRecord.

@Override
@CacheEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'ActivityStreamCommentRecords_id_'.concat(#streamId)")
public void addActionCommentRecord(String username, String commentText, int streamId) throws ApsSystemException {
    try {
        Integer key = null;
        ActionLogRecord record = null;
        do {
            key = this.getKeyGeneratorManager().getUniqueKeyCurrentValue();
            record = this.getActionLogManager().getActionRecord(key);
        } while (null != record);
        this.getSocialActivityStreamDAO().addActionCommentRecord(key, streamId, username, commentText);
        this.getActionLogManager().updateRecordDate(streamId);
    } catch (Throwable t) {
        _logger.error("Error adding a comment record to stream with id:{}", streamId, t);
        throw new ApsSystemException("Error adding a comment record", t);
    }
}
Also used : ActionLogRecord(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) CacheEvict(org.springframework.cache.annotation.CacheEvict)

Example 18 with ActionLogRecord

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

the class TestSocialActivityStreamDAO method testAddDeleteCommentRecord.

public void testAddDeleteCommentRecord() throws Throwable {
    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._socialActivityStreamDAO.addActionCommentRecord(100, addedRecord1.getId(), "admin", "test comment 1");
    synchronized (this) {
        this.wait(1000);
    }
    this._socialActivityStreamDAO.addActionCommentRecord(101, addedRecord1.getId(), "admin", "test comment 2");
    List<ActivityStreamComment> actionCommentRecords = this._socialActivityStreamDAO.getActionCommentRecords(addedRecord1.getId());
    assertEquals(2, actionCommentRecords.size());
    assertEquals(100, actionCommentRecords.get(0).getId());
    assertEquals(101, actionCommentRecords.get(1).getId());
    this._socialActivityStreamDAO.deleteActionCommentRecord(100);
    actionCommentRecords = this._socialActivityStreamDAO.getActionCommentRecords(addedRecord1.getId());
    assertEquals(1, actionCommentRecords.size());
    assertEquals("test comment 2", actionCommentRecords.get(0).getCommentText());
}
Also used : ActionLogRecord(org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord) ActivityStreamComment(org.entando.entando.apsadmin.system.services.activitystream.model.ActivityStreamComment)

Example 19 with ActionLogRecord

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

the class TestSocialActivityStreamDAO 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 20 with ActionLogRecord

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

the class TestSocialActivityStreamDAO 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)

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