Search in sources :

Example 1 with ICodeType

use of org.eclipse.scout.rt.shared.services.common.code.ICodeType in project scout.rt by eclipse.

the class AbstractContentAssistField method setCodeTypeClass.

@Override
public void setCodeTypeClass(Class<? extends ICodeType<?, LOOKUP_KEY>> codeType) {
    m_codeTypeClass = codeType;
    // create lookup service call
    m_lookupCall = null;
    if (m_codeTypeClass != null) {
        CodeLookupCall<LOOKUP_KEY> codeLookupCall = CodeLookupCall.newInstanceByService(m_codeTypeClass);
        m_lookupCall = codeLookupCall;
        ICodeType t = BEANS.opt(m_codeTypeClass);
        if (t != null && !ConfigurationUtility.isMethodOverwrite(AbstractContentAssistField.class, "getConfiguredBrowseHierarchy", new Class[0], this.getClass())) {
            setBrowseHierarchy(t.isHierarchy());
        }
    }
}
Also used : ICodeType(org.eclipse.scout.rt.shared.services.common.code.ICodeType)

Example 2 with ICodeType

use of org.eclipse.scout.rt.shared.services.common.code.ICodeType in project scout.rt by eclipse.

the class AbstractSmartField2 method setCodeTypeClass.

@Override
public void setCodeTypeClass(Class<? extends ICodeType<?, VALUE>> codeType) {
    m_codeTypeClass = codeType;
    // create lookup service call
    m_lookupCall = null;
    if (m_codeTypeClass != null) {
        CodeLookupCall<VALUE> codeLookupCall = CodeLookupCall.newInstanceByService(m_codeTypeClass);
        m_lookupCall = codeLookupCall;
        ICodeType t = BEANS.opt(m_codeTypeClass);
        if (t != null && !ConfigurationUtility.isMethodOverwrite(AbstractSmartField2.class, "getConfiguredBrowseHierarchy", new Class[0], this.getClass())) {
            setBrowseHierarchy(t.isHierarchy());
        }
    }
}
Also used : ICodeType(org.eclipse.scout.rt.shared.services.common.code.ICodeType)

Example 3 with ICodeType

use of org.eclipse.scout.rt.shared.services.common.code.ICodeType in project scout.rt by eclipse.

the class CodeServiceTest method testInvlidateCodeTypes.

/**
 * Tests that a client notification is created when invalidating a list of code types
 * {@link CodeService#invalidateCodeTypes(List)}
 */
@Test
public void testInvlidateCodeTypes() {
    ICodeService codeService = BEANS.get(ICodeService.class);
    List<Class<? extends ICodeType<?, ?>>> list = new ArrayList<Class<? extends ICodeType<?, ?>>>();
    list.add(SomeCodeType.class);
    list.add(DummyCodeType.class);
    codeService.invalidateCodeTypes(list);
    ArgumentCaptor<InvalidateCacheNotification> notification = ArgumentCaptor.forClass(InvalidateCacheNotification.class);
    verify(m_clientNotificationReg).putTransactionalForAllNodes(notification.capture(), anyBoolean());
    Set<Class<? extends ICodeType<?, ?>>> codeTypeClasses = ((CodeTypeCacheEntryFilter) notification.getValue().getFilter()).getCodeTypeClasses();
    assertEquals("CodeType list in the notification size", 2, codeTypeClasses.size());
    for (Class<? extends ICodeType<?, ?>> codeTypeClass : codeTypeClasses) {
        assertTrue("CodeTypes not invalidated", codeTypeClass == SomeCodeType.class || codeTypeClass == DummyCodeType.class);
    }
}
Also used : ICodeType(org.eclipse.scout.rt.shared.services.common.code.ICodeType) CodeTypeCacheEntryFilter(org.eclipse.scout.rt.shared.services.common.code.CodeTypeCacheEntryFilter) ICodeService(org.eclipse.scout.rt.shared.services.common.code.ICodeService) ArrayList(java.util.ArrayList) InvalidateCacheNotification(org.eclipse.scout.rt.shared.cache.InvalidateCacheNotification) Test(org.junit.Test)

