001
014
015 package com.liferay.portlet.expando.util;
016
017 import com.liferay.portal.service.ServiceContext;
018 import com.liferay.portlet.expando.model.ExpandoBridge;
019
020 import java.io.Serializable;
021
022 import java.util.Map;
023
024
028 public class ExpandoBridgeUtil {
029
030 public static void copyExpandoBridgeAttributes(
031 ExpandoBridge oldExpandoBridge, ExpandoBridge newExpandoBridge) {
032
033 newExpandoBridge.setAttributes(
034 oldExpandoBridge.getAttributes(false), false);
035 }
036
037 public static void setExpandoBridgeAttributes(
038 ExpandoBridge oldExpandoBridge, ExpandoBridge newExpandoBridge,
039 ServiceContext serviceContext) {
040
041 Map<String, Serializable> expandoBridgeAttributes =
042 oldExpandoBridge.getAttributes(false);
043
044 Map<String, Serializable> serviceContextAttributes =
045 serviceContext.getExpandoBridgeAttributes();
046
047 for (String key : serviceContextAttributes.keySet()) {
048 expandoBridgeAttributes.put(key, serviceContextAttributes.get(key));
049 }
050
051 newExpandoBridge.setAttributes(expandoBridgeAttributes, false);
052 }
053
054 }