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

org.bimserver.emf.IfcModelInterface Maven / Gradle / Ivy

package org.bimserver.emf;

/******************************************************************************
 * Copyright (C) 2009-2017  BIMserver.org
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero 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 Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see {@literal}.
 *****************************************************************************/

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.bimserver.models.ifc2x3tc1.IfcRoot;
import org.bimserver.plugins.ObjectAlreadyExistsException;
import org.bimserver.shared.exceptions.PublicInterfaceNotFoundException;
import org.bimserver.shared.exceptions.ServerException;
import org.bimserver.shared.exceptions.UserException;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;

import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.BiMap;

/**
 * @author Ruben de Laat
 *
 * 
 */
public interface IfcModelInterface extends Iterable, ObjectFactory {

	/**
	 * Retrieve an object by its GUID
	 * @param guid
	 * @return An object of a subclass of IfcRoot, or null if the object does not exist in this model
	 */
	IfcRoot getByGuid(String guid);

	/**
	 * Retrieve an object by its name
	 * @param eClass The type of the object
	 * @param name The name of the object
	 * @return The object, or null if it is not in the model
	 */
	IdEObject getByName(EClass eClass, String name);

	/**
	 * Retrieve an object by its OID
	 * @param oid
	 * @return The object with the given OID, or null if the object does not exist in this model
	 */
	IdEObject get(long oid);
	
	/**
	 * Retrieve a set of all the GUIDs of the objects of a certain type
	 * @param eClass The type to look for
	 * @return A Set containing all the GUIDs
	 */
	Set getGuids(EClass eClass);

	/**
	 * Retrieve a set of all the names of the objects of a certain type
	 * @param eClass The type to look for
	 * @return A Set containing all the names
	 */
	Set getNames(EClass eClass);
	
	
	/**
	 * Retrieve the size of the model
	 * @return The amount of objects in the model
	 */
	long size();
	
	/**
	 * Tests if this model has a certain GUID
	 * @param referredGuid
	 * @return true if the model has an object with the given GUID, false if it has not
	 */
	boolean containsGuid(String referredGuid);

	/**
	 * Tests whether this model has a certain OID
	 * @param oid
	 * @return true if the model has an object with the given OID, false if it has not
	 */
	boolean contains(long oid);

	/**
	 * Count the amount of objects of the given type
	 * @param eClass The type to query
	 * @return The amount of objects of the given type
	 */
	int count(EClass eClass);
	
	/**
	 * @return All objects in this model as a Collection
	 */
	Collection getValues();

	/**
	 * @return A BiMap with all objects in this model
	 */
	BiMap getObjects();

	/**
	 * @return All OID's in this model
	 */
	Set keySet();

	/**
	 * @param clazz The type to query for
	 * @return A List with all the objects in this model of the given type, instances of subtypes are not included
	 */
	 List getAll(Class clazz);

	/**
	 * @param clazz The type to query for
	 * @return A List with all the objects in this model of the given type, instances of subtypes are not included
	 */
	 List getAll(EClass clazz);
	
	/**
	 * @param clazz The type to query for 
	 * @return A List with all the objects in this model of the given type, instances of subtypes are included
	 */
	 List getAllWithSubTypes(Class clazz);

	/**
	 * @param clazz The type to query for 
	 * @return A List with all the objects in this model of the given type, instances of subtypes are included
	 */
	 List getAllWithSubTypes(EClass eClass);

	/** Tests whether the given object is part of this model
	 * @param referencedObject
	 * @return Whether the given object is part of this model
	 */
	boolean contains(IdEObject referencedObject);

	/**
	 * Add an object to this model with an explicit OID, only use this method in BIMserver internal code
	 * @param oid The given OID
	 * @param newObject The new object to add to this model
	 * @throws IfcModelInterfaceException
	 * @throws ObjectAlreadyStoredException 
	 */
	void add(long oid, IdEObject newObject) throws IfcModelInterfaceException, ObjectAlreadyExistsException;
	
	/**
	 * Add an object to this model with an explicit OID, allow the object to exist in multiple models, only use this method in BIMserver internal code
	 * @param oid The given OID
	 * @param newObject The new object to add to this model
	 * @throws IfcModelInterfaceException
	 * @throws ObjectAlreadyStoredException 
	 */
	void addAllowMultiModel(long oid, IdEObject newObject) throws IfcModelInterfaceException, ObjectAlreadyExistsException;

	/**
	 * Remove an object
	 * @param objectToRemove The object to remove from this model
	 */
	void remove(IdEObject objectToRemove);

	/**
	 * @return The ModelMetaData of this model
	 */
	ModelMetaData getModelMetaData();
	
	void fixOids(OidProvider oidProvider);
	void fixOidsFlat(OidProvider oidProvider);
	void setObjectOids();
	void indexGuids();
	long getHighestOid();
	void resetOids();
	void resetOidsFlat();
	boolean isValid();
	void checkDoubleOidsPlusReferences();
	void fixOidCounter();
	void setUseDoubleStrings(boolean useDoubleStrings);
	boolean isUseDoubleStrings();
	void changeOid(IdEObject object);
	void fixOids();
	void generateMinimalExpressIds();

	void fixInverseMismatches();
	
	Collection getUnidentifiedValues();
	int countWithSubtypes(EClass eClass);

	void clear();

	void resetExpressIds();

	IfcModelInterface branch(long poid, boolean recordChanges);

	long commit(String comment) throws ServerException, UserException, PublicInterfaceNotFoundException;

	 T create(Class class1, OidProvider oidProvider) throws IfcModelInterfaceException, ObjectAlreadyExistsException;
	 T create(EClass eClass, OidProvider oidProvider) throws IfcModelInterfaceException, ObjectAlreadyExistsException;
	
	PackageMetaData getPackageMetaData();
	Map getPidRoidMap();

	void set(IdEObject idEObject, EStructuralFeature eFeature, Object newValue);

	void checkin(long poid, String comment) throws ServerException, UserException, PublicInterfaceNotFoundException;

	 T create(EClass eClass, long oid) throws IfcModelInterfaceException;

	 T createAndAdd(Class class1) throws IfcModelInterfaceException, ObjectAlreadyExistsException;

	boolean containsNoFetch(long oid);

	IdEObject getNoFetch(long oid);

	void load(IdEObject idEObject);

	Set getUsedClasses();

	void query(ObjectNode query);

	 T createAndAdd(EClass eClass, long oid) throws IfcModelInterfaceException, ObjectAlreadyExistsException;

	 T createAndAdd(EClass eClass) throws IfcModelInterfaceException, ObjectAlreadyExistsException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy