Example usage for java.text Annotation getValue

List of usage examples for java.text Annotation getValue

Introduction

In this page you can find the example usage for java.text Annotation getValue.

Prototype

public Object getValue() 

Source Link

Document

Returns the value of the attribute, which may be null.

Usage

From source file:uk.ac.ebi.intact.editor.controller.curate.publication.PublicationController.java

public void rejectPublication(ActionEvent evt) {

    List<String> rejectionComments = new ArrayList<String>();

    for (Experiment exp : publication.getExperiments()) {
        Annotation toBeReviewed = AnnotationUtils.collectFirstAnnotationWithTopic(exp.getAnnotations(), null,
                Releasable.TO_BE_REVIEWED);
        if (toBeReviewed != null) {
            rejectionComments/*from w w w. j a  va  2 s.c  o  m*/
                    .add("[" + ((IntactExperiment) exp).getShortLabel() + ": " + toBeReviewed.getValue() + "]");
        }
    }
    if (newValue != null) {
        rejectionComments.add(newValue);
    }

    if (rejectionComments.isEmpty() && this.toBeReviewed == null) {
        addErrorMessage("Cannot reject publication without a correction comment", "");
    } else {
        rejectPublication(" - " + StringUtils.join(rejectionComments, ", "));
    }
}

From source file:uk.ac.ebi.intact.editor.controller.curate.publication.PublicationController.java

public void copyAnnotationsToExperiments(ActionEvent evt) {
    for (Experiment exp : publication.getExperiments()) {
        for (Annotation annot : publication.getDbAnnotations()) {
            Annotation existingAnnot = AnnotationUtils.collectFirstAnnotationWithTopic(exp.getAnnotations(),
                    annot.getTopic().getMIIdentifier(), annot.getTopic().getShortName());
            if (existingAnnot != null) {
                existingAnnot.setValue(annot.getValue());
            } else {
                exp.getAnnotations().add(new ExperimentAnnotation(annot.getTopic(), annot.getValue()));
            }//  ww  w  . ja v  a2s.c o m
        }
        Collection<String> parent = new ArrayList<String>();
        if (publication.getAc() != null) {
            parent.add(publication.getAc());
        }
        getChangesController().markAsUnsaved((IntactExperiment) exp,
                getEditorService().getIntactDao().getSynchronizerContext().getExperimentSynchronizer(),
                "Experiment: " + ((IntactExperiment) exp).getShortLabel(), parent);
    }

    addInfoMessage("Annotations copied", publication.getExperiments().size() + " experiments were modified");
}

From source file:org.openbel.framework.internal.KAMStoreDaoImpl.java

@Override
public List<BelStatement> getSupportingEvidence(KamEdge kamEdge, AnnotationFilter filter) throws SQLException {
    final List<BelStatement> stmts = getSupportingEvidence(kamEdge);

    if (filter == null) {
        return stmts;
    }//from ww  w .  j av a2s . com

    final List<FilterCriteria> criteria = filter.getFilterCriteria();
    final Map<AnnotationType, AnnotationFilterCriteria> amap = sizedHashMap(criteria.size());
    for (final FilterCriteria c : criteria) {
        final AnnotationFilterCriteria afc = (AnnotationFilterCriteria) c;
        amap.put(afc.getAnnotationType(), afc);
    }

    final Iterator<BelStatement> stmtIt = stmts.iterator();
    while (stmtIt.hasNext()) {
        final BelStatement stmt = stmtIt.next();

        final List<Annotation> annotations = stmt.getAnnotationList();

        for (final FilterCriteria c : criteria) {
            // criteria is invalid, continue
            if (c == null) {
                continue;
            }

            final AnnotationFilterCriteria afc = (AnnotationFilterCriteria) c;

            // criteria's annotation type is invalid, continue
            if (afc.getAnnotationType() == null) {
                continue;
            }

            Annotation matchedAnnotation = null;
            for (final Annotation annotation : annotations) {
                if (annotation.getAnnotationType() == afc.getAnnotationType()) {
                    matchedAnnotation = annotation;
                }
            }

            if (matchedAnnotation == null) {
                if (c.isInclude()) {
                    stmtIt.remove();
                }
            } else {
                boolean valueMatch = afc.getValues().contains(matchedAnnotation.getValue());
                if (valueMatch && !c.isInclude()) {
                    stmtIt.remove();
                }
            }
        }
    }

    return stmts;
}