diff --git a/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/tracking/email/EntityTrackingEmailGenerator.java b/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/tracking/email/EntityTrackingEmailGenerator.java index 14d2690445060b57ca8d82c66874ccbad5970787..b6ecc8530940b3d9b90520f4ee4094c91db1a926 100644 --- a/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/tracking/email/EntityTrackingEmailGenerator.java +++ b/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/tracking/email/EntityTrackingEmailGenerator.java @@ -134,6 +134,8 @@ public class EntityTrackingEmailGenerator implements IEntityTrackingEmailGenerat private static final String SUBSECTION_SEPARATOR_LINE = createSeparatorLine(SUBSECTION_SEPARATOR_CHAR); + private final static String EXTERNAL_SAMPLE_NAME_PROPERTY_CODE = "EXTERNAL_SAMPLE_NAME"; + private static final String PERMLINK_LABEL = "See details in openBIS"; private static final String GENARATED_CONTENT_TARGET = "{generated-content}"; @@ -242,10 +244,30 @@ public class EntityTrackingEmailGenerator implements IEntityTrackingEmailGenerat appendAttribute(sb, "Sequencing sample", String.format("'%s'\n %s", sequencingSample .getCode(), sequencingSample.getPermlink())); + // information about external sample name + appendAttribute(sb, "External sample name", tryGetSamplePropertyValue(sequencingSample, + EXTERNAL_SAMPLE_NAME_PROPERTY_CODE)); + // data set properties appendProperties(sb, dataSet.getProperties()); } + private static String tryGetSamplePropertyValue(Sample sequencingSample, + String externalSampleNamePropertyCode) + { + String result = null; + for (IEntityProperty property : sequencingSample.getProperties()) + { + final String propertyCode = property.getPropertyType().getCode(); + if (propertyCode.equals(EXTERNAL_SAMPLE_NAME_PROPERTY_CODE)) + { + result = StringEscapeUtils.unescapeHtml(property.getValue()); + break; + } + } + return result; + } + // NOTE: Information about properties assigned to entity type are not loaded. // If it would be available we could append information about all properties assigned // to entity type, not only about properties filled for specific entity. Additionally