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;
}
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);
}
}
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());
}
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);
}
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);
}
Aggregations