1 package org.simantics.diagram.profile;
5 import org.simantics.db.RequestProcessor;
6 import org.simantics.db.Resource;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.db.layer0.util.SimanticsClipboard.Representation;
9 import org.simantics.utils.datastructures.hints.IHintContext.Key;
10 import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
15 * @author Tuukka Lehtonen
18 public class ProfileActivityBeanRepresentation implements Representation {
20 private static final Logger LOGGER = LoggerFactory.getLogger(ProfileActivityBeanRepresentation.class);
22 public static Key KEY = new KeyOf(ProfileActivityBean.class, "PROFILE_ACTIVITY_BEAN");
24 private final Resource source;
25 private ProfileActivityBean bean;
27 public ProfileActivityBeanRepresentation(Resource source) {
36 @SuppressWarnings("unchecked")
38 public <T> T getValue(RequestProcessor processor, Map<String,Object> hints) {
41 bean = Profiles.readProfileActivity(processor, source);
42 } catch (DatabaseException e) {
43 LOGGER.error("Failed to read profile activity information from model " + source, e);
44 // Prevent the code from attempting further reads from this source
45 bean = new ProfileActivityBean();