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());
}
}
}
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());
}
}
}
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);
}
}
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);
}
}
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());
}
Aggregations