
package de.ivu.elect.business.stimmeingabe.entity;

import de.ivu.elect.business.customdata.entity.CustomDataStorage;
import de.ivu.elect.jee.entity.customdata.DefaultCustomData;

public abstract class AbstractStimmeingabePlausiKonfigurationCustomData extends DefaultCustomData implements StimmeingabePlausiKonfigurationCustomData {

  private static final long serialVersionUID = 1L;

  protected AbstractStimmeingabePlausiKonfigurationCustomData() {
    super();
  }

  protected Long zeroIfNotPositive(Long value) {
    if (value == null) {
      return 0L;
    }

    return Math.max(0, value);
  }

  @Override
  public Object getContent() {
    CustomDataStorage storageEntity = (CustomDataStorage) getStorageEntity();

    if (storageEntity == null) {
      return null;
    }

    return storageEntity.getCustomDataXml();
  }
}
