Create AddressDataType from ProposalPerson

@param person
ProposalPerson
@return AddressDataType corresponding to the ProposalPerson object.
963428
public AddressDataType getAddressDataType(ProposalPersonContract person) {
		AddressDataType addressType = AddressDataType.Factory.newInstance();
		if (person != null) {
			String street1 = person.getAddressLine1();
			addressType.setStreet1(street1);
			String street2 = person.getAddressLine2();
			if (street2 != null && !street2.equals("")) {
				addressType.setStreet2(street2);
			}
			String city = person.getCity();
			addressType.setCity(city);

			String postalCode = person.getPostalCode();
			if (postalCode != null && !postalCode.equals("")) {
				addressType.setZipPostalCode(postalCode);
			}
			if (person.getCounty() != null) {
				addressType.setCounty(person.getCounty());
			}

			String county = person.getCounty();
			if (county != null && !county.equals("")) {
				addressType.setCounty(county);
			}
			String country = person.getCountryCode();
			CountryCodeDataType.Enum countryCodeDataType = getCountryCodeDataType(country);
			addressType.setCountry(countryCodeDataType);

			String state = person.getState();
			if (state != null && !state.equals("")) {
				if (countryCodeDataType != null) {
					if (countryCodeDataType
							.equals(CountryCodeDataType.USA_UNITED_STATES)) {
						addressType.setState(getStateCodeDataType(country, state));
					} else {
						addressType.setProvince(person.getState());
					}
				}

			}

		}
		return addressType;
	}
1267637
def create_from_userdata(userdata):
        """"""
        memhi = userdata.get('d3')
        memlo = userdata.get('d4')
        memory = memhi << 8 | memlo
        control_flags = userdata.get('d6')
        group = userdata.get('d7')
        addrhi = userdata.get('d8')
        addrmed = userdata.get('d9')
        addrlo = userdata.get('d10')
        addr = Address(bytearray([addrhi, addrmed, addrlo]))
        data1 = userdata.get('d11')
        data2 = userdata.get('d12')
        data3 = userdata.get('d13')
        return ALDBRecord(memory, control_flags, group, addr,
                          data1, data2, data3)
905644
@Nonnull
  public TypeaheadRemote setDataType (@Nonnull @Nonempty final String sDataType)
  {
    m_sDataType = ValueEnforcer.notEmpty (sDataType, "DataType");
    return this;
  }
1277976
public static DestinationAddressAttribute createDestinationAddressAttribute(
			TransportAddress address) {
		DestinationAddressAttribute attribute = new DestinationAddressAttribute();

		attribute.setAddress(address);

		return attribute;
	}
1117932
function PersonAddresses (f1, personID) {
  if (!personID) {
    throw new Error('PersonAddresses requires a person ID!')
  }
  Addresses.call(this, f1, {
    path: '/People/' + personID + '/Addresses'
  })
}
823867
@Nonnull
	public static LCharSupplier charSupplierFrom(Consumer<LCharSupplierBuilder> buildingFunction) {
		LCharSupplierBuilder builder = new LCharSupplierBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}
1081825
public Email recipient(EmailAddress recipient, RecipientType type) {
		recipient(new Recipient(recipient, type));
		return this;
	}