Example 4 with ICodeType

use of org.eclipse.scout.rt.shared.services.common.code.ICodeType in project scout.rt by eclipse.

the class CodeServiceTest method testReloadCodeTypes.

@Test
public void testReloadCodeTypes() {
    ICodeService codeService = BEANS.get(ICodeService.class);
    List<Class<? extends ICodeType<?, ?>>> list = new ArrayList<Class<? extends ICodeType<?, ?>>>();
    list.add(SomeCodeType.class);
    list.add(DummyCodeType.class);
    codeService.reloadCodeTypes(list);
    ArgumentCaptor<InvalidateCacheNotification> notification = ArgumentCaptor.forClass(InvalidateCacheNotification.class);
    verify(m_clientNotificationReg).putTransactionalForAllNodes(notification.capture(), anyBoolean());
    Set<Class<? extends ICodeType<?, ?>>> codeTypeClasses = ((CodeTypeCacheEntryFilter) notification.getValue().getFilter()).getCodeTypeClasses();
    assertEquals("CodeType list in the notification size", 2, codeTypeClasses.size());
    for (Class<? extends ICodeType<?, ?>> codeTypeClass : codeTypeClasses) {
        assertTrue("CodeTypes not invalidated", codeTypeClass == SomeCodeType.class || codeTypeClass == DummyCodeType.class);
    }
}
Also used : ICodeType(org.eclipse.scout.rt.shared.services.common.code.ICodeType) CodeTypeCacheEntryFilter(org.eclipse.scout.rt.shared.services.common.code.CodeTypeCacheEntryFilter) ICodeService(org.eclipse.scout.rt.shared.services.common.code.ICodeService) ArrayList(java.util.ArrayList) InvalidateCacheNotification(org.eclipse.scout.rt.shared.cache.InvalidateCacheNotification) Test(org.junit.Test)

Example 5 with ICodeType

use of org.eclipse.scout.rt.shared.services.common.code.ICodeType in project scout.rt by eclipse.

the class CodeServiceTest method testReloadCodeType.

/**
 * Tests that a client notification is created when reloading a code type {@link CodeService#reloadCodeType}
 */
@Test
public void testReloadCodeType() {
    ICodeService codeService = BEANS.get(ICodeService.class);
    codeService.reloadCodeType(SomeCodeType.class);
    ArgumentCaptor<InvalidateCacheNotification> notification = ArgumentCaptor.forClass(InvalidateCacheNotification.class);
    verify(m_clientNotificationReg).putTransactionalForAllNodes(notification.capture(), anyBoolean());
    Set<Class<? extends ICodeType<?, ?>>> codeTypeClasses = ((CodeTypeCacheEntryFilter) notification.getValue().getFilter()).getCodeTypeClasses();
    assertEquals("CodeType list in the notification size", 1, codeTypeClasses.size());
    assertEquals("CodeType list(0) class", SomeCodeType.class, codeTypeClasses.iterator().next());
}
Also used : ICodeType(org.eclipse.scout.rt.shared.services.common.code.ICodeType) CodeTypeCacheEntryFilter(org.eclipse.scout.rt.shared.services.common.code.CodeTypeCacheEntryFilter) ICodeService(org.eclipse.scout.rt.shared.services.common.code.ICodeService) InvalidateCacheNotification(org.eclipse.scout.rt.shared.cache.InvalidateCacheNotification) Test(org.junit.Test)

Aggregations

ICodeType (org.eclipse.scout.rt.shared.services.common.code.ICodeType)7 InvalidateCacheNotification (org.eclipse.scout.rt.shared.cache.InvalidateCacheNotification)4 CodeTypeCacheEntryFilter (org.eclipse.scout.rt.shared.services.common.code.CodeTypeCacheEntryFilter)4 ICodeService (org.eclipse.scout.rt.shared.services.common.code.ICodeService)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)1 CodeService (org.eclipse.scout.rt.shared.services.common.code.CodeService)1