Skip to content

Commit

Permalink
[Task 72040] added javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Raf-atmire committed Jul 28, 2020
1 parent 739ac03 commit 9db06d0
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dspace-api/src/main/java/org/dspace/content/dao/ProcessLogDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@
import org.dspace.scripts.Process;
import org.dspace.scripts.ProcessLog;

/**
* This is a DAO class that deals with DB calls for the {@link ProcessLog} entity
*/
public interface ProcessLogDAO extends GenericDAO<ProcessLog> {

/**
* This method will return a list of {@link ProcessLog} objects for the given {@link Process}
* @param context The relevant DSpace context
* @param process The {@link Process} from which we'll retrieve the {@link ProcessLog} objects
* @return The list of {@link ProcessLog} objects
* @throws SQLException If something goes wrong
*/
public List<ProcessLog> findByProcess(Context context, Process process) throws SQLException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,19 @@ public abstract class HibernateDBConnection implements DBConnection<Session> {
private boolean batchModeEnabled = false;
private boolean readOnlyEnabled = false;

/**
* Retrieves the current Session from Hibernate (per our settings, Hibernate is configured to create one Session
* per thread). If Session doesn't yet exist, it is created. A Transaction is also initialized (or reinintialized)
* in the Session if one doesn't exist, or was previously closed (e.g. if commit() was previously called)
* @return Hibernate current Session object
* @throws SQLException
*/
public abstract Session getSession() throws SQLException;

/**
* Retrieves the current Session from Hibernate
* @return The current Session
*/
public abstract Session getCurrentSession();


Expand Down
3 changes: 3 additions & 0 deletions dspace-api/src/main/java/org/dspace/scripts/ProcessLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
* This class is the representation of the ProcessLog entity stored in the process_log table in the DB
*/
@Entity
@Table(name = "process_log")
public class ProcessLog {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*/
package org.dspace.scripts;

/**
* This Enum defines all the possible Log levels that a {@link ProcessLog} can hold in the DB
*/
public enum ProcessLogLevel {
INFO,
WARNING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

import java.util.List;

/**
* This class acts as a REST representation for the {@link org.dspace.scripts.ProcessLog} objects that a given
* {@link org.dspace.scripts.Process} may hold
*/
public class ProcessOutputRest implements RestModel {
public static final String NAME = "processOutput";
private List<String> logs = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import org.dspace.app.rest.model.ProcessOutputRest;
import org.dspace.app.rest.model.hateoas.annotations.RelNameDSpaceResource;

/**
* This is the Resource class for the {@link ProcessOutputRest}
*/
@RelNameDSpaceResource(ProcessOutputRest.NAME)
public class ProcessOutputResource extends HALResource<ProcessOutputRest> {
public ProcessOutputResource(ProcessOutputRest content) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;

/**
* This is the LinkRepository that deals with GET calls for the {@link ProcessLog} list from a given {@link Process}
*/
@Component(ProcessRest.CATEGORY + "." + ProcessRest.NAME + "." + ProcessRest.OUTPUT)
public class ProcessOutputLinkRepository extends AbstractDSpaceRestRepository implements LinkRestRepository {

Expand All @@ -36,6 +39,18 @@ public class ProcessOutputLinkRepository extends AbstractDSpaceRestRepository im
@Autowired
private AuthorizeService authorizeService;

/**
* This method will retrieve the list of {@link ProcessLog} objects from the {@link Process} as defined through the
* given ID in the rest call and it'll wrap this in a {@link ProcessOutputRest} object to return these
* @param request The current request
* @param processId The given processId for the {@link Process}
* @param optionalPageable Pageable if applicable
* @param projection The current projection
* @return The {@link ProcessOutputRest} containing the list of all {@link ProcessLog} for the
* given {@link Process}
* @throws SQLException If something goes wrong
* @throws AuthorizeException If something goes wrong
*/
@PreAuthorize("hasAuthority('ADMIN')")
public ProcessOutputRest getOutputFromProcess(@Nullable HttpServletRequest request,
Integer processId,
Expand Down

0 comments on commit 9db06d0

Please sign in to comment.