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

nl.tno.bim.mapping.domain.MappingSet Maven / Gradle / Ivy

package nl.tno.bim.mapping.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonManagedReference;

@SuppressWarnings("serial")
@Entity
@Table(name = "mapping_set")
public class MappingSet implements Serializable {

    @Id
    @GeneratedValue
    private Long id;

    @Column(name = "project_id", unique=true)
    private String projectId;

    private Date date;
    @JsonManagedReference(value="mappingset-1")
    @OneToMany(mappedBy = "mappingSet", cascade = CascadeType.ALL,fetch = FetchType.EAGER)
    List mappingSetMaps;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    
    public String getProjectId() {
        return projectId;
    }

    public void setProjectId(String projectId) {
        this.projectId = projectId;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public List getMappingSetMaps() {
        return mappingSetMaps;
    }

    public void setMappingSetMaps(List mappingSetMaps) {
        this.mappingSetMaps = mappingSetMaps;
    }

    public MappingSet(String contextId, Date date,Long id) {
        this.projectId = contextId;
        this.date = date;
        this.id = id;
    }

    public MappingSet() {
    }
    
    /**
     * Add a mapping to the mappingset and create a MappingSetMap 
     * mappingrevisionId of the mappingsetmap will be determined by the db service
     * @param map Mapping object to add to the mappingSet
     * @param guid IfcProduct Guid to use in the created MappingSetMap
     */
    public void addMappingToMappingSet(Mapping map, String guid) {
    	if (this.getMappingSetMaps() == null) {
    		this.setMappingSetMaps(new ArrayList<>());
    	}
    	MappingSetMap msm = new MappingSetMap();
    	msm.setElementGuid(guid);
    	msm.setMapping(map);
    	this.getMappingSetMaps().add(msm);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy