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.model.data.party.server.entity.Language; 021import com.echothree.util.server.persistence.BaseDatabaseQuery; 022import com.echothree.util.server.persistence.EntityPermission; 023import com.echothree.util.server.persistence.Session; 024import java.util.List; 025 026public class EntityInstancesMissingStringEntityAttributeQuery 027 extends BaseDatabaseQuery<EntityInstanceResult> { 028 029 public EntityInstancesMissingStringEntityAttributeQuery() { 030 super(""" 031 SELECT eni_entityinstanceid AS EntityInstance 032 FROM entityattributes 033 JOIN entityattributedetails ON ena_activedetailid = enadt_entityattributedetailid 034 JOIN entityinstances ON enadt_ent_entitytypeid = eni_ent_entitytypeid 035 JOIN entitytimes ON eni_entityinstanceid = etim_eni_entityinstanceid 036 WHERE ena_entityattributeid = ? AND etim_deletedtime IS NULL 037 AND eni_entityinstanceid NOT IN 038 (SELECT ensa_eni_entityinstanceid 039 FROM entitystringattributes 040 WHERE ensa_ena_entityattributeid = ? AND ensa_lang_languageid = ? AND ensa_thrutime = ?) 041 """, EntityPermission.READ_ONLY); 042 } 043 044 public List<EntityInstanceResult> execute(final EntityAttribute entityAttribute, final Language language) { 045 return super.execute(entityAttribute, entityAttribute, language, Session.MAX_TIME_LONG); 046 } 047 048}