Skip to content

Commit

Permalink
[Task 72040] added javadocs and override annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Raf-atmire committed Jul 28, 2020
1 parent 9db06d0 commit 81ba2f8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
Expand Up @@ -20,8 +20,12 @@
import org.dspace.scripts.ProcessLog;
import org.dspace.scripts.ProcessLog_;

/**
* This is the implementing class for the {@link ProcessLogDAO}
*/
public class ProcessLogDAOImpl extends AbstractHibernateDAO<ProcessLog> implements ProcessLogDAO {

@Override
public List<ProcessLog> findByProcess(Context context, Process process) throws SQLException {
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, ProcessLog.class);
Expand Down
Expand Up @@ -15,6 +15,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

/**
* Implementing class for the MANAGED Context state for {@link HibernateDBConnection}
*/
public class ManagedHibernateDBConnection extends HibernateDBConnection {

@Autowired(required = true)
Expand Down
Expand Up @@ -15,6 +15,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

/**
* Implementing class for the regular Context states for {@link HibernateDBConnection}
*/
public class ThreadBoundHibernateDBConnection extends HibernateDBConnection {

@Autowired(required = true)
Expand Down
Expand Up @@ -175,11 +175,19 @@ public void logError(String message) {
}


private void appendLogToProcess(String message, ProcessLogLevel error) {
/**
* This method will ensure that the current {@link Process} has the given {@link org.dspace.scripts.ProcessLog}
* objects made and attached to it in the DB when a log is called.
* It'll use a separate Context for this and close this one immediately afterwards so that it's updated in
* real-time
* @param message The message to be used in the log
* @param processLogLevel The log level to be used in the log
*/
private void appendLogToProcess(String message, ProcessLogLevel processLogLevel) {
Context context = new Context(Context.Mode.MANAGED);
try {
Process process = processService.find(context, processId);
processService.appendLog(context, process, message, error);
processService.appendLog(context, process, message, processLogLevel);
context.complete();
} catch (SQLException e) {
log.error("RestDSpaceRunnableHandler with process: " + processId + " could not write log to process", e);
Expand Down

0 comments on commit 81ba2f8

Please sign in to comment.