public static String intactObjectToString(IntactObject io, boolean showAttributesCount) { if (io instanceof AnnotatedObject) { return annotatedObjectToString((AnnotatedObject) io, showAttributesCount); } Class clazz = CgLibUtil.removeCglibEnhanced(io.getClass()); StringBuilder sb = new StringBuilder(); sb.append(clazz.getSimpleName()).append(", ac=").append(io.getAc()).append("}"); return sb.toString(); } }
@Around("@annotation(lifecycleTransition)") public Object checkTransition(ProceedingJoinPoint pjp, LifecycleTransition lifecycleTransition) throws Throwable{ // get the publication from the arguments for (Object obj : pjp.getArgs()) { if (obj instanceof Publication) { Publication publication = (Publication) obj; if (lifecycleTransition.fromStatus() != CvPublicationStatusType.PUB_STATUS) { if (!publication.getStatus().getIdentifier().equals(lifecycleTransition.fromStatus().identifier())) { throw new IllegalTransitionException("Transition '"+pjp.getSignature().getName()+"' cannot be applied to publication '"+ DebugUtil.annotatedObjectToString(publication, false)+ "' with state: '"+DebugUtil.cvObjectToSimpleString(publication.getStatus())+"'"); } } } } return pjp.proceed(); }
public static void renderIntactObjectAsTree( IntactObject intactObject ) { renderIntactObjectAsTree( intactObject, null ); }
log.debug( "\tAbout to persist " + DebugUtil.intactObjectToString(ao, true) +" - Key: "+ getKeyForValue( annotatedObjectsToPersist, ao )); log.warn( "Object to persist should NOT have an AC: " + DebugUtil.intactObjectToString(ao, true) ); } else { for ( AnnotatedObject ao : annotatedObjectsToMerge.values() ) { if ( log.isDebugEnabled() ) { log.debug( "\tAbout to merge " + DebugUtil.annotatedObjectToString(ao, true) ); throw new IllegalStateException( "Object to persist should have an AC: " + DebugUtil.annotatedObjectToString(ao, true)); } else { daoFactory.getBaseDao().merge( ao );
@Override public void visitXref(Xref xref) { currentNode.setUserObject("Xref: "+xref.getPrimaryId()+" / Database="+ DebugUtil.cvObjectToSimpleString(xref.getCvDatabase())+ ", Qualifier="+DebugUtil.cvObjectToSimpleString(xref.getCvXrefQualifier())); }
/** * The publication is ready to go through the release project. * * @param publication the publication * @param comment optional comment */ @LifecycleTransition(fromStatus = CvPublicationStatusType.ACCEPTED_ON_HOLD, toStatus = CvPublicationStatusType.READY_FOR_RELEASE) public void onHoldRemoved(Publication publication, String comment) { if (PublicationUtils.isOnHold(publication)) { throw new IllegalStateException("Cannot mark a publication as ready for release if it is still on-hold: "+ DebugUtil.intactObjectToString(publication, false)); } changeStatus(publication, CvPublicationStatusType.READY_FOR_RELEASE, CvLifecycleEventType.READY_FOR_RELEASE, comment); for ( LifecycleEventListener listener : getListeners() ) { listener.fireReadyForRelease( publication ); } } }
log.debug( "\tAbout to persist " + DebugUtil.intactObjectToString(ao, true) +" - Key: "+ getKeyForValue( annotatedObjectsToPersist, ao )); log.warn( "Object to persist should NOT have an AC: " + DebugUtil.intactObjectToString(ao, true) ); } else { for ( AnnotatedObject ao : annotatedObjectsToMerge.values() ) { if ( log.isDebugEnabled() ) { log.debug( "\tAbout to merge " + DebugUtil.annotatedObjectToString(ao, true) ); throw new IllegalStateException( "Object to persist should have an AC: " + DebugUtil.annotatedObjectToString(ao, true)); } else { daoFactory.getBaseDao().merge( ao );
@Override public void visitXref(Xref xref) { currentNode.setUserObject("Xref: "+xref.getPrimaryId()+" / Database="+ DebugUtil.cvObjectToSimpleString(xref.getCvDatabase())+ ", Qualifier="+DebugUtil.cvObjectToSimpleString(xref.getCvXrefQualifier())); }
/** * The publication is ready to go through the release project. * * @param publication the publication * @param comment optional comment */ @LifecycleTransition(fromStatus = CvPublicationStatusType.ACCEPTED_ON_HOLD, toStatus = CvPublicationStatusType.READY_FOR_RELEASE) public void onHoldRemoved(Publication publication, String comment) { if (PublicationUtils.isOnHold(publication)) { throw new IllegalStateException("Cannot mark a publication as ready for release if it is still on-hold: "+ DebugUtil.intactObjectToString(publication, false)); } changeStatus(publication, CvPublicationStatusType.READY_FOR_RELEASE, CvLifecycleEventType.READY_FOR_RELEASE, comment); for ( LifecycleEventListener listener : getListeners() ) { listener.fireReadyForRelease( publication ); } } }
public static String intactObjectToString(IntactObject io, boolean showAttributesCount) { if (io instanceof AnnotatedObject) { return annotatedObjectToString((AnnotatedObject) io, showAttributesCount); } Class clazz = CgLibUtil.removeCglibEnhanced(io.getClass()); StringBuilder sb = new StringBuilder(); sb.append(clazz.getSimpleName()).append(", ac=").append(io.getAc()).append("}"); return sb.toString(); } }
@Around("@annotation(lifecycleTransition)") public Object checkTransition(ProceedingJoinPoint pjp, LifecycleTransition lifecycleTransition) throws Throwable{ // get the publication from the arguments for (Object obj : pjp.getArgs()) { if (obj instanceof Publication) { Publication publication = (Publication) obj; if (lifecycleTransition.fromStatus() != CvPublicationStatusType.PUB_STATUS) { if (!publication.getStatus().getIdentifier().equals(lifecycleTransition.fromStatus().identifier())) { throw new IllegalTransitionException("Transition '"+pjp.getSignature().getName()+"' cannot be applied to publication '"+ DebugUtil.annotatedObjectToString(publication, false)+ "' with state: '"+DebugUtil.cvObjectToSimpleString(publication.getStatus())+"'"); } } } } return pjp.proceed(); }
@Override public void visitAlias(Alias alias) { currentNode.setUserObject("Alias: "+alias.getName()+" / Type="+DebugUtil.cvObjectToSimpleString(alias.getCvAliasType())); }
public void delete(IntactObject intactObject) { if (intactObject.getAc() != null) { if (log.isDebugEnabled()) log.debug("Deleting: " + DebugUtil.intactObjectToString(intactObject, false));
public static void renderIntactObjectAsTree( IntactObject intactObject ) { renderIntactObjectAsTree( intactObject, null ); }
sourceInfo = DebugUtil.annotatedObjectToString((AnnotatedObject) source, true);
@Override public void visitAnnotation(Annotation annotation) { currentNode.setUserObject("Annotation: "+annotation.getAnnotationText()+" / Topic="+ DebugUtil.cvObjectToSimpleString(annotation.getCvTopic())); }
public void delete(IntactObject intactObject) { if (intactObject.getAc() != null) { if (log.isDebugEnabled()) log.debug("Deleting: " + DebugUtil.intactObjectToString(intactObject, false));
sourceInfo = DebugUtil.annotatedObjectToString((AnnotatedObject) source, true);
@Override public void visitAlias(Alias alias) { currentNode.setUserObject("Alias: "+alias.getName()+" / Type="+DebugUtil.cvObjectToSimpleString(alias.getCvAliasType())); }
@Transactional @IntactFlushMode(FlushModeType.COMMIT) public PersisterStatistics saveOrUpdate( AnnotatedObject... annotatedObjects ) throws PersisterException { for (AnnotatedObject ao : annotatedObjects) { if (log.isDebugEnabled()) log.debug("Saving: "+DebugUtil.annotatedObjectToString(ao, false)); synchronize(ao); } commit(); // we reload the annotated objects by its AC // note: if an object does not have one, it is probably a duplicate for ( AnnotatedObject ao : annotatedObjects ) { reload( ao ); } if (log.isDebugEnabled()) log.debug(statistics); return statistics; }