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

org.nuiton.topia.it.mapping.test6.A63Abstract Maven / Gradle / Ivy

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

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

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

    private static final long serialVersionUID = 7364573104786662969L;

    @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_ROLE_B63, List.class, B63.class, roleB63);
    }

    @Override
    public void addRoleB63(B63 roleB63) {
        fireOnPreWrite(PROPERTY_ROLE_B63, null, roleB63);
        if (this.roleB63 == null) {
            this.roleB63 = new LinkedList();
        }
        this.roleB63.add(roleB63);
        fireOnPostWrite(PROPERTY_ROLE_B63, this.roleB63.size(), null, roleB63);
    }

    @Override
    public void addRoleB63(int index, B63 roleB63) {
        fireOnPreWrite(PROPERTY_ROLE_B63, null, roleB63);
        if (this.roleB63 == null) {
            this.roleB63 = new LinkedList();
        }
        this.roleB63.add(index, roleB63);
        fireOnPostWrite(PROPERTY_ROLE_B63, index, null, roleB63);
    }

    @Override
    public void addAllRoleB63(Iterable roleB63) {
        if (roleB63 == null) {
            return;
        }
        for (B63 item : roleB63) {
            addRoleB63(item);
        }
    }

    @Override
    public void setRoleB63(List roleB63) {
        // Copy elements to keep data for fire with new reference
        List oldValue = this.roleB63 != null ? new LinkedList(this.roleB63) : null;
        fireOnPreWrite(PROPERTY_ROLE_B63, oldValue, roleB63);
        this.roleB63 = roleB63;
        fireOnPostWrite(PROPERTY_ROLE_B63, oldValue, roleB63);
    }

    @Override
    public void removeRoleB63(B63 roleB63) {
        fireOnPreWrite(PROPERTY_ROLE_B63, roleB63, null);
        if (this.roleB63 == null || !this.roleB63.remove(roleB63)) {
            throw new IllegalArgumentException("List does not contain given element");
        }
        fireOnPostWrite(PROPERTY_ROLE_B63, this.roleB63.size() + 1, roleB63, null);
    }

    @Override
    public void removeRoleB63(int index) {
        fireOnPreWrite(PROPERTY_ROLE_B63, roleB63, null);
        if (this.roleB63 == null) {
            throw new IllegalArgumentException("List does not contain given element");
        }
        B63 oldValue = this.roleB63.remove(index);
        if (oldValue == null) {
            throw new IllegalArgumentException("List does not contain given element");
        }
        fireOnPostWrite(PROPERTY_ROLE_B63, index, oldValue, null);
    }

    @Override
    public void clearRoleB63() {
        if (this.roleB63 == null) {
            return;
        }
        List oldValue = new LinkedList(this.roleB63);
        fireOnPreWrite(PROPERTY_ROLE_B63, oldValue, this.roleB63);
        this.roleB63.clear();
        fireOnPostWrite(PROPERTY_ROLE_B63, oldValue, this.roleB63);
    }

    @Override
    public List getRoleB63() {
        return roleB63;
    }

    @Override
    public B63 getRoleB63(int index) {
        return TopiaEntityHelper.getEntityByIndex(roleB63, index);
    }

    @Override
    public B63 getRoleB63ByTopiaId(String topiaId) {
        return TopiaEntityHelper.getEntityByTopiaId(roleB63, topiaId);
    }

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

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

    @Override
    public boolean isRoleB63Empty() {
        int size = sizeRoleB63();
        return size == 0;
    }

    @Override
    public boolean isRoleB63NotEmpty() {
        boolean empty = isRoleB63Empty();
        return ! empty;
    }

    @Override
    public boolean containsRoleB63(B63 roleB63) {
        boolean contains = this.roleB63 !=null && this.roleB63.contains(roleB63);
        return contains;
    }

} //A63Abstract




© 2015 - 2025 Weber Informatics LLC | Privacy Policy