use of ubic.gemma.model.common.auditAndSecurity.AuditEvent in project Gemma by PavlidisLab.
the class ExpressionExperimentDaoImpl method getArrayDesignAuditEvents.
@Override
@Deprecated
public Map<Long, Map<Long, Collection<AuditEvent>>> getArrayDesignAuditEvents(Collection<Long> ids) {
// language=HQL
final String queryString = "select ee.id, ad.id, event " + "from ExpressionExperiment ee " + "inner join ee.bioAssays b " + "inner join b.arrayDesignUsed ad " + "inner join ad.auditTrail trail " + "inner join trail.events event " + "where ee.id in (:ids) ";
List result = this.getSessionFactory().getCurrentSession().createQuery(queryString).setParameterList("ids", ids).list();
Map<Long, Map<Long, Collection<AuditEvent>>> eventMap = new HashMap<>();
// process list of expression experiment ids that have events
for (Object o : result) {
Object[] row = (Object[]) o;
Long eeId = (Long) row[0];
Long adId = (Long) row[1];
AuditEvent event = (AuditEvent) row[2];
Map<Long, Collection<AuditEvent>> adEventMap = eventMap.get(eeId);
if (adEventMap == null) {
adEventMap = new HashMap<>();
eventMap.put(eeId, adEventMap);
}
Collection<AuditEvent> events = adEventMap.get(adId);
if (events == null) {
events = new ArrayList<>();
adEventMap.put(adId, events);
}
events.add(event);
}
return eventMap;
}
use of ubic.gemma.model.common.auditAndSecurity.AuditEvent in project Gemma by PavlidisLab.
the class ExpressionExperimentDaoImpl method getAuditEvents.
@Override
public Map<Long, Collection<AuditEvent>> getAuditEvents(Collection<Long> ids) {
// language=HQL
final String queryString = "select ee.id, auditEvent from ExpressionExperiment ee inner join ee.auditTrail as auditTrail inner join auditTrail.events as auditEvent " + " where ee.id in (:ids) ";
List result = this.getSessionFactory().getCurrentSession().createQuery(queryString).setParameterList("ids", ids).list();
Map<Long, Collection<AuditEvent>> eventMap = new HashMap<>();
for (Object o : result) {
Object[] row = (Object[]) o;
Long id = (Long) row[0];
AuditEvent event = (AuditEvent) row[1];
this.addEventsToMap(eventMap, id, event);
}
// their values to null.
for (Object object : ids) {
Long id = (Long) object;
if (!eventMap.containsKey(id)) {
eventMap.put(id, null);
}
}
return eventMap;
}
use of ubic.gemma.model.common.auditAndSecurity.AuditEvent in project Gemma by PavlidisLab.
the class ArrayDesignDaoImpl method getAuditEvents.
@Override
public Map<Long, Collection<AuditEvent>> getAuditEvents(Collection<Long> ids) {
// language=HQL
final String queryString = "select ad.id, auditEvent from ArrayDesign ad" + " join ad.auditTrail as auditTrail join auditTrail.events as auditEvent join fetch auditEvent.performer " + " where ad.id in (:ids) ";
// noinspection unchecked
List<Object[]> list = this.getSessionFactory().getCurrentSession().createQuery(queryString).setParameterList("ids", ids).list();
Map<Long, Collection<AuditEvent>> eventMap = new HashMap<>();
for (Object[] o : list) {
Long id = (Long) o[0];
AuditEvent event = (AuditEvent) o[1];
this.addEventsToMap(eventMap, id, event);
}
// Set their values to null.
for (Object object : ids) {
Long id = (Long) object;
if (!eventMap.containsKey(id)) {
eventMap.put(id, null);
}
}
return eventMap;
}
use of ubic.gemma.model.common.auditAndSecurity.AuditEvent in project Gemma by PavlidisLab.
the class ArrayDesignMergeHelperServiceImpl method audit.
/**
* Add an ArrayDesignMergeEvent event to the audit trail. Does not persist it.
*
* @param arrayDesign array design
* @param note note
*/
private void audit(ArrayDesign arrayDesign, String note) {
AuditEvent auditEvent = AuditEvent.Factory.newInstance(new Date(), AuditAction.UPDATE, note, null, null, new ArrayDesignMergeEvent());
arrayDesign.getAuditTrail().addEvent(auditEvent);
}
use of ubic.gemma.model.common.auditAndSecurity.AuditEvent in project Gemma by PavlidisLab.
the class GeoBrowserServiceImpl method formatArrayDetails.
private void formatArrayDetails(NodeList gpls, StringBuilder buf) {
Set<String> seenGpl = new HashSet<>();
for (int i = 0; i < gpls.getLength(); i++) {
String gpl = "GPL" + gpls.item(i).getNodeValue();
if (gpl.contains(";"))
continue;
if (seenGpl.contains(gpl))
continue;
seenGpl.add(gpl);
ArrayDesign arrayDesign = arrayDesignService.findByShortName(gpl);
if (arrayDesign != null) {
arrayDesign = arrayDesignService.thawLite(arrayDesign);
String trouble = "";
if (arrayDesign.getCurationDetails().getTroubled()) {
AuditEvent lastTroubleEvent = arrayDesign.getCurationDetails().getLastTroubledEvent();
if (lastTroubleEvent != null) {
trouble = " <img src='" + Settings.getRootContext() + "/images/icons/warning.png' height='16' width='16' alt=\"troubled\" title=\"" + lastTroubleEvent.getNote() + "\"/>";
}
}
buf.append("<p><strong>Platform in Gemma: <a target=\"_blank\" href=\"").append(Settings.getRootContext()).append("/arrays/showArrayDesign.html?id=").append(arrayDesign.getId()).append("\">").append(gpl).append("</a></strong>").append(trouble);
} else {
buf.append("<p><strong>").append(gpl).append(" [New to Gemma]</strong>");
}
}
}
Aggregations