本文整理汇总了Java中org.osiam.resources.scim.Address类的典型用法代码示例。如果您正苦于以下问题:Java Address类的具体用法?Java Address怎么用?Java Address使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Address类属于org.osiam.resources.scim包,在下文中一共展示了Address类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromScim
import org.osiam.resources.scim.Address; //导入依赖的package包/类
@Override
public AddressEntity fromScim(Address scim) {
if (scim == null) {
return null;
}
AddressEntity addressEntity = new AddressEntity();
addressEntity.setCountry(scim.getCountry());
addressEntity.setFormatted(scim.getFormatted());
addressEntity.setLocality(scim.getLocality());
addressEntity.setPostalCode(scim.getPostalCode());
addressEntity.setPrimary(scim.isPrimary());
addressEntity.setRegion(scim.getRegion());
addressEntity.setStreetAddress(scim.getStreetAddress());
addressEntity.setType(scim.getType());
addressEntity.setDisplay(scim.getDisplay());
return addressEntity;
}
示例2: toScim
import org.osiam.resources.scim.Address; //导入依赖的package包/类
@Override
public Address toScim(AddressEntity entity) {
if (entity == null) {
return null;
}
return new Address.Builder()
.setCountry(entity.getCountry())
.setFormatted(entity.getFormatted())
.setLocality(entity.getLocality())
.setPostalCode(entity.getPostalCode())
.setRegion(entity.getRegion())
.setStreetAddress(entity.getStreetAddress())
.setPrimary(entity.isPrimary())
.setType(entity.getType())
.setDisplay(entity.getDisplay())
.build();
}
示例3: update
import org.osiam.resources.scim.Address; //导入依赖的package包/类
/**
* updates (adds new, delete, updates) the addresses of the given {@link UserEntity} based on the given List of
* {@link Address}
*
* @param address list of {@link Address} to be deleted, updated or added
* @param userEntity user who needs to be updated
* @param attributes all {@link AddressEntity}'s will be deleted if this Set contains 'address'
*/
void update(List<Address> address, UserEntity userEntity, Set<String> attributes) {
if (attributes.contains("addresses")) {
userEntity.removeAllAddresses();
}
if (address != null) {
for (Address scimAddress : address) {
AddressEntity addressEntity = addressConverter.fromScim(scimAddress);
userEntity.removeAddress(addressEntity); // we always have to remove the address in case
// the primary attribute has changed
if (Strings.isNullOrEmpty(scimAddress.getOperation())
|| !scimAddress.getOperation().equalsIgnoreCase("delete")) {
ensureOnlyOnePrimaryAddressExists(addressEntity, userEntity.getAddresses());
userEntity.addAddress(addressEntity);
}
}
}
}
示例4: fromScim
import org.osiam.resources.scim.Address; //导入依赖的package包/类
@Override
public AddressEntity fromScim(Address scim) {
if (scim == null) {
return null;
}
AddressEntity addressEntity = new AddressEntity();
addressEntity.setCountry(scim.getCountry());
addressEntity.setFormatted(scim.getFormatted());
addressEntity.setLocality(scim.getLocality());
addressEntity.setPostalCode(scim.getPostalCode());
addressEntity.setPrimary(scim.isPrimary());
addressEntity.setRegion(scim.getRegion());
addressEntity.setStreetAddress(scim.getStreetAddress());
addressEntity.setType(scim.getType());
return addressEntity;
}
示例5: toScim
import org.osiam.resources.scim.Address; //导入依赖的package包/类
@Override
public Address toScim(AddressEntity entity) {
if (entity == null) {
return null;
}
return new Address.Builder()
.setCountry(entity.getCountry())
.setFormatted(entity.getFormatted())
.setLocality(entity.getLocality())
.setPostalCode(entity.getPostalCode())
.setRegion(entity.getRegion())
.setStreetAddress(entity.getStreetAddress())
.setPrimary(entity.isPrimary())
.setType(entity.getType())
.build();
}
示例6: update
import org.osiam.resources.scim.Address; //导入依赖的package包/类
/**
* updates (adds new, delete, updates) the addresses of the given {@link UserEntity} based on the given List of
* {@link Address}
*
* @param addresss list of {@link Address} to be deleted, updated or added
* @param userEntity user who needs to be updated
* @param attributes all {@link AddressEntity}'s will be deleted if this Set contains 'address'
*/
void update(List<Address> addresss, UserEntity userEntity, Set<String> attributes) {
if (attributes.contains("addresses")) {
userEntity.removeAllAddresses();
}
if (addresss != null) {
for (Address scimAddress : addresss) {
AddressEntity addressEntity = addressConverter.fromScim(scimAddress);
userEntity.removeAddress(addressEntity); // we always have to remove the address in case
// the primary attribute has changed
if (Strings.isNullOrEmpty(scimAddress.getOperation())
|| !scimAddress.getOperation().equalsIgnoreCase("delete")) {
ensureOnlyOnePrimaryAddressExists(addressEntity, userEntity.getAddresses());
userEntity.addAddress(addressEntity);
}
}
}
}
示例7: updateAddress
import org.osiam.resources.scim.Address; //导入依赖的package包/类
@Command(description = "Update an address from the user.", startsSubshell = true)
public void updateAddress(
@Param(value = "searchKey", description = "Which key should be used to identify the address.")
String key,
@Param(value = "expr", description = "If the value matches this regular expression, the address will updated.")
String valueExp) throws IOException{
Set<Address> addresses = builderCommand.showAllAddresses();
for(Address current : addresses){
if(match(current, key, valueExp)){
final Address address = builderCommand.builderShellFactory.enterAddressShell(current);
if(address != null){
builderCommand.builder.updateAddress(current, address);
}
}
}
}
示例8: enterAddressShell
import org.osiam.resources.scim.Address; //导入依赖的package包/类
/**
* Enter a new subshell for creating an {@link Address}.
*
* @param current The current persisted {@link Address}.
* @return The {@link Address}. Or null if the user interrupt the process.
* @throws IOException
*/
public Address enterAddressShell(Address current) throws IOException {
final AddressBuilder addressBuilder = new AddressBuilder(current);
final Shell subShell = ShellBuilder.subshell((current == null ? "create" : "replace") + "-address", shell)
.behavior()
.disableExitCommand()
.addHandler(addressBuilder)
.build();
output.out()
.normal("In this subshell you can create an address. Leave this sub shell via \"commit\" to persist the changes.")
.println();
subShell.commandLoop();
return addressBuilder.build();
}
示例9: assertThatAddressesAreEqual
import org.osiam.resources.scim.Address; //导入依赖的package包/类
private void assertThatAddressesAreEqual(List<Address> expected, List<Address> actual) {
assertEquals(expected.size(), actual.size());
ensureListSizeIsOne(expected);
Address expectedValue = expected.get(0);
Address actualValue = actual.get(0);
assertEquals(expectedValue.getType(), actualValue.getType());
assertEquals(expectedValue.isPrimary(), actualValue.isPrimary());
assertEquals(expectedValue.getDisplay(), actualValue.getDisplay());
assertEquals(expectedValue.getCountry(), actualValue.getCountry());
assertEquals(expectedValue.getFormatted(), actualValue.getFormatted());
assertEquals(expectedValue.getLocality(), actualValue.getLocality());
assertEquals(expectedValue.getPostalCode(), actualValue.getPostalCode());
assertEquals(expectedValue.getRegion(), actualValue.getRegion());
assertEquals(expectedValue.getStreetAddress(), actualValue.getStreetAddress());
}
示例10: updateAddress
import org.osiam.resources.scim.Address; //导入依赖的package包/类
private void updateAddress(UpdateUser.Builder updateBuilder, List<Address> addresses,
DirContextOperations ldapUserData) {
for (Address address : addresses) {
if (address.getType() != null && address.getType().toString().equals(LdapAuthentication.LDAP_PROVIDER)) {
updateBuilder.deleteAddress(address);
}
}
List<Address> newAddresses = getAddresses(ldapUserData);
if (!newAddresses.isEmpty()) {
updateBuilder.addAddress(newAddresses.get(0));
}
}
示例11: convertToDatabaseColumn
import org.osiam.resources.scim.Address; //导入依赖的package包/类
@Override
public String convertToDatabaseColumn(Address.Type attribute) {
if (attribute == null || Strings.isNullOrEmpty(attribute.getValue())) {
return null;
}
return attribute.getValue();
}
示例12: convertToEntityAttribute
import org.osiam.resources.scim.Address; //导入依赖的package包/类
@Override
public Address.Type convertToEntityAttribute(String dbData) {
if (Strings.isNullOrEmpty(dbData)) {
return null;
}
return new Address.Type(dbData);
}
示例13: AddressCommand
import org.osiam.resources.scim.Address; //导入依赖的package包/类
public AddressCommand(Address address) {
setPrimary(address.isPrimary());
setCountry(address.getCountry());
setFormatted(address.getFormatted());
setLocality(address.getLocality());
setPostalcode(address.getPostalCode());
setRegion(address.getRegion());
setStreetaddress(address.getStreetAddress());
if (address.getType() != null) {
setType(address.getType().getValue());
}
}
示例14: getAsAddress
import org.osiam.resources.scim.Address; //导入依赖的package包/类
public Address getAsAddress() {
return new Address.Builder()
.setPrimary(getPrimary())
.setCountry(getCountry())
.setFormatted(getFormatted())
.setLocality(getLocality())
.setPostalCode(getPostalcode())
.setRegion(getRegion())
.setStreetAddress(getStreetaddress())
.setType(new Type(getType()))
.build();
}
示例15: deleteAddress
import org.osiam.resources.scim.Address; //导入依赖的package包/类
@Command(description = "Delete an address from the user.")
public void deleteAddress(
@Param(value = "searchKey", description = "Which key should be used to identify the address.")
String key,
@Param(value = "expr", description = "If the value matches this regular expression, the address will deleted.")
String valueExp){
Set<Address> addresses = builderCommand.showAllAddresses();
for(Address current : addresses){
if(match(current, key, valueExp)){
builderCommand.builder.deleteAddress(current);
}
}
}