public static List<ErrorDocument> getErrorDocuments(T2Reference reference, ReferenceService referenceService) { List<ErrorDocument> errorDocuments = new ArrayList<ErrorDocument>(); if (reference.getReferenceType().equals(T2ReferenceType.ErrorDocument)) { ErrorDocumentService errorDocumentService = referenceService .getErrorDocumentService(); errorDocuments.add(errorDocumentService.getError(reference)); } else if (reference.getReferenceType().equals( T2ReferenceType.IdentifiedList)) { ListService listService = referenceService.getListService(); IdentifiedList<T2Reference> list = listService.getList(reference); for (T2Reference listReference : list) { errorDocuments .addAll(getErrorDocuments(listReference, referenceService)); } } return errorDocuments; }
/** * Construct a deep copy of the given T2Reference * * @param source * T2Reference to copy */ private T2ReferenceImpl(T2Reference source) { super(); setNamespacePart(source.getNamespacePart()); setLocalPart(source.getLocalPart()); setContainsErrors(source.containsErrors()); setReferenceType(source.getReferenceType()); setDepth(source.getDepth()); }
private T2Reference findFirstFailure(T2Reference value) { IdentifiedList<T2Reference> originalList = listService.getList(value); for (T2Reference subValue : originalList) { if (subValue.getReferenceType().equals(ErrorDocument)) return subValue; if (subValue.getReferenceType().equals(IdentifiedList)) if (subValue.containsErrors()) return findFirstFailure(subValue); // No need to consider value } return null; }
private T2Reference considerReference(T2Reference value, List<T2Reference> exceptions) { if (!value.containsErrors()) { return value; } else if (!value.getReferenceType().equals(IdentifiedList)) { return replaceErrors(value, exceptions); } else if (exceptionHandling.failLists()) { T2Reference failure = findFirstFailure(value); T2Reference replacement = replaceErrors(failure, value.getDepth(), exceptions); return replacement; } else { IdentifiedList<T2Reference> originalList = listService .getList(value); List<T2Reference> replacementList = new ArrayList<T2Reference>(); for (T2Reference subValue : originalList) replacementList.add(considerReference(subValue, exceptions)); return referenceService.register(replacementList, value.getDepth(), true, context); } }
int depth = items.get(0).getDepth(); T2ReferenceListImpl newList = new T2ReferenceListImpl(); int counter = 0; for (T2Reference ref : items) { if (ref.getDepth() != depth) { throw new ListServiceException( "Mismatched depths in list registration; reference at index '" + counter + "' has depth " + ref.getDepth() + " but all preceeding items have depth " + depth); if (ref.containsErrors()) {
/** * If the job contains errors, or collections which contain errors * themselves then bounce a result message with error documents in back up * to the layer above */ @Override public void receiveJob(DispatchJobEvent jobEvent) { Set<T2Reference> errorReferences = new HashSet<T2Reference>(); for (T2Reference ei : jobEvent.getData().values()) { if (ei.containsErrors()) { errorReferences.add(ei); } } if (errorReferences.isEmpty()) { // relay the message down... getBelow().receiveJob(jobEvent); } else { getState(jobEvent.getOwningProcess()) .incrementErrorsReflected(); sendErrorOutput(jobEvent, null, errorReferences); } }
private T2Reference replaceErrors(T2Reference value, List<T2Reference> exceptions) { return replaceErrors(value, value.getDepth(), exceptions); }
public synchronized void deleteReferenceSetsForWFRun(String workflowRunId) throws DaoException { for (T2Reference reference: store.keySet()){ if (reference.getNamespacePart().equals(workflowRunId)){ store.remove(reference); } } }
int depth = items.get(0).getDepth(); if (depth < 0) { throw new ListServiceException("Can't register list of depth less than 1, but first item " + items.get(0) + " has depth " + depth); int counter = 0; for (T2Reference ref : items) { if (ref.getDepth() != depth) { throw new ListServiceException( "Mismatched depths in list registration; reference at index '" + counter + "' has depth " + ref.getDepth() + " but all preceeding items have depth " + depth); if (ref.containsErrors()) {
/** * If the job contains errors, or collections which contain errors * themselves then bounce a result message with error documents in back up * to the layer above */ @Override public void receiveJob(DispatchJobEvent jobEvent) { Set<T2Reference> errorReferences = new HashSet<T2Reference>(); for (T2Reference ei : jobEvent.getData().values()) { if (ei.containsErrors()) { errorReferences.add(ei); } } if (errorReferences.isEmpty()) { // relay the message down... getBelow().receiveJob(jobEvent); } else { getState(jobEvent.getOwningProcess()) .incrementErrorsReflected(); sendErrorOutput(jobEvent, null, errorReferences); } }
private Set<T2Reference> getErrors(T2Reference ref) { Set<T2Reference> result = new HashSet<T2Reference>(); if (ref.getReferenceType().equals(ReferenceSet)) { // nothing } else if (ref.getReferenceType().equals(IdentifiedList)) { IdentifiedList<T2Reference> originalList = listService.getList(ref); for (T2Reference subValue : originalList) if (subValue.containsErrors()) result.addAll(getErrors(subValue)); } else { result.add(ref); } return result; }
/** * Returns an Element representing the data item, identfied as either input * or output. References to data are currently resolved to their actual * values */ public static Element getDataItemAsXML(DataProvenanceItem provenanceItem) { String name; if (provenanceItem.getEventType().equals(SharedVocabulary.INPUTDATA_EVENT_TYPE)) { name = "inputdata"; } else { name = "outputdata"; } Element result = new Element(name); result.setAttribute("identifier", provenanceItem.getIdentifier()); result.setAttribute("processID", provenanceItem.getProcessId()); result.setAttribute("parent", provenanceItem.getParentId()); for (String port : provenanceItem.getDataMap().keySet()) { Element portElement = new Element("port"); portElement.setAttribute("name", port); portElement.setAttribute("depth", Integer.toString(provenanceItem.getDataMap() .get(port).getDepth())); result.addContent(portElement); portElement.addContent(resolveToElement(provenanceItem.getDataMap().get(port), provenanceItem.getReferenceService())); Element element = new Element("some_stuff"); portElement.addContent(element); } return result; }
public synchronized void deleteErrorDocumentsForWFRun(String workflowRunId) throws DaoException { for (T2Reference reference: store.keySet()){ if (reference.getNamespacePart().equals(workflowRunId)){ store.remove(reference); } } }
public static List<ErrorDocument> getErrorDocuments(T2Reference reference, ReferenceService referenceService) { List<ErrorDocument> errorDocuments = new ArrayList<ErrorDocument>(); if (reference.getReferenceType().equals(T2ReferenceType.ErrorDocument)) { ErrorDocumentService errorDocumentService = referenceService .getErrorDocumentService(); errorDocuments.add(errorDocumentService.getError(reference)); } else if (reference.getReferenceType().equals( T2ReferenceType.IdentifiedList)) { ListService listService = referenceService.getListService(); IdentifiedList<T2Reference> list = listService.getList(reference); for (T2Reference listReference : list) { errorDocuments .addAll(getErrorDocuments(listReference, referenceService)); } } return errorDocuments; }
/** * Construct a deep copy of the given T2Reference * * @param source * T2Reference to copy */ private T2ReferenceImpl(T2Reference source) { super(); setNamespacePart(source.getNamespacePart()); setLocalPart(source.getLocalPart()); setContainsErrors(source.containsErrors()); setReferenceType(source.getReferenceType()); setDepth(source.getDepth()); }
int depth = items.get(0).getDepth(); T2ReferenceListImpl newList = new T2ReferenceListImpl(); int counter = 0; for (T2Reference ref : items) { if (ref.getDepth() != depth) { throw new ListServiceException( "Mismatched depths in list registration; reference at index '" + counter + "' has depth " + ref.getDepth() + " but all preceeding items have depth " + depth); if (ref.containsErrors()) {
public Object renderIdentifier(T2Reference id, Class<?> leafClass, ReferenceContext context) throws ReferenceServiceException { // Check we have the services installed checkServices(); // Insert an empty context if context was null context = EmptyReferenceContext.checkContext(context); // Reject if the source reference contains errors if (id.containsErrors()) { throw new ReferenceServiceException( "Can't render an identifier which contains errors to a POJO"); } // Attempt to find an appropriate StreamToValueConverterSPI instance to // build the specified class StreamToValueConverterSPI<?> converter = null; if (valueBuilderRegistry != null) { for (StreamToValueConverterSPI<?> stvc : valueBuilderRegistry) { Class<?> builtClass = stvc.getPojoClass(); if (leafClass.isAssignableFrom(builtClass)) { converter = stvc; break; } } } if (converter == null) { log.warn("No stream->value converters found for type '" + leafClass.getCanonicalName() + "'"); } // Render the identifier return renderIdentifierInner(id, leafClass, context, converter); }
int currentDepth = source.getDepth(); while (currentDepth > desiredDepth) { List<ContextualizedT2Reference> newSet = new ArrayList<ContextualizedT2Reference>();
public synchronized void deleteIdentifiedListsForWFRun(String workflowRunId) throws DaoException { for (T2Reference reference: store.keySet()){ if (reference.getNamespacePart().equals(workflowRunId)){ store.remove(reference); } } } }
public static List<ErrorDocument> getErrorDocuments(T2Reference reference, InvocationContext context) { List<ErrorDocument> errorDocuments = new ArrayList<ErrorDocument>(); if (reference.getReferenceType().equals(T2ReferenceType.ErrorDocument)) { ErrorDocumentService errorDocumentService = context.getReferenceService().getErrorDocumentService(); errorDocuments.add(errorDocumentService.getError(reference)); } else if (reference.getReferenceType().equals(T2ReferenceType.IdentifiedList)) { ListService listService = context.getReferenceService().getListService(); IdentifiedList<T2Reference> list = listService.getList(reference); for (T2Reference listReference : list) { errorDocuments.addAll(getErrorDocuments(listReference, context)); } } return errorDocuments; }