Search in sources :

Example 16 with LoadContext

use of com.haulmont.cuba.core.global.LoadContext in project cuba by cuba-platform.

the class SoftDeleteNotFoundDeletedTest method testLoadDeletedObject.

@Test
public void testLoadDeletedObject() {
    View taskView_Message = new View(SoftDelete_Task.class).addProperty("message");
    View taskView_Service = new View(SoftDelete_Task.class).addProperty("service", new View(SoftDelete_Service.class).addProperty("code"));
    View taskValueView = new View(SoftDelete_TaskValue.class).addProperty("task", taskView_Message);
    View projectView = new View(SoftDelete_Project.class).addProperty("name").addProperty("aValue", taskValueView).addProperty("task", taskView_Service);
    LoadContext<SoftDelete_Project> loadContext = new LoadContext<>(SoftDelete_Project.class).setView(projectView).setId(projectId);
    SoftDelete_Project project = dataManager.load(loadContext);
    Assertions.assertNotNull(project);
    Assertions.assertNotNull(project.getTask());
    Assertions.assertTrue(project.getTask().isDeleted());
}
Also used : SoftDelete_Task(com.haulmont.cuba.testmodel.softdelete_notfounddeleted.SoftDelete_Task) SoftDelete_TaskValue(com.haulmont.cuba.testmodel.softdelete_notfounddeleted.SoftDelete_TaskValue) LoadContext(com.haulmont.cuba.core.global.LoadContext) SoftDelete_Project(com.haulmont.cuba.testmodel.softdelete_notfounddeleted.SoftDelete_Project) View(com.haulmont.cuba.core.global.View)

Aggregations

LoadContext (com.haulmont.cuba.core.global.LoadContext)16 User (com.haulmont.cuba.security.entity.User)6 DataService (com.haulmont.cuba.core.app.DataService)4 Entity (com.haulmont.cuba.core.entity.Entity)4 DataManager (com.haulmont.cuba.core.global.DataManager)4 Test (org.junit.jupiter.api.Test)4 FileDescriptor (com.haulmont.cuba.core.entity.FileDescriptor)2 IOException (java.io.IOException)2 UUID (java.util.UUID)2 BaseGenericIdEntity (com.haulmont.cuba.core.entity.BaseGenericIdEntity)1 JmxInstance (com.haulmont.cuba.core.entity.JmxInstance)1 EntityLoadInfo (com.haulmont.cuba.core.global.EntityLoadInfo)1 FileStorageException (com.haulmont.cuba.core.global.FileStorageException)1 View (com.haulmont.cuba.core.global.View)1 LogicalCondition (com.haulmont.cuba.core.global.queryconditions.LogicalCondition)1 SecurityContext (com.haulmont.cuba.core.sys.SecurityContext)1 GuiDevelopmentException (com.haulmont.cuba.gui.GuiDevelopmentException)1 Group (com.haulmont.cuba.security.entity.Group)1 NoUserSessionException (com.haulmont.cuba.security.global.NoUserSessionException)1 UserSession (com.haulmont.cuba.security.global.UserSession)1