Class PreboardedExperimentServiceImpl
- All Implemented Interfaces:
PreboardedExperimentService
PreboardedExperimentService implementation.
The promotion path is the substantive piece: it calls into
AnnotationSetService.rebindInvestigation(Investigation, Investigation) to point every
AnnotationSet row at the loaded EE rather than the preboarded, then
advances both rows' workflow state. Audit events are emitted declaratively
via @Audited. The create path delegates to
PreboardedAuditService so the proxy-intercepted return triggers the
aspect against the freshly constructed preboarded — direct annotation on
createPreboarded would not work because the AuditedAspect
locates the auditable target on the argument list (the new preboarded is
built inside the method body).
-
Nested Class Summary
Nested classes/interfaces inherited from interface PreboardedExperimentService
PreboardedExperimentService.AccessionAlreadyExistsException, PreboardedExperimentService.PreboardedAlreadyPromotedException, PreboardedExperimentService.PromotionResult -
Constructor Summary
ConstructorsConstructorDescriptionPreboardedExperimentServiceImpl(SessionFactory sessionFactory, AnnotationSetService annotationSetService, ExpressionExperimentService expressionExperimentService, PreboardedAuditService preboardedAuditService) -
Method Summary
Modifier and TypeMethodDescriptioncreatePreboarded(String accession, String source, String identifyingMetadata) Create a new preboarded for the given accession.findAllByAccession(String accession) findByAccession(String accession) findExpressionExperimentByAccession(String accession) Look up an existingExpressionExperimentcarrying the given accession.loadAccessions(Collection<Long> ids) Accessions for a set of preboarded ids, in ONE query.promote(ExpressionExperiment ee, PreboardedExperiment preboarded) Promote the preboarded to a loadedExpressionExperiment.
-
Constructor Details
-
PreboardedExperimentServiceImpl
@Autowired public PreboardedExperimentServiceImpl(SessionFactory sessionFactory, AnnotationSetService annotationSetService, ExpressionExperimentService expressionExperimentService, PreboardedAuditService preboardedAuditService)
-
-
Method Details
-
createPreboarded
@Transactional public PreboardedExperiment createPreboarded(String accession, @Nullable String source, @Nullable String identifyingMetadata) throws PreboardedExperimentService.AccessionAlreadyExistsException Description copied from interface:PreboardedExperimentServiceCreate a new preboarded for the given accession.Throws
PreboardedExperimentService.AccessionAlreadyExistsExceptionif an existingPreboardedExperimentORExpressionExperimentalready carries the same accession. The exception carries the existing entity's id and type so the REST layer can mint a 409 response per spec.Emits a
PreboardedCreatedEventaudit row against the new preboarded's own audit trail.- Specified by:
createPreboardedin interfacePreboardedExperimentService- Throws:
PreboardedExperimentService.AccessionAlreadyExistsException
-
load
- Specified by:
loadin interfacePreboardedExperimentService- Returns:
- the preboarded with the given id, or
null.
-
loadAccessions
Description copied from interface:PreboardedExperimentServiceAccessions for a set of preboarded ids, in ONE query.Batched on purpose: the ticket navigator resolves the labels for a whole page of tickets at once, and a batch triage ticket carries every candidate from its scrape. Resolving one id at a time would put an N+1 on the server, which is the thing
TicketsWebService.resolveTargetLabelsexists to avoid.- Specified by:
loadAccessionsin interfacePreboardedExperimentService- Returns:
- accession by id; ids that do not exist are simply absent
-
findByAccession
@Nullable @Transactional(readOnly=true) public PreboardedExperiment findByAccession(String accession) - Specified by:
findByAccessionin interfacePreboardedExperimentService- Returns:
- the preboarded with the given accession, or
null.
-
findAllByAccession
@Transactional(readOnly=true) public List<PreboardedExperiment> findAllByAccession(String accession) - Specified by:
findAllByAccessionin interfacePreboardedExperimentService- Returns:
- list of preboarded with the given accession (defensive — only one is expected; the create path enforces uniqueness).
-
findExpressionExperimentByAccession
@Nullable @Transactional(readOnly=true) public ExpressionExperiment findExpressionExperimentByAccession(String accession) Description copied from interface:PreboardedExperimentServiceLook up an existingExpressionExperimentcarrying the given accession. Used by thePOST /preboarded409 path: if the data is already loaded as an EE, the caller should write against the EE directly rather than create a preboarded.- Specified by:
findExpressionExperimentByAccessionin interfacePreboardedExperimentService- Returns:
- the existing EE with this accession, or
null.
-
promote
@Transactional @Audited(value=PreboardedPromotedEvent.class, messageSpel="'Preboarded#' + #preboarded.id + ' promoted to ExpressionExperiment#' + #ee.id + ' (annotation_sets_rebound=' + #result.annotationSetsRebound + ')'") public PreboardedExperimentService.PromotionResult promote(ExpressionExperiment ee, PreboardedExperiment preboarded) throws PreboardedExperimentService.PreboardedAlreadyPromotedException Description copied from interface:PreboardedExperimentServicePromote the preboarded to a loadedExpressionExperiment.The implementation rebinds every
AnnotationSetattached to the preboarded so it points at the EE row instead (new-row + FK rebind approach; seeSTATUS_PROPOSED_EXPERIMENT_WORKFLOW.mdfor the trade-off discussion). The preboarded's workflow state is advanced toLoaded(terminal marker — the row is retained for history; it carries no curatable artifacts) and the EE's workflow state is advanced toLoadedtoo.Emits a
PreboardedPromotedEventon the EE's audit trail (post-promotion the EE is the authoritative parent of the trail). Theeeargument is first so the@Auditedaspect picks the EE as the audit target rather than the preboarded.Throws
PreboardedExperimentService.PreboardedAlreadyPromotedExceptionif the preboarded's workflow state is alreadyLoaded(or beyond).- Specified by:
promotein interfacePreboardedExperimentService- Returns:
- the promoted-from / promoted-to pair + counts the REST layer needs for the 200 response.
- Throws:
PreboardedExperimentService.PreboardedAlreadyPromotedException
-