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);
}
}
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;
}
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;
}
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;
}
Aggregations