/** * Static method, returns the context passed unless a null is passed in * which case it returns a new empty reference context * * @param context * @return */ public static ReferenceContext checkContext(ReferenceContext context) { if (context != null) { return context; } else { return new EmptyReferenceContext(); } }
public final ErrorDocument registerError(String message, int depth, ReferenceContext context) throws ErrorDocumentServiceException { context = EmptyReferenceContext.checkContext(context); return registerError(message, (Throwable) null, depth, context); }
context = new EmptyReferenceContext();
public final ErrorDocument registerError(Throwable t, int depth, ReferenceContext context) throws ErrorDocumentServiceException { context = EmptyReferenceContext.checkContext(context); return registerError("", t, depth, context); }
context = new EmptyReferenceContext();
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); }
checkServices(); if (context == null) { context = new EmptyReferenceContext();
throws ReferenceServiceException { checkServices(); context = EmptyReferenceContext.checkContext(context); if (useConverterSPI) { checkConverterRegistry();
checkAugmentor(); if (context == null) { context = new EmptyReferenceContext();
context = EmptyReferenceContext.checkContext(context); checkDao(); checkGenerator();
checkServices(); if (context == null) { context = new EmptyReferenceContext();
/** * {@inheritDoc} */ public ReferenceSet registerReferenceSet( Set<ExternalReferenceSPI> references, ReferenceContext context) throws ReferenceSetServiceException { checkDao(); checkGenerator(); context = EmptyReferenceContext.checkContext(context); ReferenceSetImpl rsi = new ReferenceSetImpl(); rsi .setExternalReferences(new HashSet<ExternalReferenceSPI>( references)); T2Reference id = getGenerator(context).nextReferenceSetReference(); rsi.setTypedId(T2ReferenceImpl.getAsImpl(id)); try { referenceSetDao.store(rsi); return rsi; } catch (DaoException de) { throw new ReferenceSetServiceException(de); } } }
checkAugmentor(); if (context == null) { context = new EmptyReferenceContext();
public IdentifiedList<T2Reference> registerEmptyList(int depth, ReferenceContext context) throws ListServiceException { checkDao(); checkGenerator(); context = EmptyReferenceContext.checkContext(context); T2ReferenceImpl newReference = T2ReferenceImpl.getAsImpl(getGenerator( context).nextListReference(false, depth)); T2ReferenceListImpl newList = new T2ReferenceListImpl(); newList.setTypedId(newReference); try { listDao.store(newList); return newList; } catch (DaoException de) { throw new ListServiceException(de); } }
checkAugmentor(); if (context == null) { context = new EmptyReferenceContext();
private T2Reference getNameForObject(Object o, int currentDepth, boolean useConverterSPI, ReferenceContext context) throws ReferenceServiceException { context = EmptyReferenceContext.checkContext(context);
checkServices(); if (context == null) { context = new EmptyReferenceContext();
checkDao(); checkGenerator(); context = EmptyReferenceContext.checkContext(context); if (items.isEmpty()) { throw new ListServiceException(
checkServices(); if (context == null) { context = new EmptyReferenceContext();
checkDao(); checkGenerator(); context = EmptyReferenceContext.checkContext(context); T2Reference ref = getGenerator(context).nextErrorDocumentReference( depth);