414012
private void setAllkeyPersonDetailsToKeyPerson(ProposalPersonContract keyPerson,
            Profile profileKeyPerson) {
        assignRolodexId(keyPerson);
		profileKeyPerson.setName(globLibV20Generator
				.getHumanNameDataType(keyPerson));
		setDirectoryTitleToProfile(profileKeyPerson, keyPerson);
		profileKeyPerson.setAddress(globLibV20Generator
				.getAddressDataType(keyPerson));
		profileKeyPerson.setPhone(keyPerson.getOfficePhone());
		if (StringUtils.isNotEmpty(keyPerson.getFaxNumber())) {
			profileKeyPerson.setFax(keyPerson.getFaxNumber());
		}
		if (keyPerson.getDegree() != null) {
			profileKeyPerson.setDegreeType(keyPerson.getDegree());
		}
		if (keyPerson.getYearGraduated() != null) {
			profileKeyPerson.setDegreeYear(keyPerson.getYearGraduated());
		}
		if(keyPerson.getDegree() == null && keyPerson.getYearGraduated() == null ){
	          if(keyPerson.getProposalPersonDegrees() != null && keyPerson.getProposalPersonDegrees().size() > 0){
	              ProposalPersonDegreeContract proposalPersonDegree = keyPerson.getProposalPersonDegrees().get(0);
	              if(proposalPersonDegree != null){  
	                  if(proposalPersonDegree.getDegreeType() != null &&proposalPersonDegree.getDegreeType().getDescription() != null)
	                      profileKeyPerson.setDegreeType(proposalPersonDegree.getDegreeType().getDescription());
	                  if(proposalPersonDegree.getGraduationYear() != null)
	                      profileKeyPerson.setDegreeYear(proposalPersonDegree.getGraduationYear());
	              }	            
	          }  
	     }
		profileKeyPerson.setEmail(keyPerson.getEmailAddress());
		DevelopmentProposalContract developmentProposal = pdDoc
				.getDevelopmentProposal();
		setOrganizationName(profileKeyPerson, developmentProposal);
		setDepartmentNameToProfile(profileKeyPerson,keyPerson);
		String divisionName = keyPerson.getDivision();
		if (divisionName != null) {
			profileKeyPerson.setDivisionName(StringUtils.substring(divisionName, 0, DIVISION_NAME_MAX_LENGTH));
		}
		if (keyPerson.getEraCommonsUserName() != null) {
			profileKeyPerson.setCredential(keyPerson.getEraCommonsUserName());
		} else {
            if (getSponsorHierarchyService().isSponsorNihMultiplePi(pdDoc.getDevelopmentProposal().getSponsor().getSponsorCode())) {
                if (keyPerson.isMultiplePi()) {
                    getAuditErrors().add(new AuditError(AuditError.NO_FIELD_ERROR_KEY, ERROR_ERA_COMMON_USER_NAME + keyPerson.getFullName(),
                            AuditError.GG_LINK));
                }
            }
        }
        if (keyPerson.isMultiplePi() || keyPerson.isCoInvestigator()) {
            if(getSponsorHierarchyService().isSponsorNihMultiplePi(pdDoc.getDevelopmentProposal().getSponsor().getSponsorCode())){
                if (keyPerson.isMultiplePi()) {
                    profileKeyPerson.setProjectRole(ProjectRoleDataType.PD_PI);
                } else {
                    profileKeyPerson.setProjectRole(ProjectRoleDataType.CO_INVESTIGATOR);
                }
            }else{
                profileKeyPerson.setProjectRole(ProjectRoleDataType.CO_PD_PI);
            }
        } else {
			setProjectRoleCategoryToProfile(keyPerson, profileKeyPerson);
		}
	}
413288
public TypeSpec.Builder buildDaoFactoryInterfaceInternal(Elements elementUtils, Filer filer, SQLiteDatabaseSchema schema) throws Exception {
		String schemaName = buildDaoFactoryName(schema);

		classBuilder = TypeSpec.interfaceBuilder(schemaName).addModifiers(Modifier.PUBLIC).addSuperinterface(BindDaoFactory.class);

		classBuilder.addJavadoc("<p>\n");
		classBuilder.addJavadoc("Represents dao factory interface for $L.\n", schema.getName());
		classBuilder.addJavadoc("This class expose database interface through Dao attribute.\n", schema.getName());
		classBuilder.addJavadoc("</p>\n\n");

		JavadocUtility.generateJavadocGeneratedBy(classBuilder);
		classBuilder.addJavadoc("@see $T\n", TypeUtility.typeName(schema.getElement()));

		for (SQLiteDaoDefinition dao : schema.getCollection()) {
			TypeName daoName = BindDaoBuilder.daoInterfaceTypeName(dao);
			TypeName daoImplName = BindDaoBuilder.daoTypeName(dao);

			classBuilder.addJavadoc("@see $T\n", daoName);
			classBuilder.addJavadoc("@see $T\n", daoImplName);

			String entity = BindDataSourceSubProcessor.generateEntityName(dao, dao.getEntity());

			classBuilder.addJavadoc("@see $T\n", TypeUtility.typeName(entity));
		}

		for (SQLiteDaoDefinition dao : schema.getCollection()) {
			TypeName daoImplName = BindDaoBuilder.daoTypeName(dao);

			// dao with external connections
			{
				MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("get" + dao.getName())
						.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT).addJavadoc("Retrieve dao $L.\n\n@return dao implementation\n", dao.getName())
						.returns(daoImplName);
				classBuilder.addMethod(methodBuilder.build());
			}
		}
		
		SchemaUtility.generateTransaction(classBuilder, schema, true);

		return classBuilder;
	}
