Revision d114cfe2

b/src/gr/ebs/gss/server/ejb/ExternalAPI.java
366 366
	public Set<String> getUserTags(final Long userId) throws ObjectNotFoundException;
367 367

  
368 368
	/**
369
	 * Updates name and tags for the specified file
369
	 * Updates the attributes of the specified file.
370 370
	 *
371 371
	 * @param userId
372 372
	 * @param fileId
373 373
	 * @param name
374 374
	 * @param tagSet a String that contains tags separated by comma
375
	 * @param modificationDate the modification date
375 376
	 * @throws ObjectNotFoundException
376 377
	 * @throws InsufficientPermissionsException
377 378
	 */
378
	public void updateFile(Long userId, Long fileId, String name, String tagSet)
379
	public void updateFile(Long userId, Long fileId, String name, String tagSet, Date modificationDate)
379 380
			throws ObjectNotFoundException, InsufficientPermissionsException;
380 381

  
381 382
	/**
b/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java
656 656
		return dao.getUserTags(userId);
657 657
	}
658 658

  
659
	/* (non-Javadoc)
660
	 * @see gr.ebs.gss.server.ejb.ExternalAPI#updateFile(java.lang.Long, java.lang.Long, java.lang.String, java.util.Set)
661
	 */
662
	public void updateFile(Long userId, Long fileId, String name, String tagSet) throws ObjectNotFoundException, InsufficientPermissionsException {
659
	public void updateFile(Long userId, Long fileId, String name,
660
				String tagSet, Date modificationDate)
661
			throws ObjectNotFoundException,	InsufficientPermissionsException {
663 662
		if (userId == null)
664 663
			throw new ObjectNotFoundException("No user specified");
665 664
		if (fileId == null)
......
675 674

  
676 675
		if (name != null)
677 676
			file.setName(name);
677
		if (modificationDate != null) {
678
			file.getAuditInfo().setModificationDate(modificationDate);
679
			file.getAuditInfo().setModifiedBy(user);
680
		}
678 681
		List<FileTag> tags = file.getFileTags();
679 682

  
680 683
		if (tagSet != null) {
b/src/gr/ebs/gss/server/ejb/ExternalAPIRemote.java
31 31
import gr.ebs.gss.server.domain.dto.UserDTO;
32 32

  
33 33
import java.io.InputStream;
34
import java.util.Date;
34 35
import java.util.List;
35 36
import java.util.Set;
36 37

  
......
289 290
	public Set<String> getUserTags(final Long userId) throws ObjectNotFoundException;
290 291

  
291 292
	/**
292
	 * Updates name and tags for the specified file
293
	 * Updates the attributes of the specified file.
293 294
	 *
294 295
	 * @param userId
295 296
	 * @param fileId
296 297
	 * @param name
297 298
	 * @param tagSet a String that contains tags separated by comma
299
	 * @param modificationDate the modification date
298 300
	 * @throws ObjectNotFoundException
299 301
	 * @throws InsufficientPermissionsException
300 302
	 */
301
	public void updateFile(Long userId, Long fileId, String name, String tagSet) throws ObjectNotFoundException, InsufficientPermissionsException;
303
	public void updateFile(Long userId, Long fileId, String name, String tagSet, Date modificationDate)
304
			throws ObjectNotFoundException, InsufficientPermissionsException;
302 305

  
303 306
	/**
304 307
	 * Retrieve the contents of the current body for the file
b/src/gr/ebs/gss/server/rest/FilesHandler.java
1383 1383
				String name = null;
1384 1384
				if (json.opt("name") != null)
1385 1385
					name = json.optString("name");
1386
				Long modificationDate = null;
1387
				if (json.optLong("modificationDate") != 0)
1388
					modificationDate = json.optLong("modificationDate");
1386 1389
				JSONArray tagset = json.optJSONArray("tags");
1387 1390
				String tags = null;
1388 1391
				StringBuffer t = new StringBuffer();
......
1391 1394
						t.append(tagset.getString(i) + ',');
1392 1395
					tags = t.toString();
1393 1396
				}
1394
				if (name != null || tags != null) {
1397
				if (name != null || tags != null || modificationDate != null) {
1395 1398
					final String fName = name;
1396 1399
					final String fTags = tags;
1400
					final Date mDate = modificationDate != null? new Date(modificationDate): null;
1397 1401
					new TransactionHelper<Object>().tryExecute(new Callable<Object>() {
1398 1402
						@Override
1399 1403
						public Object call() throws Exception {
1400
							getService().updateFile(user.getId(), file.getId(), fName, fTags);
1404
							getService().updateFile(user.getId(), file.getId(), fName, fTags, mDate);
1401 1405
							return null;
1402 1406
						}
1403 1407

  

Also available in: Unified diff