Search in sources :

Example 1 with SORTA_JOB_EXECUTION

use of org.molgenis.ontology.sorta.meta.SortaJobExecutionMetaData.SORTA_JOB_EXECUTION in project molgenis by molgenis.

the class SortaController method getJobsForCurrentUser.

private List<SortaJobExecution> getJobsForCurrentUser() {
    final List<SortaJobExecution> jobs = new ArrayList<>();
    User currentUser = userAccountService.getCurrentUser();
    Query<SortaJobExecution> query = dataService.query(SORTA_JOB_EXECUTION, SortaJobExecution.class).eq(JobExecutionMetaData.USER, currentUser.getUsername());
    query.sort().on(JobExecutionMetaData.START_DATE, DESC);
    RunAsSystemAspect.runAsSystem(() -> query.findAll().forEach(job -> {
        // TODO: fetch the user as well
        job.set(JobExecutionMetaData.USER, currentUser.getUsername());
        jobs.add(job);
    }));
    return jobs;
}
Also used : PluginController(org.molgenis.web.PluginController) DEEP_COPY_ATTRS(org.molgenis.data.meta.model.EntityType.AttributeCopyMode.DEEP_COPY_ATTRS) MenuReaderService(org.molgenis.core.ui.menu.MenuReaderService) IdGenerator(org.molgenis.data.populate.IdGenerator) Operator(org.molgenis.data.QueryRule.Operator) LoggerFactory(org.slf4j.LoggerFactory) PermissionSystemService(org.molgenis.data.security.permission.PermissionSystemService) StringUtils(org.apache.commons.lang3.StringUtils) Attribute(org.molgenis.data.meta.model.Attribute) FileStore(org.molgenis.data.file.FileStore) Collections.singletonList(java.util.Collections.singletonList) JobExecutionMetaData(org.molgenis.jobs.model.JobExecutionMetaData) User(org.molgenis.data.security.auth.User) Model(org.springframework.ui.Model) ByteArrayInputStream(java.io.ByteArrayInputStream) SORTA_JOB_EXECUTION(org.molgenis.ontology.sorta.meta.SortaJobExecutionMetaData.SORTA_JOB_EXECUTION) Arrays.asList(java.util.Arrays.asList) RunAsSystemAspect(org.molgenis.security.core.runas.RunAsSystemAspect) EntityTypeIdentity(org.molgenis.data.security.EntityTypeIdentity) StringUtils.isEmpty(org.apache.commons.lang3.StringUtils.isEmpty) EntityCollectionResponse(org.molgenis.data.rest.EntityCollectionResponse) AttributeFactory(org.molgenis.data.meta.model.AttributeFactory) org.molgenis.data(org.molgenis.data) ImmutableMap(com.google.common.collect.ImmutableMap) XREF(org.molgenis.data.meta.AttributeType.XREF) UserAccountService(org.molgenis.security.user.UserAccountService) EntityType(org.molgenis.data.meta.model.EntityType) Collectors(java.util.stream.Collectors) Stream(java.util.stream.Stream) UserPermissionEvaluator(org.molgenis.security.core.UserPermissionEvaluator) org.springframework.web.bind.annotation(org.springframework.web.bind.annotation) URI(org.molgenis.ontology.sorta.controller.SortaController.URI) CsvWriter(org.molgenis.data.csv.CsvWriter) SortaJobExecutionMetaData(org.molgenis.ontology.sorta.meta.SortaJobExecutionMetaData) SortaService(org.molgenis.ontology.sorta.service.SortaService) EntityPager(org.molgenis.data.rest.EntityPager) java.util(java.util) SortaServiceImpl(org.molgenis.ontology.sorta.service.impl.SortaServiceImpl) SimpleDateFormat(java.text.SimpleDateFormat) QueryImpl(org.molgenis.data.support.QueryImpl) SortaCsvRepository(org.molgenis.ontology.sorta.repo.SortaCsvRepository) Controller(org.springframework.stereotype.Controller) EntityTypePermission(org.molgenis.data.security.EntityTypePermission) OntologyTermMetaData(org.molgenis.ontology.core.meta.OntologyTermMetaData) NumberFormat(java.text.NumberFormat) StringUtils.isNotEmpty(org.apache.commons.lang3.StringUtils.isNotEmpty) HttpServletRequest(javax.servlet.http.HttpServletRequest) DynamicEntity(org.molgenis.data.support.DynamicEntity) SortaJobImpl(org.molgenis.ontology.sorta.job.SortaJobImpl) SortaServiceRequest(org.molgenis.ontology.sorta.request.SortaServiceRequest) Objects.requireNonNull(java.util.Objects.requireNonNull) EntityTypeFactory(org.molgenis.data.meta.model.EntityTypeFactory) StreamSupport(java.util.stream.StreamSupport) MatchingTaskContentMetaData(org.molgenis.ontology.sorta.meta.MatchingTaskContentMetaData) OntologyService(org.molgenis.ontology.core.service.OntologyService) ExecutorService(java.util.concurrent.ExecutorService) AttributeType(org.molgenis.data.meta.AttributeType) Logger(org.slf4j.Logger) SortaJobFactory(org.molgenis.ontology.sorta.job.SortaJobFactory) HttpServletResponse(javax.servlet.http.HttpServletResponse) IOException(java.io.IOException) SortaServiceUtil(org.molgenis.ontology.utils.SortaServiceUtil) File(java.io.File) SortaServiceResponse(org.molgenis.ontology.sorta.request.SortaServiceResponse) HttpStatus(org.springframework.http.HttpStatus) DESC(org.molgenis.data.Sort.Direction.DESC) SortaServiceUtil.getEntityAsMap(org.molgenis.ontology.utils.SortaServiceUtil.getEntityAsMap) SortaJobExecution(org.molgenis.ontology.sorta.job.SortaJobExecution) MultipartFile(org.springframework.web.multipart.MultipartFile) SortaJobExecutionFactory(org.molgenis.ontology.sorta.job.SortaJobExecutionFactory) InputStream(java.io.InputStream) User(org.molgenis.data.security.auth.User) SortaJobExecution(org.molgenis.ontology.sorta.job.SortaJobExecution)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 NumberFormat (java.text.NumberFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 java.util (java.util)1 Arrays.asList (java.util.Arrays.asList)1 Collections.singletonList (java.util.Collections.singletonList)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 ExecutorService (java.util.concurrent.ExecutorService)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 StreamSupport (java.util.stream.StreamSupport)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 StringUtils (org.apache.commons.lang3.StringUtils)1 StringUtils.isEmpty (org.apache.commons.lang3.StringUtils.isEmpty)1 StringUtils.isNotEmpty (org.apache.commons.lang3.StringUtils.isNotEmpty)1