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; }
/** * 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); } }
if (id.containsErrors()) { throw new ReferenceServiceException( "Can't render an identifier which contains errors to a POJO");
if (id.containsErrors()) { throw new ReferenceServiceException( "Can't render an identifier which contains errors to a POJO");
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); }
public boolean isShown(Object o) { if (!(o instanceof WorkflowResultTreeNode)) { return false; } WorkflowResultTreeNode node = (WorkflowResultTreeNode) o; if (filter.equals(FilterType.ALL)) { return (true); } if (filter.equals(FilterType.RESULTS)) { for (Enumeration e = node.depthFirstEnumeration(); e.hasMoreElements();) { WorkflowResultTreeNode subNode = (WorkflowResultTreeNode) e.nextElement(); if ((subNode.getReference() != null) && !subNode.getReference().containsErrors()) { return true; } } return false; } if (filter.equals(FilterType.ERRORS)) { for (Enumeration e = node.depthFirstEnumeration(); e.hasMoreElements();) { WorkflowResultTreeNode subNode = (WorkflowResultTreeNode) e.nextElement(); if ((subNode.getReference() != null) && subNode.getReference().containsErrors()) { return true; } } return false; } return true; }
/** * 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 static boolean containsError (TreeNode node) { boolean result = false; if (node instanceof WorkflowResultTreeNode) { WorkflowResultTreeNode rtn = (WorkflowResultTreeNode) node; T2Reference reference = rtn.getReference(); if ((reference != null) && (reference.containsErrors())) { result = true; } } int childCount = node.getChildCount(); for (int i = 0; (i < childCount) && !result; i++ ) { result = containsError(node.getChildAt(i)); } return result; } }
public boolean isShown(Object o) { if (!(o instanceof ProcessorResultTreeNode)) { return false; } ProcessorResultTreeNode node = (ProcessorResultTreeNode) o; if (node.getReference() == null) { // root of the model return true; } if (filter.equals(FilterType.ALL)) { return (true); } if (filter.equals(FilterType.RESULTS)) { for (Enumeration e = node.depthFirstEnumeration(); e.hasMoreElements();) { ProcessorResultTreeNode subNode = (ProcessorResultTreeNode) e.nextElement(); if ((subNode.getReference() != null) && !subNode.getReference().containsErrors()) { return true; } } return false; } if (filter.equals(FilterType.ERRORS)) { return node.getReference().containsErrors(); } return true; } }
private static boolean containsError (TreeNode node) { boolean result = false; if (node instanceof ProcessorResultTreeNode) { ProcessorResultTreeNode rtn = (ProcessorResultTreeNode) node; T2Reference reference = rtn.getReference(); if ((reference != null) && (reference.containsErrors())) { result = true; } } int childCount = node.getChildCount(); for (int i = 0; (i < childCount) && !result; i++ ) { result = containsError(node.getChildAt(i)); } return result; } }
public void resultTokenProduced(WorkflowDataToken dataToken, String portname) { if (dataToken.getIndex().length == 0) { T2Reference reference = dataToken.getData(); System.out.println("Output reference made = " + reference); Object value = reference; if (reference.containsErrors()) { System.out.println("Contains errors!"); printAllErrors(context.getReferenceService().resolveIdentifier( reference, null, context)); } else { try { value = context.getReferenceService().renderIdentifier( reference, Object.class, context); } catch (ReferenceServiceException ex) { ex.printStackTrace(); } } resultMap.put(portname, value); synchronized (this) { outputCount--; } } }
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; }
@SuppressWarnings("unchecked") public void printAllErrors(Identified identified) { if (!identified.getId().containsErrors()) { return;
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); } }
/** * 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()); }
/** * 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()); }
/** * 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()); }
+ depth); if (ref.containsErrors()) {
+ depth); if (ref.containsErrors()) {
+ depth); if (ref.containsErrors()) {