public void addPublication( String identifier, String imexAccession, String status, String owner ) { Publication p = new Publication(); final Identifier id = new Identifier(); id.setAc( identifier ); p.getIdentifier().add(id); p.setImexAccession( ( imexAccession == null ? "N/A" : imexAccession ) ); p.setStatus( status ); p.setOwner( owner ); allPublications.add( p ); }
public List<Source> getSources() { if (this.sources == null){ this.sources = new ArrayList<Source>(); if (this.delegate.getAdminGroupList() != null){ for (String source : this.delegate.getAdminGroupList().getGroup()){ this.sources.add(new DefaultSource(source)); } } } return this.sources; } }
public Collection<String> getCurators() { if (this.delegate.getAdminUserList() != null){ return this.delegate.getAdminUserList().getUser(); } else if (this.curators == null){ this.curators = new ArrayList<String>(); } return this.curators; }
private static void print( Publication p ) { System.out.println( "-- " + p.getIdentifier().size() + " identifiers ------------------------" ); System.out.println( "Author: " + p.getAuthor() ); System.out.println( "Title: " + p.getTitle() ); System.out.println( "IMEx id: " + p.getImexAccession() ); System.out.println( "Owner: " + p.getOwner() ); System.out.println( "Status: " + p.getStatus() ); System.out.println( "Release date: " + p.getReleaseDate() ); } }
public Publication getPublicationById( String identifier ) throws ImexCentralException { for ( Publication p : allPublications ) { for (Identifier i : p.getIdentifier()){ if( identifier.equals( i.getAc() ) ) { return p; } } if (p.getImexAccession() != null && p.getImexAccession().equalsIgnoreCase(identifier)){ return p; } } return null; }
public void createPublication( psidev.psi.mi.jami.model.Publication publication ) throws BridgeFailedException { if (publication != null){ try { Publication pub = new Publication(); pub.setTitle(publication.getTitle()); pub.setImexAccession(publication.getImexId()); for (Xref id : publication.getIdentifiers()){ Identifier identifier = buildIdentifier(id.getId(), id.getDatabase().getShortName()); if (identifier != null){ pub.getIdentifier().add(identifier); try { XMLGregorianCalendar date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); pub.setPublicationDate(date2); } catch (DatatypeConfigurationException e) { throw new BridgeFailedException( "Error while creating a publication: " + publication, e); try { XMLGregorianCalendar date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); pub.setReleaseDate(date2); } catch (DatatypeConfigurationException e) { throw new BridgeFailedException( "Error while creating a publication: " + publication, e); pub.setAuthor(buffer.toString()); pub.setAdminGroupList(new Publication.AdminGroupList()); pub.getAdminGroupList().getGroup().add(publication.getSource().getShortName().toUpperCase());
public static void main( String[] args ) throws Exception { if ( args.length < 3 ) { System.err.println( "Usage: java " + "-Djavax.net.ssl.trustStore=<path.to.keystore> " + "-Djavax.net.ssl.keyStorePassword=<password> " + "Playground <imexcentral.username> <imexcentral.password> <pmid>" ); System.exit( 1 ); } final String icUsername = args[0]; final String icPassword = args[1]; final String pmid = args[2]; ImexCentralClient client = new DefaultImexCentralClient( icUsername, icPassword, DefaultImexCentralClient.IC_TEST ); final Publication publication = client.getPublicationById( pmid ); if( publication == null ) { System.err.println( "Could not find this publication in IMExCentral." ); } else { System.out.println( "Identifier: " + publication.getIdentifier() ); System.out.println( "Title: " + publication.getTitle() ); System.out.println( "IMEx ID: " + publication.getImexAccession() ); System.out.println( "Owner: " + publication.getOwner() ); System.out.println( "Status: " + publication.getStatus() ); } } }
public ImexPublication(edu.ucla.mbi.imex.central.ws.v20.Publication delegate) { super(); if (delegate == null){ throw new IllegalArgumentException("The IMEx central publication object cannot be null"); } this.delegate = delegate; // init title super.setTitle(this.delegate.getTitle()); // init publication date if (this.delegate.getPublicationDate() != null){ super.setPublicationDate(this.delegate.getPublicationDate().toGregorianCalendar().getTime()); } // init expected publication date if (this.delegate.getExpectedPublicationDate() != null){ this.expectedPublicationDate = this.delegate.getExpectedPublicationDate().toGregorianCalendar().getTime(); } // init release date if (this.delegate.getReleaseDate() != null){ super.setReleasedDate(this.delegate.getReleaseDate().toGregorianCalendar().getTime()); } // init creation date if (this.delegate.getCreationDate() != null){ this.creationDate = this.delegate.getCreationDate().toGregorianCalendar().getTime(); } // init pub status if (this.delegate.getStatus() != null){ this.status = PublicationStatus.valueOf(this.delegate.getStatus()); } }
public Publication createPublicationById( String identifier ) throws ImexCentralException { Publication p = new Publication(); final Identifier i = new Identifier(); i.setAc( identifier ); i.setNs("pmid"); p.getIdentifier().add(i); p.setImexAccession( "N/A" ); allPublications.add( p ); return p; }
private String showPublication( Publication p ) { StringBuilder sb = new StringBuilder( 128 ); sb.append( "Publication[" ); sb.append( "Identifier: " ).append( p.getIdentifier() ).append( ", " ); sb.append( "Owner: " ).append( p.getOwner() ); sb.append( "]" ); return sb.toString(); }
public Publication getPublicationImexAccession( String identifier, boolean create ) throws ImexCentralException { final Publication p = getPublicationById( identifier ); if (p != null){ if( create ) { if( p.getImexAccession() != null && !p.getImexAccession().equals("N/A")) { throw new IllegalStateException( "Publication already has an IMEx id: " + p.getImexAccession() ); } // assigning new IMEx ID p.setImexAccession( "IM-" + imexIdSequence ); imexIdSequence++; } } else { ImexCentralFault imexFault = new ImexCentralFault(); imexFault.setFaultCode(6); IcentralFault fault = new IcentralFault("No publication record found", imexFault); throw new ImexCentralException(fault); } return p; }
public Publication updatePublicationAdminGroup( String identifier, Operation operation, String group ) throws ImexCentralException { Publication p = getPublicationById( identifier ); if (p != null){ if (group != null && (group.equalsIgnoreCase(INTACT_GROUP) || group.equalsIgnoreCase(MATRIXDB_GROUP))){ if (p.getAdminGroupList() == null){ p.setAdminGroupList(new Publication.AdminGroupList()); } p.getAdminGroupList().getGroup().add(group.toUpperCase()); } // group not recognized, throw exception as in the real webservice else { ImexCentralFault imexFault = new ImexCentralFault(); imexFault.setFaultCode(11); IcentralFault fault = new IcentralFault("Group not recognized", imexFault); throw new ImexCentralException(fault); } } else { ImexCentralFault imexFault = new ImexCentralFault(); imexFault.setFaultCode(6); IcentralFault fault = new IcentralFault("No publication record found", imexFault); throw new ImexCentralException(fault); } return p; }
public Publication updatePublicationAdminUser( String identifier, Operation operation, String user ) throws ImexCentralException { Publication p = getPublicationById( identifier ); if (p != null){ if (user != null && (user.equalsIgnoreCase(intact_user) || user.equalsIgnoreCase(phantom_user))){ if (p.getAdminUserList() == null){ p.setAdminUserList(new Publication.AdminUserList()); } p.getAdminUserList().getUser().add(user.toLowerCase()); } // user not recognized, throw exception as in the real webservice else { ImexCentralFault imexFault = new ImexCentralFault(); imexFault.setFaultCode(10); IcentralFault fault = new IcentralFault("User not recognized", imexFault); throw new ImexCentralException(fault); } } else { ImexCentralFault imexFault = new ImexCentralFault(); imexFault.setFaultCode(6); IcentralFault fault = new IcentralFault("No publication record found", imexFault); throw new ImexCentralException(fault); } return p; }
public String getOwner() { return this.delegate.getOwner(); }
public void createPublication( Publication publication ) throws ImexCentralException { Publication existingP = null; for ( Publication p : allPublications ) { for (Identifier i : p.getIdentifier()){ if( !publication.getIdentifier().isEmpty() && publication.getIdentifier().iterator().next().getAc().equals( i.getAc() ) ) { existingP = p; break; } } } if (existingP == null){ allPublications.add(publication); } else { allPublications.remove(existingP); allPublications.add(publication); } }
public List<Publication> getPublicationByStatus( String status, int first, int max) { List<Publication> publications = new ArrayList<Publication>( ); for ( int j = first; j <= max; j++ ) { Publication p = allPublications.get(j); if (p.getStatus().equalsIgnoreCase(status)){ publications.add( p ); } } return publications; }
private void copyAuthorsFromDelegate() { String author = this.delegate.getAuthor(); if (author != null){ if (author.contains(",")){ super.getAuthors().addAll(Arrays.asList(author.split(","))); } else{ super.getAuthors().add(author); } } }
public psidev.psi.mi.jami.model.Publication createPublicationById( String identifier, String source ) throws BridgeFailedException { psidev.psi.mi.jami.model.Publication p = new ImexPublication(new Publication()); p.getIdentifiers().add(XrefUtils.createIdentityXref(source, identifier)); allPublications.add( p ); return p; }
public Publication getPublicationByPubmedId( String identifier ) throws ImexCentralException { for ( Publication p : allPublications ) { for (Identifier i : p.getIdentifier()){ if( "pmid".equalsIgnoreCase(i.getNs()) && identifier.equals( i.getAc() ) ) { return p; } } if (p.getImexAccession() != null && p.getImexAccession().equalsIgnoreCase(identifier)){ return p; } } return null; }
public List<Publication> getPublicationByOwner( String owner, int first, int max) throws ImexCentralException { List<Publication> publications = new ArrayList<Publication>( ); for ( int i = first; i <= max; i++ ) { Publication p = allPublications.get(i); if( owner.equals(p.getOwner()) ) { publications.add( p ); } } return publications; }