001// -------------------------------------------------------------------------------- 002// Copyright 2002-2025 Echo Three, LLC 003// 004// Licensed under the Apache License, Version 2.0 (the "License"); 005// you may not use this file except in compliance with the License. 006// You may obtain a copy of the License at 007// 008// http://www.apache.org/licenses/LICENSE-2.0 009// 010// Unless required by applicable law or agreed to in writing, software 011// distributed under the License is distributed on an "AS IS" BASIS, 012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013// See the License for the specific language governing permissions and 014// limitations under the License. 015// -------------------------------------------------------------------------------- 016 017package com.echothree.model.control.core.server.database; 018 019import com.echothree.model.data.core.server.entity.EntityAttribute; 020import com.echothree.util.server.persistence.BaseDatabaseQuery; 021import com.echothree.util.server.persistence.EntityPermission; 022import com.echothree.util.server.persistence.Session; 023import java.util.List; 024 025public class EntityInstancesMissingDateEntityAttributeQuery 026 extends BaseDatabaseQuery<EntityInstanceResult> { 027 028 public EntityInstancesMissingDateEntityAttributeQuery() { 029 super(""" 030 SELECT eni_entityinstanceid AS EntityInstance 031 FROM entityattributes 032 JOIN entityattributedetails ON ena_activedetailid = enadt_entityattributedetailid 033 JOIN entityinstances ON enadt_ent_entitytypeid = eni_ent_entitytypeid 034 JOIN entitytimes ON eni_entityinstanceid = etim_eni_entityinstanceid 035 WHERE ena_entityattributeid = ? AND etim_deletedtime IS NULL 036 AND eni_entityinstanceid NOT IN 037 (SELECT enda_eni_entityinstanceid 038 FROM entitydateattributes 039 WHERE enda_ena_entityattributeid = ? AND enda_thrutime = ?) 040 """, EntityPermission.READ_ONLY); 041 } 042 043 public List<EntityInstanceResult> execute(final EntityAttribute entityAttribute) { 044 return super.execute(entityAttribute, entityAttribute, Session.MAX_TIME_LONG); 045 } 046 047}