EN · DE · RU · FR · ES

#592: TemplateEntry.java

projectforge-business/src/main/java/org/projectforge/business/teamcal/filter/TemplateEntry.java Type : Java · Rôle : Filtre de recherche · Source : projectforge-business/src/main/java/org/projectforge/business/teamcal/filter/TemplateEntry.java 431 lignes · 265 code · 115 commentaires · 51 vides
Fichier source à projectforge-business/src/main/java/org/projectforge/business/teamcal/filter/TemplateEntry.java contenant du code Java pour la couche Filtre de recherche.

Structure du code

Paquetage : org.projectforge.business.teamcal.filter

Classes : TemplateEntry

Implémente : Serializable, Comparable<TemplateEntry>, Cloneable

Méthodes (36) : getCalendarProperties, getName, setName, addNewCalendarProperties, removeCalendarProperties, getColorCode, getCalendarProperties, contains, isVisible, getVisibleCalendarIds, getCalendars, getCalendarIds, setDirty, compareTo, hashCode, equals, clone, isModified, getDefaultCalendarId, setDefaultCalendarId, isShowBirthdays, setShowBirthdays, isShowBreaks, setShowBreaks, isShowPlanning...

Champs (11) : serialVersionUID, calendarProperties, visibleCalendarIds, name, defaultCalendarId, showBirthdays, showStatistics, timesheetUserId, selectedCalendar, showBreaks, showPlanning

Importations : 9 paquetages

Code source (abrégé)

package org.projectforge.business.teamcal.filter;

import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import org.apache.commons.lang3.StringUtils;
import org.projectforge.Constants;
import org.projectforge.business.teamcal.admin.TeamCalCache;
import org.projectforge.business.teamcal.admin.model.TeamCalDO;
import org.projectforge.framework.configuration.ApplicationContextProvider;
import org.projectforge.framework.persistence.user.api.ThreadLocalUserContext;

import java.io.Serializable;
import java.util.*;

/**
 * Persiste les paramètres d'une entrée de filtre nommée.
 *
 * @author M. Lauterbach (m.lauterbach@micromata.de)
 * @author K. Reinhard (k.reinhard@micromata.de)
 */
public class TemplateEntry implements Serializable, Comparable<TemplateEntry>, Cloneable {
    private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(TemplateEntry.class);

    private static final long serialVersionUID = 409057949195992116L;

    private final Set<TemplateCalendarProperties> calendarProperties = new TreeSet<>();

    private Set<Long> visibleCalendarIds;

    @XStreamAsAttribute
    private String name;

    @XStreamAsAttribute
    private Long defaultCalendarId;

    @XStreamAsAttribute
    private Boolean showBirthdays;

    @XStreamAsAttribute
    private Boolean showStatistics;

    @XStreamAsAttribute
    private Long timesheetUserId;

    @XStreamAsAttribute
    private String selectedCalendar;

    @XStreamAsAttribute
    private Boolean showBreaks = true;

    @XStreamAsAttribute
    private Boolean showPlanning;

    public Set<TemplateCalendarProperties> getCalendarProperties() {
        return calendarProperties;
    }

    /**
     * @return le nom
     */
    public String getName() {
        return name;
    }

    /**
     * @param name le nom à définir
     * @return this pour chaînage.
     */
    public TemplateEntry setName(final String name) {
        this.name = name;
        return this;
    }

    public TemplateCalendarProperties addNewCalendarProperties(final TeamCalCalendarFilter filter, final Long calId) {
        Objects.requireNonNull(calId);
        final TemplateCalendarProperties props = new TemplateCalendarProperties();
        props.setCalId(calId);
        props.setColorCode(filter.getUsedColor(calId));
        this.calendarProperties.add(props);
        this.visibleCalendarIds = null;
        return props;
    }

    public void removeCalendarProperties(final Long calId) {
        Objects.requireNonNull(calId);
        final TemplateCalendarProperties props = getCalendarProperties(calId);
        if (props != null) {
            this.calendarProperties.remove(props);
        }
        this.visibleCalendarIds = null;
    }

    public String getColorCode(final Long calendarId) {
        final TemplateCalendarProperties props = getCalendarProperties(calendarId);
        if (props == null) {
            return null;
        }
        return props.getColorCode();
    }

    public TemplateCalendarProperties getCalendarProperties(final Long calendarId) {
        if (calendarId == null) {
            return null;
        }
        for (final TemplateCalendarProperties props : calendarProperties) {
            if (calendarId.equals(props.getCalId())) {
                return props;
            }
        }
        return null;
    }

    public boolean contains(final Long calendarId) {
        return getCalendarProperties(calendarId) != null;
    }

    public boolean isVisible(final Long calendarId) {
        final TemplateCalendarProperties props = getCalendarProperties(calendarId);
        return props != null && props.isVisible();
    }
// ... (tronqué, total 409 lignes)

Historique Git

868d6abb7 2025 -> 2026
63081666f En-têtes de fichiers source : 2024 -> 2025.
b79a1edca Migration en cours... (tous les tests de tous les paquetages : OK).
67805f2fc ThreadLocalUserContext.user -> ThreadLocalUserContext.loggedInUser (renommé pour éviter les malentendus dans le code).
4c04cfd65 CHANGEMENT-MAJEUR ! Migration des identifiants entiers vers des identifiants Long (y compris les clés étrangères, etc.)