Search in sources :

Example 1 with ModelType

use of org.openlca.core.model.ModelType in project olca-modules by GreenDelta.

the class FileStore method deleteFolder.

public void deleteFolder(RefEntity e) {
    if (e == null)
        return;
    ModelType type = ModelType.forModelClass(e.getClass());
    deleteFolder(type, e.refId);
}
Also used : ModelType(org.openlca.core.model.ModelType)

Example 2 with ModelType

use of org.openlca.core.model.ModelType in project olca-modules by GreenDelta.

the class FileStore method copyFolder.

public void copyFolder(RefEntity from, RefEntity to) {
    if (from == null || to == null)
        return;
    ModelType type = ModelType.forModelClass(from.getClass());
    copyFolder(type, from.refId, to.refId);
}
Also used : ModelType(org.openlca.core.model.ModelType)

Example 3 with ModelType

use of org.openlca.core.model.ModelType in project olca-modules by GreenDelta.

the class BaseReferenceSearchTest method findReferences.

protected List<Reference> findReferences(Set<Long> ids) {
    ModelType type = getModelType();
    IReferenceSearch<?> search = IReferenceSearch.FACTORY.createFor(type, Tests.getDb(), true);
    return search.findReferences(ids);
}
Also used : ModelType(org.openlca.core.model.ModelType)

Example 4 with ModelType

use of org.openlca.core.model.ModelType in project olca-modules by GreenDelta.

the class CategoryDaoTest method findAllRootTypes.

@Test
public void findAllRootTypes() {
    // in categories, but this test should work
    for (ModelType type : ModelType.values()) {
        Category cat = create();
        cat.modelType = type;
        dao.insert(cat);
        Tests.emptyCache();
        List<Category> categories = dao.getRootCategories(type);
        Assert.assertTrue(categories.contains(cat));
        dao.delete(cat);
        categories = dao.getRootCategories(type);
        Assert.assertFalse(categories.contains(cat));
    }
}
Also used : Category(org.openlca.core.model.Category) ModelType(org.openlca.core.model.ModelType) Test(org.junit.Test)

Example 5 with ModelType

use of org.openlca.core.model.ModelType in project olca-modules by GreenDelta.

the class EnumsTest method testModelType.

@Test
public void testModelType() {
    ModelType type = Enums.getValue("FLOW", ModelType.class);
    assertEquals(ModelType.FLOW, type);
    assertEquals("FLOW", Enums.getLabel(type));
}
Also used : ModelType(org.openlca.core.model.ModelType) Test(org.junit.Test)

Aggregations

ModelType (org.openlca.core.model.ModelType)21 JsonObject (com.google.gson.JsonObject)4 Test (org.junit.Test)4 HashSet (java.util.HashSet)3 Category (org.openlca.core.model.Category)3 JsonArray (com.google.gson.JsonArray)2 File (java.io.File)2 HashMap (java.util.HashMap)2 Set (java.util.Set)2 JsonElement (com.google.gson.JsonElement)1 IOException (java.io.IOException)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 StandardCopyOption (java.nio.file.StandardCopyOption)1 ArrayList (java.util.ArrayList)1 Predicate (java.util.function.Predicate)1 Collectors (java.util.stream.Collectors)1 TextDropComponent (org.openlca.app.components.TextDropComponent)1 CommentControl (org.openlca.app.editors.comments.CommentControl)1 Tests (org.openlca.core.Tests)1