/// <summary> /// Cleans all text fields in this element /// </summary> /// <param name="obj"></param> /// <param name="visitSubNodes"></param> public override void visit(Generated.DBField obj, bool visitSubNodes) { if ( obj.getVariable() != null ) { obj.setVariable(obj.getVariable().Trim()); } if ( obj.getValue() != null ) { obj.setValue(obj.getValue().Trim()); } base.visit(obj, visitSubNodes); }
/// <summary> /// Compares two DBField and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareDBField(Generated.DBField obj, Generated.DBField other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareNamable (obj, other, diff); if ( !CompareUtil.canonicalStringEquality(obj.getVariable(), other.getVariable()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Variable", other.getVariable(), obj.getVariable()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getValue(), other.getValue()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Value", other.getValue(), obj.getValue()) ); } }
/// <summary> /// Duplicates a source DBField into its target /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void DuplicateDBField(Generated.DBField source, Generated.DBField target) { if ( source != null && target != null ) { DuplicateNamable (source, target); target.setVariable(source.getVariable()); target.setValue(source.getValue()); } }
/// <summary> /// Searches a specific string in DBField and updates the list /// of model element with all the elements in which that string is found /// </summary> /// <param name="obj"></param> /// <param name="obj">The string to search for</param> /// <param name="occurences">The list of model elements which hold the searched string</param> public static void searchDBField(Generated.DBField obj, string searchString, List<ModelElement> occurences) { searchNamable (obj, searchString, occurences); if ( obj.getVariable() != null && obj.getVariable().Contains (searchString) ) { occurences.Add ( obj ); } if ( obj.getValue() != null && obj.getValue().Contains (searchString) ) { occurences.Add ( obj ); } }