cancel
Showing results for 
Search instead for 
Did you mean: 

Check-in & check-in comments?

martin_cowie
Champ in-the-making
Champ in-the-making
As far as I can see, when using the JCR interface it's not possible to check-in a Node with check-in comments. These are the comments that show up in the 'Notes' column of the web GUI.

Presuming my statement to be correct, can anyone here say if it' possible to use the Foundation API instead (such as is done to set MIME-types) to check a Node in along with check-in comments?

I should be most grateful,

M.
1 REPLY 1

martin_cowie
Champ in-the-making
Champ in-the-making
I've been able to achieve this using the Foundation API Smiley Very Happy


public static ApplicationContext context = null;

public static void checkin( Node node, String checkinComment ) throws RepositoryException
{
   // retrieve service registry
    ServiceRegistry serviceRegistry = (ServiceRegistry)context.getBean(ServiceRegistry.SERVICE_REGISTRY);
   
    // convert the JCR Node to an Alfresco Node Reference
    NodeRef nodeRef = JCRNodeRef.getNodeRef(node);

    Map<String, Serializable> versionProperties = new HashMap<String,Serializable>();
    versionProperties.put( "description", checkinComment );
    serviceRegistry.getVersionService().createVersion( nodeRef, versionProperties );

    // set to 'read only'
    serviceRegistry.getLockService().lock( nodeRef, LockType.READ_ONLY_LOCK );      
}

… which draws from JCRs NodeImpl.checkin() quite alot.