本文整理匯總了Java中com.haulmont.cuba.security.entity.RoleType類的典型用法代碼示例。如果您正苦於以下問題:Java RoleType類的具體用法?Java RoleType怎麽用?Java RoleType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RoleType類屬於com.haulmont.cuba.security.entity包,在下文中一共展示了RoleType類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testUnsubscribeComponentListener
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
@Test
public void testUnsubscribeComponentListener() {
OptionsGroup optionsGroup = (OptionsGroup) factory.createComponent(OptionsGroup.NAME);
Datasource<Role> roleDs = getTestRoleDatasource();
optionsGroup.setDatasource(roleDs, "type");
optionsGroup.setValue(RoleType.STANDARD);
optionsGroup.setDatasource(null, null);
Component.ValueChangeListener listener = e -> {
throw new RuntimeException("Value was changed externally");
};
optionsGroup.addValueChangeListener(listener);
roleDs.getItem().setType(RoleType.DENYING);
assertEquals(RoleType.STANDARD, optionsGroup.getValue());
}
示例2: testUnsubscribeDsListener
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
@Test
public void testUnsubscribeDsListener() {
OptionsGroup optionsGroup = (OptionsGroup) factory.createComponent(OptionsGroup.NAME);
Datasource<Role> roleDs = getTestRoleDatasource();
optionsGroup.setDatasource(roleDs, "type");
optionsGroup.setValue(RoleType.STANDARD);
optionsGroup.setDatasource(null, null);
Datasource.ItemPropertyChangeListener<Role> listener = e -> {
throw new RuntimeException("");
};
roleDs.addItemPropertyChangeListener(listener);
optionsGroup.setValue(RoleType.DENYING);
assertEquals(RoleType.STANDARD, roleDs.getItem().getType());
}
示例3: testUnsubscribeSubscribeDsListener
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
@Test
public void testUnsubscribeSubscribeDsListener() {
OptionsGroup optionsGroup = (OptionsGroup) factory.createComponent(OptionsGroup.NAME);
Datasource<Role> roleDs = getTestRoleDatasource();
roleDs.getItem().setType(RoleType.DENYING);
optionsGroup.setDatasource(roleDs, "type");
optionsGroup.setDatasource(null, null);
boolean[] valueWasChanged = {false};
Datasource.ItemPropertyChangeListener<Role> listener = e -> valueWasChanged[0] = true;
roleDs.addItemPropertyChangeListener(listener);
optionsGroup.setDatasource(roleDs, "type");
optionsGroup.setValue(RoleType.STANDARD);
assertTrue(valueWasChanged[0]);
}
示例4: testUnsubscribeComponentListener
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
@Test
public void testUnsubscribeComponentListener() {
OptionsList optionsList = (OptionsList) factory.createComponent(OptionsList.NAME);
Datasource<Role> roleDs = getTestRoleDatasource();
optionsList.setDatasource(roleDs, "type");
optionsList.setValue(RoleType.DENYING);
optionsList.setDatasource(null, null);
Component.ValueChangeListener listener = e -> {
throw new RuntimeException("Value was changed externally");
};
optionsList.addValueChangeListener(listener);
roleDs.getItem().setType(RoleType.READONLY);
assertEquals(RoleType.DENYING, optionsList.getValue());
}
示例5: testUnsubscribeDsListener
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
@Test
public void testUnsubscribeDsListener() {
OptionsList optionsList = (OptionsList) factory.createComponent(OptionsList.NAME);
Datasource<Role> roleDs = getTestRoleDatasource();
optionsList.setDatasource(roleDs, "type");
optionsList.setValue(RoleType.DENYING);
optionsList.setDatasource(null, null);
Datasource.ItemPropertyChangeListener<Role> listener = e -> {
throw new RuntimeException("Value was changed externally");
};
roleDs.addItemPropertyChangeListener(listener);
optionsList.setValue(RoleType.STANDARD);
assertEquals(RoleType.DENYING, roleDs.getItem().getType());
}
示例6: testUnsubscribeSubscribeDsListener
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
@Test
public void testUnsubscribeSubscribeDsListener() {
OptionsList optionsList = (OptionsList) factory.createComponent(OptionsList.NAME);
Datasource<Role> roleDs = getTestRoleDatasource();
roleDs.getItem().setType(RoleType.DENYING);
optionsList.setDatasource(roleDs, "type");
optionsList.setDatasource(null, null);
boolean[] valueWasChanged = {false};
Datasource.ItemPropertyChangeListener<Role> listener = e -> valueWasChanged[0] = true;
roleDs.addItemPropertyChangeListener(listener);
optionsList.setDatasource(roleDs, "type");
optionsList.setValue(RoleType.STANDARD);
assertTrue(valueWasChanged[0]);
}
示例7: isSuperUser
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
public boolean isSuperUser() {
User user = userSessionSource.getUserSession().getCurrentOrSubstitutedUser();
if (CollectionUtils.isEmpty(user.getUserRoles())) {
return true;
}
for (UserRole userRole : user.getUserRoles()) {
if (userRole.getRole().getType() == RoleType.SUPER) {
return true;
}
}
return false;
}
示例8: testUnsubscribeSubscribeComponentListener
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
@Test
public void testUnsubscribeSubscribeComponentListener() {
OptionsGroup optionsGroup = (OptionsGroup) factory.createComponent(OptionsGroup.NAME);
Datasource<Role> roleDs = getTestRoleDatasource();
roleDs.getItem().setType(RoleType.DENYING);
optionsGroup.setDatasource(roleDs, "type");
optionsGroup.setDatasource(null, null);
// datasource before listener
optionsGroup.setDatasource(roleDs, "type");
boolean[] valueWasChanged = {false};
Component.ValueChangeListener listener = e -> valueWasChanged[0] = true;
optionsGroup.addValueChangeListener(listener);
roleDs.getItem().setType(RoleType.READONLY);
assertEquals(true, valueWasChanged[0]);
// reset state
valueWasChanged[0] = false;
optionsGroup.removeValueChangeListener(listener);
optionsGroup.setDatasource(null, null);
optionsGroup.setValue(null);
// listener before datasource
optionsGroup.addValueChangeListener(listener);
optionsGroup.setDatasource(roleDs, "type");
assertEquals(true, valueWasChanged[0]);
}
示例9: testValueChangeListener
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
@Test
public void testValueChangeListener() {
OptionsGroup optionsGroup = (OptionsGroup) factory.createComponent(OptionsGroup.NAME);
// listener before datasource
boolean[] valueWasChanged = {false};
Component.ValueChangeListener listener = e -> valueWasChanged[0] = true;
optionsGroup.addValueChangeListener(listener);
Datasource<Role> roleDs = getTestRoleDatasource();
roleDs.getItem().setType(RoleType.READONLY);
optionsGroup.setDatasource(roleDs, "type");
assertTrue(valueWasChanged[0]);
// reset state
valueWasChanged[0] = false;
optionsGroup.removeValueChangeListener(listener);
optionsGroup.setDatasource(null, null);
// datasource before listener
optionsGroup.setDatasource(roleDs, "type");
optionsGroup.addValueChangeListener(listener);
roleDs.getItem().setType(RoleType.DENYING);
assertTrue(valueWasChanged[0]);
}
示例10: testSetValue
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
@Test
public void testSetValue() {
OptionsGroup optionsGroup = (OptionsGroup) factory.createComponent(OptionsGroup.NAME);
Datasource<Role> roleDs = getTestRoleDatasource();
optionsGroup.setDatasource(roleDs, "type");
optionsGroup.setValue(RoleType.DENYING);
assertNotNull(optionsGroup.getValue());
}
示例11: testUnsubscribeSubscribeComponentListener
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
@Test
public void testUnsubscribeSubscribeComponentListener() {
OptionsList optionsList = (OptionsList) factory.createComponent(OptionsList.NAME);
Datasource<Role> roleDs = getTestRoleDatasource();
roleDs.getItem().setType(RoleType.DENYING);
optionsList.setDatasource(roleDs, "type");
optionsList.setDatasource(null, null);
// datasource before listener
optionsList.setDatasource(roleDs, "type");
boolean[] valueWasChanged = {false};
Component.ValueChangeListener listener = e -> valueWasChanged[0] = true;
optionsList.addValueChangeListener(listener);
roleDs.getItem().setType(RoleType.READONLY);
Assert.assertEquals(true, valueWasChanged[0]);
// reset state
valueWasChanged[0] = false;
optionsList.removeValueChangeListener(listener);
optionsList.setDatasource(null, null);
optionsList.setValue(null);
// listener before datasource
optionsList.addValueChangeListener(listener);
optionsList.setDatasource(roleDs, "type");
Assert.assertEquals(true, valueWasChanged[0]);
}
示例12: testValueChangeListener
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
@Test
public void testValueChangeListener() {
OptionsList optionsList = (OptionsList) factory.createComponent(OptionsList.NAME);
// listener before datasource
boolean[] valueWasChanged = {false};
Component.ValueChangeListener listener = e -> valueWasChanged[0] = true;
optionsList.addValueChangeListener(listener);
Datasource<Role> roleDs = getTestRoleDatasource();
roleDs.getItem().setType(RoleType.READONLY);
optionsList.setDatasource(roleDs, "type");
assertTrue(valueWasChanged[0]);
// reset state
valueWasChanged[0] = false;
optionsList.removeValueChangeListener(listener);
optionsList.setDatasource(null, null);
// datasource before listener
optionsList.setDatasource(roleDs, "type");
optionsList.addValueChangeListener(listener);
roleDs.getItem().setType(RoleType.DENYING);
assertTrue(valueWasChanged[0]);
}
示例13: getRoleTypeProp
import com.haulmont.cuba.security.entity.RoleType; //導入依賴的package包/類
@Property("cuba.test.roleTypeProp")
@Default("STANDARD")
RoleType getRoleTypeProp();