Search in sources :

Example 6 with TicketAdminService

use of org.irods.jargon.ticket.TicketAdminService in project metalnx-web by irods-contrib.

the class TicketServiceImpl method updateUserRestrictions.

private void updateUserRestrictions(DataGridTicket t) throws JargonException, DataGridConnectionRefusedException {
    logger.info("Update user restrictions for ticket {}", t.getTicketString());
    String ticketString = t.getTicketString();
    TicketAdminService tas = irodsServices.getTicketAdminService();
    List<String> currUsers = tas.listAllUserRestrictionsForSpecifiedTicket(ticketString, OFFSET);
    for (String user : t.getUsers()) {
        if (!user.isEmpty() && !currUsers.contains(user)) {
            tas.addTicketUserRestriction(ticketString, user);
        }
    }
    for (String user : currUsers) {
        if (!t.getUsers().contains(user))
            tas.removeTicketUserRestriction(ticketString, user);
    }
}
Also used : TicketAdminService(org.irods.jargon.ticket.TicketAdminService)

Example 7 with TicketAdminService

use of org.irods.jargon.ticket.TicketAdminService in project metalnx-web by irods-contrib.

the class TicketServiceImpl method delete.

@Override
public boolean delete(String ticketString) throws DataGridConnectionRefusedException {
    if (ticketString == null || ticketString.isEmpty()) {
        logger.error("Could not delete ticket: Ticket ID null or emtpy");
        return false;
    }
    logger.info("Deleting ticket {}", ticketString);
    boolean ticketDeleted = false;
    TicketAdminService tas = irodsServices.getTicketAdminService();
    try {
        ticketDeleted = tas.deleteTicket(ticketString);
    } catch (JargonException e) {
        logger.info("Could not delete ticket {}: {}.", ticketString, e.getMessage());
    }
    return ticketDeleted;
}
Also used : JargonException(org.irods.jargon.core.exception.JargonException) TicketAdminService(org.irods.jargon.ticket.TicketAdminService)

Example 8 with TicketAdminService

use of org.irods.jargon.ticket.TicketAdminService 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 9 with TicketAdminService

use of org.irods.jargon.ticket.TicketAdminService in project metalnx-web by irods-contrib.

the class IRODSServicesImpl method getTicketAdminService.

@Override
public TicketAdminService getTicketAdminService() throws DataGridConnectionRefusedException {
    TicketAdminService tas = null;
    try {
        TicketServiceFactory tsf = new TicketServiceFactoryImpl(irodsAccessObjectFactory);
        tas = tsf.instanceTicketAdminService(irodsAccount);
    } catch (JargonException e) {
        logger.error("Could not instantiate ticket admin service: ", e.getMessage());
        if (e.getCause() instanceof ConnectException) {
            throw new DataGridConnectionRefusedException(e.getMessage());
        }
    }
    return tas;
}
Also used : DataGridConnectionRefusedException(com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException) TicketServiceFactory(org.irods.jargon.ticket.TicketServiceFactory) TicketServiceFactoryImpl(org.irods.jargon.ticket.TicketServiceFactoryImpl) JargonException(org.irods.jargon.core.exception.JargonException) TicketAdminService(org.irods.jargon.ticket.TicketAdminService) ConnectException(java.net.ConnectException)

Aggregations

TicketAdminService (org.irods.jargon.ticket.TicketAdminService)9 JargonException (org.irods.jargon.core.exception.JargonException)6 DataGridTicket (com.emc.metalnx.core.domain.entity.DataGridTicket)3 Ticket (org.irods.jargon.ticket.Ticket)3 DataGridTicketException (com.emc.metalnx.core.domain.exceptions.DataGridTicketException)2 DataGridConnectionRefusedException (com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException)1 DataGridTicketNotFoundException (com.emc.metalnx.core.domain.exceptions.DataGridTicketNotFoundException)1 ConnectException (java.net.ConnectException)1 ArrayList (java.util.ArrayList)1 DataNotFoundException (org.irods.jargon.core.exception.DataNotFoundException)1 IRODSFile (org.irods.jargon.core.pub.io.IRODSFile)1 TicketServiceFactory (org.irods.jargon.ticket.TicketServiceFactory)1 TicketServiceFactoryImpl (org.irods.jargon.ticket.TicketServiceFactoryImpl)1 TicketCreateModeEnum (org.irods.jargon.ticket.packinstr.TicketCreateModeEnum)1