summaryrefslogtreecommitdiffstats
path: root/authz-batch/src/main/java/com/att/authz/entryConverters/UserRoleEntryConverter.java
blob: 0b2a956e1e37a9064d82480088e75732f7e132af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*******************************************************************************
 * Copyright (c) 2016 AT&T Intellectual Property. All rights reserved.
 *******************************************************************************/
package com.att.authz.entryConverters;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import com.att.dao.aaf.cass.UserRoleDAO;
import com.googlecode.jcsv.writer.CSVEntryConverter;

public class UserRoleEntryConverter extends AafEntryConverter implements CSVEntryConverter<UserRoleDAO.Data> {
	private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ssZ";
	
	@Override
	public String[] convertEntry(UserRoleDAO.Data urd) {
		String[] columns = new String[3];
		
		columns[0] = urd.user;
		columns[1] = urd.role;
		DateFormat df = new SimpleDateFormat(DATE_FORMAT);
		columns[2] = df.format(urd.expires);
		
		return columns;
	}
}