Skip to content

Commit

Permalink
Merge pull request #186 from antolinos/issue_185
Browse files Browse the repository at this point in the history
Issue 185
  • Loading branch information
antolinos authored Oct 31, 2017
2 parents ec8bb86 + 84387fc commit 68fbfc7
Show file tree
Hide file tree
Showing 6 changed files with 12,160 additions and 12,040 deletions.
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# ISPyB Project [![Build Status](https://travis-ci.org/antolinos/ispyb.png)](https://travis-ci.org/antolinos/ispyb)


## Installing
1. [Installing](#installing)
2. [Versioning](#versioning)
3. [Database creation and update](#database-creation-and-update)
4. [Database schema](#database-schema)
5. [Graylog on Widlfly 8.2](#graylog)

# Installing

1. Clone or fork the ISPyB repository and then clone it by typing:
```
Expand Down Expand Up @@ -147,3 +153,41 @@ Please do not forget to update the database schema :
https://github.com/ispyb/ISPyB/blob/master/documentation/database/ISPyB_DataModel_5.mwb

This schema can be updated using MySQLWorkbench (free tool from MySQL).


### Graylog

Download [biz.paluch.logging](http://logging.paluch.biz) that provides logging to logstash using the Graylog Extended Logging Format (GELF) 1.0 and 1.1.

Then create a custom handler on standalone.xml
```
<profile>
<subsystem xmlns="urn:jboss:domain:logging:2.0">
...
<custom-handler name="GelfLogger" class="biz.paluch.logging.gelf.wildfly.WildFlyGelfLogHandler" module="biz.paluch.logging">
<level name="INFO"/>
<properties>
<property name="host" value="udp:graylog-dau.esrf.fr"/>
<property name="port" value="12201"/>
<property name="version" value="1.0"/>
<property name="facility" value="ispyb-test"/>
<property name="timestampPattern" value="yyyy-MM-dd"/>
</properties>
</custom-handler>
...
<logger category="ispyb">
<level name="INFO"/>
<handlers>
<handler name="ISPYB"/>
<handler name="GelfLogger"/>
</handlers>
</logger>
```

I had some problems with the unvalid messages because of timestapPatter. It was fixed by using:
```
<property name="timestampPattern" value="yyyy-MM-dd"/>
```



Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ public List<Session3VO> findByStartDateAndBeamLineNameAndNbShifts(final Integer
*/
public Session3VO findByAutoProcScalingId(final Integer autoProcScalingId) throws Exception;

public Session3VO findByAutoProcProgramAttachmentId(final Integer autoProcProgramAttachmentId) throws Exception;

public void protectSession(Integer sessionId) throws Exception;

/**
Expand All @@ -195,6 +197,8 @@ public List<Session3VO> findByStartDateAndBeamLineNameAndNbShifts(final Integer
*/
public Integer getNbOfTests(final Integer sesId) throws Exception;

public Session3VO findByAutoProcProgramId(int autoProcProgramId);



}
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@ private static final String FIND_ALL(boolean fetchDataCollectionGroup, boolean f
+ " where s.sessionId = g.sessionId and " + " g.dataCollectionGroupId = c.dataCollectionGroupId and "
+ " c.dataCollectionId = api.dataCollectionId and " + " api.autoProcIntegrationId = apshi.autoProcIntegrationId and "
+ " apshi.autoProcScalingId = aps.autoProcScalingId and " + " aps.autoProcScalingId = :autoProcScalingId ";

private static final String FIND_BY_AUTOPROCPROGRAMATTACHMENT_ID = "select s.* from BLSession s, "
+ " DataCollectionGroup g, DataCollection c, AutoProcIntegration api, AutoProcProgram autoprocProgram, AutoProcProgramAttachment autoProcProgramAttachment"
+ " where s.sessionId = g.sessionId and g.dataCollectionGroupId = c.dataCollectionGroupId and autoprocProgram.autoProcProgramId = api.autoProcProgramId"
+ " and c.dataCollectionId = api.dataCollectionId and autoprocProgram.autoProcProgramId = autoProcProgramAttachment.autoProcProgramId "
+ " and autoProcProgramAttachment.autoProcProgramAttachmentId = :autoProcProgramAttachmentId ";


private static final String FIND_BY_AUTOPROCPROGRAM_ID = "select s.* from BLSession s, "
+ " DataCollectionGroup g, DataCollection c, AutoProcIntegration api, AutoProcProgram autoprocProgram "
+ " where s.sessionId = g.sessionId and g.dataCollectionGroupId = c.dataCollectionGroupId and autoprocProgram.autoProcProgramId = api.autoProcProgramId"
+ " and c.dataCollectionId = api.dataCollectionId and autoprocProgram.autoProcProgramId = :autoProcProgramId ";


private static String getProposalCodeNumberQuery() {
String query = "select * " + " FROM BLSession ses, Proposal pro "
Expand Down Expand Up @@ -525,6 +538,32 @@ public Session3VO findByAutoProcScalingId(final Integer autoProcScalingId) throw
}
return null;
}


@SuppressWarnings("unchecked")
public Session3VO findByAutoProcProgramAttachmentId(final Integer autoProcProgramAttachmentId) throws Exception {
String query = FIND_BY_AUTOPROCPROGRAMATTACHMENT_ID;
List<Session3VO> col = this.entityManager.createNativeQuery(query, "sessionNativeQuery")
.setParameter("autoProcProgramAttachmentId", autoProcProgramAttachmentId).getResultList();
if (col != null && col.size() > 0) {
return col.get(0);
}
return null;
}


@Override
public Session3VO findByAutoProcProgramId(int autoProcProgramId) {
String query = FIND_BY_AUTOPROCPROGRAM_ID;
@SuppressWarnings("unchecked")
List<Session3VO> col = this.entityManager.createNativeQuery(query, "sessionNativeQuery")
.setParameter("autoProcProgramId", autoProcProgramId).getResultList();
if (col != null && col.size() > 0) {
return col.get(0);
}
return null;
}



/**
Expand Down Expand Up @@ -818,4 +857,6 @@ private void checkChangeRemoveAccess(Session3VO vo) throws AccessDeniedException





}
Loading

0 comments on commit 68fbfc7

Please sign in to comment.