public psidev.psi.mi.jami.model.Publication fetchByIdentifier(String identifier, String source) throws BridgeFailedException { if(identifier == null) throw new IllegalArgumentException("Cannot fetch null identifier"); if(source == null) throw new IllegalArgumentException("Cannot fetch null source. Cane be IMEX, DOI or PUBMED"); try { Publication pub = port.getPublicationById(buildIdentifier(identifier, source)); if (pub != null){ return new ImexPublication(pub); } } catch ( IcentralFault f ) { switch( f.getFaultInfo().getFaultCode() ) { case NO_RECORD: // simply no data found, return null return null; } throw new BridgeFailedException("Impossible to find the publication " + identifier, f); } return null; }
private void processImexCentralException(String publication, Exception e, IcentralFault f, ImexCentralManager imexCentralManager) { if( f.getFaultInfo().getFaultCode() == ImexCentralClient.USER_NOT_AUTHORIZED ) { ImexErrorEvent errorEvt = new ImexErrorEvent(this, ImexErrorType.user_not_authorized, publication, null, null, null, "missing/unknown user and/or missing/invalid password provided : " + e.getMessage()); imexCentralManager.fireOnImexError(errorEvt); else if( f.getFaultInfo().getFaultCode() == ImexCentralClient.OPERATION_NOT_VALID ) { ImexErrorEvent errorEvt = new ImexErrorEvent(this, ImexErrorType.operation_not_valid, publication, null, null, null, "invalid operation : " + e.getMessage()); imexCentralManager.fireOnImexError(errorEvt); else if( f.getFaultInfo().getFaultCode() == ImexCentralClient.IDENTIFIER_MISSING ) { ImexErrorEvent errorEvt = new ImexErrorEvent(this, ImexErrorType.identifier_missing, publication, null, null, null, "missing identifier : " + e.getMessage()); imexCentralManager.fireOnImexError(errorEvt); else if( f.getFaultInfo().getFaultCode() == ImexCentralClient.IDENTIFIER_UNKNOWN ) { ImexErrorEvent errorEvt = new ImexErrorEvent(this, ImexErrorType.identifier_unknown, publication, null, null, null, "unrecognized identifier : " + e.getMessage()); imexCentralManager.fireOnImexError(errorEvt); else if( f.getFaultInfo().getFaultCode() == ImexCentralClient.NO_RECORD ) { ImexErrorEvent errorEvt = new ImexErrorEvent(this, ImexErrorType.no_record, publication, null, null, null, "query returned no records : " + e.getMessage()); imexCentralManager.fireOnImexError(errorEvt); else if( f.getFaultInfo().getFaultCode() == ImexCentralClient.NO_RECORD_CREATED ) { ImexErrorEvent errorEvt = new ImexErrorEvent(this, ImexErrorType.no_record_created, publication, null, null, null, "requested records were not created : " + e.getMessage()); imexCentralManager.fireOnImexError(errorEvt); else if( f.getFaultInfo().getFaultCode() == ImexCentralClient.STATUS_UNKNOWN ) { ImexErrorEvent errorEvt = new ImexErrorEvent(this, ImexErrorType.status_unknown, publication, null, null, null, "unknown status : " + e.getMessage()); imexCentralManager.fireOnImexError(errorEvt); else if( f.getFaultInfo().getFaultCode() == ImexCentralClient.NO_IMEX_ID ) {
public List<psidev.psi.mi.jami.model.Publication> fetchPublicationsByStatus(String status, int first, int max) throws BridgeFailedException { try { // create holders for publication and last record Holder<PublicationList> pubList = new Holder<PublicationList>(); Holder<Long> number = new Holder<Long>(); port.getPublicationByStatus( status, first, max, pubList, number ); if( pubList.value != null) { List<Publication> pubs = pubList.value.getPublication(); List<psidev.psi.mi.jami.model.Publication> publications = new ArrayList<psidev.psi.mi.jami.model.Publication>(pubs.size()); for (Publication pub : pubs){ if (pub != null){ publications.add(new ImexPublication(pub)); } } return publications; } return Collections.EMPTY_LIST; } catch ( IcentralFault f ) { switch( f.getFaultInfo().getFaultCode() ) { case NO_RECORD: // simply no data found, return empty list return Collections.EMPTY_LIST; } throw new BridgeFailedException( "Error while getting publications by status: " + status, f ); } }
/** * * @param identifier * @return the publication or null if not found. * @throws ImexCentralException */ public Publication getPublicationById( String identifier ) throws ImexCentralException { try { final Publication pub = port.getPublicationById(buildIdentifier(identifier)); return pub; } catch ( IcentralFault f ) { switch( f.getFaultInfo().getFaultCode() ) { case NO_RECORD: // simply no data found, return null return null; } throw new ImexCentralException("Impossible to find the publication " + identifier, f); } }
public List<psidev.psi.mi.jami.model.Publication> fetchPublicationsByOwner(String owner, int first, int max) throws BridgeFailedException { try { // create holders for publication and last record Holder<PublicationList> pubList = new Holder<PublicationList>(); Holder<Long> number = new Holder<Long>(); port.getPublicationByOwner( owner, first, max, pubList, number ); if( pubList.value != null) { List<Publication> pubs = pubList.value.getPublication(); List<psidev.psi.mi.jami.model.Publication> publications = new ArrayList<psidev.psi.mi.jami.model.Publication>(pubs.size()); for (Publication pub : pubs){ if (pub != null){ publications.add(new ImexPublication(pub)); } } return publications; } return Collections.EMPTY_LIST; } catch ( IcentralFault f ) { switch( f.getFaultInfo().getFaultCode() ) { case NO_RECORD: // simply no data found, return empty list return Collections.EMPTY_LIST; } throw new BridgeFailedException( "Error while getting publications by owner: " + owner, f ); } }
e.printStackTrace( ); final int code = ( ( IcentralFault ) e.getCause() ).getFaultInfo().getFaultCode(); final String msg = ( ( IcentralFault ) e.getCause() ).getFaultInfo().getMessage(); System.out.println( "\n\n" + code + " - " + msg );
} catch ( BridgeFailedException e ) { IcentralFault f = (IcentralFault) e.getCause(); if( f.getFaultInfo().getFaultCode() == ImexCentralClient.UNKNOWN_GROUP ) { else if (f.getFaultInfo().getFaultCode() != ImexCentralClient.OPERATION_NOT_VALID) { throw e; if( f.getFaultInfo().getFaultCode() == ImexCentralClient.UNKNOWN_GROUP || f.getFaultInfo().getFaultCode() == ImexCentralClient.OPERATION_NOT_VALID ) { if (f.getFaultInfo().getFaultCode() == ImexCentralClient.UNKNOWN_GROUP){ log.warn("The institution " + institution + " is not recognized in IMEx central so we will add INTACT admin group."); } catch ( BridgeFailedException e2 ) { IcentralFault f2 = (IcentralFault) e2.getCause(); if( f2.getFaultInfo().getFaultCode() == ImexCentralClient.UNKNOWN_GROUP) { else if (f2.getFaultInfo().getFaultCode() != ImexCentralClient.OPERATION_NOT_VALID){ throw e; } catch ( BridgeFailedException e ) { IcentralFault f = (IcentralFault) e.getCause(); if( f.getFaultInfo().getFaultCode() == ImexCentralClient.UNKNOWN_GROUP ) { else if (f.getFaultInfo().getFaultCode() != ImexCentralClient.OPERATION_NOT_VALID) { throw e;
public List<Publication> getPublicationByOwner( String owner, int first, int max) throws ImexCentralException { try { // create holders for publication and last record Holder<PublicationList> pubList = new Holder<PublicationList>(); Holder<Long> number = new Holder<Long>(); port.getPublicationByOwner( owner, first, max, pubList, number ); if( pubList.value != null) { return pubList.value.getPublication(); } return Collections.EMPTY_LIST; } catch ( IcentralFault f ) { switch( f.getFaultInfo().getFaultCode() ) { case NO_RECORD: // simply no data found, return empty list return Collections.EMPTY_LIST; } throw new ImexCentralException( "Error while getting publications by owner: " + owner, f ); } }
public List<Publication> getPublicationByStatus( String status, int first, int max) throws ImexCentralException { try { // create holders for publication and last record Holder<PublicationList> pubList = new Holder<PublicationList>(); Holder<Long> number = new Holder<Long>(); port.getPublicationByStatus( status, first, max, pubList, number ); if( pubList.value != null) { return pubList.value.getPublication(); } return Collections.EMPTY_LIST; } catch ( IcentralFault f ) { switch( f.getFaultInfo().getFaultCode() ) { case NO_RECORD: // simply no data found, return empty list return Collections.EMPTY_LIST; } throw new ImexCentralException( "Error while getting publications by status: " + status, f ); } }
if( f.getFaultInfo().getFaultCode() == ImexCentralClient.UNKNOWN_USER && !containsAdminUser(adminUserList, PHANTOM_CURATOR)) {