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

org.nuiton.topia.it.mapping.test5.A53Abstract Maven / Gradle / Ivy

The newest version!
package org.nuiton.topia.it.mapping.test5;

/*-
 * #%L
 * ToPIA :: IT
 * %%
 * Copyright (C) 2004 - 2024 Code Lutin
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public
 * License along with this program.  If not, see
 * .
 * #L%
 */

import java.util.LinkedList;
import java.util.List;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityVisitor;
import org.nuiton.topia.persistence.TopiaException;
import org.nuiton.topia.persistence.internal.AbstractTopiaEntity;
import org.nuiton.topia.persistence.util.TopiaEntityHelper;

public abstract class A53Abstract extends AbstractTopiaEntity implements A53 {

    /**
     * Nom de l'attribut en BD : b53
     */
    protected List b53;

    private static final long serialVersionUID = 7161116165906916705L;

    @Override
    public void accept(TopiaEntityVisitor visitor) throws TopiaException {
        visitor.start(this);
        accept0(visitor);
        visitor.end(this);
    }

    protected void accept0(TopiaEntityVisitor visitor) throws TopiaException {
        visitor.visit(this, PROPERTY_B53, List.class, B53.class, b53);
    }

    @Override
    public void addB53(B53 b53) {
        if (this.b53 == null) {
            this.b53 = new LinkedList();
        }
        b53.setA53(this);
        this.b53.add(b53);
    }

    @Override
    public void addB53(int index, B53 b53) {
        if (this.b53 == null) {
            this.b53 = new LinkedList();
        }
        b53.setA53(this);
        this.b53.add(index, b53);
    }

    @Override
    public void addAllB53(Iterable b53) {
        if (b53 == null) {
            return;
        }
        for (B53 item : b53) {
            addB53(item);
        }
    }

    @Override
    public void setB53(List b53) {
        this.b53 = b53;
    }

    @Override
    public void removeB53(B53 b53) {
        if (this.b53 == null || !this.b53.remove(b53)) {
            throw new IllegalArgumentException("List does not contain given element");
        }
        b53.setA53(null);
    }

    @Override
    public void removeB53(int index) {
        if (this.b53 == null) {
            throw new IllegalArgumentException("List does not contain given element");
        }
        B53 oldValue = this.b53.remove(index);
        if (oldValue == null) {
            throw new IllegalArgumentException("List does not contain given element");
        }
        oldValue.setA53(null);
    }

    @Override
    public void clearB53() {
        if (this.b53 == null) {
            return;
        }
        for (B53 item : this.b53) {
            item.setA53(null);
        }
        this.b53.clear();
    }

    @Override
    public List getB53() {
        return b53;
    }

    @Override
    public B53 getB53(int index) {
        return TopiaEntityHelper.getEntityByIndex(b53, index);
    }

    @Override
    public B53 getB53ByTopiaId(String topiaId) {
        return TopiaEntityHelper.getEntityByTopiaId(b53, topiaId);
    }

    @Override
    public List getB53TopiaIds() {
        List topiaIds = new LinkedList();
        List tmp = getB53();
        if (tmp != null) {
            for (TopiaEntity topiaEntity : tmp) {
                topiaIds.add(topiaEntity.getTopiaId());
            }
        }
        return topiaIds;
    }

    @Override
    public int sizeB53() {
        if (b53 == null) {
            return 0;
        }
        return b53.size();
    }

    @Override
    public boolean isB53Empty() {
        int size = sizeB53();
        return size == 0;
    }

    @Override
    public boolean isB53NotEmpty() {
        boolean empty = isB53Empty();
        return ! empty;
    }

    @Override
    public boolean containsB53(B53 b53) {
        boolean contains = this.b53 !=null && this.b53.contains(b53);
        return contains;
    }

} //A53Abstract




© 2015 - 2025 Weber Informatics LLC | Privacy Policy