agave-files/files-core/src/main/java/org/iplantc/service/io/dao/FileEventDao.java
/**
	 * Saves multiple job permissions. Updates existing ones.
	 * @param pem
	 * @throws LogicalFileException
	 */
Saves multiple job permissions. Updates existing ones.
@param pem
@throws LogicalFileException
Saves multiple job permissions . Updates existing ones . @param pem @throws LogicalFileException
public static void persistAll(List<FileEvent> events) throws LogicalFileException
	{
		if (events == null) {
			throw new LogicalFileException("FileEvents cannot be null");
		} else if (events.isEmpty()) {
			return;
		}
		try
		{
			String ipAddress = org.iplantc.service.common.Settings.getIpLocalAddress();
			String tenantId = TenancyHelper.getCurrentTenantId();	
			Session session = getSession();
			int i=1;
			for (FileEvent event: events) {
				session.saveOrUpdate(event);
				if (++i%50 == 0) {
					session.flush();
					session.clear();
				}
			}
			session.flush();
		}
		catch (HibernateException ex)
		{
			try
			{
				if (HibernateUtil.getSession().isOpen()) {
					HibernateUtil.rollbackTransaction();
				}
			}
			catch (Exception e) {}
			throw new LogicalFileException("Failed to save job event.", ex);
		}
		finally {
			try { HibernateUtil.commitTransaction(); } catch (Exception e) {}
		}
	}
public static void persistAll ( List < FileEvent > events ) throws LogicalFileException { if ( events == null ) { throw new LogicalFileException ( "FileEvents cannot be null" ) ; } else if ( events . isEmpty ( ) ) { return ; } try { String ipAddress = org . iplantc . service . common . Settings . getIpLocalAddress ( ) ; String tenantId = TenancyHelper . getCurrentTenantId ( ) ; Session session = getSession ( ) ; int i = 1 ; for ( FileEvent event : events ) { session . saveOrUpdate ( event ) ; if ( ++ i % 50 == 0 ) { session . flush ( ) ; session . clear ( ) ; } } session . flush ( ) ; } catch ( HibernateException ex ) { try { if ( HibernateUtil . getSession ( ) . isOpen ( ) ) { HibernateUtil . rollbackTransaction ( ) ; } } catch ( Exception e ) { } throw new LogicalFileException ( "Failed to save job event." , ex ) ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception e ) { } } }
Saves multiple job permissions.
Saves multiple job permissions .