Skip to content

Commit

Permalink
FIPS-9783/FIPS-11578 :: Move validation for ValidationRule_MissingAtt…
Browse files Browse the repository at this point in the history
…ribute to ValidationRule

Change-Id: Ieaa1c9dcb3c46f0b5d1ca1b64d268b0799a6de51
  • Loading branch information
lara0905 committed May 13, 2024
1 parent 109f242 commit 2bf05c0
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 14 deletions.
Expand Up @@ -284,8 +284,6 @@ private Messages() {
public static String AttributesSection_deleteTitle;
public static String BehaviourPage_title;
public static String RulesSection_title;
public static String RulesSection_titleMissingAttribute;
public static String RulesSection_msgMissingAttribute;
public static String RulesSection_labelSeparateValidatorClass;
public static String StructurePage_title;

Expand Down
Expand Up @@ -12,10 +12,8 @@

import java.util.EnumSet;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPartSite;
Expand Down Expand Up @@ -90,12 +88,6 @@ protected EditDialog createEditDialog(IIpsObjectPart part, Shell shell) {
String[] attrNames = rule.getValidatedAttributes();
if (attrNames.length == 1) {
IPolicyCmptTypeAttribute attr = getPcType().getPolicyCmptTypeAttribute(attrNames[0]);
if (attr == null) {
String msg = NLS.bind(Messages.RulesSection_msgMissingAttribute, attrNames[0]);
MessageDialog.openInformation(getShell(), Messages.RulesSection_titleMissingAttribute, msg);
rule.delete();
return null;
}
AttributeEditDialog dialog = new AttributeEditDialog(attr, getShell());
dialog.showValidationRulePage();
dialog.setDataChangeable(isDataChangeable());
Expand Down
Expand Up @@ -45,7 +45,6 @@ AssociationEditDialog_targetLabel=Target:
AttributesSection_deleteTitle=Delete Attribute
AttributesSection_deleteMessage=A rule is defined for this attribute to check the value against the value set. Should this rule also be deleted?
RulesSection_labelSeparateValidatorClass=Create separate validator class
RulesSection_msgMissingAttribute=This is a special rule to validate the value of the attribute {0} against its value set. The attribute does not exist, the rule is deleted.
RulesSection_title=Rules
RulesSection_titleMissingAttribute=Edit rule
BehaviourPage_title=Behavior
Expand Down
Expand Up @@ -122,6 +122,7 @@ private Messages() {
public static String ValidationRule_msgNoNewlineAllowed;
public static String ValidationRule_msgCodeShouldBeProvided;
public static String ValidationRuleMessageText_warning_invalidParameter;
public static String ValidationRule_msgMissingAttribute;

public static String Attribute_msgAttributeCantBeProductRelevantIfTypeIsNot;
public static String Attribute_proposalForRuleName;
Expand Down
Expand Up @@ -159,8 +159,11 @@ private void validateCheckValueAgainstValueSet(MessageList msgList) {
String attributeName = getValidatedAttributeAt(0);
IPolicyCmptTypeAttribute attribute = getPolicyCmptType().getPolicyCmptTypeAttribute(attributeName);
if (attribute == null) {
return;
String text = MessageFormat.format(Messages.ValidationRule_msgMissingAttribute, attributeName);
msgList.add(new Message("", text, Message.ERROR, this, //$NON-NLS-1$
IValidationRule.PROPERTY_CHECK_AGAINST_VALUE_SET_RULE));
}

if (ValueSetType.UNRESTRICTED.equals(attribute.getValueSet().getValueSetType())
&& attribute.getValueSet().isContainsNull() && !attribute.isProductRelevant()) {
String text = Messages.ValidationRule_msgValueSetRule;
Expand Down
Expand Up @@ -96,6 +96,8 @@ ValidationRule_msgDuplicateEntries=Duplicate entries.
ValidationRule_msgNoNewlineAllowed=No newline allowed in message text. Found in {0} message.
ValidationRule_msgValueSetRule=For an unrestricted value set, no rule can be generated to check whether a value is contained.
ValidationRuleMessageText_warning_invalidParameter=The parameter {0} used in the {1} text is not used in the text of the default language.
ValidationRule_msgMissingAttribute=This is a special rule to validate the value of the attribute {0} against its value set. The attribute does not exist, the rule is deleted.


Attribute_msgAttributeCantBeProductRelevantIfTypeIsNot=The attribute can only be configured, if the owning type is configurable.
Attribute_proposalForMsgCode=INVALID_{0}
Expand Down
Expand Up @@ -46,9 +46,7 @@ AssociationEditDialog_targetLabel=Zieltyp:
AttributesSection_deleteTitle=Attribut l\u00F6schen
AttributesSection_deleteMessage=Es existiert eine spezielle Regel, um dieses Attribut gegen seinen Wertebereich zu pr\u00FCfen. Soll diese Regel ebenfalls gel\u00F6scht werden?
RulesSection_labelSeparateValidatorClass=Getrennte Validierungsklasse erzeugen
RulesSection_msgMissingAttribute=Dies ist eine spezielle Regel, um das Attribut {0} gegen seinen Wertebereich zu pr\u00FCfen. Das Attribut existiert nicht, die Regel wird gel\u00F6scht.
RulesSection_title=Regeln
RulesSection_titleMissingAttribute=Regel bearbeiten
BehaviourPage_title=Verhalten
GeneralInfoSection_title=Allgemeine Informationen
GeneralInfoSection_linkSuperclass=Supertyp\:
Expand Down
Expand Up @@ -96,6 +96,7 @@ ValidationRule_msgDuplicateEntries=Doppelte Eintr\u00E4ge.
ValidationRule_msgNoNewlineAllowed=Im Meldungstext ist kein Zeilenumbruch erlaubt. (Text auf {0})
ValidationRule_msgValueSetRule=F\u00FCr ein Attribut mit unbegrenztem Wertebereich kann keine Regel zur Pr\u00FCfung, ob ein Wert in diesem Bereich enthalten ist, generiert werden.
ValidationRuleMessageText_warning_invalidParameter=Der Parameter {0} in der Sprache {1} wird nicht in der Standardsprache verwendet.
ValidationRule_msgMissingAttribute=Dies ist eine spezielle Regel, um das Attribut {0} gegen seinen Wertebereich zu pr\u00FCfen. Das Attribut existiert nicht.

Attribute_msgAttributeCantBeProductRelevantIfTypeIsNot=Ein Attribut kann nicht konfiguriert werden, wenn der Typ nicht konfigurierbar ist.
Attribute_proposalForMsgCode={0}_UNGUELTIG
Expand Down

0 comments on commit 2bf05c0

Please sign in to comment.