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

org.nuiton.topia.it.mapping.test14.A14CAbstract Maven / Gradle / Ivy

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

/*-
 * #%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.Collection;
import java.util.LinkedList;
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 A14CAbstract extends AbstractTopiaEntity implements A14C {

    /**
     * Nom de l'attribut en BD : b14C
     */
    protected Collection b14CAssoc14C;

    private static final long serialVersionUID = 7233453040327604533L;

    @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_B14_CASSOC14_C, Collection.class, Assoc14C.class, b14CAssoc14C);
    }

    @Override
    public void addB14CAssoc14C(Assoc14C b14CAssoc14C) {
        if (this.b14CAssoc14C == null) {
            this.b14CAssoc14C = new LinkedList();
        }
        b14CAssoc14C.setA14C(this);
        this.b14CAssoc14C.add(b14CAssoc14C);
    }

    @Override
    public void addAllB14CAssoc14C(Iterable b14CAssoc14C) {
        if (b14CAssoc14C == null) {
            return;
        }
        for (Assoc14C item : b14CAssoc14C) {
            addB14CAssoc14C(item);
        }
    }

    @Override
    public void setB14CAssoc14C(Collection b14CAssoc14C) {
        this.b14CAssoc14C = b14CAssoc14C;
    }

    @Override
    public void removeB14CAssoc14C(Assoc14C b14CAssoc14C) {
        if (this.b14CAssoc14C == null || !this.b14CAssoc14C.remove(b14CAssoc14C)) {
            throw new IllegalArgumentException("List does not contain given element");
        }
        b14CAssoc14C.setA14C(null);
    }

    @Override
    public void clearB14CAssoc14C() {
        if (this.b14CAssoc14C == null) {
            return;
        }
        for (Assoc14C item : this.b14CAssoc14C) {
            item.setA14C(null);
        }
        this.b14CAssoc14C.clear();
    }

    @Override
    public Collection getB14CAssoc14C() {
        return b14CAssoc14C;
    }

    @Override
    public Assoc14C getB14CAssoc14CByTopiaId(String topiaId) {
        return TopiaEntityHelper.getEntityByTopiaId(b14CAssoc14C, topiaId);
    }

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

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

    @Override
    public boolean isB14CAssoc14CEmpty() {
        int size = sizeB14CAssoc14C();
        return size == 0;
    }

    @Override
    public boolean isB14CAssoc14CNotEmpty() {
        boolean empty = isB14CAssoc14CEmpty();
        return ! empty;
    }

    @Override
    public boolean containsB14CAssoc14C(Assoc14C b14CAssoc14C) {
        boolean contains = this.b14CAssoc14C !=null && this.b14CAssoc14C.contains(b14CAssoc14C);
        return contains;
    }

} //A14CAbstract




© 2015 - 2025 Weber Informatics LLC | Privacy Policy