All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tcdng.jacklyn.common.entities.BaseTimestampedEntityQuery Maven / Gradle / Ivy

/*
 * Copyright 2018-2020 The Code Department.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * UnaddLessThan required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.tcdng.jacklyn.common.entities;

import java.util.Date;

import com.tcdng.unify.core.util.CalendarUtils;

/**
 * Query class for base time-stamped entity.
 * 
 * @author Lateef Ojulari
 * @since 1.0
 */
public abstract class BaseTimestampedEntityQuery extends BaseEventEntityQuery {

    public BaseTimestampedEntityQuery(Class entityClass) {
        super(entityClass);
    }

    public BaseTimestampedEntityQuery updateBy(String updateBy) {
        return (BaseTimestampedEntityQuery) addEquals("updateBy", updateBy);
    }

    public BaseTimestampedEntityQuery updatedOn(Date date) {
        return (BaseTimestampedEntityQuery) addBetween("updateDt", CalendarUtils.getMidnightDate(date),
                CalendarUtils.getLastSecondDate(date));
    }

    public BaseTimestampedEntityQuery updatedBetween(Date fromDate, Date toDate) {
        return (BaseTimestampedEntityQuery) addBetween("updateDt", CalendarUtils.getMidnightDate(fromDate),
                CalendarUtils.getLastSecondDate(toDate));
    }

    public BaseTimestampedEntityQuery updatedBefore(Date date) {
        return (BaseTimestampedEntityQuery) addLessThan("updateDt", date);
    }

    public BaseTimestampedEntityQuery updatedOnBefore(Date date) {
        return (BaseTimestampedEntityQuery) addLessThanEqual("updateDt", date);
    }

    public BaseTimestampedEntityQuery updatedAfter(Date date) {
        return (BaseTimestampedEntityQuery) addGreaterThan("updateDt", date);
    }

    public BaseTimestampedEntityQuery updatedOnAfter(Date date) {
        return (BaseTimestampedEntityQuery) addGreaterThanEqual("updateDt", date);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy