@RequiresXsrfCheck
  public String doAddFieldLayoutSchemeEntity() {
    if (getIssueTypeId() == null) {
      addError("issueTypeId", getText("admin.errors.fieldlayoutscheme.no.issue.type"));
    }

    if (!invalidInput()) {
      FieldLayoutSchemeEntity fieldLayoutSchemeEntity =
          new FieldLayoutSchemeEntityImpl(fieldLayoutManager, null, getConstantsManager());
      fieldLayoutSchemeEntity.setIssueTypeId(getIssueTypeId());
      fieldLayoutSchemeEntity.setFieldLayoutId(getFieldConfigurationId());
      getFieldLayoutScheme().addEntity(fieldLayoutSchemeEntity);

      // need to compare the default for unmapped issue types and the new field configuration
      final Long unmappedLayoutId = getFieldLayoutScheme().getFieldLayoutId(null);
      if (fieldLayoutSchemeHelper.doesChangingFieldLayoutAssociationRequireMessage(
          getRemoteUser(), getFieldLayoutScheme(), unmappedLayoutId, getFieldConfigurationId())) {
        reindexMessageManager.pushMessage(
            getRemoteUser(), "admin.notifications.task.field.configuration");
      }
      return getRedirect("ConfigureFieldLayoutScheme.jspa?id=" + getId());
    }

    return getResult();
  }
 public boolean isShouldDisplay(FieldLayoutSchemeEntity fieldLayoutSchemeEntity) {
   if (fieldLayoutSchemeEntity.getIssueTypeId() == null) {
     // Always display the default entry
     return true;
   } else {
     return getAllRelevantIssueTypes().contains(fieldLayoutSchemeEntity.getIssueType());
   }
 }
  @RequiresXsrfCheck
  public String doEditFieldLayoutSchemeEntity() {
    if (getId() == null) {
      addErrorMessage(getText("admin.errors.fieldlayoutscheme.no.issue.type"));
    }

    FieldLayoutSchemeEntity fieldLayoutSchemeEntity =
        getFieldLayoutScheme().getEntity(getIssueTypeId());

    // need to compare the previous and new field configurations
    Long oldFieldLayoutId = fieldLayoutSchemeEntity.getFieldLayoutId();
    Long newFieldLayoutId = getFieldConfigurationId();

    fieldLayoutSchemeEntity.setFieldLayoutId(newFieldLayoutId);
    fieldLayoutSchemeEntity.store();

    if (fieldLayoutSchemeHelper.doesChangingFieldLayoutAssociationRequireMessage(
        getRemoteUser(), getFieldLayoutScheme(), oldFieldLayoutId, newFieldLayoutId)) {
      reindexMessageManager.pushMessage(
          getRemoteUser(), "admin.notifications.task.field.configuration");
    }
    return getRedirect("ConfigureFieldLayoutScheme.jspa?id=" + getId());
  }