Example usage for com.liferay.portal.kernel.service LayoutSetPrototypeLocalServiceUtil fetchLayoutSetPrototypeByUuidAndCompanyId

List of usage examples for com.liferay.portal.kernel.service LayoutSetPrototypeLocalServiceUtil fetchLayoutSetPrototypeByUuidAndCompanyId

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service LayoutSetPrototypeLocalServiceUtil fetchLayoutSetPrototypeByUuidAndCompanyId.

Prototype

public static com.liferay.portal.kernel.model.LayoutSetPrototype fetchLayoutSetPrototypeByUuidAndCompanyId(
        String uuid, long companyId) 

Source Link

Document

Returns the layout set prototype with the matching UUID and company.

Usage

From source file:com.liferay.layout.internal.model.adapter.StagedLayoutSetImpl.java

License:Open Source License

public StagedLayoutSetImpl(LayoutSet layoutSet) {
    Objects.requireNonNull(layoutSet, "Unable to create a new staged layout set for a null layout set");

    _layoutSet = layoutSet;/*w ww .  j  a  va2s .  c o m*/

    // Last publish date

    UnicodeProperties settingsProperties = _layoutSet.getSettingsProperties();

    String lastPublishDateString = settingsProperties.getProperty("last-publish-date");

    Instant instant = Instant.ofEpochMilli(GetterUtil.getLong(lastPublishDateString));

    _lastPublishDate = Date.from(instant);

    // Layout set prototype

    if (Validator.isNotNull(_layoutSet.getLayoutSetPrototypeUuid())) {
        LayoutSetPrototype layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil
                .fetchLayoutSetPrototypeByUuidAndCompanyId(_layoutSet.getLayoutSetPrototypeUuid(),
                        _layoutSet.getCompanyId());

        if (layoutSetPrototype != null) {
            _layoutSetPrototypeName = layoutSetPrototype.getName(LocaleUtil.getDefault());
        }
    }

    try {
        Group layoutSetGroup = _layoutSet.getGroup();

        _userId = layoutSetGroup.getCreatorUserId();

        User user = UserLocalServiceUtil.getUser(_userId);

        _userName = user.getFullName();
        _userUuid = user.getUuid();
    } catch (PortalException pe) {

        // LPS-52675

        if (_log.isDebugEnabled()) {
            _log.debug(pe, pe);
        }
    }
}

From source file:com.liferay.layout.set.prototype.exportimport.data.handler.test.LayoutSetPrototypeStagedModelDataHandlerTest.java

License:Open Source License

@After
@Override//ww  w. j a  v  a  2 s.co m
public void tearDown() throws Exception {
    super.tearDown();

    if (_layoutSetPrototype != null) {
        _layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.fetchLayoutSetPrototypeByUuidAndCompanyId(
                _layoutSetPrototype.getUuid(), _layoutSetPrototype.getCompanyId());

        LayoutSetPrototypeLocalServiceUtil.deleteLayoutSetPrototype(_layoutSetPrototype);
    }

    if (_layoutPrototype != null) {
        _layoutPrototype = LayoutPrototypeLocalServiceUtil.fetchLayoutPrototypeByUuidAndCompanyId(
                _layoutPrototype.getUuid(), _layoutPrototype.getCompanyId());

        LayoutPrototypeLocalServiceUtil.deleteLayoutPrototype(_layoutPrototype);
    }
}

From source file:com.liferay.layout.set.prototype.exportimport.data.handler.test.LayoutSetPrototypeStagedModelDataHandlerTest.java

License:Open Source License

@Override
protected StagedModel getStagedModel(String uuid, Group group) {
    try {/*  w  w w  .  j  ava 2  s . c  o m*/
        return LayoutSetPrototypeLocalServiceUtil.fetchLayoutSetPrototypeByUuidAndCompanyId(uuid,
                group.getCompanyId());
    } catch (Exception e) {
        return null;
    }
}