Changeset 621


Ignore:
Timestamp:
Apr 5, 2012, 6:05:54 PM (5 years ago)
Author:
freek.de.bruijn@…
Message:

Removed some trailing whitespace.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/code/conceptwiki/common/common-util/src/main/java/nl/nbic/conceptwiki/common/util/impl/ValidationUtilityImpl.java

    r457 r621  
    2626 * This implementation adheres to the {@code @GwtCompatible} annotation of the interface; the {@code Preconditions}
    2727 * class is {@code GwtCompatible} on its own.</p>
    28  * 
     28 *
    2929 * <p><strong>Note:</strong> all {@code validate*} methods should throw an {@link IllegalArgumentException} when a
    3030 * given object is not considered valid. The message accompanying the exception should ideally inform the consumer
     
    4949     */
    5050    private static final Pattern ILLEGAL_WHITESPACE_PATTERN = Pattern.compile("(\t|\n|\r)");
    51    
     51
    5252    /**
    5353     * {@inheritDoc}
     
    6464                "uuid should have a valid UUID format (aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee)");
    6565    }
    66  
     66
    6767    /**
    6868     * {@inheritDoc}
     
    8181        validateLanguage(label.getLanguage());
    8282    }
    83    
     83
    8484    @Override
    8585    public void validateLanguage(final Language language) {
     
    8888                "Language code should be a valid ISO639-1 format");
    8989    }
    90    
     90
    9191    @Override
    9292    public void validateNotation(final Notation notation) {
     
    9595
    9696    // TODO validate a concept update
    97    
     97
    9898    @Override
    9999    public void validateConcept(final Concept concept) {
     
    102102                "Concept cannot have multiple preferred labels for the same language");
    103103    }
    104    
     104
    105105    @Override
    106106    public void validateChangeset(final Changeset changeset) {
    107107        Preconditions.checkArgument(isChangesetStructureValid(changeset), "Changeset should contain at least one removed or added object");
    108108    }
    109    
     109
    110110    @Override
    111111    public void validateConceptUpdate(final Concept concept, final Changeset changeset) {
    112112        final Action add = changeset.getAdd();
    113113        final Action remove = changeset.getRemove();
    114        
     114
    115115        if (add != null && remove != null) {
    116116            Preconditions.checkArgument(Sets.intersection(add.getLabels(), remove.getLabels()).isEmpty(),
     
    125125                    "Cannot add and remove the same urls");
    126126        }
    127        
     127
    128128        final Set<Label> labels = Sets.newHashSet(concept.getLabels());
    129129        final Set<Notation> notations = Sets.newHashSet(concept.getNotations());
     
    135135                    "Cannot remove labels that are not associated with the concept");
    136136            labels.removeAll(remove.getLabels());
    137            
     137
    138138            Preconditions.checkArgument(notations.containsAll(remove.getNotations()),
    139139                    "Cannot remove notations that are not associated with the concept");
    140140            notations.removeAll(remove.getNotations());
    141            
     141
    142142            Preconditions.checkArgument(notes.containsAll(remove.getNotes()),
    143143                    "Cannot remove notes that are not associated with the concept");
    144144            notes.removeAll(remove.getNotes());
    145            
     145
    146146            Preconditions.checkArgument(tags.containsAll(remove.getTags()),
    147147                    "Cannot remove tags that are not associated with the concept");
    148148            tags.removeAll(remove.getTags());
    149            
     149
    150150            Preconditions.checkArgument(urls.containsAll(remove.getUrls()),
    151151                    "Cannot remove urls that are not associated with the concept");
     
    156156                    "Cannot add duplicate labels");
    157157            labels.addAll(add.getLabels());
    158            
     158
    159159            Preconditions.checkArgument(Sets.intersection(add.getNotations(), notations).isEmpty(),
    160160                    "Cannot add duplicate notations");
    161            
     161
    162162            Preconditions.checkArgument(Sets.intersection(add.getNotes(), notes).isEmpty(),
    163163                    "Cannot add duplicate notes");
    164            
     164
    165165            Preconditions.checkArgument(Sets.intersection(add.getTags(), tags).isEmpty(),
    166166                    "Cannot add duplicate tags");
    167            
     167
    168168            Preconditions.checkArgument(Sets.intersection(add.getUrls(), urls).isEmpty(),
    169169                    "Cannot add duplicate urls");
     
    171171        Preconditions.checkArgument(isValidLabelSet(labels), "Cannot add multiple preferred labels for the same language");
    172172    }
    173    
     173
    174174    /**
    175175     * Convenience method for validating a {@code Changeset}. A {@code Changeset} is considered valid when at least one of its members
     
    181181        return isActionValid(changeset.getAdd()) || isActionValid(changeset.getRemove());
    182182    }
    183    
     183
    184184    /**
    185185     * Convenience method for validating an individual {@code Action} member of a {@code Changeset}. An {@code Action} is considered valid
     
    198198                );
    199199    }
    200    
     200
    201201    /**
    202202     * <p>Evaluate whether a set of labels is considered valid.
Note: See TracChangeset for help on using the changeset viewer.