List<Contact> contacts = new ArrayList<Contact>(); // Fill it. // Now sort by address instead of name (default). Collections.sort(contacts, new Comparator<Contact>() { public int compare(Contact one, Contact other) { return one.getAddress().compareTo(other.getAddress()); } });
/** * Returns the on line function that matches the given string, or returns a new one if none * match it. * * @param code The name of the code to fetch or to create. * @return A code matching the given name. */ public static OnLineFunction valueOf(String code) { return valueOf(OnLineFunction.class, code); } }
/** * Returns the presentation form that matches the given string, or returns a new one if none * match it. * * @param code The name of the code to fetch or to create. * @return A code matching the given name. */ public static PresentationForm valueOf(String code) { return valueOf(PresentationForm.class, code); } }
/** * 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)); }
/** 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()); } } }
private void getMetaDataContact(Metadata metadata, DefaultMetadata defaultMetaData){ CheckedArrayList<ResponsibleParty> contactSet= (CheckedArrayList<ResponsibleParty>) defaultMetaData.getContacts(); for(ResponsibleParty rparty:contactSet){ if(rparty.getRole()!=null) metadata.add("ContactRole",rparty.getRole().name()); if(rparty.getOrganisationName()!=null) metadata.add("ContactPartyName-",rparty.getOrganisationName().toString()); } }
private void getMetaDataDateInfo(Metadata metadata, DefaultMetadata defaultMetaData){ ArrayList<CitationDate> citationDateList= (ArrayList<CitationDate>) defaultMetaData.getDateInfo(); for(CitationDate c:citationDateList){ if(c.getDateType()!=null) { String date = DateUtils.formatDate(c.getDate()); metadata.add("DateInfo ",c.getDateType().name()+" "+date); } } }
public URI getPublisher() { try { return capabilities .getService() .getContactInformation() .getContactInfo() .getOnLineResource() .getLinkage(); } catch (NullPointerException publisherNotAvailable) { } try { return new URI(serverURL.getProtocol() + ":" + serverURL.getHost()); } catch (URISyntaxException e) { } return null; }
@Override public void visit(Mark mark) { assertEquals( "ttf://Webdings", mark.getExternalMark() .getOnlineResource() .getLinkage() .toASCIIString()); } });
/** * Returns the date type that matches the given string, or returns a new one if none match it. * * @param code The name of the code to fetch or to create. * @return A code matching the given name. */ public static DateType valueOf(String code) { return valueOf(DateType.class, code); } }
/** * Returns the role that matches the given string, or returns a new one if none match it. * * @param code The name of the code to fetch or to create. * @return A code matching the given name. */ public static Role valueOf(String code) { return valueOf(Role.class, code); } }
/** Returns the list of enumerations of the same kind than this enum. */ public PresentationForm[] family() { return values(); }
/** Returns the list of enumerations of the same kind than this enum. */ public OnLineFunction[] family() { return values(); }
/** Returns the list of enumerations of the same kind than this enum. */ public DateType[] family() { return values(); }
/** Returns the list of enumerations of the same kind than this enum. */ public Role[] family() { return values(); }
/** Formats a name for the specified factory. */ private static String format(final Factory factory) { String name = Classes.getShortClassName(factory); if (factory instanceof AuthorityFactory) { name = name + "[\"" + ((AuthorityFactory) factory).getAuthority().getTitle() + "\"]"; } return name; }
@Test public void testSEStyleWithRelativePath() throws IOException { StyleInfo si = getCatalog().getStyleByName("relative"); assertNotNull(si); Style style = si.getStyle(); PolygonSymbolizer ps = (PolygonSymbolizer) style.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0); ExternalGraphic eg = (ExternalGraphic) ps.getFill().getGraphicFill().graphicalSymbols().get(0); URI uri = eg.getOnlineResource().getLinkage(); assertNotNull(uri); File actual = URLs.urlToFile(uri.toURL()).getCanonicalFile(); assertEquals(rockFillSymbolFile, actual); }
/** Returns a string representation of the specified object, for debugging purpose only. */ final String toString(final Class owner) { final AuthorityFactory factory = getAuthorityFactory(); return Classes.getShortName(owner) + '[' + Classes.getShortName(getType()) + " in " + Classes.getShortClassName(factory) + "(\"" + factory.getAuthority().getTitle() + "\")]"; }
@Test public void testSEStyleWithRelativePathProtocol() throws IOException { StyleInfo si = getCatalog().getStyleByName("relative_protocol"); assertNotNull(si); Style style = si.getStyle(); PolygonSymbolizer ps = (PolygonSymbolizer) style.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0); ExternalGraphic eg = (ExternalGraphic) ps.getFill().getGraphicFill().graphicalSymbols().get(0); URI uri = eg.getOnlineResource().getLinkage(); assertNotNull(uri); File actual = URLs.urlToFile(uri.toURL()).getCanonicalFile(); assertEquals(rockFillSymbolFile, actual); }