Search in sources :

Example 1 with RevisionStatus

use of org.obiba.mica.core.domain.RevisionStatus in project mica2 by obiba.

the class FileSystemService method updateStatus.

/**
 * Update {@link RevisionStatus} of all files at a given path (and children).
 *
 * @param path
 * @param status
 */
public void updateStatus(String path, RevisionStatus status) {
    List<AttachmentState> states = findAttachmentStates(String.format("^%s$", path), false);
    AttachmentState state = states.stream().filter(s -> DIR_NAME.equals(s.getName())).findFirst().orElseThrow(() -> NoSuchEntityException.withPath(AttachmentState.class, path));
    RevisionStatus currentStatus = state.getRevisionStatus();
    states.addAll(findAttachmentStates(String.format("^%s/", path), false));
    states.forEach(s -> updateStatus(s, status));
    filePublicationFlowNotification.send(path, currentStatus, status);
}
Also used : RevisionStatus(org.obiba.mica.core.domain.RevisionStatus) AttachmentState(org.obiba.mica.file.AttachmentState)

Example 2 with RevisionStatus

use of org.obiba.mica.core.domain.RevisionStatus in project mica2 by obiba.

the class AbstractGitPersistableService method updateStatus.

public T updateStatus(String id, RevisionStatus status) {
    T entityState = findStateById(id);
    RevisionStatus current = entityState.getRevisionStatus();
    entityState.setRevisionStatus(status);
    getEntityStateRepository().save(entityState);
    entityPublicationFlowNotification.send(id, getTypeName(), current, status);
    return entityState;
}
Also used : RevisionStatus(org.obiba.mica.core.domain.RevisionStatus) DRAFT(org.obiba.mica.core.domain.RevisionStatus.DRAFT)

Aggregations

RevisionStatus (org.obiba.mica.core.domain.RevisionStatus)2 DRAFT (org.obiba.mica.core.domain.RevisionStatus.DRAFT)1 AttachmentState (org.obiba.mica.file.AttachmentState)1