Example usage for com.liferay.portal.kernel.util SetUtil fromList

List of usage examples for com.liferay.portal.kernel.util SetUtil fromList

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util SetUtil fromList.

Prototype

public static <E> Set<E> fromList(List<? extends E> array) 

Source Link

Usage

From source file:ch.inofix.contact.model.impl.ContactImpl.java

License:Open Source License

private EmailDTO getEmail(Email email) {

    EmailDTO emailDTO = new EmailDTO();

    if (email != null) {
        emailDTO.setAddress(email.getValue());

        // emailDTO.setAddress(email.getValue());

        // TODO: Add multi-type support
        StringBuilder sb = new StringBuilder();
        Set<EmailType> types = SetUtil.fromList(email.getTypes());
        if (types.size() > 0) {
            for (EmailType type : types) {
                sb.append(type.getValue());
            }//  w w  w. j  a  v  a  2 s  . c  o m
        } else {
            sb.append("other");
        }

        emailDTO.setType(sb.toString());
    }

    return emailDTO;
}

From source file:ch.inofix.contact.model.impl.ContactImpl.java

License:Open Source License

private PhoneDTO getPhone(Telephone phone) {

    PhoneDTO phoneDTO = new PhoneDTO();

    if (phone != null) {
        phoneDTO.setNumber(phone.getText());

        StringBuilder sb = new StringBuilder();

        Set<TelephoneType> types = SetUtil.fromList(phone.getTypes());

        // TODO: Add support for multiple telephone types
        // e.g. home-fax, work-mobile, etc.
        if (types.size() > 0) {
            for (TelephoneType type : types) {
                sb.append(type.getValue());
            }//from  w w  w . j a  v  a2  s  .c  om
        } else {
            sb.append("other");
        }

        phoneDTO.setType(sb.toString());
    }

    return phoneDTO;
}

From source file:com.liferay.dynamic.data.mapping.model.impl.DDMStructureImpl.java

License:Open Source License

@Override
public Set<String> getFieldNames() {
    List<DDMFormField> ddmFormFields = getDDMFormFields(false);

    List<String> ddmFormFieldNames = getDDMFormFieldNames(ddmFormFields);

    return SetUtil.fromList(ddmFormFieldNames);
}

From source file:com.liferay.journal.internal.upgrade.v0_0_5.UpgradeJournal.java

License:Open Source License

protected Set<String> getArticleDynamicElements(Element rootElement) {
    List<String> dynamicElementNames = new ArrayList<>();

    List<Element> dynamicElementElements = rootElement.elements("dynamic-element");

    for (Element element : dynamicElementElements) {
        dynamicElementNames.add(element.attributeValue("name"));

        dynamicElementNames.addAll(getArticleDynamicElements(element));
    }/*from www .  j  a  va2s .  co m*/

    return SetUtil.fromList(dynamicElementNames);
}