use of org.irods.jargon.ticket.Ticket in project metalnx-web by irods-contrib.
the class TicketServiceImpl method find.
@Override
public DataGridTicket find(String ticketId) throws DataGridConnectionRefusedException, DataGridTicketNotFoundException {
logger.info("Find ticket {}", ticketId);
DataGridTicket dgTicket = null;
TicketAdminService tas = irodsServices.getTicketAdminService();
try {
Ticket t = tas.getTicketForSpecifiedTicketString(ticketId);
dgTicket = convertTicketToDataGridTicket(t);
dgTicket.setHosts(tas.listAllHostRestrictionsForSpecifiedTicket(ticketId, OFFSET));
dgTicket.setUsers(tas.listAllUserRestrictionsForSpecifiedTicket(ticketId, OFFSET));
dgTicket.setGroups(tas.listAllGroupRestrictionsForSpecifiedTicket(ticketId, OFFSET));
} catch (DataNotFoundException e) {
throw new DataGridTicketNotFoundException("Ticket does not exist");
} catch (JargonException e) {
logger.error("Could not find ticket with string: {}", ticketId);
}
return dgTicket;
}
use of org.irods.jargon.ticket.Ticket in project metalnx-web by irods-contrib.
the class TicketServiceImpl method findAll.
@Override
public List<DataGridTicket> findAll() throws DataGridConnectionRefusedException {
logger.info("Find all tickets");
TicketAdminService tas = irodsServices.getTicketAdminService();
List<DataGridTicket> dgTickets;
List<Ticket> tickets;
try {
tickets = tas.listAllTickets(OFFSET);
} catch (JargonException e) {
logger.info("Could not list all tickets in the grid: {}.", e.getMessage());
tickets = new ArrayList<>();
}
dgTickets = convertListOfTickets(tickets);
return dgTickets;
}
use of org.irods.jargon.ticket.Ticket in project metalnx-web by irods-contrib.
the class TestCreateTicketWithExpirationDate method testCreateTicketWithExpirationDate.
@Test
public void testCreateTicketWithExpirationDate() throws DataGridConnectionRefusedException, DataGridTicketException, JargonException {
ticketString = ticketService.create(dgt);
Ticket ticketWithExpirationDate = ticketUtils.findTicket(ticketString);
String currDate = dateFormat.format(date);
String ticketCreatedDate = dateFormat.format(ticketWithExpirationDate.getExpireTime());
assertEquals(currDate, ticketCreatedDate);
assertFalse(ticketWithExpirationDate.getTicketString().isEmpty());
assertTrue(ticketWithExpirationDate.getIrodsAbsolutePath().equals(targetPath));
assertTrue(ticketWithExpirationDate.getOwnerName().equals(username));
}
Aggregations