Refine search
/** * Checks if the specified authority can be recognized as the expected authority. This * implementation do not requires an exact matches. A matching title is enough. */ private boolean authorityMatches(final Citation citation) { if (authority == citation) { return true; } // The "null" locale argument is required for getting the unlocalized version. return (citation != null) && authority .getTitle() .toString(null) .equalsIgnoreCase(citation.getTitle().toString(null)); }
vendors.append(vendor.getTitle().toString(locale)); implementations.append(Classes.getShortClassName(provider)); if (provider instanceof AuthorityFactory) { final Citation authority = ((AuthorityFactory) provider).getAuthority(); final Iterator<? extends Identifier> identifiers = authority.getIdentifiers().iterator(); final String identifier = identifiers.hasNext() ? identifiers.next().getCode().toString() : authority.getTitle().toString(locale); table.write(identifier);
InternationalString candidate = citation.getTitle(); Iterator<? extends InternationalString> iterator = null; do { final String asString = candidate.toString(null); if (asString.trim().equalsIgnoreCase(title)) { return true; final String asLocalized = candidate.toString(); if (asLocalized != asString && asLocalized.trim().equalsIgnoreCase(title)) { return true; citation.getAlternateTitles(); if (titles == null) { break;
/** Returns the shortest title inferred from the specified authority. */ private static InternationalString getShortestTitle(final Citation authority) { InternationalString title = authority.getTitle(); int length = title.length(); final Collection<? extends InternationalString> alt = authority.getAlternateTitles(); if (alt != null) { for (final InternationalString candidate : alt) { final int candidateLength = candidate.length(); if (candidateLength > 0 && candidateLength < length) { title = candidate; length = candidateLength; } } } return title; }
private void getMetaDataStandard(Metadata metadata, DefaultMetadata defaultMetaData){ ArrayList<Citation> citationList= (ArrayList<Citation>) defaultMetaData.getMetadataStandards(); for(Citation c:citationList){ if(c.getTitle()!=null) metadata.add("MetaDataStandardTitle ",c.getTitle().toString()); if(c.getEdition()!=null) metadata.add("MetaDataStandardEdition ",c.getEdition().toString()); } } }
/** * Returns the shortest identifier for the specified citation, or the title if there is no * identifier. This method is useful for extracting the namespace from an authority, for example * {@code "EPSG"}. * * @param citation The citation for which to get the identifier. * @return The shortest identifier of the given citation. * @since 2.4 */ public static String getIdentifier(final Citation citation) { String identifier = null; for (final Identifier id : citation.getIdentifiers()) { final String candidate = id.getCode().trim(); final int length = candidate.length(); if (length != 0) { if (identifier == null || length < identifier.length()) { identifier = candidate; } } } if (identifier == null) { identifier = String.valueOf(citation.getTitle()); } return identifier; } }
for(Identification i:identifications){ DefaultDataIdentification defaultDataIdentification= (DefaultDataIdentification) i; if(i.getCitation()!=null && i.getCitation().getTitle()!=null) metadata.add("IdentificationInfoCitationTitle ",i.getCitation().getTitle().toString()); ArrayList<CitationDate> dateArrayList= (ArrayList<CitationDate>) i.getCitation().getDates(); for (CitationDate d:dateArrayList) { if (d.getDateType()!=null) { ArrayList<ResponsibleParty> responsiblePartyArrayList= (ArrayList<ResponsibleParty>) i.getCitation().getCitedResponsibleParties(); for(ResponsibleParty r:responsiblePartyArrayList){ if(r.getRole()!=null) if(k.getThesaurusName()!=null && k.getThesaurusName().getTitle()!=null) metadata.add("ThesaurusNameTitle "+j,k.getThesaurusName().getTitle().toString()); if(k.getThesaurusName()!=null && k.getThesaurusName().getAlternateTitles()!=null) metadata.add("ThesaurusNameAlternativeTitle "+j,k.getThesaurusName().getAlternateTitles().toString()); ArrayList<CitationDate>citationDates= (ArrayList<CitationDate>) k.getThesaurusName().getDates(); for (CitationDate cd:citationDates) { if (cd.getDateType()!=null) { if(((DefaultGeographicDescription) g).getGeographicIdentifier()!=null && ((DefaultGeographicDescription) g).getGeographicIdentifier().getCode()!=null ) metadata.add("GeographicIdentifierCode ",((DefaultGeographicDescription) g).getGeographicIdentifier().getCode().toString()); if(((DefaultGeographicDescription) g).getGeographicIdentifier()!=null && ((DefaultGeographicDescription) g).getGeographicIdentifier().getAuthority()!=null && ((DefaultGeographicDescription) g).getGeographicIdentifier().getAuthority().getTitle()!=null ) metadata.add("GeographicIdentifierAuthorityTitle ",((DefaultGeographicDescription) g).getGeographicIdentifier().getAuthority().getTitle().toString()); for(InternationalString s:((DefaultGeographicDescription) g).getGeographicIdentifier().getAuthority().getAlternateTitles()) {
final InternationalString edition = authority.getEdition(); final String version = (edition != null) ? edition.toString() : null; properties.put( IdentifiedObject.IDENTIFIERS_KEY,
if (!authorityMatches(name.getAuthority())) { final Collection<GenericName> aliases = info.getAlias(); if (aliases != null) { if (alias instanceof Identifier) { final Identifier candidate = (Identifier) alias; if (authorityMatches(candidate.getAuthority())) { return candidate.getCode(); final String title = authority.getTitle().toString(null); for (final GenericName alias : aliases) { final GenericName scope = alias.scope().name();
for(Identification i:identifications) { xhtmlContentHandler.startElement("h1"); xhtmlContentHandler.characters(i.getCitation().getTitle().toString()); xhtmlContentHandler.endElement("h1"); xhtmlContentHandler.newline(); ArrayList<ResponsibleParty> responsiblePartyArrayList = (ArrayList<ResponsibleParty>) i.getCitation().getCitedResponsibleParties(); for (ResponsibleParty r : responsiblePartyArrayList) { xhtmlContentHandler.startElement("h3"); xhtmlContentHandler.characters("IdentificationInfoAbstract " + i.getAbstract().toString()); xhtmlContentHandler.endElement("p"); xhtmlContentHandler.newline();
boolean sourceb = Objects.equals(this.source.getCollectiveTitle(), that.source.getCollectiveTitle()) && Objects.equals(this.source.getEdition(), that.source.getEdition()) && Objects.equals(this.source.getEditionDate(), that.source.getEditionDate()) && Objects.equals(this.source.getISBN(), that.source.getISBN()) && Objects.equals(this.source.getISSN(), that.source.getISSN()) && Objects.equals(this.source.getIdentifiers(), that.source.getIdentifiers()) && Objects.equals(this.source.getOtherCitationDetails(), that.source.getOtherCitationDetails()) && Objects.equals(this.source.getSeries(), that.source.getSeries()) && Objects.equals(this.source.getTitle(), that.source.getTitle()); if (Objects.equals(this.source.getDates().size(), that.source.getDates().size())) { Iterator<? extends CitationDate> thisIT = this.source.getDates().iterator(); Iterator<? extends CitationDate> thatIT = that.source.getDates().iterator(); if (Objects.equals(this.source.getCitedResponsibleParties().size(), that.source.getCitedResponsibleParties().size())) { Iterator<? extends Responsibility> thisIT = this.source.getCitedResponsibleParties().iterator(); Iterator<? extends Responsibility> thatIT = that.source.getCitedResponsibleParties().iterator();
/** * Tries to get a codespace from the specified authority. This method scan first through the * identifier, then through the titles if no suitable identifier were found. */ private static String getCodeSpace(final Citation authority) { final Collection<? extends Identifier> identifiers = authority.getIdentifiers(); if (identifiers != null) { for (final Identifier id : identifiers) { final String identifier = id.getCode(); if (isValidCodeSpace(identifier)) { return identifier; } } } // The "null" locale argument is required for getting the unlocalized version. final String title = getShortestTitle(authority).toString(null); if (isValidCodeSpace(title)) { return title; } return null; }
/** * Returns {@code true} if any {@linkplain Citation#getIdentifiers identifiers} in the given * citation matches the given string. The comparaison is case-insensitive and ignores leading * and trailing spaces. If (and <em>only</em> if) the citation do not contains any identifier, * then this method fallback on titles comparaison using the {@link #titleMatches(Citation, * String) titleMatches} method. This fallback exists for compatibility with client codes using * citation {@linkplain Citation#getTitle titles} without identifiers. * * @param citation The citation to check for. * @param identifier The identifier to compare. * @return {@code true} if the title or alternate title matches the given string. */ public static boolean identifierMatches(final Citation citation, String identifier) { identifier = identifier.trim(); final Collection<? extends Identifier> identifiers = citation.getIdentifiers(); for (final Identifier id : identifiers) { final String code = id.getCode().trim(); if (identifier.equalsIgnoreCase(code)) { return true; } } if (identifiers.isEmpty()) { return titleMatches(citation, identifier); } else { return false; } }
assertEquals("EPSG Geodetic Parameter Dataset", c.getTitle().toString()); assertEquals(PresentationForm.TABLE_DIGITAL, TestUtilities.getSingleton(c.getPresentationForms())); final ResponsibleParty responsible = TestUtilities.getSingleton(c.getCitedResponsibleParties()); assertEquals(Role.PRINCIPAL_INVESTIGATOR, responsible.getRole()); assertEquals("International Association of Oil & Gas Producers", responsible.getOrganisationName().toString()); assertNull(c.getEditionDate()); assertTrue(c.getDates().isEmpty()); assertEquals(0, c.getAlternateTitles().size());
public static String epsgCode(CoordinateReferenceSystem crs) { if (crs == null) { return null; } for (Iterator i = crs.getIdentifiers().iterator(); i.hasNext(); ) { Identifier id = (Identifier) i.next(); // return "EPSG:" + id.getCode(); if ((id.getAuthority() != null) && id.getAuthority().getTitle().equals(Citations.EPSG.getTitle())) { return id.getCode(); } } return null; }
final InternationalString expectedAltTitle = first(fromDB.getAlternateTitles()); final InternationalString actualAltTitle = first(fromFB.getAlternateTitles()); if (fromFB.getTitle().equals(expectedAltTitle)) { assertNull(name, actualAltTitle); } else { assertEquals(name, fromDB.getTitle(), fromFB.getTitle()); if (actualAltTitle != null) { assertEquals(name, expectedAltTitle, actualAltTitle); final Identifier expectedID = first(fromDB.getIdentifiers()); final Identifier actualID = first(fromFB.getIdentifiers()); if (expectedID == null) { assertNull(name, actualID); } else if (actualID != null) { assertEquals(name, expectedID.getCode(), actualID.getCode()); final ResponsibleParty expectedResp = first(fromDB.getCitedResponsibleParties()); final ResponsibleParty actualResp = first(fromFB.getCitedResponsibleParties()); if (expectedResp == null) { assertNull(name, actualResp); assertEquals(name, first(fromDB.getPresentationForms()), first(fromFB.getPresentationForms()));
/** * Returns the responsible party for the given constant. */ private static String getCitedResponsibleParty(final Citation citation) { return getSingleton(citation.getCitedResponsibleParties()).getOrganisationName().toString(Locale.US); }
/** * Validates the given citation. * * @param object the object to validate, or {@code null}. */ public void validate(final Citation object) { if (object == null) { return; } validateMandatory(object.getTitle()); validateOptional (object.getEdition()); for (final InternationalString e : toArray(InternationalString.class, object.getAlternateTitles())) { container.validate(e); } for (final Identifier e : toArray(Identifier.class, object.getIdentifiers())) { container.validate(e); } for (final InternationalString e : toArray(InternationalString.class, object.getOtherCitationDetails())) { container.validate(e); } validate(toArray(CitationDate.class, object.getDates())); for (final Responsibility e : toArray(Responsibility.class, object.getCitedResponsibleParties())) { validate(e); } }
String title = toString(vendor.getTitle()); for (final Identifier identifier : IdentifiedObjects.nullSafe(vendor.getIdentifiers())) { if (identifier == null) continue; // Paranoiac safety. if (title == null) { title = identifier.getCode(); version = identifier.getVersion(); search: for (final Responsibility responsibility : vendor.getCitedResponsibleParties()) { if (responsibility == null) continue; // Paranoiac safety. for (final Party party : responsibility.getParties()) {
/** * Validates the given citation. * * @param object The object to validate, or {@code null}. */ public void validate(final Citation object) { if (object == null) { return; } validateMandatory(object.getTitle()); validateOptional (object.getEdition()); validateOptional (object.getOtherCitationDetails()); validateOptional (object.getCollectiveTitle()); validateCollection(InternationalString.class, object.getAlternateTitles()); validateCollection(Identifier.class, object.getIdentifiers()); } }