Search in sources :

Example 6 with Ticket

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;
}
Also used : DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) Ticket(org.irods.jargon.ticket.Ticket) DataNotFoundException(org.irods.jargon.core.exception.DataNotFoundException) JargonException(org.irods.jargon.core.exception.JargonException) DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) DataGridTicketNotFoundException(com.emc.metalnx.core.domain.exceptions.DataGridTicketNotFoundException) TicketAdminService(org.irods.jargon.ticket.TicketAdminService)

Example 7 with Ticket

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;
}
Also used : DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) Ticket(org.irods.jargon.ticket.Ticket) JargonException(org.irods.jargon.core.exception.JargonException) ArrayList(java.util.ArrayList) DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) TicketAdminService(org.irods.jargon.ticket.TicketAdminService)

Example 8 with Ticket

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));
}
Also used : DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) Ticket(org.irods.jargon.ticket.Ticket) Test(org.junit.Test)

Aggregations

DataGridTicket (com.emc.metalnx.core.domain.entity.DataGridTicket)8 Ticket (org.irods.jargon.ticket.Ticket)8 Test (org.junit.Test)4 JargonException (org.irods.jargon.core.exception.JargonException)3 TicketAdminService (org.irods.jargon.ticket.TicketAdminService)3 DataGridTicketException (com.emc.metalnx.core.domain.exceptions.DataGridTicketException)1 DataGridTicketNotFoundException (com.emc.metalnx.core.domain.exceptions.DataGridTicketNotFoundException)1 ArrayList (java.util.ArrayList)1 DataNotFoundException (org.irods.jargon.core.exception.DataNotFoundException)1 TicketCreateModeEnum (org.irods.jargon.ticket.packinstr.TicketCreateModeEnum)1