本文整理汇总了Java中org.osiam.resources.scim.Email类的典型用法代码示例。如果您正苦于以下问题:Java Email类的具体用法?Java Email怎么用?Java Email使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Email类属于org.osiam.resources.scim包,在下文中一共展示了Email类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: update
import org.osiam.resources.scim.Email; //导入依赖的package包/类
/**
* updates (adds new, delete, updates) the {@link EmailEntity}'s of the given {@link UserEntity} based on the given
* List of Email's
*
* @param emails list of Email's to be deleted, updated or added
* @param userEntity user who needs to be updated
* @param attributes all {@link EmailEntity}'s will be deleted if this Set contains 'emails'
*/
void update(List<Email> emails, UserEntity userEntity, Set<String> attributes) {
if (attributes.contains("emails")) {
userEntity.removeAllEmails();
}
if (emails != null) {
for (Email scimEmail : emails) {
EmailEntity emailEntity = emailConverter.fromScim(scimEmail);
userEntity.removeEmail(emailEntity); // we always have to remove the email in case
// the primary attribute has changed
if (Strings.isNullOrEmpty(scimEmail.getOperation())
|| !scimEmail.getOperation().equalsIgnoreCase("delete")) {
ensureOnlyOnePrimaryEmailExists(emailEntity, userEntity.getEmails());
userEntity.addEmail(emailEntity);
}
}
}
}
开发者ID:osiam,项目名称:osiam,代码行数:29,代码来源:EmailUpdater.java
示例2: updateEmail
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Command(description = "Update an email from the user.", startsSubshell = true)
public void updateEmail(
@Param(value = "searchKey", description = "Which key should be used to identify the email.")
String key,
@Param(value = "expr", description = "If the value matches this regular expression, the email will updated.")
String valueExp) throws IOException{
Set<Email> emails = builderCommand.showAllEmails();
for(Email current : emails){
if(match(current, key, valueExp)){
final Email email = builderCommand.builderShellFactory.enterEmailShell(current);
if(email != null){
builderCommand.builder.updateEmail(current, email);
}
}
}
}
开发者ID:osiam,项目名称:shell,代码行数:18,代码来源:UpdateUserUpdateCommands.java
示例3: enterEmailShell
import org.osiam.resources.scim.Email; //导入依赖的package包/类
/**
* Enter a new subshell for creating an {@link Email}.
*
* @param current The current persisted {@link Email}.
* @return The {@link Email}. Or null if the user interrupt the process.
* @throws IOException
*/
public Email enterEmailShell(Email current) throws IOException {
final EmailBuilder emailBuilder = new EmailBuilder(current);
final Shell subShell = ShellBuilder.subshell((current == null ? "create" : "replace") + "-email", shell)
.behavior()
.disableExitCommand()
.addHandler(emailBuilder)
.build();
output.out()
.normal("In this subshell you can create an email. Leave this sub shell via \"commit\" to persist the changes.")
.println();
subShell.commandLoop();
return emailBuilder.build();
}
开发者ID:osiam,项目名称:shell,代码行数:25,代码来源:BuilderShellFactory.java
示例4: can_replace_own_user
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Test
public void can_replace_own_user() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ME);
User originalUser = OSIAM_CONNECTOR.getUser(OWN_USER_ID, accessToken);
Email email = new Email.Builder()
.setValue("[email protected]")
.setType(Email.Type.HOME)
.build();
User replaceUser = new User.Builder(originalUser)
.setDisplayName("Marissa")
.setActive(false)
.addEmail(email)
.build();
User user = OSIAM_CONNECTOR.replaceUser(OWN_USER_ID, replaceUser, accessToken);
assertThat(user.getDisplayName(), is(equalTo("Marissa")));
assertThat(user.getEmails().get(0).getValue(), is(equalTo("[email protected]")));
assertThat(user.getEmails().get(0).getType(), is(equalTo(Email.Type.HOME)));
}
开发者ID:osiam,项目名称:connector4java-integration-tests,代码行数:21,代码来源:MeScopeIT.java
示例5: can_replace_own_user
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Test
public void can_replace_own_user() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ADMIN);
User originalUser = OSIAM_CONNECTOR.getUser(OWN_USER_ID, accessToken);
Email email = new Email.Builder()
.setValue("[email protected]")
.setType(Email.Type.HOME)
.build();
User replaceUser = new User.Builder(originalUser)
.setDisplayName("Marissa")
.setActive(false)
.addEmail(email)
.build();
User user = OSIAM_CONNECTOR.replaceUser(OWN_USER_ID, replaceUser, accessToken);
assertThat(user.getDisplayName(), is(equalTo("Marissa")));
assertThat(user.isActive(), is(equalTo(false)));
assertThat(user.getEmails().get(0).getValue(), is(equalTo("[email protected]")));
assertThat(user.getEmails().get(0).getType(), is(equalTo(Email.Type.HOME)));
}
开发者ID:osiam,项目名称:connector4java-integration-tests,代码行数:22,代码来源:AdminScopeIT.java
示例6: can_replace_other_user
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Test
public void can_replace_other_user() {
AccessToken accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ADMIN);
User originalUser = OSIAM_CONNECTOR.getUser(OTHER_USER_ID, accessToken);
Email email = new Email.Builder()
.setValue("[email protected]")
.setType(Email.Type.HOME)
.build();
User replaceUser = new User.Builder(originalUser)
.setDisplayName("Barbara")
.setActive(false)
.addEmail(email)
.build();
User user = OSIAM_CONNECTOR.replaceUser(OTHER_USER_ID, replaceUser, accessToken);
assertThat(user.getDisplayName(), is(equalTo("Barbara")));
assertThat(user.isActive(), is(equalTo(false)));
assertThat(user.getEmails().get(0).getValue(), is(equalTo("[email protected]")));
assertThat(user.getEmails().get(0).getType(), is(equalTo(Email.Type.HOME)));
}
开发者ID:osiam,项目名称:connector4java-integration-tests,代码行数:22,代码来源:AdminScopeIT.java
示例7: updateEmail
import org.osiam.resources.scim.Email; //导入依赖的package包/类
private void updateEmail(UpdateUser.Builder updateBuilder, List<Email> emails, String emailValue) {
Email newEmail = new Email.Builder().setValue(emailValue)
.setType(new Email.Type(LdapAuthentication.LDAP_PROVIDER)).build();
for (Email email : emails) {
if (email.getType() != null && email.getType().toString().equals(LdapAuthentication.LDAP_PROVIDER)) {
updateBuilder.deleteEmail(email);
}
}
updateBuilder.addEmail(newEmail);
}
开发者ID:osiam,项目名称:auth-server,代码行数:11,代码来源:OsiamLdapUserContextMapper.java
示例8: fromScim
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Override
public EmailEntity fromScim(Email scim) {
EmailEntity emailEntity = new EmailEntity();
emailEntity.setValue(scim.getValue());
emailEntity.setPrimary(scim.isPrimary());
emailEntity.setType(scim.getType());
emailEntity.setDisplay(scim.getDisplay());
return emailEntity;
}
开发者ID:osiam,项目名称:osiam,代码行数:10,代码来源:EmailConverter.java
示例9: toScim
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Override
public Email toScim(EmailEntity entity) {
return new Email.Builder()
.setPrimary(entity.isPrimary())
.setType(entity.getType())
.setValue(entity.getValue())
.setDisplay(entity.getDisplay())
.build();
}
开发者ID:osiam,项目名称:osiam,代码行数:10,代码来源:EmailConverter.java
示例10: convertToDatabaseColumn
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Override
public String convertToDatabaseColumn(Email.Type attribute) {
if (attribute == null || Strings.isNullOrEmpty(attribute.getValue())) {
return null;
}
return attribute.getValue();
}
开发者ID:osiam,项目名称:osiam,代码行数:9,代码来源:EmailTypeConverter.java
示例11: convertToEntityAttribute
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Override
public Email.Type convertToEntityAttribute(String dbData) {
if (Strings.isNullOrEmpty(dbData)) {
return null;
}
return new Email.Type(dbData);
}
开发者ID:osiam,项目名称:osiam,代码行数:9,代码来源:EmailTypeConverter.java
示例12: fromScim
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Override
public EmailEntity fromScim(Email scim) {
EmailEntity emailEntity = new EmailEntity();
emailEntity.setValue(scim.getValue());
emailEntity.setPrimary(scim.isPrimary());
emailEntity.setType(scim.getType());
return emailEntity;
}
开发者ID:osiam,项目名称:resource-server,代码行数:10,代码来源:EmailConverter.java
示例13: toScim
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Override
public Email toScim(EmailEntity entity) {
return new Email.Builder()
.setPrimary(entity.isPrimary())
.setType(entity.getType())
.setValue(entity.getValue())
.build();
}
开发者ID:osiam,项目名称:resource-server,代码行数:9,代码来源:EmailConverter.java
示例14: sendDeactivateMail
import org.osiam.resources.scim.Email; //导入依赖的package包/类
public void sendDeactivateMail(User user, Locale locale) {
Map<String, Object> variables = new HashMap<>();
variables.put("user", user);
String mailContent = renderer.renderEmailBody("user/deactivate", locale, variables);
String mailSubject = renderer.renderEmailSubject("user/deactivate", locale, variables);
Optional<Email> email = user.getPrimaryOrFirstEmail();
if (!email.isPresent()) {
throw new SendEmailException("The user has no email!", "user.no.email");
}
sendHTMLMail(fromAddress, email.get().getValue(), mailSubject, mailContent);
}
开发者ID:osiam,项目名称:addon-administration,代码行数:14,代码来源:EmailSender.java
示例15: sendActivateMail
import org.osiam.resources.scim.Email; //导入依赖的package包/类
public void sendActivateMail(User user, Locale locale) {
Map<String, Object> variables = new HashMap<>();
variables.put("user", user);
String mailContent = renderer.renderEmailBody("user/activate", locale, variables);
String mailSubject = renderer.renderEmailSubject("user/activate", locale, variables);
Optional<Email> email = user.getPrimaryOrFirstEmail();
if (!email.isPresent()) {
throw new SendEmailException("The user has no email!", "user.no.email");
}
sendHTMLMail(fromAddress, email.get().getValue(), mailSubject, mailContent);
}
开发者ID:osiam,项目名称:addon-administration,代码行数:14,代码来源:EmailSender.java
示例16: EmailCommand
import org.osiam.resources.scim.Email; //导入依赖的package包/类
public EmailCommand(Email email) {
display = email.getDisplay();
primary = email.isPrimary();
value = email.getValue();
if (email.getType() != null) {
type = email.getType().getValue();
}
}
开发者ID:osiam,项目名称:addon-administration,代码行数:10,代码来源:EmailCommand.java
示例17: getAsEmail
import org.osiam.resources.scim.Email; //导入依赖的package包/类
public Email getAsEmail() {
Email.Builder email = new Email.Builder()
.setDisplay(display)
.setPrimary(primary)
.setValue(value);
if (!Strings.isNullOrEmpty(type)) {
email.setType(new Email.Type(type));
}
return email.build();
}
开发者ID:osiam,项目名称:addon-administration,代码行数:13,代码来源:EmailCommand.java
示例18: deleteEmail
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Command(description = "Delete an email from the user.")
public void deleteEmail(
@Param(value = "searchKey", description = "Which key should be used to identify the email.")
String key,
@Param(value = "expr", description = "If the value matches this regular expression, the email will deleted.")
String valueExp){
Set<Email> emails = builderCommand.showAllEmails();
for(Email current : emails){
if(match(current, key, valueExp)){
builderCommand.builder.deleteEmail(current);
}
}
}
开发者ID:osiam,项目名称:shell,代码行数:15,代码来源:UpdateUserDeleteCommands.java
示例19: addEmail
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Command(description = "Add an email for this user.", startsSubshell = true)
public void addEmail() throws IOException {
final Email email = builderCommand.builderShellFactory.enterEmailShell();
if(email != null){
builderCommand.builder.addEmail(email);
}
}
开发者ID:osiam,项目名称:shell,代码行数:8,代码来源:UpdateUserAddCommands.java
示例20: emails
import org.osiam.resources.scim.Email; //导入依赖的package包/类
@Command(description = "Show all emails (persited and non persisted) for the user.")
public Set<Email> showAllEmails(){
Set<Email> all = new HashSet<>(user.getEmails());
all.addAll(_build().getScimConformUpdateUser().getEmails());
return all;
}
开发者ID:osiam,项目名称:shell,代码行数:8,代码来源:UpdateUserBuilder.java
注:本文中的org.osiam.resources.scim.Email类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论