001/** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.isis.objectstore.jdo.applib.service.background; 018 019import java.util.List; 020import java.util.UUID; 021 022import org.slf4j.Logger; 023import org.slf4j.LoggerFactory; 024 025import org.apache.isis.applib.AbstractFactoryAndRepository; 026import org.apache.isis.applib.annotation.DomainService; 027import org.apache.isis.applib.annotation.Programmatic; 028import org.apache.isis.applib.query.QueryDefault; 029import org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo; 030 031/** 032 * Provides supporting functionality for querying 033 * {@link org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo command} entities that have been persisted 034 * to execute in the background. 035 * 036 * <p> 037 * This supporting service with no UI and no side-effects, and is there are no other implementations of the service, 038 * thus has been annotated with {@link org.apache.isis.applib.annotation.DomainService}. This means that there is no 039 * need to explicitly register it as a service (eg in <tt>isis.properties</tt>). 040 */ 041@DomainService 042public class BackgroundCommandServiceJdoRepository extends AbstractFactoryAndRepository { 043 044 @SuppressWarnings("unused") 045 private static final Logger LOG = LoggerFactory.getLogger(BackgroundCommandServiceJdoRepository.class); 046 047 @Programmatic 048 public List<CommandJdo> findByTransactionId(final UUID transactionId) { 049 return allMatches( 050 new QueryDefault<CommandJdo>(CommandJdo.class, 051 "findBackgroundCommandByTransactionId", 052 "transactionId", transactionId)); 053 } 054 055 @Programmatic 056 public List<CommandJdo> findByParent(CommandJdo parent) { 057 return allMatches( 058 new QueryDefault<CommandJdo>(CommandJdo.class, 059 "findBackgroundCommandsByParent", 060 "parent", parent)); 061 } 062 063 @Programmatic 064 public List<CommandJdo> findBackgroundCommandsNotYetStarted() { 065 return allMatches( 066 new QueryDefault<CommandJdo>(CommandJdo.class, 067 "findBackgroundCommandsNotYetStarted")); 068 } 069 070}