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