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

org.nuiton.topia.it.mapping.test7.A7Abstract Maven / Gradle / Ivy

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

/*-
 * #%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 A7Abstract extends AbstractTopiaEntity implements A7 {

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

    private static final long serialVersionUID = 4049692852257110071L;

    @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_B7, List.class, B7.class, b7);
    }

    @Override
    public void addB7(B7 b7) {
        if (this.b7 == null) {
            this.b7 = new LinkedList();
        }
        this.b7.add(b7);
    }

    @Override
    public void addB7(int index, B7 b7) {
        if (this.b7 == null) {
            this.b7 = new LinkedList();
        }
        this.b7.add(index, b7);
    }

    @Override
    public void addAllB7(Iterable b7) {
        if (b7 == null) {
            return;
        }
        for (B7 item : b7) {
            addB7(item);
        }
    }

    @Override
    public void setB7(List b7) {
        this.b7 = b7;
    }

    @Override
    public void removeB7(B7 b7) {
        if (this.b7 == null || !this.b7.remove(b7)) {
            throw new IllegalArgumentException("List does not contain given element");
        }
    }

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

    @Override
    public void clearB7() {
        if (this.b7 == null) {
            return;
        }
        this.b7.clear();
    }

    @Override
    public List getB7() {
        return b7;
    }

    @Override
    public B7 getB7(int index) {
        return TopiaEntityHelper.getEntityByIndex(b7, index);
    }

    @Override
    public B7 getB7ByTopiaId(String topiaId) {
        return TopiaEntityHelper.getEntityByTopiaId(b7, topiaId);
    }

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

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

    @Override
    public boolean isB7Empty() {
        int size = sizeB7();
        return size == 0;
    }

    @Override
    public boolean isB7NotEmpty() {
        boolean empty = isB7Empty();
        return ! empty;
    }

    @Override
    public boolean containsB7(B7 b7) {
        boolean contains = this.b7 !=null && this.b7.contains(b7);
        return contains;
    }

} //A7Abstract




© 2015 - 2025 Weber Informatics LLC | Privacy Policy