739321
static IDataModel createDataModelFromCell(Sheet sheet, FormulaParsingWorkbook workbook, IA1Address address) {
        IDataModel dm = new DataModel(randomUUID().toString());
        resolveCellDependencies(address, sheet, workbook).forEach(cell -> ConverterUtils.copyCell(new CellAddress(dm.getDataModelId(), cell), sheet, dm));
        return dm;
    }
981690
public SipURI createSipURI(String user, String host) {		
		if (logger.isDebugEnabled()) {
			logger.debug("Creating SipURI from USER[" + user + "] HOST[" + host
					+ "]");
		}		
		// Fix for http://code.google.com/p/sipservlets/issues/detail?id=145
		if(user != null && user.trim().isEmpty()) {
			user = null;
		}
		try {
			return new SipURIImpl(SipFactoryImpl.addressFactory.createSipURI(
					user, host), ModifiableRule.Modifiable);
		} catch (ParseException e) {
			logger.error("couldn't parse the SipURI from USER[" + user
					+ "] HOST[" + host + "]", e);
			throw new IllegalArgumentException("Could not create SIP URI user = " + user + " host = " + host);
		}
	}
1166303
@XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "contributor", scope = EntryType.class)
    public JAXBElement<PersonType> createEntryTypeContributor(PersonType value) {
        return new JAXBElement<PersonType>(ENTRY_TYPE_CONTRIBUTOR_QNAME,
                PersonType.class, EntryType.class, value);
    }
1241613
def persons_at_address(address_id)
      body = self.gov_talk_request({
        message: 'CRA_GetPersonsAtAddress',
        class:   'CRA_GetPersonsAtAddress',
        params: {
          long: address_id,
        }
      })
      CRA::PersonAtAddress.list_from_hash(body['ArrayOfPersonsAtAddress'])
    end
777258
@Programmatic
    public PostalAddress newPostal(
            final Object owner,
            final String addressLine1,
            final String addressLine2,
            final String addressLine3,
            final String addressLine4,
            final String postalCode,
            final String country,
            final String purpose,
            final String notes) {

        final PostalAddress pa = factoryService.instantiate(PostalAddress.class);
        pa.setType(CommunicationChannelType.POSTAL_ADDRESS);
        owner(pa).setOwner(owner);
        pa.setPurpose(purpose);
        pa.setAddressLine1(addressLine1);
        pa.setAddressLine2(addressLine2);
        pa.setAddressLine3(addressLine3);
        pa.setAddressLine4(addressLine4);
        pa.setPostalCode(postalCode);
        pa.setNotes(notes);
        pa.setCountry(country);

        repositoryService.persist(pa);
        return pa;
    }
1278914
protected AddressResolver<InetSocketAddress> newAddressResolver(EventLoop eventLoop,
                                                                    NameResolver<InetAddress> resolver)
            throws Exception {
        return new InetSocketAddressResolver(eventLoop, resolver);
    }
893096
private static CreateRequestType checkType(final FormItemList formItemList,
			final CreateResponse createResponse) {
		final String sType = formItemList
				.getField(ProtocolConstants.Parameters.Create.TYPE);
		if (sType != null) {
			if (CreateRequestType.USER.getIdentifier().equals(sType)) {
				return CreateRequestType.USER;
			} else if (CreateRequestType.FOLLOW.getIdentifier().equals(sType)) {
				return CreateRequestType.FOLLOW;
			} else if (CreateRequestType.STATUS_UPDATE.getIdentifier().equals(
					sType)) {
				return CreateRequestType.STATUS_UPDATE;
			}

			createResponse.typeInvalid(sType);
		} else {
			createResponse.typeMissing();
		}

		return null;
	}
876596
public static ChangedAddressAttribute createChangedAddressAttribute(
			TransportAddress address) {
		ChangedAddressAttribute attribute = new ChangedAddressAttribute();

		attribute.setAddress(address);

		return attribute;
	}