Merge rome-modules into rome
This commit is contained in:
commit
daca87d544
420 changed files with 58813 additions and 0 deletions
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
/.classpath
|
||||
/.project
|
||||
/.settings
|
||||
/target
|
||||
/.checkstyle
|
202
LICENSE
Normal file
202
LICENSE
Normal file
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
6
README.md
Normal file
6
README.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
rome
|
||||
====
|
||||
|
||||
ROME is a set of RSS and Atom Utilities for Java. It makes it easy to work in Java with most syndication formats: RSS 0.90, RSS 0.91 Netscape, RSS 0.91 Userland, RSS 0.92, RSS 0.93, RSS 0.94, RSS 1.0, RSS 2.0, Atom 0.3, Atom 1.0
|
||||
|
||||
More Information: http://rometools.github.io/rome-modules/
|
119
pom.xml
Normal file
119
pom.xml
Normal file
|
@ -0,0 +1,119 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.rometools</groupId>
|
||||
<artifactId>rome-parent</artifactId>
|
||||
<version>1.6.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>rome-modules</artifactId>
|
||||
<version>1.6.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>rome-modules</name>
|
||||
|
||||
<description>Plugin collection for the ROME RSS and Atom Utilities</description>
|
||||
|
||||
<url>http://rometools.github.io/rome-modules/</url>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:ssh://github.com/rometools/rome-modules.git</connection>
|
||||
<developerConnection>scm:git:ssh://git@github.com/rometools/rome-modules.git</developerConnection>
|
||||
<url>https://github.com/rometools/rome-modules</url>
|
||||
</scm>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>kebernet</id>
|
||||
<email>kebernet@gmail.com</email>
|
||||
<name>Robert Cooper</name>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-nexus-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-scm-publish-plugin</artifactId>
|
||||
<configuration>
|
||||
<scmBranch>gh-pages</scmBranch>
|
||||
<pubScmUrl>${project.scm.developerConnection}</pubScmUrl>
|
||||
<content>${project.build.directory}/site</content>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Export-Package>
|
||||
!com.rometools.modules.*.io,
|
||||
com.rometools.modules.*,
|
||||
</Export-Package>
|
||||
<Import-Package>
|
||||
org.jdom2,
|
||||
org.jdom2.filter,
|
||||
org.jdom2.input,
|
||||
org.jdom2.input.sax,
|
||||
org.jdom2.output,
|
||||
org.slf4j,
|
||||
org.w3c.dom,
|
||||
org.xml.sax
|
||||
</Import-Package>
|
||||
<_exportcontents>
|
||||
com.rometools.rome.feed,
|
||||
com.rometools.rome.feed.atom,
|
||||
com.rometools.rome.feed.module,
|
||||
com.rometools.rome.feed.rss,
|
||||
com.rometools.rome.feed.synd,
|
||||
com.rometools.rome.io,
|
||||
com.rometools.utils
|
||||
</_exportcontents>
|
||||
<Embed-Dependency>*;artifactId=rome|rome-utils</Embed-Dependency>
|
||||
<Embed-Transitive>true</Embed-Transitive>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.rometools</groupId>
|
||||
<artifactId>rome</artifactId>
|
||||
<version>1.6.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-library</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
17
src/main/etc/header.txt
Normal file
17
src/main/etc/header.txt
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (C) The ROME Team ${year}
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams;
|
||||
|
||||
import com.rometools.modules.activitystreams.types.ActivityObject;
|
||||
import com.rometools.modules.activitystreams.types.Mood;
|
||||
import com.rometools.modules.activitystreams.types.Verb;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public interface ActivityStreamModule {
|
||||
|
||||
public Verb getVerb();
|
||||
|
||||
public void setVerb(Verb verb);
|
||||
|
||||
public ActivityObject getObject();
|
||||
|
||||
public void setObject(ActivityObject object);
|
||||
|
||||
public ActivityObject getTarget();
|
||||
|
||||
public void setTarget(ActivityObject object);
|
||||
|
||||
public Mood getMood();
|
||||
|
||||
public void setMood(Mood mood);
|
||||
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
package com.rometools.modules.activitystreams;
|
||||
|
||||
import com.rometools.modules.activitystreams.types.ActivityObject;
|
||||
import com.rometools.modules.activitystreams.types.Mood;
|
||||
import com.rometools.modules.activitystreams.types.Verb;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class ActivityStreamModuleImpl implements ActivityStreamModule {
|
||||
private ActivityObject object;
|
||||
private Verb verb;
|
||||
|
||||
/**
|
||||
* Set the value of object
|
||||
*
|
||||
* @param newobject new value of object
|
||||
*/
|
||||
@Override
|
||||
public void setObject(final ActivityObject newobject) {
|
||||
object = newobject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of object
|
||||
*
|
||||
* @return the value of object
|
||||
*/
|
||||
@Override
|
||||
public ActivityObject getObject() {
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of verb
|
||||
*
|
||||
* @param newverb new value of verb
|
||||
*/
|
||||
@Override
|
||||
public void setVerb(final Verb newverb) {
|
||||
verb = newverb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of verb
|
||||
*
|
||||
* @return the value of verb
|
||||
*/
|
||||
@Override
|
||||
public Verb getVerb() {
|
||||
return verb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityObject getTarget() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTarget(final ActivityObject object) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mood getMood() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMood(final Mood mood) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
import com.rometools.modules.georss.GeoRSSModule;
|
||||
import com.rometools.modules.portablecontacts.ContactModule;
|
||||
import com.rometools.rome.feed.atom.Entry;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public abstract class ActivityObject extends Entry implements HasLocation {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public abstract String getTypeIRI();
|
||||
|
||||
@Override
|
||||
public GeoRSSModule getLocation() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocation(final GeoRSSModule location) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContactModule getAddress() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAddress(final ContactModule address) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "article" Object type indicates that the Object is an article, such as a news article, a
|
||||
* knowledge base entry, or other similar construct.
|
||||
* </p>
|
||||
* <p>
|
||||
* Articles generally consist of paragraphs of text, in some cases incorporating embedded media such
|
||||
* as photos and inline hyperlinks to other resources.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "Article" Object type is identified by the URL
|
||||
* <tt>http://activitystrea.ms/schema/1.0/article</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* An article has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Name</dt>
|
||||
* <dd>The title of the article. Represented by the Name component of the base Object Construct.</dd>
|
||||
* <dt>Content</dt>
|
||||
* <dd>The main body content of the article. Represented in JSON as a property called
|
||||
* <tt>content</tt> whose value is a JSON string containing a fragment of HTML that represents the
|
||||
* content.</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Article extends ActivityObject {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/article";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "audio" Object type represents audio content.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "audio" Object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/audio</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* An audio has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Audio Stream Link</dt>
|
||||
* <dd>A Media Link Construct linking to the audio content itself. Represented in JSON as a property
|
||||
* called <tt>stream</tt> whose value is a JSON object with properties as defined in [TODO: xref the
|
||||
* JSON serialization of a Media Link Construct]</dd>
|
||||
* <dt>Embed Code</dt>
|
||||
* <dd>An HTML fragment that, when embedded in an HTML page, will provide an interactive player UI
|
||||
* for the audio stream. Represented in JSON as a property called <tt>embedCode</tt> whose value is
|
||||
* a JSON string containing the fragment of HTML.</dd>
|
||||
* </dl>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Audio extends ActivityObject {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String embedCode;
|
||||
private String streamLink;
|
||||
|
||||
/**
|
||||
* Set the value of embedCode
|
||||
*
|
||||
* @param newembedCode new value of embedCode
|
||||
*/
|
||||
public void setEmbedCode(final String newembedCode) {
|
||||
embedCode = newembedCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of embedCode
|
||||
*
|
||||
* @return the value of embedCode
|
||||
*/
|
||||
public String getEmbedCode() {
|
||||
return embedCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of streamLink
|
||||
*
|
||||
* @param newstreamLink new value of streamLink
|
||||
*/
|
||||
public void setStreamLink(final String newstreamLink) {
|
||||
streamLink = newstreamLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of streamLink
|
||||
*
|
||||
* @return the value of streamLink
|
||||
*/
|
||||
public String getStreamLink() {
|
||||
return streamLink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/audio";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
import com.rometools.rome.feed.atom.Link;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "bookmark" Object type represents a pointer to some URL -- typically a web page. In most
|
||||
* cases, a bookmark is specific to a given user and contains metadata chosen by that user. Bookmark
|
||||
* Objects are similar in principle to the concept of bookmarks or favorites in a web browser. A
|
||||
* bookmark represents a pointer to the URL, not the URL or the associated resource itself.
|
||||
* </p>
|
||||
* <p>
|
||||
* When dealing with bookmarks it is important to note the distinction between the title,
|
||||
* description, and URL of the bookmark itself and the title, content, and URL of the resource that
|
||||
* is the target of the bookmark. In some implementations these MAY be the same, but bookmark
|
||||
* managers often allow a user to edit the title and description of his or her own bookmarks to
|
||||
* differ from the metadata on the target itself.
|
||||
* </p>
|
||||
* <p>
|
||||
* Some implementations refer to this Object type as a "link". This specification uses the term
|
||||
* "bookmark" to avoid confusion with the general concept of hyperlinks which apply to all Object
|
||||
* types.
|
||||
* </p>
|
||||
* <p>
|
||||
* Since bookmarks are often specific to a particular user, even though multiple users might have
|
||||
* bookmarks pointing at the same resource, it is appropriate to use the "post" Verb to describe the
|
||||
* publication of such a bookmark. The "mark as favorite" Verb SHOULD be used when a user flags
|
||||
* another user's bookmark as being a favorite without creating his own bookmark, or when a user
|
||||
* flags his own bookmark as being a favorite as a special classification within his own bookmark
|
||||
* collection.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "bookmark" Object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/bookmark</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A bookmark has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Title</dt>
|
||||
* <dd>The title of the bookmark, as entered by the user who created the bookmark. Represented by
|
||||
* the Name component of the base Object Construct. Publishers MAY use the title of the target
|
||||
* resource as a default for this property where a user hasn't entered a customized value.</dd>
|
||||
* <dt>Target URL</dt>
|
||||
* <dd>The URL of the item that is the target of the bookmark. Represented in JSON by a property
|
||||
* called <tt>targetUrl</tt> whose value is a JSON string containing the target URL.</dd>
|
||||
* <dt>Thumbnail</dt>
|
||||
* <dd>The URL and metadata for a thumbnail version of the page. Represented by the Representative
|
||||
* Image component of the base Object Construct. Processors MAY ignore thumbnails that are of an
|
||||
* inappropriate size for their user interface.</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Bookmark extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/bookmark";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of thumbnail
|
||||
*
|
||||
* @return the value of thumbnail
|
||||
*/
|
||||
public Link getThumbnail() {
|
||||
return findRelatedLink("thumbnail");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of thumbnail
|
||||
*
|
||||
* @param newthumbnail new value of thumbnail
|
||||
*/
|
||||
public void setThumbnail(final Link newthumbnail) {
|
||||
Link old = null;
|
||||
for (final Link l : getOtherLinks()) {
|
||||
if ("thumbnail".equals(l.getRel())) {
|
||||
old = l;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (old != null) {
|
||||
getOtherLinks().remove(old);
|
||||
newthumbnail.setRel("thumbnail");
|
||||
}
|
||||
getOtherLinks().add(newthumbnail);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "comment" object type represents a textual response to another object.
|
||||
* </p>
|
||||
* <p>
|
||||
* The comment object type MUST NOT be used for other kinds of replies, such as video replies or
|
||||
* reviews.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "comment" object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/comment</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A comment has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Subject</dt>
|
||||
* <dd>The subject of the comment. Represented by the Name component of the base Object Construct.
|
||||
* Many systems do not have the concept of a title or subject for a comment; such systems MUST omit
|
||||
* the Name component. Processors SHOULD refer to such comments as simply being "a comment", with
|
||||
* appropriate localization, if they are to be described in a sentence.</dd>
|
||||
* <dt>Content</dt>
|
||||
* <dd>The content of the comment. Represented in JSON as a property called <tt>content</tt> whose
|
||||
* value is a JSON string containing a fragment of HTML that represents the content. Publishers
|
||||
* SHOULD include any markup necessary to achieve a similar presentation to that on the publisher's
|
||||
* own HTML pages, including any links that the service automatically adds. Processors MAY remove
|
||||
* all HTML markup and consider the comment to be plain text.</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Comment extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/comment";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "event" object type represents an event that occurs in a certain place during a particular
|
||||
* interval of time.
|
||||
* </p>
|
||||
* <p>
|
||||
* The object type URL for the "event" object type is
|
||||
* <tt>http://activitystrea.ms/schema/1.0/event</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* An event has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Start Date and Time</dt>
|
||||
* <dd>The date and time that the event begins. Represented in JSON as a property called
|
||||
* <tt>startTime</tt> whose value is JSON string containing a W3CDTF timestamp. [TODO: Reference
|
||||
* W3CDTF spec.] [TODO: Include prose describing how to represent just a date vs. a date and time.]</dd>
|
||||
* <dt>End Date and Time</dt>
|
||||
* <dd>The date and time that the event ends. Represented in JSON as a property called
|
||||
* <tt>endTime</tt> whose value is JSON string containing a W3CDTF timestamp. [TODO: Reference
|
||||
* W3CDTF spec.] [TODO: Include prose describing how to represent just a date vs. a date and time.]</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Event extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/event";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "file" Object type represents some document or other file with no additional machine-readable
|
||||
* semantics.
|
||||
* </p>
|
||||
* <p>
|
||||
* It is intended that this type be used as a base type for other Objects that manifest as files, so
|
||||
* that additional semantics can be added while providing a fallback ability for clients that do not
|
||||
* support the more specific Object type.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "file" Object type is identified by the URI <tt>http://activitystrea.ms/schema/1.0/file</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A file has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Associated File URL</dt>
|
||||
* <dd>The URL of the file described by this Object Construct. Represented in JSON by a property
|
||||
* called <tt>fileUrl</tt> whose value is a JSON string containing the URL.</dd>
|
||||
* <dt>File MIME Type</dt>
|
||||
* <dd>The MIME type of the file described by this Object Construct. Represented in JSON by a
|
||||
* property called <tt>mimeType</tt> whose value is a JSON string containing the MIME type.</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class File extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/file";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "folder" object type represents a collection of files or media objects. This is similar to
|
||||
* the "photo album" object type, but not specifically representing a collection of "photos."
|
||||
* </p>
|
||||
* <p>
|
||||
* The "folder" object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/folder</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A folder has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Preview Image Link</dt>
|
||||
* <dd>A Media Link Construct describing an image file that can be used as a preview image for the
|
||||
* folder. Represented by the Representative Image component of the base Object Construct.
|
||||
* Processors MAY ignore thumbnails that are of an inappropriate size for their user interface.</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Folder extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/folder";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "group" Object type represents a social networking group. A group is a collection of people
|
||||
* which people can join and leave.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "group" Object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/group</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A group has no additional components.
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Group {
|
||||
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
import com.rometools.modules.georss.GeoRSSModule;
|
||||
import com.rometools.modules.portablecontacts.ContactModule;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Location is a concept which can be used inside the atom:entry level, atom:author and
|
||||
* activity:object. Location can be specified via geographic coordinates, a street address, a
|
||||
* free-form location name or a combination of these. Geographic coordinates should be included as a
|
||||
* geo:point element as described by the GeoRSS specification. Addresses should be included using a
|
||||
* poco:address element defined at Portable Contacts specification. The entry level location
|
||||
* represents the location of the author at the time the activity was performed. The author level
|
||||
* location represents the primary location of the author. Finally, the location within other
|
||||
* objects represents the physical location of those objects. All location fields are optional. For
|
||||
* free form addresses use the poco:formatted field.
|
||||
* </p>
|
||||
* <p>
|
||||
* <a class='info' href='#location-poco'>Figure 1<span> (</span><span class='info'>Location
|
||||
* Example</span><span>)</span></a>
|
||||
* </p>
|
||||
* <p>
|
||||
* <br />
|
||||
* <hr class="insert" />
|
||||
* <a name="location-poco"></a>
|
||||
* </p>
|
||||
* <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'>
|
||||
*
|
||||
* <pre>
|
||||
* <entry>
|
||||
* <id>tag:world:activity:1212121212121</id>
|
||||
* <title>Rob liked Goldeberg's Deli</title>
|
||||
* <author>
|
||||
* <name>Rob Dolin</name>
|
||||
* <id>tag:world:person:1212121212121</id>
|
||||
* <link rel="alternate" type="text/html" href="http://robdolin.com" />
|
||||
* <poco:address>
|
||||
* <poco:locality>Marina del Rey</poco:locality>
|
||||
* <poco:region>CA</poco:region>
|
||||
* <poco:postalCode>90292</poco:postalCode>
|
||||
* <poco:country>US</poco:country>
|
||||
* </poco:address>
|
||||
* </author>
|
||||
* <activity:object>
|
||||
* <activity:object-type>http://activitystrea.ms/schema/1.0/place</object-type>
|
||||
* <id>tag:world:place:1212121212121</id>
|
||||
* <title>Goldberg's Deli</title>
|
||||
* <link rel="alternate" type="text/html" href="http://www.deli.com" />
|
||||
* <geo:point>33.9777 -118.4351</geo:point>
|
||||
* <poco:address>
|
||||
* <poco:streetAddress>14016 Bora Bora Way</poco:streetAddress>
|
||||
* <poco:locality>Marina del Rey</poco:locality>
|
||||
* <poco:region>CA</poco:region>
|
||||
* <poco:postalCode>90292</poco:postalCode>
|
||||
* <poco:country>US</poco:country>
|
||||
* </poco:address>
|
||||
* </activity:object>
|
||||
* <geo:point>33.9777 -119.4351</geo:point>
|
||||
* <activity:verb>http://activitystrea.ms/schema/1.0/like</activity:verb>
|
||||
* </entry>
|
||||
* </pre>
|
||||
*
|
||||
* </div>
|
||||
* <p>
|
||||
* <table border="0" cellpadding="0" cellspacing="2" align="center">
|
||||
* <tr>
|
||||
* <td align="center"><font face="monaco, MS Sans Serif" size="1"><b> Figure 1: Location
|
||||
* Example </b></font><br />
|
||||
* </td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* <hr class="insert" />
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public interface HasLocation {
|
||||
|
||||
public GeoRSSModule getLocation();
|
||||
|
||||
public void setLocation(GeoRSSModule location);
|
||||
|
||||
public ContactModule getAddress();
|
||||
|
||||
public void setAddress(ContactModule address);
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "list" object type represents a collection of related objects.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "list" object type is identified by the URI <tt>http://activitystrea.ms/schema/1.0/list</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A list has no additional components.
|
||||
* </p>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class List extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/list";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Mood describes the mood of the user when the activity was performed. This is usually collected
|
||||
* via an extra field in the user interface used to perform the activity. For the purpose of this
|
||||
* schema, a mood is a freeform, short mood keyword or phrase along with an optional mood icon
|
||||
* image.
|
||||
* </p>
|
||||
* <p>
|
||||
* Moods are included via a mood element in the namespace <tt>http://activitystrea.ms/context/</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* The content of the mood element is the mood keyword or phrase.
|
||||
* </p>
|
||||
* <p>
|
||||
* The mood element may have an optional <tt>icon</tt> attribute which contains the URL of a mood
|
||||
* icon image. The mood icon image SHOULD be small and appropriate to be displayed alongside the
|
||||
* mood keyword at a normal text size.
|
||||
* </p>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Mood {
|
||||
private String iconUrl;
|
||||
private String text;
|
||||
|
||||
/**
|
||||
* Set the value of iconUrl
|
||||
*
|
||||
* @param newiconUrl new value of iconUrl
|
||||
*/
|
||||
public void setIconUrl(final String newiconUrl) {
|
||||
iconUrl = newiconUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of iconUrl
|
||||
*
|
||||
* @return the value of iconUrl
|
||||
*/
|
||||
public String getIconUrl() {
|
||||
return iconUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of text
|
||||
*
|
||||
* @param newtext new value of text
|
||||
*/
|
||||
public void setText(final String newtext) {
|
||||
text = newtext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of text
|
||||
*
|
||||
* @return the value of text
|
||||
*/
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "note" Object type represents short-form text messages. This Object type is intended for use
|
||||
* in "micro-blogging" and in systems where users are invited to publish short, often plain-text
|
||||
* messages whose useful lifespan is generally shorter than that of an article or weblog entry.
|
||||
* </p>
|
||||
* <p>
|
||||
* A note is similar in structure to an article, but it does not have a title and its body tends to
|
||||
* be shorter. Applications will often display the entire content of a note in an activity stream
|
||||
* UI, whereas they MAY display only the title or the title and summary for a weblog entry.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "note" Object type is identified by the URI <tt>http://activitystrea.ms/schema/1.0/note</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A note has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Content</dt>
|
||||
* <dd>The content of the comment. Represented in JSON as a property called <tt>content</tt> whose
|
||||
* value is a JSON string containing a fragment of HTML that represents the content. Publishers
|
||||
* SHOULD include any markup necessary to achieve a similar presentation to that on the publisher's
|
||||
* own HTML pages, including any links that the service automatically adds. Processors MAY remove
|
||||
* all HTML markup and consider the comment to be plain text.</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Note extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/note";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
import com.rometools.rome.feed.atom.Link;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "person" Object type represents a user account. This is often represents a person, but might
|
||||
* also be a company or fictitious character that is being represented by a user account.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "person" Object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/person</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A person has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Display Name</dt>
|
||||
* <dd>A name that can be used for the person in the user interface. This is often a name by which
|
||||
* the individual is known in a given context; no restriction is placed on what kind of name may be
|
||||
* used here. Represented by the Name component of the base Object Construct.</dd>
|
||||
* <dt>Avatar</dt>
|
||||
* <dd>A link to an "avatar" or "userpic" image for the user. Represented by the Representative
|
||||
* Image component of the base Object Construct.</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Person extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/person";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of avatar
|
||||
*
|
||||
* @return the value of avatar
|
||||
*/
|
||||
public Link getAvatar() {
|
||||
final Link result = findRelatedLink("avatar");
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
return findRelatedLink("userpic");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of avatar
|
||||
*
|
||||
* @param newavatar new value of avatar
|
||||
*/
|
||||
public void setAvatar(final Link newavatar) {
|
||||
final Link old = getAvatar();
|
||||
if (old != null) {
|
||||
getOtherLinks().remove(old);
|
||||
}
|
||||
newavatar.setRel("avatar");
|
||||
getOtherLinks().add(newavatar);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "photo" object type represents a graphical still image.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "photo" Object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/photo</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A photo has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Thumbnail</dt>
|
||||
* <dd>A link to a thumbnail version of the image. Represented by the Representative Image component
|
||||
* of the base Object Construct. Processors MAY ignore thumbnails that are of an inappropriate size
|
||||
* for their user interface.</dd>
|
||||
* <dt>Larger Image</dt>
|
||||
* <dd>A Media Link Construct linking to a larger -- ideally, full-size -- version of the photo
|
||||
* intended for standalone viewing. Represented in JSON as a property named <tt>fullImage</tt> whose
|
||||
* value is a JSON object with properties as defined in [TODO: xref the JSON serialization of a
|
||||
* Media Link Construct].</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Photo extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/photo";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "photo album" object type represents a collection of images.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "photo album" object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/photo-album</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* The photo album has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Preview Image Link</dt>
|
||||
* <dd>A Media Link Construct describing an image file that can be used as a preview image for the
|
||||
* album. Represented by the Representative Image component of the base Object Construct. Processors
|
||||
* MAY ignore thumbnails that are of an inappropriate size for their user interface.</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class PhotoAlbum extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/photo-album";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "place" object type represents a location on Earth.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "place" object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/place</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A place has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Latitude</dt>
|
||||
* <dd>The latitude of the place as a point on Earth. Represented in JSON as a property named
|
||||
* <tt>latitude</tt> whose value is a JSON number containing a decimal representation of the
|
||||
* latitude in degrees.</dd>
|
||||
* <dt>Longitude</dt>
|
||||
* <dd>The longitude of the place as a point on Earth. Represented in JSON as a property named
|
||||
* <tt>longitude</tt> whose value is a JSON number containing a decimal representation of the
|
||||
* longitude in degrees.</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Place extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/place";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* The "playlist" object type represents an ordered list of time-based media items, such as video
|
||||
* and audio objects.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "playlist" object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/playlist</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A playlist has no additional components.
|
||||
* </p>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Playlist extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/playlist";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "product" object type represents a commercial good or service.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "product" object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/product</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A product has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Thumbnail</dt>
|
||||
* <dd>A link to a thumbnail-sized image that contains a photo of the product. Represented by the
|
||||
* Representative Image component of the base Object Construct. Processors MAY ignore thumbnails
|
||||
* that are of an inappropriate size for their user interface.</dd>
|
||||
* <dt>Larger Image</dt>
|
||||
* <dd>A Media Link Construct linking to a larger -- ideally, full-size -- version of the photo of
|
||||
* the product. Represented in JSON as a property named <tt>fullImage</tt> whose value is a JSON
|
||||
* object with properties as defined in [TODO: xref the JSON serialization of a Media Link
|
||||
* Construct].</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Product extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/product";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "review" object type represents a primarily prose-based commentary on another object.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "review" object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/review</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A review has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Title</dt>
|
||||
* <dd>The title of the review. Represented by the Name component of the base Object Construct. Many
|
||||
* systems do not have the concept of a title for a review; such systems MUST omit the Name
|
||||
* component. Processors SHOULD refer to such reviews as simply being "a review", with appropriate
|
||||
* localization, if they are to be described in a sentence.</dd>
|
||||
* <dt>Content</dt>
|
||||
* <dd>The content of the comment. Represented in JSON as a property called <tt>content</tt> whose
|
||||
* value is a JSON string containing a fragment of HTML that represents the content. Publishers
|
||||
* SHOULD include any markup necessary to achieve a similar presentation to that on the publisher's
|
||||
* own HTML pages, including any links that the service automatically adds. Processors MAY remove
|
||||
* all HTML markup and consider the comment to be plain text.</dd>
|
||||
* <dt>Reviewed Object</dt>
|
||||
* <dd>The Object Construct representing the item that this review applies to. Represented as the In
|
||||
* Reply To Object component of the base Object Construct.</dd>
|
||||
* <dt>Rating</dt>
|
||||
* <dd>A rating for the item, given as a number between 1.0 and 5.0 inclusive with one decimal place
|
||||
* of precision. Represented in JSON as a property called <tt>rating</tt> whose value is a JSON
|
||||
* number giving the rating.</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Review extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/review";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "service" Object type represents a website, personal website or blog, business, brand, or
|
||||
* other entity that performs some kind of work for other entities, people, or services, or acts as
|
||||
* kind of container for other objects.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "service" Object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/service</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A service has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>icon</dt>
|
||||
* <dd>A Media Link Construct representing a link to a small image representing the service.
|
||||
* Represented in JSON as a property named <tt>icon</tt> whose value is a JSON object with
|
||||
* properties as defined in [TODO: xref the JSON serialization of a Media Link Construct]. The
|
||||
* linked image MUST have an aspect ratio of one (horizontal) to one (vertical) and SHOULD be
|
||||
* suitable for presentation at a small size.</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Service extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/service";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "song" Object type represents a song or a recording of a song.
|
||||
* </p>
|
||||
* <p>
|
||||
* Objects of type Song might contain information about the song or recording, or they might contain
|
||||
* some representation of the recording itself. In the latter case, the song SHOULD also be
|
||||
* annotated with the "audio" object type as described in <a class='info'
|
||||
* href='#audio'>Section 3.2.2<span> (</span><span class='info'>Audio</span><span>)</span></a>
|
||||
* and use its properties. This type should only be used when the publisher can guarantee that the
|
||||
* object is a song rather than merely a generic audio stream.
|
||||
* </p>
|
||||
* <p>
|
||||
* The Object type URL for the "song" Object type is
|
||||
* <tt>http://activitystrea.ms/schema/1.0/song</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A song has no additional components.
|
||||
* </p>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Song extends ActivityObject {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Audio audio;
|
||||
|
||||
/**
|
||||
* Set the value of audio
|
||||
*
|
||||
* @param newaudio new value of audio
|
||||
*/
|
||||
public void setAudio(final Audio newaudio) {
|
||||
audio = newaudio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of audio
|
||||
*
|
||||
* @return the value of audio
|
||||
*/
|
||||
public Audio getAudio() {
|
||||
return audio;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/song";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "status" Object type represents a human-readable update of the author's situation, mood,
|
||||
* location or other status.
|
||||
* </p>
|
||||
* <p>
|
||||
* A status is similar in structure to a note, but carries the additional meaning that the content
|
||||
* is primarily describing something its author is doing, feeling or experiencing.
|
||||
* </p>
|
||||
* <p>
|
||||
* A consumers MAY consider the content of the most recent status object it encountered to be the
|
||||
* user's current status, unless the most recent status update is old. When a status becomes too old
|
||||
* is not defined by this specification.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "status" object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/status</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A status has the same components as a note.
|
||||
* </p>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Status extends ActivityObject {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getTypeIRI() {
|
||||
return "http://activitystrea.ms/schema/1.0/status";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the icense for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public enum Verb {
|
||||
/**
|
||||
* The "mark as favorite" Verb indicates that the Subject marked the Object as an item of
|
||||
* special interest. Objects so marked often appear in a collection of such Objects which MAY be
|
||||
* published as a feed of entries annotated with this Verb. If a particular service uses
|
||||
* favorites as a mechanism by which a user can recall items that were earlier marked, it MAY be
|
||||
* appropriate to also mark activities of this type with the "save" Verb as described in Section
|
||||
* 3.1.8. The verb URI for the "mark as favorite" Verb is
|
||||
* http://activitystrea.ms/schema/1.0/favorite.
|
||||
*/
|
||||
MARK_AS_FAVORITE("http://activitystrea.ms/schema/1.0/favorite"),
|
||||
/**
|
||||
* The "start following" Verb indicates that the Subject began following the activity of the
|
||||
* Object. In most cases, the Object of this Verb will be a user, but it can potentially be of
|
||||
* any type that can sensibly generate activity.
|
||||
*
|
||||
* The verb URI for the "start following" Verb is http://activitystrea.ms/schema/1.0/follow.
|
||||
*
|
||||
* Processors MAY ignore (silently drop) successive identical "start following" activities
|
||||
* regardless of whether they maintain state sufficient to determine (A), (B), or (C) above.
|
||||
*/
|
||||
START_FOLLOWING("http://activitystrea.ms/schema/1.0/follow"),
|
||||
/**
|
||||
* The "mark as liked" verb indicates that the actor indicated that it likes the object.
|
||||
*
|
||||
* The verb URI for the "mark as liked" Verb is http://activitystrea.ms/schema/1.0/like.
|
||||
*/
|
||||
MARK_AS_LIKED("http://activitystrea.ms/schema/1.0/like"),
|
||||
/**
|
||||
* The "make friend" Verb indicates the creation of a friendship that is reciprocated by the
|
||||
* object.
|
||||
*
|
||||
* Since this verb implies an activity on the part of its object, processors MUST NOT accept
|
||||
* activities with this Verb unless they are able to verify through some external means that
|
||||
* there is in fact a reciprocated connection. For example, a processor MAY have received a
|
||||
* guarantee from a particular publisher that the publisher will only use this Verb in cases
|
||||
* where a reciprocal relationship exists.
|
||||
*
|
||||
* The verb URI for the "make friend" Verb is http://activitystrea.ms/schema/1.0/make-friend.
|
||||
*/
|
||||
MAKE_FRIEND("http://activitystrea.ms/schema/1.0/make-friend"),
|
||||
/**
|
||||
* The "join" Verb indicates that the actor has become a member of the Object. This
|
||||
* specification only defines the meaning of this Verb when its Object is a Group, though
|
||||
* implementors SHOULD be prepared to handle other Object types as meaning MAY be provided by
|
||||
* extension specifications.
|
||||
*
|
||||
* Processors MAY ignore (silently drop) successive identical "join" activities regardless of
|
||||
* whether they maintain state sufficient to determine (A) or (B) above.
|
||||
*
|
||||
* The "join" Verb is identified by the URI http://activitystrea.ms/schema/1.0/join.
|
||||
*/
|
||||
JOIN("http://activitystrea.ms/schema/1.0/join"),
|
||||
/**
|
||||
* The "play" verb indicates that the subject spent some time enjoying the object. For example,
|
||||
* if the object is a video this indicates that the subject watched all or part of the video.
|
||||
*
|
||||
* The "play" Verb is identified by the URI http://activitystrea.ms/schema/1.0/play.
|
||||
*/
|
||||
PLAY("http://activitystrea.ms/schema/1.0/play"),
|
||||
/**
|
||||
* The "Post" Verb is described in section 8 of the AtomActivity specification. It is only
|
||||
* referenced here for completeness.
|
||||
*
|
||||
* http://activitystrea.ms/schema/1.0/post
|
||||
*/
|
||||
POST("http://activitystrea.ms/schema/1.0/post"),
|
||||
/**
|
||||
* The "save" Verb indicates that the Subject has called out the Object as being of interest
|
||||
* primarily to him- or herself. Though this action MAY be shared publicly, the implication is
|
||||
* that the Object has been saved primarily for the actor's own benefit rather than to show it
|
||||
* to others as would be indicated by the "share" Verb (Section 3.1.9).
|
||||
*
|
||||
* The "save" Verb is identified by the URI http://activitystrea.ms/schema/1.0/save.
|
||||
*/
|
||||
SAVE("http://activitystrea.ms/schema/1.0/save"),
|
||||
/**
|
||||
* The "share" Verb indicates that the Subject has called out the Object to readers. In most
|
||||
* cases, the actor did not create the Object being shared, but is instead drawing attention to
|
||||
* it.
|
||||
*
|
||||
* The "share" Verb is identified by the URI http://activitystrea.ms/schema/1.0/share.
|
||||
*/
|
||||
SHARE("http://activitystrea.ms/schema/1.0/share"),
|
||||
/**
|
||||
* The "tag" verb indicates that the actor has identified the presence of a target inside
|
||||
* another object. For example, the actor may have specified that a particular user appears in a
|
||||
* photo.
|
||||
*
|
||||
* The "tag" verb is identified by the URI http://activitystrea.ms/schema/1.0/tag.
|
||||
*
|
||||
* The target of the "tag" verb gives the object in which the tag has been added. For example,
|
||||
* if a user appears in a photo, the activity:object is the user and the activity:target is the
|
||||
* photo.
|
||||
*/
|
||||
TAG("http://activitystrea.ms/schema/1.0/tag"),
|
||||
/**
|
||||
* The "update" Verb indicates that the Subject has modified the referenced Object.
|
||||
*
|
||||
* Implementors SHOULD use verbs such as Section 3.1.7 where the Subject is adding new items to
|
||||
* a Section 3.2.8 or similar. Update is reserved for modifications to existing Objects or data
|
||||
* such as changing a user's profile information.
|
||||
*
|
||||
* The "update" Verb is identified by the URI http://activitystrea.ms/schema/1.0/update.
|
||||
*/
|
||||
UPDATE("http://activitystrea.ms/schema/1.0/update"),
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* The "positive RSVP" verb indicates that the actor has made a positive RSVP for the object.
|
||||
* This specification only defines the meaning of this verb when its object is an event (see <a
|
||||
* class='info' href='#event'>Section 4.2.1<span> (</span><span
|
||||
* class='info'>Event</span><span>)</span></a>), though implementors SHOULD be prepared to
|
||||
* handle other object types as meaning MAY be provided by extension specifications.
|
||||
* </p>
|
||||
* <p>
|
||||
* The use of this Verb is only appropriate when the RSVP was created by an explicit action by
|
||||
* the actor. It is not appropriate to use this verb when a user has been added as an attendee
|
||||
* by an event organiser or administrator.
|
||||
* </p>
|
||||
* <p>
|
||||
* The verb URI for the "positive RSVP" Verb is
|
||||
* <tt>http://activitystrea.ms/schema/1.0/rsvp-yes</tt>.
|
||||
* </p>
|
||||
*/
|
||||
RSVP_YES("http://activitystrea.ms/schema/1.0/rsvp-yes"),
|
||||
/**
|
||||
* <p>
|
||||
* The "possible RSVP" verb indicates that the actor has made a possible RSVP for the object.
|
||||
* This specification only defines the meaning of this verb when its object is an event (see <a
|
||||
* class='info' href='#event'>Section 4.2.1<span> (</span><span
|
||||
* class='info'>Event</span><span>)</span></a>), though implementors SHOULD be prepared to
|
||||
* handle other object types as meaning MAY be provided by extension specifications.
|
||||
* </p>
|
||||
* <p>
|
||||
* The use of this Verb is only appropriate when the RSVP was created by an explicit action by
|
||||
* the actor. It is not appropriate to use this verb when a user has been added as an attendee
|
||||
* by an event organiser or administrator.
|
||||
* </p>
|
||||
* <p>
|
||||
* The verb URI for the "possible RSVP" Verb is
|
||||
* <tt>http://activitystrea.ms/schema/1.0/rsvp-maybe</tt>.
|
||||
* </p>
|
||||
*/
|
||||
RSVP_MAYBE("http://activitystrea.ms/schema/1.0/rsvp-maybe"),
|
||||
/**
|
||||
* <p>
|
||||
* The "negative RSVP" verb indicates that the actor has made a negative RSVP for the object.
|
||||
* This specification only defines the meaning of this verb when its object is an event (see <a
|
||||
* class='info' href='#event'>Section 4.2.1<span> (</span><span
|
||||
* class='info'>Event</span><span>)</span></a>), though implementors SHOULD be prepared to
|
||||
* handle other object types as meaning MAY be provided by extension specifications.
|
||||
* </p>
|
||||
* <p>
|
||||
* The use of this Verb is only appropriate when the RSVP was created by an explicit action by
|
||||
* the actor. It is not appropriate to use this verb when a user has been added as an attendee
|
||||
* by an event organiser or administrator.
|
||||
* </p>
|
||||
* <p>
|
||||
* The verb URI for the "negative RSVP" Verb is
|
||||
* <tt>http://activitystrea.ms/schema/1.0/rsvp-no</tt>.
|
||||
* </p>
|
||||
*/
|
||||
RSVP_NO("http://activitystrea.ms/schema/1.0/rsvp-no");
|
||||
private final String iri;
|
||||
|
||||
/**
|
||||
* @param iri
|
||||
*/
|
||||
Verb(final String iri) {
|
||||
this.iri = iri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return iri;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param iri
|
||||
* @return
|
||||
*/
|
||||
public static Verb fromIRI(final String iri) {
|
||||
for (final Verb v : Verb.values()) {
|
||||
if (v.toString().equals(iri)) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.activitystreams.types;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The "video" Object type represents video content, which usually consists of a motion picture
|
||||
* track and an audio track.
|
||||
* </p>
|
||||
* <p>
|
||||
* The "video" Object type is identified by the URI
|
||||
* <tt>http://activitystrea.ms/schema/1.0/video</tt>.
|
||||
* </p>
|
||||
* <p>
|
||||
* A video has the following additional components:
|
||||
* </p>
|
||||
* <p>
|
||||
* </p>
|
||||
* <blockquote class="text">
|
||||
* <dl>
|
||||
* <dt>Video Stream Link</dt>
|
||||
* <dd>A Media Link Construct linking to the video content itself. Represented in JSON as a property
|
||||
* called <tt>stream</tt> whose value is a JSON object with properties as defined in [TODO: xref the
|
||||
* JSON serialization of a Media Link Construct]</dd>
|
||||
* <dt>Embed Code</dt>
|
||||
* <dd>An HTML fragment that, when embedded in an HTML page, will provide an interactive player UI
|
||||
* for the video stream. Represented in JSON as a property called <tt>embedCode</tt> whose value is
|
||||
* a JSON string containing the fragment of HTML.</dd>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class Video {
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.rometools.modules.atom.io;
|
||||
|
||||
public interface AtomLinkAttribute {
|
||||
String REL = "rel";
|
||||
String TYPE = "type";
|
||||
String HREF = "href";
|
||||
String TITLE = "title";
|
||||
String HREF_LANG = "hreflang";
|
||||
String LENGTH = "length";
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package com.rometools.modules.atom.io;
|
||||
|
||||
import com.rometools.modules.atom.modules.AtomLinkModule;
|
||||
import com.rometools.rome.feed.atom.Link;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleGenerator;
|
||||
import org.jdom2.Attribute;
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class AtomModuleGenerator implements ModuleGenerator {
|
||||
|
||||
static final Namespace NS = Namespace.getNamespace("atom", AtomLinkModule.URI);
|
||||
private static final Set<Namespace> NAMESPACES;
|
||||
|
||||
static {
|
||||
final Set<Namespace> nss = new HashSet<Namespace>();
|
||||
nss.add(NS);
|
||||
NAMESPACES = Collections.unmodifiableSet(nss);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getNamespaceUri() {
|
||||
return AtomLinkModule.URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Set<Namespace> getNamespaces() {
|
||||
return NAMESPACES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(Module module, Element element) {
|
||||
if (module instanceof AtomLinkModule) {
|
||||
AtomLinkModule m = (AtomLinkModule) module;
|
||||
generateLinc(m.getLink(), element);
|
||||
}
|
||||
}
|
||||
|
||||
private void generateLinc(Link link, Element element) {
|
||||
if (link == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Element linkElement = new Element("link", NS);
|
||||
|
||||
if (link.getHref() != null) {
|
||||
Attribute href = new Attribute(AtomLinkAttribute.HREF, link.getHref());
|
||||
linkElement.setAttribute(href);
|
||||
}
|
||||
if (link.getType() != null) {
|
||||
Attribute type = new Attribute(AtomLinkAttribute.TYPE, link.getType());
|
||||
linkElement.setAttribute(type);
|
||||
}
|
||||
if (link.getRel() != null) {
|
||||
Attribute rel = new Attribute(AtomLinkAttribute.REL, link.getRel());
|
||||
linkElement.setAttribute(rel);
|
||||
}
|
||||
|
||||
if (link.getHreflang() != null) {
|
||||
final Attribute hreflangAttribute = new Attribute(AtomLinkAttribute.HREF_LANG, link.getHreflang());
|
||||
linkElement.setAttribute(hreflangAttribute);
|
||||
}
|
||||
|
||||
if (link.getTitle() != null) {
|
||||
final Attribute title = new Attribute(AtomLinkAttribute.TITLE, link.getTitle());
|
||||
linkElement.setAttribute(title);
|
||||
}
|
||||
|
||||
if (link.getLength() != 0) {
|
||||
final Attribute lenght = new Attribute(AtomLinkAttribute.LENGTH, Long.toString(link.getLength()));
|
||||
linkElement.setAttribute(lenght);
|
||||
}
|
||||
|
||||
element.addContent(linkElement);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package com.rometools.modules.atom.io;
|
||||
|
||||
import com.rometools.modules.atom.modules.AtomLinkModule;
|
||||
import com.rometools.modules.atom.modules.AtomLinkModuleImpl;
|
||||
import com.rometools.rome.feed.atom.Link;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleParser;
|
||||
import com.rometools.rome.io.impl.NumberParser;
|
||||
import org.jdom2.Attribute;
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class AtomModuleParser implements ModuleParser {
|
||||
|
||||
private static final Namespace NS = Namespace.getNamespace(AtomLinkModule.URI);
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module parse(Element element, Locale locale) {
|
||||
AtomLinkModuleImpl mod = new AtomLinkModuleImpl();
|
||||
if (element.getName().equals("channel") || element.getName().equals("item")) {
|
||||
Element link = element.getChild("link", NS);
|
||||
if (link != null) {
|
||||
Link l = parseLink(link);
|
||||
mod.setLink(l);
|
||||
return mod;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Link parseLink(final Element eLink) {
|
||||
|
||||
final Link link = new Link();
|
||||
|
||||
final String rel = getAttributeValue(eLink, AtomLinkAttribute.REL);
|
||||
if (rel != null) {
|
||||
link.setRel(rel);
|
||||
}
|
||||
|
||||
final String type = getAttributeValue(eLink, AtomLinkAttribute.TYPE);
|
||||
if (type != null) {
|
||||
link.setType(type);
|
||||
}
|
||||
|
||||
final String href = getAttributeValue(eLink, AtomLinkAttribute.HREF);
|
||||
if (href != null) {
|
||||
link.setHref(href);
|
||||
}
|
||||
|
||||
final String title = getAttributeValue(eLink, AtomLinkAttribute.TITLE);
|
||||
if (title != null) {
|
||||
link.setTitle(title);
|
||||
}
|
||||
|
||||
final String hrefLang = getAttributeValue(eLink, AtomLinkAttribute.HREF_LANG);
|
||||
if (hrefLang != null) {
|
||||
link.setHreflang(hrefLang);
|
||||
}
|
||||
|
||||
final String length = getAttributeValue(eLink, AtomLinkAttribute.LENGTH);
|
||||
if (length != null) {
|
||||
final Long val = NumberParser.parseLong(length);
|
||||
if (val != null) {
|
||||
link.setLength(val.longValue());
|
||||
}
|
||||
}
|
||||
|
||||
return link;
|
||||
|
||||
}
|
||||
|
||||
protected String getAttributeValue(final Element e, final String attributeName) {
|
||||
Attribute attr = e.getAttribute(attributeName);
|
||||
if (attr == null) {
|
||||
attr = e.getAttribute(attributeName, NS);
|
||||
}
|
||||
if (attr != null) {
|
||||
return attr.getValue();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.rometools.modules.atom.modules;
|
||||
|
||||
import com.rometools.rome.feed.atom.Link;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
|
||||
public interface AtomLinkModule extends Module {
|
||||
|
||||
public static final String URI = "http://www.w3.org/2005/Atom";
|
||||
|
||||
public Link getLink();
|
||||
|
||||
public void setLink(Link link);
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package com.rometools.modules.atom.modules;
|
||||
|
||||
import com.rometools.rome.feed.CopyFrom;
|
||||
import com.rometools.rome.feed.atom.Link;
|
||||
import com.rometools.rome.feed.impl.EqualsBean;
|
||||
import com.rometools.rome.feed.impl.ToStringBean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AtomLinkModuleImpl implements AtomLinkModule, Cloneable, Serializable {
|
||||
|
||||
private Link link;
|
||||
|
||||
@Override
|
||||
public Link getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLink(Link link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUri() {
|
||||
return URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends CopyFrom> getInterface() {
|
||||
return AtomLinkModule.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(CopyFrom obj) {
|
||||
AtomLinkModule other = (AtomLinkModule) obj;
|
||||
Link link = other.getLink();
|
||||
if (link != null) {
|
||||
Link l = new Link();
|
||||
l.setHref(link.getHref());
|
||||
l.setType(link.getType());
|
||||
l.setRel(link.getRel());
|
||||
l.setHreflang(link.getHreflang());
|
||||
l.setTitle(link.getTitle());
|
||||
l.setLength(link.getLength());
|
||||
setLink(l);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
final AtomLinkModuleImpl m = new AtomLinkModuleImpl();
|
||||
if (link != null) {
|
||||
Link l = new Link();
|
||||
l.setHref(link.getHref());
|
||||
l.setType(link.getType());
|
||||
l.setRel(link.getRel());
|
||||
l.setHreflang(link.getHreflang());
|
||||
l.setTitle(link.getTitle());
|
||||
l.setLength(link.getLength());
|
||||
m.setLink(l);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
final EqualsBean eBean = new EqualsBean(AtomLinkModuleImpl.class, this);
|
||||
return eBean.beanEquals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final EqualsBean equals = new EqualsBean(AtomLinkModuleImpl.class, this);
|
||||
return equals.beanHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final ToStringBean tsBean = new ToStringBean(AtomLinkModuleImpl.class, this);
|
||||
return tsBean.toString();
|
||||
}
|
||||
}
|
380
src/main/java/com/rometools/modules/base/Article.java
Normal file
380
src/main/java/com/rometools/modules/base/Article.java
Normal file
|
@ -0,0 +1,380 @@
|
|||
/*
|
||||
* Article.java
|
||||
*
|
||||
* Created on November 16, 2005, 1:01 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* This is an interface for the GoogleBase plug in that exposes methods used for Article or News
|
||||
* entry types.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public interface Article extends GlobalInterface {
|
||||
/**
|
||||
* Array of Author Names. Limit 10.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="author"></a>author</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Author of the item.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:author>John Steinbeck</g:author></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, News and Articles</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param authors Array of Author Names. Limit 10.
|
||||
*/
|
||||
public void setAuthors(String[] authors);
|
||||
|
||||
/**
|
||||
* Array of Author Names. Limit 10.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="author"></a>author</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Author of the item.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:author>John Steinbeck</g:author></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, News and Articles</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Array of author names.
|
||||
*/
|
||||
public String[] getAuthors();
|
||||
|
||||
/**
|
||||
* Source for this article.
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="news_source"></a>news_source</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> The source of news content.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:news_source>Journal</g:news_source></font></td>
|
||||
*
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> News and Articles</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param newsSource Source for this article
|
||||
*/
|
||||
public void setNewsSource(String newsSource);
|
||||
|
||||
/**
|
||||
* Source for this article.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="news_source"></a>news_source</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> The source of news content.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:news_source>Journal</g:news_source></font></td>
|
||||
*
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> News and Articles</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return source for this article.
|
||||
*/
|
||||
public String getNewsSource();
|
||||
|
||||
/**
|
||||
* Number of pages in the article.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="pages"></a>pages</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* The number of pages in the publication.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:pages>18</g:pages></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, News and Articles</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> integer</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param pages Number of pages in the article
|
||||
*/
|
||||
public void setPages(Integer pages);
|
||||
|
||||
/**
|
||||
* Number of pages in the article.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="pages"></a>pages</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* The number of pages in the publication.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:pages>18</g:pages></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, News and Articles</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> integer</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Number of pages in the article
|
||||
*/
|
||||
public Integer getPages();
|
||||
|
||||
/**
|
||||
* Date article was published.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="publish_date"></a>publish_date</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Date the item was published in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>
|
||||
* format: YYYY-MM-DD</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:publish_date>2005-12-20</g:publish_date></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reference Items</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* date</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param publishDate Date article was published
|
||||
*/
|
||||
public void setPublishDate(Date publishDate);
|
||||
|
||||
/**
|
||||
* Date article was published.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="publish_date"></a>publish_date</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Date the item was published in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>
|
||||
* format: YYYY-MM-DD</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:publish_date>2005-12-20</g:publish_date></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reference Items</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* date</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Date article was published
|
||||
*/
|
||||
public Date getPublishDate();
|
||||
}
|
565
src/main/java/com/rometools/modules/base/Course.java
Normal file
565
src/main/java/com/rometools/modules/base/Course.java
Normal file
|
@ -0,0 +1,565 @@
|
|||
/*
|
||||
* CourseInformation.java
|
||||
*
|
||||
* Created on November 16, 2005, 11:12 AM
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import com.rometools.modules.base.types.DateTimeRange;
|
||||
|
||||
/**
|
||||
* This is an interface for the GoogleBase plug in that exposes methods used for Class or Course
|
||||
* information entry types.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public interface Course extends GlobalInterface {
|
||||
/**
|
||||
* The timeframe a course is running.
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="course_date_range"></a>course_date_range</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1">Date and time range a class is in session, in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>. Two
|
||||
* sub-attributes are included in course_date_range attribute.
|
||||
* <ul type="disc">
|
||||
*
|
||||
* <li>start = Start date and time of a trip in format YYYY-MM-DDThh:mm:ss</li>
|
||||
* <li>end = End date and time of a trip in format YYYY-MM-DDThh:mm:ss</li>
|
||||
* </ul>
|
||||
* </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:course_date_range> <br>
|
||||
*
|
||||
* <g:start>2005-12-20T09:30:01</g:start> <br>
|
||||
* <g:end>2005-12-29T10:30:59</g:end><br>
|
||||
* </g:course_date_range></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Course schedules</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> dateTimeRange</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param courseDateRange The timeframe a course is running
|
||||
*/
|
||||
public void setCourseDateRange(DateTimeRange courseDateRange);
|
||||
|
||||
/**
|
||||
* The timeframe a course is running.
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="course_date_range"></a>course_date_range</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1">Date and time range a class is in session, in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>. Two
|
||||
* sub-attributes are included in course_date_range attribute.
|
||||
* <ul type="disc">
|
||||
*
|
||||
* <li>start = Start date and time of a trip in format YYYY-MM-DDThh:mm:ss</li>
|
||||
* <li>end = End date and time of a trip in format YYYY-MM-DDThh:mm:ss</li>
|
||||
* </ul>
|
||||
* </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:course_date_range> <br>
|
||||
*
|
||||
* <g:start>2005-12-20T09:30:01</g:start> <br>
|
||||
* <g:end>2005-12-29T10:30:59</g:end><br>
|
||||
* </g:course_date_range></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Course schedules</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> dateTimeRange</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return The timeframe a course is running
|
||||
*/
|
||||
public DateTimeRange getCourseDateRange();
|
||||
|
||||
/**
|
||||
* ID code associated with a course.
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="course_number"></a>course_number</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">ID code associated with a course</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1"><g:course_number>HIST-90A</g:course_number></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">Course schedules</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param courseNumber ID code associated with a course
|
||||
*/
|
||||
public void setCourseNumber(String courseNumber);
|
||||
|
||||
/**
|
||||
* ID code associated with a course.
|
||||
*
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="course_number"></a>course_number</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">ID code associated with a course</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1"><g:course_number>HIST-90A</g:course_number></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">Course schedules</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return ID code associated with a course
|
||||
*/
|
||||
public String getCourseNumber();
|
||||
|
||||
/**
|
||||
* Time a class is in session.
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="course_times"></a>course_times</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1">Time a class is in session.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"><g:course_times>MWF 08:30 - 09:45</g:course_times></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">Course schedules</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param courseTimes Time a class is in session
|
||||
*/
|
||||
public void setCourseTimes(String courseTimes);
|
||||
|
||||
/**
|
||||
* Time a class is in session.
|
||||
*
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="course_times"></a>course_times</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1">Time a class is in session.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"><g:course_times>MWF 08:30 - 09:45</g:course_times></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">Course schedules</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Time a class is in session
|
||||
*/
|
||||
public String getCourseTimes();
|
||||
|
||||
/**
|
||||
* Salary for this position.
|
||||
*
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="salary"></a>salary</b></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Salary for this position. Non-numeric values such as "$" symbols are not
|
||||
* acceptable. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:salary>55000</g:salary></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* float</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param salary Salary for this position
|
||||
*/
|
||||
public void setSalary(Float salary);
|
||||
|
||||
/**
|
||||
* Salary for this position.
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="salary"></a>salary</b></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Salary for this position. Non-numeric values such as "$" symbols are not
|
||||
* acceptable. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:salary>55000</g:salary></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* float</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Salary for this position
|
||||
*/
|
||||
public Float getSalary();
|
||||
|
||||
/**
|
||||
* Topics of study for a course.
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="subject"></a>subject</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Topic of study for a course.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:subject>Trigonometry</g:subject></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* Course schedules</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param subject Topics of study for a course
|
||||
*/
|
||||
public void setSubjects(String[] subject);
|
||||
|
||||
/**
|
||||
* Topics of study for a course.
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="subject"></a>subject</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Topic of study for a course.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:subject>Trigonometry</g:subject></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* Course schedules</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Topics of study for a course
|
||||
*/
|
||||
public String[] getSubjects();
|
||||
|
||||
/**
|
||||
* Name of the school at which a class is offered.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="university"></a>university</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Name of the school a class is offered at. </font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:university>Stanford</g:university></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Course schedules</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param university Name of the school at which a class is offered.
|
||||
*/
|
||||
public void setUniversity(String university);
|
||||
|
||||
/**
|
||||
* Name of the school at which a class is offered.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="university"></a>university</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Name of the school a class is offered at. </font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:university>Stanford</g:university></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Course schedules</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Name of the school at which a class is offered.
|
||||
*/
|
||||
public String getUniversity();
|
||||
}
|
149
src/main/java/com/rometools/modules/base/CustomTag.java
Normal file
149
src/main/java/com/rometools/modules/base/CustomTag.java
Normal file
|
@ -0,0 +1,149 @@
|
|||
/*
|
||||
* CustomTag.java
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2006 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.base;
|
||||
|
||||
/**
|
||||
* This class represents a custom tag name and value.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public interface CustomTag {
|
||||
|
||||
/**
|
||||
* Returns the tag name used.
|
||||
*
|
||||
* @return Returns the tag name used.
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* The value of the custom tag. <br>
|
||||
* <br>
|
||||
* <table border="1" cellpadding="6" cellspacing="0">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td><strong><font size="-1">Type (JavaType)</font></strong></td>
|
||||
*
|
||||
* <td><strong><font size="-1">Description</font></strong></td>
|
||||
* <td><strong><font size="-1">Examples</font></strong></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td><font size="-1">string (String)</font></td>
|
||||
* <td><font size="-1">Any string</font></td>
|
||||
* <td><font size="-1">Blue</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td><font size="-1">int (Integer)</font></td>
|
||||
* <td><font size="-1">Whole number values</font></td>
|
||||
* <td><font size="-1">1000</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td><font size="-1">float (Float)</font></td>
|
||||
* <td><font size="-1">Numbers with decimal digits</font></td>
|
||||
* <td><font size="-1">3.5</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td><font size="-1">intUnit (IntUnit)</font></td>
|
||||
*
|
||||
* <td><font size="-1">Whole number value and a string</font></td>
|
||||
*
|
||||
* <td><font size="-1">10 km</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td><font size="-1">floatUnit (FloatUnit)</font></td>
|
||||
* <td><font size="-1">Numbers with decimal digits and a string</font></td>
|
||||
*
|
||||
* <td><font size="-1">1.5 km</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td><font size="-1">date (ShortDate)</font></td>
|
||||
* <td><font size="-1">Date of an event, in format YYYY-MM-DD</font></td>
|
||||
* <td><font size="-1">2005-12-12</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td><font size="-1">dateTime (java.util.Date)</font></td>
|
||||
*
|
||||
* <td><font size="-1">Date and time for an event, in format YYYY-MM-DDThh:mm:ss</font></td>
|
||||
* <td><font size="-1">2005-12-12T12:00:00 </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td><font size="-1">dateTimeRange (DateTimeRange)</font></td>
|
||||
*
|
||||
* <td><font size="-1">Start and end dates for an event. An attribute of this type will contain
|
||||
* two sub-attributes, <start> and <end> in format YYYY-MM-DD</font></td>
|
||||
*
|
||||
* <td><font size="-1"><start>1975-09-25</start><br>
|
||||
* <end>1975-09-25</end>
|
||||
*
|
||||
* </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td><font size="-1">url (java.net.URL)</font></td>
|
||||
* <td><font size="-1">HTTP URL </font></td>
|
||||
*
|
||||
* <td><font size="-1">http://www.google.com</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td><font size="-1">boolean (Boolean)</font></td>
|
||||
* <td><font size="-1">Value may be either true or false.</font></td>
|
||||
* <td><font size="-1">true</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td><font size="-1">location (CustomTagImpl.Location)</font></td>
|
||||
*
|
||||
* <td><font size="-1">Location</font></td>
|
||||
* <td><font size="-1">921 W. Dana Street, Mtn View, CA-94103 </font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return The value of the tag. The objects class is determined by the "type" attribute on the
|
||||
* tag.
|
||||
*/
|
||||
public Object getValue();
|
||||
|
||||
}
|
246
src/main/java/com/rometools/modules/base/CustomTagImpl.java
Normal file
246
src/main/java/com/rometools/modules/base/CustomTagImpl.java
Normal file
|
@ -0,0 +1,246 @@
|
|||
/*
|
||||
* CustomTagImpl.java
|
||||
*
|
||||
* Created on February 6, 2006, 12:06 AM
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
|
||||
import com.rometools.modules.base.types.DateTimeRange;
|
||||
import com.rometools.modules.base.types.FloatUnit;
|
||||
import com.rometools.modules.base.types.IntUnit;
|
||||
import com.rometools.modules.base.types.ShortDate;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.1 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class CustomTagImpl implements CustomTag {
|
||||
private Object value;
|
||||
private final String name;
|
||||
|
||||
/** Creates a new instance of CustomTagImpl */
|
||||
public CustomTagImpl(final String name, final String value) {
|
||||
if (name == null || value == null) {
|
||||
throw new NullPointerException("Name and Value cannont be null.");
|
||||
}
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CustomTagImpl(final String name, final Integer value) {
|
||||
if (name == null || value == null) {
|
||||
throw new NullPointerException("Name and Value cannont be null.");
|
||||
}
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CustomTagImpl(final String name, final Float value) {
|
||||
if (name == null || value == null) {
|
||||
throw new NullPointerException("Name and Value cannont be null.");
|
||||
}
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CustomTagImpl(final String name, final IntUnit value) {
|
||||
if (name == null || value == null) {
|
||||
throw new NullPointerException("Name and Value cannont be null.");
|
||||
}
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CustomTagImpl(final String name, final FloatUnit value) {
|
||||
if (name == null || value == null) {
|
||||
throw new NullPointerException("Name and Value cannont be null.");
|
||||
}
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CustomTagImpl(final String name, final ShortDate value) {
|
||||
if (name == null || value == null) {
|
||||
throw new NullPointerException("Name and Value cannont be null.");
|
||||
}
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CustomTagImpl(final String name, final Date value) {
|
||||
if (name == null || value == null) {
|
||||
throw new NullPointerException("Name and Value cannont be null.");
|
||||
}
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CustomTagImpl(final String name, final DateTimeRange value) {
|
||||
if (name == null || value == null) {
|
||||
throw new NullPointerException("Name and Value cannont be null.");
|
||||
}
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CustomTagImpl(final String name, final URL value) {
|
||||
if (name == null || value == null) {
|
||||
throw new NullPointerException("Name and Value cannont be null.");
|
||||
}
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CustomTagImpl(final String name, final Boolean value) {
|
||||
if (name == null || value == null) {
|
||||
throw new NullPointerException("Name and Value cannont be null.");
|
||||
}
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CustomTagImpl(final String name, final Location value) {
|
||||
if (name == null || value == null) {
|
||||
throw new NullPointerException("Name and Value cannont be null.");
|
||||
}
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o instanceof CustomTag) {
|
||||
final CustomTag tag = (CustomTag) o;
|
||||
if (name.equals(tag.getName()) && value.equals(tag.getValue())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a copy of this object. The precise meaning of "copy" may depend on the
|
||||
* class of the object. The general intent is that, for any object <tt>x</tt>, the expression:
|
||||
* <blockquote>
|
||||
*
|
||||
* <pre>
|
||||
* x.clone() != x
|
||||
* </pre>
|
||||
*
|
||||
* </blockquote> will be true, and that the expression: <blockquote>
|
||||
*
|
||||
* <pre>
|
||||
* x.clone().getClass() == x.getClass()
|
||||
* </pre>
|
||||
*
|
||||
* </blockquote> will be <tt>true</tt>, but these are not absolute requirements. While it is
|
||||
* typically the case that: <blockquote>
|
||||
*
|
||||
* <pre>
|
||||
* x.clone().equals(x)
|
||||
* </pre>
|
||||
*
|
||||
* </blockquote> will be <tt>true</tt>, this is not an absolute requirement.
|
||||
* <p>
|
||||
* By convention, the returned object should be obtained by calling <tt>super.clone</tt>. If a
|
||||
* class and all of its superclasses (except <tt>Object</tt>) obey this convention, it will be
|
||||
* the case that <tt>x.clone().getClass() == x.getClass()</tt>.
|
||||
* <p>
|
||||
* By convention, the object returned by this method should be independent of this object (which
|
||||
* is being cloned). To achieve this independence, it may be necessary to modify one or more
|
||||
* fields of the object returned by <tt>super.clone</tt> before returning it. Typically, this
|
||||
* means copying any mutable objects that comprise the internal "deep structure" of the object
|
||||
* being cloned and replacing the references to these objects with references to the copies. If
|
||||
* a class contains only primitive fields or references to immutable objects, then it is usually
|
||||
* the case that no fields in the object returned by <tt>super.clone</tt> need to be modified.
|
||||
* <p>
|
||||
* The method <tt>clone</tt> for class <tt>Object</tt> performs a specific cloning operation.
|
||||
* First, if the class of this object does not implement the interface <tt>Cloneable</tt>, then
|
||||
* a <tt>CloneNotSupportedException</tt> is thrown. Note that all arrays are considered to
|
||||
* implement the interface <tt>Cloneable</tt>. Otherwise, this method creates a new instance of
|
||||
* the class of this object and initializes all its fields with exactly the contents of the
|
||||
* corresponding fields of this object, as if by assignment; the contents of the fields are not
|
||||
* themselves cloned. Thus, this method performs a "shallow copy" of this object, not a
|
||||
* "deep copy" operation.
|
||||
* <p>
|
||||
* The class <tt>Object</tt> does not itself implement the interface <tt>Cloneable</tt>, so
|
||||
* calling the <tt>clone</tt> method on an object whose class is <tt>Object</tt> will result in
|
||||
* throwing an exception at run time.
|
||||
*
|
||||
* @return a clone of this instance.
|
||||
* @exception CloneNotSupportedException if the object's class does not support the
|
||||
* <code>Cloneable</code> interface. Subclasses that override the
|
||||
* <code>clone</code> method can also throw this exception to indicate that an
|
||||
* instance cannot be cloned.
|
||||
* @see java.lang.Cloneable
|
||||
*/
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
final CustomTagImpl cti = new CustomTagImpl(name, "");
|
||||
cti.value = value;
|
||||
return cti;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[custom name=\"" + name + "\" value=\"" + value.toString() + "\"]";
|
||||
}
|
||||
|
||||
public static class Location {
|
||||
private final String value;
|
||||
|
||||
public Location(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new Location(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o instanceof Location && ((Location) o).value.equals(value)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
57
src/main/java/com/rometools/modules/base/CustomTags.java
Normal file
57
src/main/java/com/rometools/modules/base/CustomTags.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* CustomTags.java
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2006 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.1 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public interface CustomTags extends Module {
|
||||
|
||||
public static final String URI = "http://base.google.com/cns/1.0";
|
||||
|
||||
public List<CustomTag> getValues();
|
||||
|
||||
public void setValues(List<CustomTag> values);
|
||||
|
||||
}
|
90
src/main/java/com/rometools/modules/base/CustomTagsImpl.java
Normal file
90
src/main/java/com/rometools/modules/base/CustomTagsImpl.java
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* CustomTagsImpl.java
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2006 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.rometools.rome.feed.CopyFrom;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.1 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class CustomTagsImpl implements CustomTags {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<CustomTag> values;
|
||||
|
||||
@Override
|
||||
public List<CustomTag> getValues() {
|
||||
values = values == null ? new ArrayList<CustomTag>() : values;
|
||||
return values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(final List<CustomTag> values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom object) {
|
||||
final CustomTags ct = (CustomTags) object;
|
||||
values = new ArrayList<CustomTag>(ct.getValues());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
final CustomTagsImpl cti = new CustomTagsImpl();
|
||||
cti.values = new ArrayList<CustomTag>(values);
|
||||
return cti;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<CustomTags> getInterface() {
|
||||
return CustomTags.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUri() {
|
||||
return CustomTags.URI;
|
||||
}
|
||||
|
||||
}
|
1346
src/main/java/com/rometools/modules/base/Event.java
Normal file
1346
src/main/java/com/rometools/modules/base/Event.java
Normal file
File diff suppressed because it is too large
Load diff
554
src/main/java/com/rometools/modules/base/GlobalInterface.java
Normal file
554
src/main/java/com/rometools/modules/base/GlobalInterface.java
Normal file
|
@ -0,0 +1,554 @@
|
|||
/*
|
||||
* GlobalInterface.java
|
||||
*
|
||||
* Created on November 16, 2005, 5:27 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* This is an interface representing the universals.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public interface GlobalInterface extends Serializable {
|
||||
/**
|
||||
* Expiration Date for this item. <br>
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="expiration_date"></a>expiration_date</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Date that the item expires in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>
|
||||
* format: YYYY-MM-DD</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:expiration_date>2005-20-12</g:expiration_date>
|
||||
*
|
||||
* </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, People profiles, Products,
|
||||
* Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> date</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param expirationDate the date this entry will expire
|
||||
*/
|
||||
public void setExpirationDate(Date expirationDate);
|
||||
|
||||
/**
|
||||
* Expiration Date for this item. <br>
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="expiration_date"></a>expiration_date</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Date that the item expires in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>
|
||||
* format: YYYY-MM-DD</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:expiration_date>2005-20-12</g:expiration_date>
|
||||
*
|
||||
* </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, People profiles, Products,
|
||||
* Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> date</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return the date this entry will expire
|
||||
*/
|
||||
public Date getExpirationDate();
|
||||
|
||||
/**
|
||||
* Date and time that the item expires.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="expiration_date_time"></a>expiration_date_time</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1"> Date and time that the item expires in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>
|
||||
* format: YYYY-MM-DDThh:mm:ss</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">
|
||||
* <g:expiration_date_time>12-20-05T11:59:59</g:expiration_date_time> </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, People profiles, Products,
|
||||
* Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1"> dateTime</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param expirationDateTime Date and time that the item expires.
|
||||
*/
|
||||
public void setExpirationDateTime(Date expirationDateTime);
|
||||
|
||||
/**
|
||||
* Date and time that the item expires.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="expiration_date_time"></a>expiration_date_time</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1"> Date and time that the item expires in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>
|
||||
* format: YYYY-MM-DDThh:mm:ss</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">
|
||||
* <g:expiration_date_time>12-20-05T11:59:59</g:expiration_date_time> </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, People profiles, Products,
|
||||
* Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1"> dateTime</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Date and time that the item expires.
|
||||
*/
|
||||
public Date getExpirationDateTime();
|
||||
|
||||
/**
|
||||
* Unique id for this item.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="id"></a>id</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Unique alphanumeric identifier for each item - e.g., your internal ID
|
||||
* code.<br>
|
||||
* IMPORTANT: Once you submit an item with a unique id, this identifier must not change when you
|
||||
* send in a new bulk upload. Each item must retain the same id in subsequent bulk
|
||||
* uploads.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* <g:id>01flx</g:id></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, News and Articles, People
|
||||
* profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param id unique identifier for this entry
|
||||
*/
|
||||
public void setId(String id);
|
||||
|
||||
/**
|
||||
* Unique id for this item.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="id"></a>id</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Unique alphanumeric identifier for each item - e.g., your internal ID
|
||||
* code.<br>
|
||||
* IMPORTANT: Once you submit an item with a unique id, this identifier must not change when you
|
||||
* send in a new bulk upload. Each item must retain the same id in subsequent bulk
|
||||
* uploads.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* <g:id>01flx</g:id></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, News and Articles, People
|
||||
* profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return unique identifier for this entry
|
||||
*/
|
||||
public String getId();
|
||||
|
||||
/**
|
||||
* Images for this item. <br>
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="image_link"></a>image_link</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1"> URL of an associated image if available online. Use your full-sized
|
||||
* images; do not use thumbnail images. Up to ten image_links, all placed in between their own
|
||||
* <image_link> and </image_link> attributes, can be included with each item. If you
|
||||
* do not have an image available, do not include this attribute. Please do not include an image
|
||||
* that says "Image not available." Relative URLs and logo images are not acceptable.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1"> <em>Acceptable:</em><br>
|
||||
* <image_link>http://example.com/images/1006.jpg</image_link><br>
|
||||
*
|
||||
* <image_link>http://example.com/i/6.jpg,http://example.com/i/9.jpg</image_link><br>
|
||||
*
|
||||
* <em>Not acceptable:</em><br>
|
||||
* <image_link>/images/1006.jpg</image_link><br>
|
||||
* <image_link>example.com/images/1006.jpg</image_link></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, News and Articles, People
|
||||
* profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> url</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param imageLinks URLs to images. Limit 10.
|
||||
*/
|
||||
public void setImageLinks(URL[] imageLinks);
|
||||
|
||||
/**
|
||||
* Images for this item. <br>
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="image_link"></a>image_link</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1"> URL of an associated image if available online. Use your full-sized
|
||||
* images; do not use thumbnail images. Up to ten image_links, all placed in between their own
|
||||
* <image_link> and </image_link> attributes, can be included with each item. If you
|
||||
* do not have an image available, do not include this attribute. Please do not include an image
|
||||
* that says "Image not available." Relative URLs and logo images are not acceptable.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1"> <em>Acceptable:</em><br>
|
||||
* <image_link>http://example.com/images/1006.jpg</image_link><br>
|
||||
*
|
||||
* <image_link>http://example.com/i/6.jpg,http://example.com/i/9.jpg</image_link><br>
|
||||
*
|
||||
* <em>Not acceptable:</em><br>
|
||||
* <image_link>/images/1006.jpg</image_link><br>
|
||||
* <image_link>example.com/images/1006.jpg</image_link></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, News and Articles, People
|
||||
* profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> url</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return URLs to images
|
||||
*/
|
||||
public URL[] getImageLinks();
|
||||
|
||||
/**
|
||||
* Labels for this item. <br>
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top">
|
||||
* <font size="-1"><b><a name="label"></a>label</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120">
|
||||
*
|
||||
* <font size="-1"><b>Details</b></font></td>
|
||||
* <td>
|
||||
* <font size="-1">A list of classifications the item may fall under. Up to ten user-selected
|
||||
* label, each placed in between their own <label>
|
||||
*
|
||||
* and </label> tags, can be included with each item. These attributes will be used to
|
||||
* match your items to search queries. Each attribute value will be checked for policy
|
||||
* compliance.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120">
|
||||
* <font size="-1"><b>Example</b></font></td>
|
||||
* <td>
|
||||
*
|
||||
* <font size="-1"><em>Acceptable:<br>
|
||||
* For an automobile in a Vehicles information type:</em><br>
|
||||
* </font>
|
||||
*
|
||||
* <font size="-1"><g:label>Leather</g:label><br>
|
||||
* </font> <font size="-1"><g:label>Power locks</g:label><br>
|
||||
*
|
||||
* </font> <font size="-1"><g:label>sunroof</g:label><br>
|
||||
*
|
||||
* </font> <font size="-1"><g:label>ABS</g:label><br>
|
||||
* <br>
|
||||
* </font> <font size="-1"><em>For a concert in an Events information type:</em></font><br>
|
||||
*
|
||||
* <font size="-1"><g:label>VIP</g:label><br>
|
||||
*
|
||||
* </font> <font size="-1"><g:label>front row</g:label><br>
|
||||
* </font> <font size="-1"><g:label>backstage</g:label><br>
|
||||
*
|
||||
* </font>
|
||||
*
|
||||
* <font size="-1"><g:label>KROCK 101.5</g:label><br>
|
||||
* </font> <font size="-1"><g:label>parking passes</g:label><br>
|
||||
* <br>
|
||||
* </font> <font size="-1"><em>Not acceptable:</em><br>
|
||||
*
|
||||
* </font> <font size="-1"><g:label> leater, power locks, sunroof, ABS
|
||||
* </g:label></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120">
|
||||
* <font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td>
|
||||
* <font size="-1">Reference Items, Events, Housing, Jobs, News and Articles, People profiles,
|
||||
* Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120">
|
||||
* <font size="-1"><b>Content type</b></font></td>
|
||||
* <td>
|
||||
*
|
||||
* <font size="-1">string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param labels labels for this entry. Limit 10.
|
||||
*/
|
||||
public void setLabels(String[] labels);
|
||||
|
||||
/**
|
||||
* Labels for this item. <br>
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top">
|
||||
* <font size="-1"><b><a name="label"></a>label</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120">
|
||||
*
|
||||
* <font size="-1"><b>Details</b></font></td>
|
||||
* <td>
|
||||
* <font size="-1">A list of classifications the item may fall under. Up to ten user-selected
|
||||
* label, each placed in between their own <label>
|
||||
*
|
||||
* and </label> tags, can be included with each item. These attributes will be used to
|
||||
* match your items to search queries. Each attribute value will be checked for policy
|
||||
* compliance.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120">
|
||||
* <font size="-1"><b>Example</b></font></td>
|
||||
* <td>
|
||||
*
|
||||
* <font size="-1"><em>Acceptable:<br>
|
||||
* For an automobile in a Vehicles information type:</em><br>
|
||||
* </font>
|
||||
*
|
||||
* <font size="-1"><g:label>Leather</g:label><br>
|
||||
* </font> <font size="-1"><g:label>Power locks</g:label><br>
|
||||
*
|
||||
* </font> <font size="-1"><g:label>sunroof</g:label><br>
|
||||
*
|
||||
* </font> <font size="-1"><g:label>ABS</g:label><br>
|
||||
* <br>
|
||||
* </font> <font size="-1"><em>For a concert in an Events information type:</em></font><br>
|
||||
*
|
||||
* <font size="-1"><g:label>VIP</g:label><br>
|
||||
*
|
||||
* </font> <font size="-1"><g:label>front row</g:label><br>
|
||||
* </font> <font size="-1"><g:label>backstage</g:label><br>
|
||||
*
|
||||
* </font>
|
||||
*
|
||||
* <font size="-1"><g:label>KROCK 101.5</g:label><br>
|
||||
* </font> <font size="-1"><g:label>parking passes</g:label><br>
|
||||
* <br>
|
||||
* </font> <font size="-1"><em>Not acceptable:</em><br>
|
||||
*
|
||||
* </font> <font size="-1"><g:label> leater, power locks, sunroof, ABS
|
||||
* </g:label></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120">
|
||||
* <font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td>
|
||||
* <font size="-1">Reference Items, Events, Housing, Jobs, News and Articles, People profiles,
|
||||
* Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120">
|
||||
* <font size="-1"><b>Content type</b></font></td>
|
||||
* <td>
|
||||
*
|
||||
* <font size="-1">string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return labels for this entry
|
||||
*/
|
||||
public String[] getLabels();
|
||||
}
|
60
src/main/java/com/rometools/modules/base/GoogleBase.java
Normal file
60
src/main/java/com/rometools/modules/base/GoogleBase.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* GoogleBase.java
|
||||
*
|
||||
* Created on November 16, 2005, 4:37 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
|
||||
/**
|
||||
* This is the root interface for the Google Base module.
|
||||
*
|
||||
* <p>
|
||||
* It supports all the individual data "types". If you want to work with, for instance, just the
|
||||
* Article or Job datatype, you can cast it to the respective interface and see only methods related
|
||||
* to a particular entry type.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public interface GoogleBase extends Module, Article, Course, Event, Job, Person, Product, Review, ScholarlyArticle, Service, Travel, Unknown, Vehicle, Wanted,
|
||||
Housing {
|
||||
/** This is the URI for the Google Base Schema. */
|
||||
public static final String URI = "http://base.google.com/ns/1.0";
|
||||
}
|
1444
src/main/java/com/rometools/modules/base/GoogleBaseImpl.java
Normal file
1444
src/main/java/com/rometools/modules/base/GoogleBaseImpl.java
Normal file
File diff suppressed because it is too large
Load diff
1541
src/main/java/com/rometools/modules/base/Housing.java
Normal file
1541
src/main/java/com/rometools/modules/base/Housing.java
Normal file
File diff suppressed because it is too large
Load diff
870
src/main/java/com/rometools/modules/base/Job.java
Normal file
870
src/main/java/com/rometools/modules/base/Job.java
Normal file
|
@ -0,0 +1,870 @@
|
|||
/*
|
||||
* Job.java
|
||||
*
|
||||
* Created on November 16, 2005, 12:39 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import com.rometools.modules.base.types.CurrencyEnumeration;
|
||||
import com.rometools.modules.base.types.PriceTypeEnumeration;
|
||||
|
||||
/**
|
||||
* This is an interface for the GoogleBase plug in that exposes methods used for Job listing entry
|
||||
* types.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public interface Job extends GlobalInterface {
|
||||
/**
|
||||
* Level of education required for an employment position.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="education"></a>education</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Level of education required for an employment position.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1"><g:education>PhD</g:education></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param education Level of education required for an employment position.
|
||||
*/
|
||||
public void setEducation(String education);
|
||||
|
||||
/**
|
||||
* Level of education required for an employment position.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="education"></a>education</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Level of education required for an employment position.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1"><g:education>PhD</g:education></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Level of education required for an employment position.
|
||||
*/
|
||||
public String getEducation();
|
||||
|
||||
/**
|
||||
* Company providing employment.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="employer"></a>employer</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1"> Company providing employment.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"><g:employer>Google, Inc</g:employer></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param employer Company providing employment.
|
||||
*/
|
||||
public void setEmployer(String employer);
|
||||
|
||||
/**
|
||||
* Company providing employment.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="employer"></a>employer</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1"> Company providing employment.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"><g:employer>Google, Inc</g:employer></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Company providing employment.
|
||||
*/
|
||||
public String getEmployer();
|
||||
|
||||
/**
|
||||
* Legal residency requirements for an employment position.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="immigration_status"></a>immigration_status</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Legal residency requirements for an employment position.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"><g:immigration_status>Permanent
|
||||
* resident</g:immigration_status></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param immigrationStatus Legal residency requirements for an employment position.
|
||||
*/
|
||||
public void setImmigrationStatus(String immigrationStatus);
|
||||
|
||||
/**
|
||||
* Legal residency requirements for an employment position.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="immigration_status"></a>immigration_status</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Legal residency requirements for an employment position.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"><g:immigration_status>Permanent
|
||||
* resident</g:immigration_status></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Legal residency requirements for an employment position.
|
||||
*/
|
||||
public String getImmigrationStatus();
|
||||
|
||||
/**
|
||||
* The functions of an employment position.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="job_function"></a>job_function</b></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> The function of an employment position.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:job_function>Product Manager</g:job_function></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param function The functions of an employment position.
|
||||
*/
|
||||
public void setJobFunctions(String[] function);
|
||||
|
||||
/**
|
||||
* The functions of an employment position.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="job_function"></a>job_function</b></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> The function of an employment position.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:job_function>Product Manager</g:job_function></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return The functions of an employment position.
|
||||
*/
|
||||
public String[] getJobFunctions();
|
||||
|
||||
/**
|
||||
* The industry of an employment position.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
|
||||
*
|
||||
* <b><a name="job_industry"></a>job_industry</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> The industry of an employment position.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:job_industry>Government</g:job_industry></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param jobIndustries The industry of an employment position.
|
||||
*/
|
||||
public void setJobIndustries(String[] jobIndustries);
|
||||
|
||||
/**
|
||||
* The industry of an employment position.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
|
||||
*
|
||||
* <b><a name="job_industry"></a>job_industry</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> The industry of an employment position.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:job_industry>Government</g:job_industry></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return The industry of an employment position.
|
||||
*/
|
||||
public String[] getJobIndustries();
|
||||
|
||||
/**
|
||||
* Type of employment position. Example: Full-time, part-time, contractor, etc.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="job_type"></a>job_type</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Type of employment position. Example: Full-time, part-time, contractor,
|
||||
* etc.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:job_type>contractor</g:job_type></font></td>
|
||||
*
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param jobTypes Type of employment position. Example: Full-time, part-time, contractor, etc.
|
||||
*/
|
||||
public void setJobTypes(String[] jobTypes);
|
||||
|
||||
/**
|
||||
* Type of employment position. Example: Full-time, part-time, contractor, etc.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="job_type"></a>job_type</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Type of employment position. Example: Full-time, part-time, contractor,
|
||||
* etc.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:job_type>contractor</g:job_type></font></td>
|
||||
*
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Type of employment position. Example: Full-time, part-time, contractor, etc.
|
||||
*/
|
||||
public String[] getJobTypes();
|
||||
|
||||
/**
|
||||
* Location of the position.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="location"></a>location</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Location of a property. Should include street, city, state, postal code,
|
||||
* and country, in that order. </font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <em>Acceptable:</em><br>
|
||||
* <g:location><st1:place>123 Main St, <st1:city>Anytown</st1:city>,
|
||||
* <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location><br>
|
||||
*
|
||||
* <em>Not acceptable:</em><br>
|
||||
* <g:location><st1:place><st1:city>123</st1:city> Main St,, <st1:state>CA</st1:state>,
|
||||
* <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location><br>
|
||||
* <g:location> <st1:place><st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>,
|
||||
* <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, News and Articles, People
|
||||
* profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> locationType</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param location Location of the position.
|
||||
*/
|
||||
public void setLocation(String location);
|
||||
|
||||
/**
|
||||
* Location of the position.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="location"></a>location</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Location of a property. Should include street, city, state, postal code,
|
||||
* and country, in that order. </font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <em>Acceptable:</em><br>
|
||||
* <g:location><st1:place>123 Main St, <st1:city>Anytown</st1:city>,
|
||||
* <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location><br>
|
||||
*
|
||||
* <em>Not acceptable:</em><br>
|
||||
* <g:location><st1:place><st1:city>123</st1:city> Main St,, <st1:state>CA</st1:state>,
|
||||
* <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location><br>
|
||||
* <g:location> <st1:place><st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>,
|
||||
* <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, News and Articles, People
|
||||
* profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> locationType</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Location of the position.
|
||||
*/
|
||||
public String getLocation();
|
||||
|
||||
/**
|
||||
* Salary for this position. Non-numeric values such as "$" symbols are not acceptable.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="salary"></a>salary</b></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Salary for this position. Non-numeric values such as "$" symbols are not
|
||||
* acceptable. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:salary>55000</g:salary></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* float</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param salary Salary for this position. Non-numeric values such as "$" symbols are not
|
||||
* acceptable.
|
||||
*/
|
||||
public void setSalary(Float salary);
|
||||
|
||||
/**
|
||||
* Salary for this position. Non-numeric values such as "$" symbols are not acceptable.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="salary"></a>salary</b></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Salary for this position. Non-numeric values such as "$" symbols are not
|
||||
* acceptable. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:salary>55000</g:salary></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* float</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Salary for this position. Non-numeric values such as "$" symbols are not acceptable.
|
||||
*/
|
||||
public Float getSalary();
|
||||
|
||||
/**
|
||||
* The type of salary included.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="salary_type"></a>salary_type</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> The type of salary included. Accepted values are <EFBFBD>starting<EFBFBD> or
|
||||
* <EFBFBD>negotiable;<EFBFBD> The default is <EFBFBD>starting at.<EFBFBD></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:salary_type>negotiable</g:salary_type></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* "starting" or "negotiable"</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param salaryType The type of salary included.
|
||||
*/
|
||||
public void setSalaryType(PriceTypeEnumeration salaryType);
|
||||
|
||||
/**
|
||||
* The type of salary included.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="salary_type"></a>salary_type</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> The type of salary included. Accepted values are <EFBFBD>starting<EFBFBD> or
|
||||
* <EFBFBD>negotiable;<EFBFBD> The default is <EFBFBD>starting at.<EFBFBD></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:salary_type>negotiable</g:salary_type></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* "starting" or "negotiable"</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return The type of salary included.
|
||||
*/
|
||||
public PriceTypeEnumeration getSalaryType();
|
||||
|
||||
/**
|
||||
* Currency of the price amount for an item.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="currency"></a>currency</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">Currency of the price amount for an item. Values must be in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/currencycodeslist.html">ISO 4217</a>
|
||||
* currency code format.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"><em>Acceptable:</em><br>
|
||||
* <g:currency>USD</g:currency><br>
|
||||
*
|
||||
* <em>Not acceptable:</em><br>
|
||||
* <g:currency>US Dollars</g:currency></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">Events, Housing, Products, Services, Travel, Vehicles</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1">currencyEnumeration</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param value Currency of the price amount for an item.
|
||||
*/
|
||||
public void setCurrency(CurrencyEnumeration value);
|
||||
|
||||
/**
|
||||
* Currency of the price amount for an item.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="currency"></a>currency</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">Currency of the price amount for an item. Values must be in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/currencycodeslist.html">ISO 4217</a>
|
||||
* currency code format.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"><em>Acceptable:</em><br>
|
||||
* <g:currency>USD</g:currency><br>
|
||||
*
|
||||
* <em>Not acceptable:</em><br>
|
||||
* <g:currency>US Dollars</g:currency></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">Events, Housing, Products, Services, Travel, Vehicles</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1">currencyEnumeration</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Currency of the price amount for an item.
|
||||
*/
|
||||
public CurrencyEnumeration getCurrency();
|
||||
|
||||
}
|
865
src/main/java/com/rometools/modules/base/Person.java
Normal file
865
src/main/java/com/rometools/modules/base/Person.java
Normal file
|
@ -0,0 +1,865 @@
|
|||
/*
|
||||
* Person.java
|
||||
*
|
||||
* Created on November 16, 2005, 1:26 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import com.rometools.modules.base.types.GenderEnumeration;
|
||||
|
||||
/**
|
||||
* This is an interface for the GoogleBase plug in that exposes methods used for Person (personal
|
||||
* ad, resume, profile) entry types.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public interface Person extends GlobalInterface {
|
||||
/**
|
||||
* Age of the individual.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr bgcolor="#dddddd" valign="top">
|
||||
* <td colspan="2" nowrap="nowrap"><font size="-1"><strong><a name="age"></a>age</strong></font>
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><strong><font size="-1">Details</font></strong></td>
|
||||
* <td><font size="-1">Minimum age requirement for the event or the age of the individual in a
|
||||
* People profiles bulk upload entry.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td><strong><font size="-1">Example</font></strong></td>
|
||||
* <td><font size="-1"><em>Acceptable:</em><br>
|
||||
* < g:age>18</g:age><br>
|
||||
* <em>Not acceptable:</em><br>
|
||||
*
|
||||
* < g:age>18 and over</g:age></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td><strong><font size="-1">Attribute of</font></strong></td>
|
||||
* <td><font size="-1">Events, People profiles</font></td>
|
||||
*
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td><strong><font size="-1">Content type</font></strong></td>
|
||||
* <td><font size="-1">integer</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param age Age of the individual.
|
||||
*/
|
||||
public void setAge(Integer age);
|
||||
|
||||
/**
|
||||
* Age of the individual.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr bgcolor="#dddddd" valign="top">
|
||||
* <td colspan="2" nowrap="nowrap"><font size="-1"><strong><a name="age"></a>age</strong></font>
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><strong><font size="-1">Details</font></strong></td>
|
||||
* <td><font size="-1">Minimum age requirement for the event or the age of the individual in a
|
||||
* People profiles bulk upload entry.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td><strong><font size="-1">Example</font></strong></td>
|
||||
* <td><font size="-1"><em>Acceptable:</em><br>
|
||||
* < g:age>18</g:age><br>
|
||||
* <em>Not acceptable:</em><br>
|
||||
*
|
||||
* < g:age>18 and over</g:age></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td><strong><font size="-1">Attribute of</font></strong></td>
|
||||
* <td><font size="-1">Events, People profiles</font></td>
|
||||
*
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td><strong><font size="-1">Content type</font></strong></td>
|
||||
* <td><font size="-1">integer</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Age of the individual.
|
||||
*/
|
||||
public Integer getAge();
|
||||
|
||||
/**
|
||||
* Education of the individual.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="education"></a>education</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Level of education required for an employment position.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1"><g:education>PhD</g:education></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param education Education of the individual.
|
||||
*/
|
||||
public void setEducation(String education);
|
||||
|
||||
/**
|
||||
* Education of the individual.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="education"></a>education</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Level of education required for an employment position.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1"><g:education>PhD</g:education></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Education of the individual.
|
||||
*/
|
||||
public String getEducation();
|
||||
|
||||
/**
|
||||
* Individuals employer.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="employer"></a>employer</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1"> Company providing employment.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"><g:employer>Google, Inc</g:employer></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param employer Individuals employer.
|
||||
*/
|
||||
public void setEmployer(String employer);
|
||||
|
||||
/**
|
||||
* Individuals employer.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="employer"></a>employer</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1"> Company providing employment.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"><g:employer>Google, Inc</g:employer></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Jobs</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Individuals employer.
|
||||
*/
|
||||
public String getEmployer();
|
||||
|
||||
/**
|
||||
* Ethnicity of the individual in the People profiles bulk upload entry.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="ethnicity"></a>ethnicity</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Ethnicity of the individual in the People profiles bulk upload
|
||||
* entry.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1"><g:ethnicity>Latino</g:ethnicity></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> People profiles</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param ethnicities Ethnicity of the individual in the People profiles bulk upload entry.
|
||||
*/
|
||||
public void setEthnicities(String[] ethnicities);
|
||||
|
||||
/**
|
||||
* Ethnicity of the individual in the People profiles bulk upload entry.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="ethnicity"></a>ethnicity</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Ethnicity of the individual in the People profiles bulk upload
|
||||
* entry.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td><font size="-1"><g:ethnicity>Latino</g:ethnicity></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> People profiles</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Ethnicity of the individual in the People profiles bulk upload entry.
|
||||
*/
|
||||
public String[] getEthnicities();
|
||||
|
||||
/**
|
||||
* Gender of an individual in a People profiles bulk upload.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="gender"></a>gender</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Gender of an individual in a People profiles bulk upload item.
|
||||
* Acceptable values are <EFBFBD>Male<EFBFBD>, <EFBFBD>M<EFBFBD>, <EFBFBD>Female<EFBFBD>, or <EFBFBD>F<EFBFBD>.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <gender>Female</gender></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> People profiles</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1"> genderEnumeration</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param gender Gender of an individual in a People profiles bulk upload.
|
||||
*/
|
||||
public void setGender(GenderEnumeration gender);
|
||||
|
||||
/**
|
||||
* Gender of an individual in a People profiles bulk upload.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="gender"></a>gender</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Gender of an individual in a People profiles bulk upload item.
|
||||
* Acceptable values are <EFBFBD>Male<EFBFBD>, <EFBFBD>M<EFBFBD>, <EFBFBD>Female<EFBFBD>, or <EFBFBD>F<EFBFBD>.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <gender>Female</gender></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> People profiles</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1"> genderEnumeration</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Gender of an individual in a People profiles bulk upload.
|
||||
*/
|
||||
public GenderEnumeration getGender();
|
||||
|
||||
/**
|
||||
* Interest of a person being profiled.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="interested_in"></a>interested_in</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1"> Interest of a person being profiled.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:interested_in>Long walks on the
|
||||
* beach.</g:interested_in></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">People profiles</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param interestedIn Interest of a person being profiled.
|
||||
*/
|
||||
public void setInterestedIn(String[] interestedIn);
|
||||
|
||||
/**
|
||||
* Interest of a person being profiled.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="interested_in"></a>interested_in</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1"> Interest of a person being profiled.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:interested_in>Long walks on the
|
||||
* beach.</g:interested_in></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">People profiles</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Interest of a person being profiled.
|
||||
*/
|
||||
public String[] getInterestedIn();
|
||||
|
||||
/**
|
||||
* Location of a person.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="location"></a>location</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Location of a property. Should include street, city, state, postal code,
|
||||
* and country, in that order. </font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <em>Acceptable:</em><br>
|
||||
* <g:location><st1:place>123 Main St, <st1:city>Anytown</st1:city>,
|
||||
* <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location><br>
|
||||
*
|
||||
* <em>Not acceptable:</em><br>
|
||||
* <g:location><st1:place><st1:city>123</st1:city> Main St,, <st1:state>CA</st1:state>,
|
||||
* <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location><br>
|
||||
* <g:location> <st1:place><st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>,
|
||||
* <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, News and Articles, People
|
||||
* profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> locationType</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param location Location of a person.
|
||||
*/
|
||||
public void setLocation(String location);
|
||||
|
||||
/**
|
||||
* Location of a person.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="location"></a>location</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Location of a property. Should include street, city, state, postal code,
|
||||
* and country, in that order. </font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <em>Acceptable:</em><br>
|
||||
* <g:location><st1:place>123 Main St, <st1:city>Anytown</st1:city>,
|
||||
* <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location><br>
|
||||
*
|
||||
* <em>Not acceptable:</em><br>
|
||||
* <g:location><st1:place><st1:city>123</st1:city> Main St,, <st1:state>CA</st1:state>,
|
||||
* <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location><br>
|
||||
* <g:location> <st1:place><st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>,
|
||||
* <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, News and Articles, People
|
||||
* profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> locationType</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Location of a person.
|
||||
*/
|
||||
public String getLocation();
|
||||
|
||||
/**
|
||||
* Marital status of an individual.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="marital_status"></a>marital_status</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Marital status of an individual in a People profiles bulk upload entry.
|
||||
* For example -single, divorced, separated, widowed, married, and <EFBFBD>in relationship.<EFBFBD></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:marital_status>single</g:marital_status><br>
|
||||
*
|
||||
* </font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> People profiles</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param maritalStatus Marital status of an individual.
|
||||
*/
|
||||
public void setMaritalStatus(String maritalStatus);
|
||||
|
||||
/**
|
||||
* Marital status of an individual.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="marital_status"></a>marital_status</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Marital status of an individual in a People profiles bulk upload entry.
|
||||
* For example -single, divorced, separated, widowed, married, and <EFBFBD>in relationship.<EFBFBD></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:marital_status>single</g:marital_status><br>
|
||||
*
|
||||
* </font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> People profiles</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Marital status of an individual.
|
||||
*/
|
||||
public String getMaritalStatus();
|
||||
|
||||
/**
|
||||
* Occupation of an individual.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="occupation"></a>occupation</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Industry the individual in a People profiles bulk upload is employed
|
||||
* in.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:occupation>Sales</g:occupation></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* People profiles</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param occupation Occupation of an individual.
|
||||
*/
|
||||
public void setOccupation(String occupation);
|
||||
|
||||
/**
|
||||
* Occupation of an individual.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="occupation"></a>occupation</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Industry the individual in a People profiles bulk upload is employed
|
||||
* in.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:occupation>Sales</g:occupation></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* People profiles</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Occupation of an individual.
|
||||
*/
|
||||
public String getOccupation();
|
||||
|
||||
/**
|
||||
* Individual's sexual orientation.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="sexual_orientation"></a>sexual_orientation</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Sexual orientation of an individual in a People profiles information
|
||||
* type..</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:sexual_orientation>straight</g:sexual_orientation></font>
|
||||
* </td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* Personal</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param sexualOrientation Individual's sexual orientation.
|
||||
*/
|
||||
public void setSexualOrientation(String sexualOrientation);
|
||||
|
||||
/**
|
||||
* Individual's sexual orientation.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="sexual_orientation"></a>sexual_orientation</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Sexual orientation of an individual in a People profiles information
|
||||
* type..</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:sexual_orientation>straight</g:sexual_orientation></font>
|
||||
* </td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* Personal</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Individual's sexual orientation.
|
||||
*/
|
||||
public String getSexualOrientation();
|
||||
}
|
2742
src/main/java/com/rometools/modules/base/Product.java
Normal file
2742
src/main/java/com/rometools/modules/base/Product.java
Normal file
File diff suppressed because it is too large
Load diff
798
src/main/java/com/rometools/modules/base/Review.java
Normal file
798
src/main/java/com/rometools/modules/base/Review.java
Normal file
|
@ -0,0 +1,798 @@
|
|||
/*
|
||||
* Review.java
|
||||
*
|
||||
* Created on November 16, 2005, 1:58 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
|
||||
import com.rometools.modules.base.types.FloatUnit;
|
||||
|
||||
/**
|
||||
* This is an interface for the GoogleBase plug in that exposes methods used for critical reviews of
|
||||
* other things.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public interface Review extends GlobalInterface {
|
||||
/**
|
||||
* Author of the item.
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="author"></a>author</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Author of the item.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:author>John Steinbeck</g:author></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, News and Articles</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param authors Author of the item.
|
||||
*/
|
||||
public void setAuthors(String[] authors);
|
||||
|
||||
/**
|
||||
* Author of the item.
|
||||
*
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="author"></a>author</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Author of the item.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:author>John Steinbeck</g:author></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, News and Articles</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Author of the item.
|
||||
*/
|
||||
public String[] getAuthors();
|
||||
|
||||
/**
|
||||
* Additional instructions to explain the item’s delivery process.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="delivery_notes"></a>delivery_notes</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">Additional instructions to explain the item’s delivery process.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td>
|
||||
* <font size="-1"><g:delivery_notes>Items usually shipped within 24
|
||||
* hours.<g:/delivery_notes><br>
|
||||
*
|
||||
* </font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td>
|
||||
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted Ads. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param deliveryNotes Additional instructions to explain the item’s delivery process.
|
||||
*/
|
||||
public void setDeliveryNotes(String deliveryNotes);
|
||||
|
||||
/**
|
||||
* Additional instructions to explain the item’s delivery process.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="delivery_notes"></a>delivery_notes</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">Additional instructions to explain the item’s delivery process.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td>
|
||||
* <font size="-1"><g:delivery_notes>Items usually shipped within 24
|
||||
* hours.<g:/delivery_notes><br>
|
||||
*
|
||||
* </font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td>
|
||||
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted Ads. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Additional instructions to explain the item’s delivery process.
|
||||
*/
|
||||
public String getDeliveryNotes();
|
||||
|
||||
/**
|
||||
* The maximum distance you will deliver an item in any direction.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="delivery_radius"></a>delivery_radius</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1">The maximum distance you will deliver an item in any direction. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td>
|
||||
* <font size="-1"><g:delivery_radius>10<g:/delivery_radius> </font> <br>
|
||||
* <font size="-1"><g:delivery_radius>10km</g:delivery_radius></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td>
|
||||
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted Ads. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1">floatUnit</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param deliveryRadius The maximum distance you will deliver an item in any direction.
|
||||
*/
|
||||
public void setDeliveryRadius(FloatUnit deliveryRadius);
|
||||
|
||||
/**
|
||||
* The maximum distance you will deliver an item in any direction.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="delivery_radius"></a>delivery_radius</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1">The maximum distance you will deliver an item in any direction. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td>
|
||||
* <font size="-1"><g:delivery_radius>10<g:/delivery_radius> </font> <br>
|
||||
* <font size="-1"><g:delivery_radius>10km</g:delivery_radius></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td>
|
||||
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted Ads. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1">floatUnit</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return The maximum distance you will deliver an item in any direction.
|
||||
*/
|
||||
public FloatUnit getDeliveryRadius();
|
||||
|
||||
/**
|
||||
* The name of an item being reviewed.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="name_of_item_being_reviewed"></a>name_of_item_being_reviewed</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* The name of an item being reviewed.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:name_of_item_being__reviewed>Fleur de lys
|
||||
* Restaurant</g:name_of_item_being_reviewed></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reviews</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param nameOfItemBeingReviewed The name of an item being reviewed.
|
||||
*/
|
||||
public void setNameOfItemBeingReviewed(String nameOfItemBeingReviewed);
|
||||
|
||||
/**
|
||||
* The name of an item being reviewed.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="name_of_item_being_reviewed"></a>name_of_item_being_reviewed</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* The name of an item being reviewed.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:name_of_item_being__reviewed>Fleur de lys
|
||||
* Restaurant</g:name_of_item_being_reviewed></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reviews</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return The name of an item being reviewed.
|
||||
*/
|
||||
public String getNameOfItemBeingReviewed();
|
||||
|
||||
/**
|
||||
* Date the item was published.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="publish_date"></a>publish_date</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Date the item was published in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>
|
||||
* format: YYYY-MM-DD</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:publish_date>2005-12-20</g:publish_date></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* Reference Items</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> date</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param publishDate Date the item was published.
|
||||
*/
|
||||
public void setPublishDate(Date publishDate);
|
||||
|
||||
/**
|
||||
* Date the item was published.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="publish_date"></a>publish_date</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Date the item was published in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>
|
||||
* format: YYYY-MM-DD</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:publish_date>2005-12-20</g:publish_date></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* Reference Items</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> date</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Date the item was published.
|
||||
*/
|
||||
public Date getPublishDate();
|
||||
|
||||
/**
|
||||
* Rating of the product or service on a scale of 1-5, with 5 as the best.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="rating"></a>rating</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Rating of the product or service on a scale of 1-5, with 5 as the best.
|
||||
* Numeric values only.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <em>Acceptable:</em><br>
|
||||
* <g:rating>4</g:rating><br>
|
||||
*
|
||||
* <em>Not acceptable:</em><br>
|
||||
*
|
||||
* <g:rating>good</g:rating></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reviews</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param rating Rating of the product or service on a scale of 1-5, with 5 as the best.
|
||||
*/
|
||||
public void setRating(Float rating);
|
||||
|
||||
/**
|
||||
* Rating of the product or service on a scale of 1-5, with 5 as the best.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="rating"></a>rating</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Rating of the product or service on a scale of 1-5, with 5 as the best.
|
||||
* Numeric values only.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <em>Acceptable:</em><br>
|
||||
* <g:rating>4</g:rating><br>
|
||||
*
|
||||
* <em>Not acceptable:</em><br>
|
||||
*
|
||||
* <g:rating>good</g:rating></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reviews</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Rating of the product or service on a scale of 1-5, with 5 as the best.
|
||||
*/
|
||||
public Float getRating();
|
||||
|
||||
/**
|
||||
* The category of the item being reviewed.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="review_type"></a>review_type</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> The category of the item being reviewed.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:review_type>toy</g:review_type><br>
|
||||
*
|
||||
* <g:review_type>music</g:review_type><br>
|
||||
* <g:review_type>restaraunt</g:review_type></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reviews</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param reviewType The category of the item being reviewed.
|
||||
*/
|
||||
public void setReviewType(String reviewType);
|
||||
|
||||
/**
|
||||
* The category of the item being reviewed.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="review_type"></a>review_type</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> The category of the item being reviewed.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:review_type>toy</g:review_type><br>
|
||||
*
|
||||
* <g:review_type>music</g:review_type><br>
|
||||
* <g:review_type>restaraunt</g:review_type></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reviews</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return The category of the item being reviewed.
|
||||
*/
|
||||
public String getReviewType();
|
||||
|
||||
/**
|
||||
* The type of rating being provided: editorial (a review written by a member of your staff) or
|
||||
* “user” ( a review written by a user of your site).
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="reviewer_type"></a>reviewer_type</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> The type of rating being provided: editorial (a review written by a
|
||||
* member of your staff) or “user” ( a review written by a user of your site)</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:reviewer_type>editorial</g:reviewer_type></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reviews</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param reviewerType The type of rating being provided: editorial (a review written by a
|
||||
* member of your staff) or “user” ( a review written by a user of your site).
|
||||
*/
|
||||
public void setReviewerType(String reviewerType);
|
||||
|
||||
/**
|
||||
* The type of rating being provided: editorial (a review written by a member of your staff) or
|
||||
* “user” ( a review written by a user of your site).
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="reviewer_type"></a>reviewer_type</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> The type of rating being provided: editorial (a review written by a
|
||||
* member of your staff) or “user” ( a review written by a user of your site)</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:reviewer_type>editorial</g:reviewer_type></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reviews</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return The type of rating being provided: editorial (a review written by a member of your
|
||||
* staff) or “user” ( a review written by a user of your site).
|
||||
*/
|
||||
public String getReviewerType();
|
||||
|
||||
/**
|
||||
* The web page of an item being reviewed.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="url_of_item_being_reviewed"></a>url_of_item_being_reviewed</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
* <td><font size="-1"> The web page of an item being reviewed.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:url_of_item_being_reviewed>http://www.fleurdelyssf.com/</g:
|
||||
* url_of_item_being_reviewed></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* Reviews</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> uri</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param urlOfItemBeingReviewed The web page of an item being reviewed.
|
||||
*/
|
||||
public void setUrlOfItemBeingReviewed(URL urlOfItemBeingReviewed);
|
||||
|
||||
/**
|
||||
* The web page of an item being reviewed.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="url_of_item_being_reviewed"></a>url_of_item_being_reviewed</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
* <td><font size="-1"> The web page of an item being reviewed.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <g:url_of_item_being_reviewed>http://www.fleurdelyssf.com/</g:
|
||||
* url_of_item_being_reviewed></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* Reviews</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> uri</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return The web page of an item being reviewed.
|
||||
*/
|
||||
public URL getUrlOfItemBeingReviewed();
|
||||
}
|
463
src/main/java/com/rometools/modules/base/ScholarlyArticle.java
Normal file
463
src/main/java/com/rometools/modules/base/ScholarlyArticle.java
Normal file
|
@ -0,0 +1,463 @@
|
|||
/*
|
||||
* ScholarlyArticle.java
|
||||
*
|
||||
* Created on November 16, 2005, 1:55 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* This is an interface for the GoogleBase plug in that exposes methods used for Scholarly
|
||||
* publication, research studies and reference materials.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public interface ScholarlyArticle extends GlobalInterface {
|
||||
/**
|
||||
* Array of Author Names. Limit 10.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="author"></a>author</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Author of the item.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:author>John Steinbeck</g:author></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, News and Articles</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param authors Array of Author Names. Limit 10.
|
||||
*/
|
||||
public void setAuthors(String[] authors);
|
||||
|
||||
/**
|
||||
* Array of Author Names. Limit 10.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="author"></a>author</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Author of the item.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:author>John Steinbeck</g:author></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, News and Articles</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Array of author names.
|
||||
*/
|
||||
public String[] getAuthors();
|
||||
|
||||
/**
|
||||
* Number of pages in the article.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="pages"></a>pages</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* The number of pages in the publication.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:pages>18</g:pages></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, News and Articles</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> integer</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param pages Number of pages in the article
|
||||
*/
|
||||
public void setPages(Integer pages);
|
||||
|
||||
/**
|
||||
* Number of pages in the article.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="pages"></a>pages</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* The number of pages in the publication.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:pages>18</g:pages></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, News and Articles</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> integer</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Number of pages in the article
|
||||
*/
|
||||
public Integer getPages();
|
||||
|
||||
/**
|
||||
* Name of the publication.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="publication_name"></a>publication_name</b></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* Name of the publication.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:publication_name> Journal of Appropriate
|
||||
* Technology</g:publication_name></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Research studies and publications</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param publicationName Name of the publication.
|
||||
*/
|
||||
public void setPublicationName(String publicationName);
|
||||
|
||||
/**
|
||||
* Name of the publication.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
*
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="publication_name"></a>publication_name</b></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* Name of the publication.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:publication_name> Journal of Appropriate
|
||||
* Technology</g:publication_name></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Research studies and publications</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Name of the publication.
|
||||
*/
|
||||
public String getPublicationName();
|
||||
|
||||
/**
|
||||
* Volume of the publication.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="publication_volume"></a>publication_volume</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* Volume of the publication.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"><g:publication_volume>VI</g:publication_volume></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param publicationVolume Volume of the publication.
|
||||
*/
|
||||
public void setPublicationVolume(String publicationVolume);
|
||||
|
||||
/**
|
||||
* Volume of the publication.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="publication_volume"></a>publication_volume</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* Volume of the publication.</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
* <td><font size="-1"><g:publication_volume>VI</g:publication_volume></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Volume of the publication.
|
||||
*/
|
||||
public String getPublicationVolume();
|
||||
|
||||
/**
|
||||
* Date article was published.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="publish_date"></a>publish_date</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Date the item was published in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>
|
||||
* format: YYYY-MM-DD</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:publish_date>2005-12-20</g:publish_date></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reference Items</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* date</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param publishDate Date article was published
|
||||
*/
|
||||
public void setPublishDate(Date publishDate);
|
||||
|
||||
/**
|
||||
* Date article was published.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd"><font size="-1"> <b><a
|
||||
* name="publish_date"></a>publish_date</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Date the item was published in <a
|
||||
* href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>
|
||||
* format: YYYY-MM-DD</font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Example</b></font></td>
|
||||
* <td><font size="-1"> <g:publish_date>2005-12-20</g:publish_date></font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> Reference Items</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1">
|
||||
*
|
||||
* <b>Content type</b></font></td>
|
||||
* <td><font size="-1">
|
||||
*
|
||||
* date</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Date article was published
|
||||
*/
|
||||
public Date getPublishDate();
|
||||
}
|
1232
src/main/java/com/rometools/modules/base/Service.java
Normal file
1232
src/main/java/com/rometools/modules/base/Service.java
Normal file
File diff suppressed because it is too large
Load diff
1352
src/main/java/com/rometools/modules/base/Travel.java
Normal file
1352
src/main/java/com/rometools/modules/base/Travel.java
Normal file
File diff suppressed because it is too large
Load diff
76
src/main/java/com/rometools/modules/base/Unknown.java
Normal file
76
src/main/java/com/rometools/modules/base/Unknown.java
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* Unknown.java
|
||||
*
|
||||
* Created on November 18, 2005, 1:34 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import com.rometools.modules.base.types.IntUnit;
|
||||
|
||||
/**
|
||||
* This interface contains all the other schema elements that the document doesn't associate with a
|
||||
* particular type.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public interface Unknown extends GlobalInterface {
|
||||
public void setLicenses(String[] licenses);
|
||||
|
||||
public String[] getLicenses();
|
||||
|
||||
public void setOperatingSystems(String systems);
|
||||
|
||||
public String getOperatingSystems();
|
||||
|
||||
public void setProgrammingLanguages(String[] languages);
|
||||
|
||||
public String[] getProgrammingLanguages();
|
||||
|
||||
public void setRelatedLinks(URL[] links);
|
||||
|
||||
public URL[] getRelatedLinks();
|
||||
|
||||
public void setSquareFootages(IntUnit[] squareFootages);
|
||||
|
||||
public IntUnit[] getSquareFootages();
|
||||
|
||||
public void setSubjectAreas(String[] subjectAreas);
|
||||
|
||||
public String[] getSubjectAreas();
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* ValidationException.java
|
||||
*
|
||||
* Created on November 20, 2005, 3:14 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.base;
|
||||
|
||||
/**
|
||||
* This is an unchecked exception that is thrown when a data value violates the Google Schema
|
||||
* limits.
|
||||
*
|
||||
* @version $Revision: 1.1 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class ValidationException extends RuntimeException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** Creates a new instance of ValidationException */
|
||||
public ValidationException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
1827
src/main/java/com/rometools/modules/base/Vehicle.java
Normal file
1827
src/main/java/com/rometools/modules/base/Vehicle.java
Normal file
File diff suppressed because it is too large
Load diff
309
src/main/java/com/rometools/modules/base/Wanted.java
Normal file
309
src/main/java/com/rometools/modules/base/Wanted.java
Normal file
|
@ -0,0 +1,309 @@
|
|||
/*
|
||||
* Wanted.java
|
||||
*
|
||||
* Created on November 16, 2005, 3:32 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base;
|
||||
|
||||
import com.rometools.modules.base.types.FloatUnit;
|
||||
|
||||
/**
|
||||
* This is an interface for the GoogleBase plug in that exposes methods used for wanted ads.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public interface Wanted extends GlobalInterface {
|
||||
/**
|
||||
* Additional instructions to explain the item’s delivery process.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="delivery_notes"></a>delivery_notes</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">Additional instructions to explain the item’s delivery process.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td>
|
||||
* <font size="-1"><g:delivery_notes>Items usually shipped within 24
|
||||
* hours.<g:/delivery_notes><br>
|
||||
*
|
||||
* </font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td>
|
||||
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted Ads. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param deliveryNotes Additional instructions to explain the item’s delivery process.
|
||||
*/
|
||||
public void setDeliveryNotes(String deliveryNotes);
|
||||
|
||||
/**
|
||||
* Additional instructions to explain the item’s delivery process.
|
||||
*
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="delivery_notes"></a>delivery_notes</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">Additional instructions to explain the item’s delivery process.</font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
* <td>
|
||||
* <font size="-1"><g:delivery_notes>Items usually shipped within 24
|
||||
* hours.<g:/delivery_notes><br>
|
||||
*
|
||||
* </font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
* <td>
|
||||
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted Ads. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
*
|
||||
* <td><font size="-1">string</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Additional instructions to explain the item’s delivery process.
|
||||
*/
|
||||
public String getDeliveryNotes();
|
||||
|
||||
/**
|
||||
* The maximum distance you will deliver an item in any direction.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="delivery_radius"></a>delivery_radius</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1">The maximum distance you will deliver an item in any direction. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td>
|
||||
* <font size="-1"><g:delivery_radius>10<g:/delivery_radius> </font> <br>
|
||||
* <font size="-1"><g:delivery_radius>10km</g:delivery_radius></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td>
|
||||
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted Ads. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1">floatUnit</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param deliveryRadius The maximum distance you will deliver an item in any direction.
|
||||
*/
|
||||
public void setDeliveryRadius(FloatUnit deliveryRadius);
|
||||
|
||||
/**
|
||||
* The maximum distance you will deliver an item in any direction.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"><b><a
|
||||
* name="delivery_radius"></a>delivery_radius</b></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Details</b></font></td>
|
||||
* <td><font size="-1">The maximum distance you will deliver an item in any direction. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Example</b></font></td>
|
||||
*
|
||||
* <td>
|
||||
* <font size="-1"><g:delivery_radius>10<g:/delivery_radius> </font> <br>
|
||||
* <font size="-1"><g:delivery_radius>10km</g:delivery_radius></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Attribute of</b></font></td>
|
||||
*
|
||||
* <td>
|
||||
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted Ads. </font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"><b>Content type</b></font></td>
|
||||
* <td><font size="-1">floatUnit</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return The maximum distance you will deliver an item in any direction.
|
||||
*/
|
||||
public FloatUnit getDeliveryRadius();
|
||||
|
||||
/**
|
||||
* Location of the property.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="location"></a>location</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Location of a property. Should include street, city, state, postal code,
|
||||
* and country, in that order. </font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <em>Acceptable:</em><br>
|
||||
* <g:location><st1:place>123 Main St, <st1:city>Anytown</st1:city>,
|
||||
* <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location><br>
|
||||
*
|
||||
* <em>Not acceptable:</em><br>
|
||||
* <g:location><st1:place><st1:city>123</st1:city> Main St,, <st1:state>CA</st1:state>,
|
||||
* <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location><br>
|
||||
* <g:location> <st1:place><st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>,
|
||||
* <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, News and Articles, People
|
||||
* profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> locationType</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @param location Location of the property.
|
||||
*/
|
||||
public void setLocation(String location);
|
||||
|
||||
/**
|
||||
* Location of the property.
|
||||
* <table border="1" cellpadding="5" cellspacing="0" width="640">
|
||||
* <tbody>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1"> <b><a
|
||||
* name="location"></a>location</b></font></td>
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Details</b></font></td>
|
||||
* <td><font size="-1"> Location of a property. Should include street, city, state, postal code,
|
||||
* and country, in that order. </font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Example</b></font></td>
|
||||
*
|
||||
* <td><font size="-1"> <em>Acceptable:</em><br>
|
||||
* <g:location><st1:place>123 Main St, <st1:city>Anytown</st1:city>,
|
||||
* <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location><br>
|
||||
*
|
||||
* <em>Not acceptable:</em><br>
|
||||
* <g:location><st1:place><st1:city>123</st1:city> Main St,, <st1:state>CA</st1:state>,
|
||||
* <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location><br>
|
||||
* <g:location> <st1:place><st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>,
|
||||
* <st1:postalcode>12345</st1:postalcode>,
|
||||
* <st1:country-region>USA</st1:country-region></st1:place></g:location></font></td>
|
||||
*
|
||||
* </tr>
|
||||
* <tr valign="top">
|
||||
* <td width="120"><font size="-1"> <b>Attribute of</b></font></td>
|
||||
* <td><font size="-1"> Reference Items, Events, Housing, Jobs, News and Articles, People
|
||||
* profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr valign="top">
|
||||
*
|
||||
* <td width="120"><font size="-1"> <b>Content type</b></font></td>
|
||||
* <td><font size="-1"> locationType</font></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @return Location of the property.
|
||||
*/
|
||||
public String getLocation();
|
||||
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* CustomTagGenerator.java
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2006 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.io;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
||||
import com.rometools.modules.base.CustomTag;
|
||||
import com.rometools.modules.base.CustomTagImpl;
|
||||
import com.rometools.modules.base.CustomTags;
|
||||
import com.rometools.modules.base.types.DateTimeRange;
|
||||
import com.rometools.modules.base.types.FloatUnit;
|
||||
import com.rometools.modules.base.types.IntUnit;
|
||||
import com.rometools.modules.base.types.ShortDate;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleGenerator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.1 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class CustomTagGenerator implements ModuleGenerator {
|
||||
|
||||
static final HashSet<Namespace> NAMESPACES = new HashSet<Namespace>();
|
||||
|
||||
static {
|
||||
NAMESPACES.add(CustomTagParser.NS);
|
||||
}
|
||||
|
||||
/** Creates a new instance of CustomTagGenerator */
|
||||
public CustomTagGenerator() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return CustomTags.URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Namespace> getNamespaces() {
|
||||
return NAMESPACES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(final Module module, final Element element) {
|
||||
if (!(module instanceof CustomTags)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final List<CustomTag> tags = ((CustomTags) module).getValues();
|
||||
final Iterator<CustomTag> it = tags.iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
final CustomTag tag = it.next();
|
||||
|
||||
if (tag.getValue() instanceof DateTimeRange) {
|
||||
final DateTimeRange dtr = (DateTimeRange) tag.getValue();
|
||||
final Element newTag = new Element(tag.getName(), CustomTagParser.NS);
|
||||
newTag.setAttribute("type", "dateTimeRange");
|
||||
newTag.addContent(generateSimpleElement("start", GoogleBaseParser.LONG_DT_FMT.format(dtr.getStart())));
|
||||
newTag.addContent(generateSimpleElement("end", GoogleBaseParser.LONG_DT_FMT.format(dtr.getEnd())));
|
||||
element.addContent(newTag);
|
||||
} else if (tag.getValue() instanceof ShortDate) {
|
||||
final ShortDate sd = (ShortDate) tag.getValue();
|
||||
final Element newTag = generateSimpleElement(tag.getName(), GoogleBaseParser.SHORT_DT_FMT.format(sd));
|
||||
newTag.setAttribute("type", "date");
|
||||
element.addContent(newTag);
|
||||
} else if (tag.getValue() instanceof Date) {
|
||||
final Date d = (Date) tag.getValue();
|
||||
final Element newTag = generateSimpleElement(tag.getName(), GoogleBaseParser.SHORT_DT_FMT.format(d));
|
||||
newTag.setAttribute("type", "dateTime");
|
||||
element.addContent(newTag);
|
||||
} else if (tag.getValue() instanceof Integer) {
|
||||
final Element newTag = generateSimpleElement(tag.getName(), tag.getValue().toString());
|
||||
newTag.setAttribute("type", "int");
|
||||
element.addContent(newTag);
|
||||
} else if (tag.getValue() instanceof IntUnit) {
|
||||
final Element newTag = generateSimpleElement(tag.getName(), tag.getValue().toString());
|
||||
newTag.setAttribute("type", "intUnit");
|
||||
element.addContent(newTag);
|
||||
} else if (tag.getValue() instanceof Float) {
|
||||
final Element newTag = generateSimpleElement(tag.getName(), tag.getValue().toString());
|
||||
newTag.setAttribute("type", "float");
|
||||
element.addContent(newTag);
|
||||
} else if (tag.getValue() instanceof FloatUnit) {
|
||||
final Element newTag = generateSimpleElement(tag.getName(), tag.getValue().toString());
|
||||
newTag.setAttribute("type", "floatUnit");
|
||||
element.addContent(newTag);
|
||||
} else if (tag.getValue() instanceof String) {
|
||||
final Element newTag = generateSimpleElement(tag.getName(), tag.getValue().toString());
|
||||
newTag.setAttribute("type", "string");
|
||||
element.addContent(newTag);
|
||||
} else if (tag.getValue() instanceof URL) {
|
||||
final Element newTag = generateSimpleElement(tag.getName(), tag.getValue().toString());
|
||||
newTag.setAttribute("type", "url");
|
||||
element.addContent(newTag);
|
||||
} else if (tag.getValue() instanceof Boolean) {
|
||||
final Element newTag = generateSimpleElement(tag.getName(), tag.getValue().toString());
|
||||
newTag.setAttribute("type", "boolean");
|
||||
element.addContent(newTag);
|
||||
} else if (tag.getValue() instanceof CustomTagImpl.Location) {
|
||||
final Element newTag = generateSimpleElement(tag.getName(), tag.getValue().toString());
|
||||
newTag.setAttribute("type", "location");
|
||||
element.addContent(newTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Element generateSimpleElement(final String name, final String value) {
|
||||
final Element element = new Element(name, CustomTagParser.NS);
|
||||
element.addContent(value);
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
148
src/main/java/com/rometools/modules/base/io/CustomTagParser.java
Normal file
148
src/main/java/com/rometools/modules/base/io/CustomTagParser.java
Normal file
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
* CustomTagParser.java
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2006 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.base.io;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.rometools.modules.base.CustomTag;
|
||||
import com.rometools.modules.base.CustomTagImpl;
|
||||
import com.rometools.modules.base.CustomTags;
|
||||
import com.rometools.modules.base.CustomTagsImpl;
|
||||
import com.rometools.modules.base.types.DateTimeRange;
|
||||
import com.rometools.modules.base.types.FloatUnit;
|
||||
import com.rometools.modules.base.types.IntUnit;
|
||||
import com.rometools.modules.base.types.ShortDate;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleParser;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.4 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class CustomTagParser implements ModuleParser {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CustomTagParser.class);
|
||||
|
||||
static final Namespace NS = Namespace.getNamespace("g-custom", CustomTags.URI);
|
||||
|
||||
/** Creates a new instance of CustomTagParser */
|
||||
public CustomTagParser() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module parse(final Element element, final Locale locale) {
|
||||
final CustomTags module = new CustomTagsImpl();
|
||||
final ArrayList<CustomTag> tags = new ArrayList<CustomTag>();
|
||||
final List<Element> elements = element.getChildren();
|
||||
final Iterator<Element> it = elements.iterator();
|
||||
while (it.hasNext()) {
|
||||
final Element child = it.next();
|
||||
if (child.getNamespace().equals(NS)) {
|
||||
final String type = child.getAttributeValue("type");
|
||||
try {
|
||||
if (type == null) {
|
||||
continue;
|
||||
} else if (type.equals("string")) {
|
||||
tags.add(new CustomTagImpl(child.getName(), child.getText()));
|
||||
} else if (type.equals("int")) {
|
||||
tags.add(new CustomTagImpl(child.getName(), new Integer(child.getTextTrim())));
|
||||
} else if (type.equals("float")) {
|
||||
tags.add(new CustomTagImpl(child.getName(), new Float(child.getTextTrim())));
|
||||
} else if (type.equals("intUnit")) {
|
||||
tags.add(new CustomTagImpl(child.getName(), new IntUnit(child.getTextTrim())));
|
||||
} else if (type.equals("floatUnit")) {
|
||||
tags.add(new CustomTagImpl(child.getName(), new FloatUnit(child.getTextTrim())));
|
||||
} else if (type.equals("date")) {
|
||||
try {
|
||||
tags.add(new CustomTagImpl(child.getName(), new ShortDate(GoogleBaseParser.SHORT_DT_FMT.parse(child.getTextTrim()))));
|
||||
} catch (final ParseException e) {
|
||||
LOG.warn("Unable to parse date type on " + child.getName(), e);
|
||||
}
|
||||
} else if (type.equals("dateTime")) {
|
||||
try {
|
||||
tags.add(new CustomTagImpl(child.getName(), GoogleBaseParser.LONG_DT_FMT.parse(child.getTextTrim())));
|
||||
} catch (final ParseException e) {
|
||||
LOG.warn("Unable to parse date type on " + child.getName(), e);
|
||||
}
|
||||
} else if (type.equals("dateTimeRange")) {
|
||||
try {
|
||||
tags.add(new CustomTagImpl(child.getName(), new DateTimeRange(GoogleBaseParser.LONG_DT_FMT.parse(child
|
||||
.getChild("start", CustomTagParser.NS).getText().trim()), GoogleBaseParser.LONG_DT_FMT.parse(child
|
||||
.getChild("end", CustomTagParser.NS).getText().trim()))));
|
||||
} catch (final Exception e) {
|
||||
LOG.warn("Unable to parse date type on " + child.getName(), e);
|
||||
}
|
||||
} else if (type.equals("url")) {
|
||||
try {
|
||||
tags.add(new CustomTagImpl(child.getName(), new URL(child.getTextTrim())));
|
||||
} catch (final MalformedURLException e) {
|
||||
LOG.warn("Unable to parse URL type on " + child.getName(), e);
|
||||
}
|
||||
} else if (type.equals("boolean")) {
|
||||
tags.add(new CustomTagImpl(child.getName(), new Boolean(child.getTextTrim().toLowerCase())));
|
||||
} else if (type.equals("location")) {
|
||||
tags.add(new CustomTagImpl(child.getName(), new CustomTagImpl.Location(child.getText())));
|
||||
} else {
|
||||
throw new Exception("Unknown type: " + type);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
LOG.warn("Unable to parse type on " + child.getName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.setValues(tags);
|
||||
return module;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return CustomTags.URI;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* GoogleBaseGenerator.java
|
||||
*
|
||||
* Created on November 17, 2005, 2:46 PM
|
||||
*
|
||||
* This library is provided under dual licenses. You may choose the terms of the Lesser General
|
||||
* Public License or the Apache License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU Lesser General Public License as published by the Free Software Foundation; either version
|
||||
* 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with this library;
|
||||
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.rometools.modules.base.io;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.rometools.modules.base.GoogleBase;
|
||||
import com.rometools.modules.base.GoogleBaseImpl;
|
||||
import com.rometools.modules.base.types.CurrencyEnumeration;
|
||||
import com.rometools.modules.base.types.DateTimeRange;
|
||||
import com.rometools.modules.base.types.FloatUnit;
|
||||
import com.rometools.modules.base.types.GenderEnumeration;
|
||||
import com.rometools.modules.base.types.IntUnit;
|
||||
import com.rometools.modules.base.types.PaymentTypeEnumeration;
|
||||
import com.rometools.modules.base.types.PriceTypeEnumeration;
|
||||
import com.rometools.modules.base.types.ShippingType;
|
||||
import com.rometools.modules.base.types.ShortDate;
|
||||
import com.rometools.modules.base.types.Size;
|
||||
import com.rometools.modules.base.types.YearType;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleGenerator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public class GoogleBaseGenerator implements ModuleGenerator {
|
||||
private static final Namespace NS = Namespace.getNamespace("g-core", GoogleBase.URI);
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GoogleBaseGenerator.class);
|
||||
|
||||
/** Creates a new instance of GoogleBaseGenerator */
|
||||
public GoogleBaseGenerator() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return GoogleBase.URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Namespace> getNamespaces() {
|
||||
final HashSet<Namespace> set = new HashSet<Namespace>();
|
||||
set.add(GoogleBaseGenerator.NS);
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(final Module module, final Element element) {
|
||||
final GoogleBaseImpl mod = (GoogleBaseImpl) module;
|
||||
final HashMap<Object, Object> props2tags = new HashMap<Object, Object>(GoogleBaseParser.PROPS2TAGS);
|
||||
final PropertyDescriptor[] pds = GoogleBaseParser.pds;
|
||||
|
||||
for (final PropertyDescriptor pd : pds) {
|
||||
final String tagName = (String) props2tags.get(pd.getName());
|
||||
|
||||
if (tagName == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Object[] values = null;
|
||||
|
||||
try {
|
||||
if (pd.getPropertyType().isArray()) {
|
||||
values = (Object[]) pd.getReadMethod().invoke(mod, (Object[]) null);
|
||||
} else {
|
||||
values = new Object[] {pd.getReadMethod().invoke(mod, (Object[]) null)};
|
||||
}
|
||||
|
||||
for (int j = 0; values != null && j < values.length; j++) {
|
||||
if (values[j] != null) {
|
||||
element.addContent(generateTag(values[j], tagName));
|
||||
}
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
LOG.error("Error", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Element generateTag(final Object o, final String tagName) {
|
||||
if (o instanceof URL || o instanceof Float || o instanceof Boolean || o instanceof Integer || o instanceof String || o instanceof FloatUnit
|
||||
|| o instanceof IntUnit || o instanceof GenderEnumeration || o instanceof PaymentTypeEnumeration || o instanceof PriceTypeEnumeration
|
||||
|| o instanceof CurrencyEnumeration || o instanceof Size || o instanceof YearType) {
|
||||
return generateSimpleElement(tagName, o.toString());
|
||||
} else if (o instanceof ShortDate) {
|
||||
return generateSimpleElement(tagName, GoogleBaseParser.SHORT_DT_FMT.format(o));
|
||||
} else if (o instanceof Date) {
|
||||
return generateSimpleElement(tagName, GoogleBaseParser.LONG_DT_FMT.format(o));
|
||||
} else if (o instanceof ShippingType) {
|
||||
final ShippingType st = (ShippingType) o;
|
||||
final Element element = new Element(tagName, GoogleBaseGenerator.NS);
|
||||
|
||||
element.addContent(generateSimpleElement("country", st.getCountry()));
|
||||
|
||||
element.addContent(generateSimpleElement("service", st.getService().toString()));
|
||||
|
||||
element.addContent(generateSimpleElement("price", st.getPrice().toString()));
|
||||
|
||||
return element;
|
||||
} else if (o instanceof DateTimeRange) {
|
||||
final DateTimeRange dtr = (DateTimeRange) o;
|
||||
final Element element = new Element(tagName, GoogleBaseGenerator.NS);
|
||||
element.addContent(generateSimpleElement("start", GoogleBaseParser.LONG_DT_FMT.format(dtr.getStart())));
|
||||
element.addContent(generateSimpleElement("end", GoogleBaseParser.LONG_DT_FMT.format(dtr.getEnd())));
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
throw new RuntimeException("Unknown class type to handle: " + o.getClass().getName());
|
||||
}
|
||||
|
||||
protected Element generateSimpleElement(final String name, final String value) {
|
||||
final Element element = new Element(name, GoogleBaseGenerator.NS);
|
||||
element.addContent(value);
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
/*
|
||||
* GoogleBaseParser.java
|
||||
*
|
||||
* Created on November 17, 2005, 11:31 AM
|
||||
*
|
||||
* This library is provided under dual licenses. You may choose the terms of the Lesser General
|
||||
* Public License or the Apache License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU Lesser General Public License as published by the Free Software Foundation; either version
|
||||
* 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with this library;
|
||||
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.rometools.modules.base.io;
|
||||
|
||||
import java.beans.IntrospectionException;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.rometools.modules.base.GoogleBase;
|
||||
import com.rometools.modules.base.GoogleBaseImpl;
|
||||
import com.rometools.modules.base.types.CurrencyEnumeration;
|
||||
import com.rometools.modules.base.types.DateTimeRange;
|
||||
import com.rometools.modules.base.types.FloatUnit;
|
||||
import com.rometools.modules.base.types.GenderEnumeration;
|
||||
import com.rometools.modules.base.types.IntUnit;
|
||||
import com.rometools.modules.base.types.PaymentTypeEnumeration;
|
||||
import com.rometools.modules.base.types.PriceTypeEnumeration;
|
||||
import com.rometools.modules.base.types.ShippingType;
|
||||
import com.rometools.modules.base.types.Size;
|
||||
import com.rometools.modules.base.types.YearType;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleParser;
|
||||
|
||||
/**
|
||||
* DOCUMENT ME!
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.3 $
|
||||
*/
|
||||
public class GoogleBaseParser implements ModuleParser {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GoogleBaseParser.class);
|
||||
|
||||
public static final char[] INTEGER_CHARS = "-1234567890".toCharArray();
|
||||
public static final char[] FLOAT_CHARS = "-1234567890.".toCharArray();
|
||||
public static final SimpleDateFormat SHORT_DT_FMT = new SimpleDateFormat("yyyy-MM-dd");
|
||||
public static final SimpleDateFormat LONG_DT_FMT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||
static final Namespace NS = Namespace.getNamespace(GoogleBase.URI);
|
||||
static final Properties PROPS2TAGS = new Properties();
|
||||
static PropertyDescriptor[] pds = null;
|
||||
|
||||
static {
|
||||
try {
|
||||
pds = Introspector.getBeanInfo(GoogleBaseImpl.class).getPropertyDescriptors();
|
||||
PROPS2TAGS.load(GoogleBaseParser.class.getResourceAsStream("/com/rometools/modules/base/io/tags.properties"));
|
||||
} catch (final IOException e) {
|
||||
LOG.error("Unable to read properties file for Google Base tags!", e);
|
||||
} catch (final IntrospectionException e) {
|
||||
LOG.error("Unable to get property descriptors for GoogleBaseImpl!", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of GoogleBaseParser
|
||||
*/
|
||||
public GoogleBaseParser() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module parse(final Element element, final Locale locale) {
|
||||
final HashMap<String, PropertyDescriptor> tag2pd = new HashMap<String, PropertyDescriptor>();
|
||||
final GoogleBaseImpl module = new GoogleBaseImpl();
|
||||
|
||||
try {
|
||||
for (final PropertyDescriptor pd : pds) {
|
||||
final String tagName = GoogleBaseParser.PROPS2TAGS.getProperty(pd.getName());
|
||||
|
||||
if (tagName == null) {
|
||||
LOG.debug("Property: {} doesn't have a tag mapping.", pd.getName());
|
||||
} else {
|
||||
tag2pd.put(tagName, pd);
|
||||
}
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
throw new RuntimeException("Exception building tag to property mapping. ", e);
|
||||
}
|
||||
|
||||
final List<Element> children = element.getChildren();
|
||||
final Iterator<Element> it = children.iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
final Element child = it.next();
|
||||
|
||||
if (child.getNamespace().equals(GoogleBaseParser.NS)) {
|
||||
final PropertyDescriptor pd = tag2pd.get(child.getName());
|
||||
|
||||
if (pd != null) {
|
||||
try {
|
||||
handleTag(child, pd, module);
|
||||
} catch (final Exception e) {
|
||||
LOG.warn("Unable to handle tag: " + child.getName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return module;
|
||||
}
|
||||
|
||||
public static String stripNonValidCharacters(final char[] validCharacters, final String input) {
|
||||
final StringBuffer newString = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < input.length(); i++) {
|
||||
for (final char validCharacter : validCharacters) {
|
||||
if (input.charAt(i) == validCharacter) {
|
||||
newString.append(validCharacter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return newString.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return GoogleBase.URI;
|
||||
}
|
||||
|
||||
private void handleTag(final Element tag, final PropertyDescriptor pd, final GoogleBase module) throws Exception {
|
||||
Object tagValue = null;
|
||||
|
||||
if (pd.getPropertyType() == Integer.class || pd.getPropertyType().getComponentType() == Integer.class) {
|
||||
tagValue = new Integer(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.INTEGER_CHARS, tag.getText()));
|
||||
} else if (pd.getPropertyType() == Float.class || pd.getPropertyType().getComponentType() == Float.class) {
|
||||
tagValue = new Float(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.FLOAT_CHARS, tag.getText()));
|
||||
} else if (pd.getPropertyType() == String.class || pd.getPropertyType().getComponentType() == String.class) {
|
||||
tagValue = tag.getText();
|
||||
} else if (pd.getPropertyType() == URL.class || pd.getPropertyType().getComponentType() == URL.class) {
|
||||
tagValue = new URL(tag.getText().trim());
|
||||
} else if (pd.getPropertyType() == Boolean.class || pd.getPropertyType().getComponentType() == Boolean.class) {
|
||||
tagValue = new Boolean(tag.getText().trim());
|
||||
} else if (pd.getPropertyType() == Date.class || pd.getPropertyType().getComponentType() == Date.class) {
|
||||
final String text = tag.getText().trim();
|
||||
|
||||
if (text.length() > 10) {
|
||||
tagValue = GoogleBaseParser.LONG_DT_FMT.parse(text);
|
||||
} else {
|
||||
tagValue = GoogleBaseParser.SHORT_DT_FMT.parse(text);
|
||||
}
|
||||
} else if (pd.getPropertyType() == IntUnit.class || pd.getPropertyType().getComponentType() == IntUnit.class) {
|
||||
tagValue = new IntUnit(tag.getText());
|
||||
} else if (pd.getPropertyType() == FloatUnit.class || pd.getPropertyType().getComponentType() == FloatUnit.class) {
|
||||
tagValue = new FloatUnit(tag.getText());
|
||||
} else if (pd.getPropertyType() == DateTimeRange.class || pd.getPropertyType().getComponentType() == DateTimeRange.class) {
|
||||
tagValue =
|
||||
new DateTimeRange(LONG_DT_FMT.parse(tag.getChild("start", GoogleBaseParser.NS).getText().trim()), LONG_DT_FMT.parse(tag
|
||||
.getChild("end", GoogleBaseParser.NS).getText().trim()));
|
||||
} else if (pd.getPropertyType() == ShippingType.class || pd.getPropertyType().getComponentType() == ShippingType.class) {
|
||||
final FloatUnit price = new FloatUnit(tag.getChild("price", GoogleBaseParser.NS).getText().trim());
|
||||
ShippingType.ServiceEnumeration service =
|
||||
ShippingType.ServiceEnumeration.findByValue(tag.getChild("service", GoogleBaseParser.NS).getText().trim());
|
||||
|
||||
if (service == null) {
|
||||
service = ShippingType.ServiceEnumeration.STANDARD;
|
||||
}
|
||||
|
||||
final String country = tag.getChild("country", GoogleBaseParser.NS).getText().trim();
|
||||
tagValue = new ShippingType(price, service, country);
|
||||
} else if (pd.getPropertyType() == PaymentTypeEnumeration.class || pd.getPropertyType().getComponentType() == PaymentTypeEnumeration.class) {
|
||||
tagValue = PaymentTypeEnumeration.findByValue(tag.getText().trim());
|
||||
} else if (pd.getPropertyType() == PriceTypeEnumeration.class || pd.getPropertyType().getComponentType() == PriceTypeEnumeration.class) {
|
||||
tagValue = PriceTypeEnumeration.findByValue(tag.getText().trim());
|
||||
} else if (pd.getPropertyType() == CurrencyEnumeration.class || pd.getPropertyType().getComponentType() == CurrencyEnumeration.class) {
|
||||
tagValue = CurrencyEnumeration.findByValue(tag.getText().trim());
|
||||
} else if (pd.getPropertyType() == GenderEnumeration.class || pd.getPropertyType().getComponentType() == GenderEnumeration.class) {
|
||||
tagValue = GenderEnumeration.findByValue(tag.getText().trim());
|
||||
} else if (pd.getPropertyType() == YearType.class || pd.getPropertyType().getComponentType() == YearType.class) {
|
||||
tagValue = new YearType(tag.getText().trim());
|
||||
} else if (pd.getPropertyType() == Size.class || pd.getPropertyType().getComponentType() == Size.class) {
|
||||
tagValue = new Size(tag.getText().trim());
|
||||
}
|
||||
|
||||
if (!pd.getPropertyType().isArray()) {
|
||||
pd.getWriteMethod().invoke(module, new Object[] {tagValue});
|
||||
} else {
|
||||
final Object[] current = (Object[]) pd.getReadMethod().invoke(module, (Object[]) null);
|
||||
final int newSize = current == null ? 1 : current.length + 1;
|
||||
final Object setValue = Array.newInstance(pd.getPropertyType().getComponentType(), newSize);
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (; current != null && i < current.length; i++) {
|
||||
Array.set(setValue, i, current[i]);
|
||||
}
|
||||
|
||||
Array.set(setValue, i, tagValue);
|
||||
pd.getWriteMethod().invoke(module, new Object[] {setValue});
|
||||
}
|
||||
}
|
||||
}
|
72
src/main/java/com/rometools/modules/base/package.html
Normal file
72
src/main/java/com/rometools/modules/base/package.html
Normal file
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
This is the base package for the Google Base ROME module.
|
||||
<p>This package contains the core module interface <code>GoogleBase</code>,
|
||||
as well as the implementation class <code>GoogleBaseImpl</code>. If you want
|
||||
to work with a specific type of Google Base entry, you can cast it to a
|
||||
specific item type interface, such as <code>Vehicle</code>.</p>
|
||||
<p>Sample Useage:
|
||||
<pre>
|
||||
|
||||
SyndEntry entry = new SyndEntryImpl();
|
||||
// set up the entry...
|
||||
Vehicle vehicle = new GoogleBaseImpl();
|
||||
vehicle.setMake("Honda");
|
||||
vehicle.setModel("Insight");
|
||||
vehicle.setYear( new Year("2000"));
|
||||
List modules = new ArrayList();
|
||||
modules.add( vehicle );
|
||||
entry.setModules( modules );
|
||||
|
||||
//Optionally, to get Google Base information from a Feed:
|
||||
Article article = entry.getModule( "http://base.google.com/ns/1.0" );
|
||||
System.out.println( article.getPages() );
|
||||
|
||||
</pre>
|
||||
</p>
|
||||
<p>Google Base is a trademark of Google, Inc. The authors of this software
|
||||
are not affiliated with Google, Inc. and Google does not endorse, support,
|
||||
blah blah blah.
|
||||
</p>
|
||||
<pre>
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* CloneableType.java
|
||||
*
|
||||
* Created on November 18, 2005, 10:42 AM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.types;
|
||||
|
||||
/**
|
||||
* This is just a holder interface for cloneable elements.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public interface CloneableType extends Cloneable {
|
||||
public Object clone();
|
||||
}
|
|
@ -0,0 +1,601 @@
|
|||
/*
|
||||
* CurrencyEnumeration.java
|
||||
*
|
||||
* Created on November 18, 2005, 11:33 AM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.types;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* An Enumeration of valid currency types.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public class CurrencyEnumeration {
|
||||
|
||||
private static final HashMap<String, CurrencyEnumeration> lookup = new HashMap<String, CurrencyEnumeration>();
|
||||
|
||||
// <xs:restriction base="xs:string">
|
||||
// <xs:enumeration value="AED"/>
|
||||
public static final CurrencyEnumeration AED = new CurrencyEnumeration("AED");
|
||||
|
||||
// <xs:enumeration value="AFA"/>
|
||||
public static final CurrencyEnumeration AFA = new CurrencyEnumeration("AFA");
|
||||
|
||||
// <xs:enumeration value="ALL"/>
|
||||
public static final CurrencyEnumeration ALL = new CurrencyEnumeration("ALL");
|
||||
|
||||
// <xs:enumeration value="AMD"/>
|
||||
public static final CurrencyEnumeration AMD = new CurrencyEnumeration("AMD");
|
||||
|
||||
// <xs:enumeration value="ANG"/>
|
||||
public static final CurrencyEnumeration ANG = new CurrencyEnumeration("ANG");
|
||||
|
||||
// <xs:enumeration value="AOA"/>
|
||||
public static final CurrencyEnumeration AOA = new CurrencyEnumeration("AOA");
|
||||
|
||||
// <xs:enumeration value="ARS"/>
|
||||
public static final CurrencyEnumeration ARS = new CurrencyEnumeration("ARS");
|
||||
|
||||
// <xs:enumeration value="AUD"/>
|
||||
public static final CurrencyEnumeration AUD = new CurrencyEnumeration("AUD");
|
||||
|
||||
// <xs:enumeration value="AWG"/>
|
||||
public static final CurrencyEnumeration AWG = new CurrencyEnumeration("AWG");
|
||||
|
||||
// <xs:enumeration value="AZM"/>
|
||||
public static final CurrencyEnumeration AZM = new CurrencyEnumeration("AZM");
|
||||
|
||||
// <xs:enumeration value="BAM"/>
|
||||
public static final CurrencyEnumeration BAM = new CurrencyEnumeration("BAM");
|
||||
|
||||
// <xs:enumeration value="BBD"/>
|
||||
public static final CurrencyEnumeration BBD = new CurrencyEnumeration("BBD");
|
||||
|
||||
// <xs:enumeration value="BDT"/>
|
||||
public static final CurrencyEnumeration BDT = new CurrencyEnumeration("BDT");
|
||||
|
||||
// <xs:enumeration value="BGN"/>
|
||||
public static final CurrencyEnumeration BGN = new CurrencyEnumeration("BGN");
|
||||
|
||||
// <xs:enumeration value="BHD"/>
|
||||
public static final CurrencyEnumeration BHD = new CurrencyEnumeration("BHD");
|
||||
|
||||
// <xs:enumeration value="BIF"/>
|
||||
public static final CurrencyEnumeration BIF = new CurrencyEnumeration("BIF");
|
||||
|
||||
// <xs:enumeration value="BMD"/>
|
||||
public static final CurrencyEnumeration BMD = new CurrencyEnumeration("BMD");
|
||||
|
||||
// <xs:enumeration value="BND"/>
|
||||
public static final CurrencyEnumeration BND = new CurrencyEnumeration("BND");
|
||||
|
||||
// <xs:enumeration value="BOB"/>
|
||||
public static final CurrencyEnumeration BOB = new CurrencyEnumeration("BOB");
|
||||
|
||||
// <xs:enumeration value="BRL"/>
|
||||
public static final CurrencyEnumeration BRL = new CurrencyEnumeration("BRL");
|
||||
|
||||
// <xs:enumeration value="BSD"/>
|
||||
public static final CurrencyEnumeration BSD = new CurrencyEnumeration("BSD");
|
||||
|
||||
// <xs:enumeration value="BTN"/>
|
||||
public static final CurrencyEnumeration BTN = new CurrencyEnumeration("BTN");
|
||||
|
||||
// <xs:enumeration value="BWP"/>
|
||||
public static final CurrencyEnumeration BWP = new CurrencyEnumeration("BWP");
|
||||
|
||||
// <xs:enumeration value="BYR"/>
|
||||
public static final CurrencyEnumeration BYR = new CurrencyEnumeration("BYR");
|
||||
|
||||
// <xs:enumeration value="BZD"/>
|
||||
public static final CurrencyEnumeration BZD = new CurrencyEnumeration("BZD");
|
||||
|
||||
// <xs:enumeration value="CAD"/>
|
||||
public static final CurrencyEnumeration CAD = new CurrencyEnumeration("CAD");
|
||||
|
||||
// <xs:enumeration value="CDF"/>
|
||||
public static final CurrencyEnumeration CDF = new CurrencyEnumeration("CDF");
|
||||
|
||||
// <xs:enumeration value="CHF"/>
|
||||
public static final CurrencyEnumeration CHF = new CurrencyEnumeration("CHF");
|
||||
|
||||
// <xs:enumeration value="CLP"/>
|
||||
public static final CurrencyEnumeration CLP = new CurrencyEnumeration("CLP");
|
||||
|
||||
// <xs:enumeration value="CNY"/>
|
||||
public static final CurrencyEnumeration CNY = new CurrencyEnumeration("CNY");
|
||||
|
||||
// <xs:enumeration value="CRC"/>
|
||||
public static final CurrencyEnumeration CRC = new CurrencyEnumeration("CRC");
|
||||
|
||||
// <xs:enumeration value="CSD"/>
|
||||
public static final CurrencyEnumeration CSD = new CurrencyEnumeration("CSD");
|
||||
|
||||
// <xs:enumeration value="CUP"/>
|
||||
public static final CurrencyEnumeration CUP = new CurrencyEnumeration("CUP");
|
||||
|
||||
// <xs:enumeration value="CVE"/>
|
||||
public static final CurrencyEnumeration CVE = new CurrencyEnumeration("CVE");
|
||||
|
||||
// <xs:enumeration value="CYP"/>
|
||||
public static final CurrencyEnumeration CYP = new CurrencyEnumeration("CYP");
|
||||
|
||||
// <xs:enumeration value="CZK"/>
|
||||
public static final CurrencyEnumeration CZK = new CurrencyEnumeration("CZK");
|
||||
|
||||
// <xs:enumeration value="DJF"/>
|
||||
public static final CurrencyEnumeration DJF = new CurrencyEnumeration("DJF");
|
||||
|
||||
// <xs:enumeration value="DKK"/>
|
||||
public static final CurrencyEnumeration DKK = new CurrencyEnumeration("DKK");
|
||||
|
||||
// <xs:enumeration value="DOP"/>
|
||||
public static final CurrencyEnumeration DOP = new CurrencyEnumeration("DOP");
|
||||
|
||||
// <xs:enumeration value="DZD"/>
|
||||
public static final CurrencyEnumeration DZD = new CurrencyEnumeration("DZD");
|
||||
|
||||
// <xs:enumeration value="EEK"/>
|
||||
public static final CurrencyEnumeration EEK = new CurrencyEnumeration("EEK");
|
||||
|
||||
// <xs:enumeration value="EGP"/>
|
||||
public static final CurrencyEnumeration EGP = new CurrencyEnumeration("EGP");
|
||||
|
||||
// <xs:enumeration value="ERN"/>
|
||||
public static final CurrencyEnumeration ERN = new CurrencyEnumeration("ERN");
|
||||
|
||||
// <xs:enumeration value="ETB"/>
|
||||
public static final CurrencyEnumeration ETB = new CurrencyEnumeration("ETB");
|
||||
|
||||
// <xs:enumeration value="EUR"/>
|
||||
public static final CurrencyEnumeration EUR = new CurrencyEnumeration("EUR");
|
||||
|
||||
// <xs:enumeration value="FJD"/>
|
||||
public static final CurrencyEnumeration FJD = new CurrencyEnumeration("FJD");
|
||||
|
||||
// <xs:enumeration value="FKP"/>
|
||||
public static final CurrencyEnumeration FKP = new CurrencyEnumeration("FKP");
|
||||
|
||||
// <xs:enumeration value="GBP"/>
|
||||
public static final CurrencyEnumeration GBP = new CurrencyEnumeration("GBP");
|
||||
|
||||
// <xs:enumeration value="GEL"/>
|
||||
public static final CurrencyEnumeration GEL = new CurrencyEnumeration("GEL");
|
||||
|
||||
// <xs:enumeration value="GGP"/>
|
||||
public static final CurrencyEnumeration GGP = new CurrencyEnumeration("GGP");
|
||||
|
||||
// <xs:enumeration value="GHC"/>
|
||||
public static final CurrencyEnumeration GHC = new CurrencyEnumeration("GHC");
|
||||
|
||||
// <xs:enumeration value="GIP"/>
|
||||
public static final CurrencyEnumeration GIP = new CurrencyEnumeration("GIP");
|
||||
|
||||
// <xs:enumeration value="GMD"/>
|
||||
public static final CurrencyEnumeration GMD = new CurrencyEnumeration("GMD");
|
||||
|
||||
// <xs:enumeration value="GNF"/>
|
||||
public static final CurrencyEnumeration GNF = new CurrencyEnumeration("GNF");
|
||||
|
||||
// <xs:enumeration value="GTQ"/>
|
||||
public static final CurrencyEnumeration GTQ = new CurrencyEnumeration("GTQ");
|
||||
|
||||
// <xs:enumeration value="GYD"/>
|
||||
public static final CurrencyEnumeration GYD = new CurrencyEnumeration("GYD");
|
||||
|
||||
// <xs:enumeration value="HKD"/>
|
||||
public static final CurrencyEnumeration HKD = new CurrencyEnumeration("HKD");
|
||||
|
||||
// <xs:enumeration value="HNL"/>
|
||||
public static final CurrencyEnumeration HNL = new CurrencyEnumeration("HNL");
|
||||
|
||||
// <xs:enumeration value="HRK"/>
|
||||
public static final CurrencyEnumeration HRK = new CurrencyEnumeration("HRK");
|
||||
|
||||
// <xs:enumeration value="HTG"/>
|
||||
public static final CurrencyEnumeration HTG = new CurrencyEnumeration("HTG");
|
||||
|
||||
// <xs:enumeration value="HUF"/>
|
||||
public static final CurrencyEnumeration HUF = new CurrencyEnumeration("HUF");
|
||||
|
||||
// <xs:enumeration value="IDR"/>
|
||||
public static final CurrencyEnumeration IDR = new CurrencyEnumeration("IDR");
|
||||
|
||||
// <xs:enumeration value="ILS"/>
|
||||
public static final CurrencyEnumeration ILS = new CurrencyEnumeration("ILS");
|
||||
|
||||
// <xs:enumeration value="IMP"/>
|
||||
public static final CurrencyEnumeration IMP = new CurrencyEnumeration("IMP");
|
||||
|
||||
// <xs:enumeration value="INR"/>
|
||||
public static final CurrencyEnumeration INR = new CurrencyEnumeration("INR");
|
||||
|
||||
// <xs:enumeration value="IQD"/>
|
||||
public static final CurrencyEnumeration IQD = new CurrencyEnumeration("IQD");
|
||||
|
||||
// <xs:enumeration value="IRR"/>
|
||||
public static final CurrencyEnumeration IRR = new CurrencyEnumeration("IRR");
|
||||
|
||||
// <xs:enumeration value="ISK"/>
|
||||
public static final CurrencyEnumeration ISK = new CurrencyEnumeration("ISK");
|
||||
|
||||
// <xs:enumeration value="JEP"/>
|
||||
public static final CurrencyEnumeration JEP = new CurrencyEnumeration("JEP");
|
||||
|
||||
// <xs:enumeration value="JMD"/>
|
||||
public static final CurrencyEnumeration JMD = new CurrencyEnumeration("JMD");
|
||||
|
||||
// <xs:enumeration value="JOD"/>
|
||||
public static final CurrencyEnumeration JOD = new CurrencyEnumeration("JOD");
|
||||
|
||||
// <xs:enumeration value="JPY"/>
|
||||
public static final CurrencyEnumeration JPY = new CurrencyEnumeration("JPY");
|
||||
|
||||
// <xs:enumeration value="KES"/>
|
||||
public static final CurrencyEnumeration KES = new CurrencyEnumeration("KES");
|
||||
|
||||
// <xs:enumeration value="KGS"/>
|
||||
public static final CurrencyEnumeration KGS = new CurrencyEnumeration("KGS");
|
||||
|
||||
// <xs:enumeration value="KHR"/>
|
||||
public static final CurrencyEnumeration KHR = new CurrencyEnumeration("KHR");
|
||||
|
||||
// <xs:enumeration value="KMF"/>
|
||||
public static final CurrencyEnumeration KMF = new CurrencyEnumeration("KMF");
|
||||
|
||||
// <xs:enumeration value="KPW"/>
|
||||
public static final CurrencyEnumeration KPW = new CurrencyEnumeration("KPW");
|
||||
|
||||
// <xs:enumeration value="KRW"/>
|
||||
public static final CurrencyEnumeration KRW = new CurrencyEnumeration("KRW");
|
||||
|
||||
// <xs:enumeration value="KWD"/>
|
||||
public static final CurrencyEnumeration KWD = new CurrencyEnumeration("KWD");
|
||||
|
||||
// <xs:enumeration value="KYD"/>
|
||||
public static final CurrencyEnumeration KYD = new CurrencyEnumeration("KYD");
|
||||
|
||||
// <xs:enumeration value="KZT"/>
|
||||
public static final CurrencyEnumeration KZT = new CurrencyEnumeration("KZT");
|
||||
|
||||
// <xs:enumeration value="LAK"/>
|
||||
public static final CurrencyEnumeration LAK = new CurrencyEnumeration("LAK");
|
||||
|
||||
// <xs:enumeration value="LBP"/>
|
||||
public static final CurrencyEnumeration LBP = new CurrencyEnumeration("LBP");
|
||||
|
||||
// <xs:enumeration value="LKR"/>
|
||||
public static final CurrencyEnumeration LKR = new CurrencyEnumeration("LKR");
|
||||
|
||||
// <xs:enumeration value="LRD"/>
|
||||
public static final CurrencyEnumeration LRD = new CurrencyEnumeration("LRD");
|
||||
|
||||
// <xs:enumeration value="LSL"/>
|
||||
public static final CurrencyEnumeration LSL = new CurrencyEnumeration("LSL");
|
||||
|
||||
// <xs:enumeration value="LTL"/>
|
||||
public static final CurrencyEnumeration LTL = new CurrencyEnumeration("LTL");
|
||||
|
||||
// <xs:enumeration value="LVL"/>
|
||||
public static final CurrencyEnumeration LVL = new CurrencyEnumeration("LVL");
|
||||
|
||||
// <xs:enumeration value="LYD"/>
|
||||
public static final CurrencyEnumeration LYD = new CurrencyEnumeration("LYD");
|
||||
|
||||
// <xs:enumeration value="MAD"/>
|
||||
public static final CurrencyEnumeration MAD = new CurrencyEnumeration("MAD");
|
||||
|
||||
// <xs:enumeration value="MDL"/>
|
||||
public static final CurrencyEnumeration MDL = new CurrencyEnumeration("MDL");
|
||||
|
||||
// <xs:enumeration value="MGA"/>
|
||||
public static final CurrencyEnumeration MGA = new CurrencyEnumeration("MGA");
|
||||
|
||||
// <xs:enumeration value="MKD"/>
|
||||
public static final CurrencyEnumeration MKD = new CurrencyEnumeration("MKD");
|
||||
|
||||
// <xs:enumeration value="MMK"/>
|
||||
public static final CurrencyEnumeration MMK = new CurrencyEnumeration("MMK");
|
||||
|
||||
// <xs:enumeration value="MNT"/>
|
||||
public static final CurrencyEnumeration MNT = new CurrencyEnumeration("MNT");
|
||||
|
||||
// <xs:enumeration value="MOP"/>
|
||||
public static final CurrencyEnumeration MOP = new CurrencyEnumeration("MOP");
|
||||
|
||||
// <xs:enumeration value="MRO"/>
|
||||
public static final CurrencyEnumeration MRO = new CurrencyEnumeration("MRO");
|
||||
|
||||
// <xs:enumeration value="MTL"/>
|
||||
public static final CurrencyEnumeration MTL = new CurrencyEnumeration("MTL");
|
||||
|
||||
// <xs:enumeration value="MUR"/>
|
||||
public static final CurrencyEnumeration MUR = new CurrencyEnumeration("MUR");
|
||||
|
||||
// <xs:enumeration value="MVR"/>
|
||||
public static final CurrencyEnumeration MVR = new CurrencyEnumeration("MVR");
|
||||
|
||||
// <xs:enumeration value="MWK"/>
|
||||
public static final CurrencyEnumeration MWK = new CurrencyEnumeration("MWK");
|
||||
|
||||
// <xs:enumeration value="MXN"/>
|
||||
public static final CurrencyEnumeration MXN = new CurrencyEnumeration("MXN");
|
||||
|
||||
// <xs:enumeration value="MYR"/>
|
||||
public static final CurrencyEnumeration MYR = new CurrencyEnumeration("MYR");
|
||||
|
||||
// <xs:enumeration value="MZM"/>
|
||||
public static final CurrencyEnumeration MZM = new CurrencyEnumeration("MZM");
|
||||
|
||||
// <xs:enumeration value="NAD"/>
|
||||
public static final CurrencyEnumeration NAD = new CurrencyEnumeration("NAD");
|
||||
|
||||
// <xs:enumeration value="NGN"/>
|
||||
public static final CurrencyEnumeration NGN = new CurrencyEnumeration("NGN");
|
||||
|
||||
// <xs:enumeration value="NIO"/>
|
||||
public static final CurrencyEnumeration NIO = new CurrencyEnumeration("NIO");
|
||||
|
||||
// <xs:enumeration value="NOK"/>
|
||||
public static final CurrencyEnumeration NOK = new CurrencyEnumeration("NOK");
|
||||
|
||||
// <xs:enumeration value="NPR"/>
|
||||
public static final CurrencyEnumeration NPR = new CurrencyEnumeration("NPR");
|
||||
|
||||
// <xs:enumeration value="NZD"/>
|
||||
public static final CurrencyEnumeration NZD = new CurrencyEnumeration("NZD");
|
||||
|
||||
// <xs:enumeration value="OMR"/>
|
||||
public static final CurrencyEnumeration OMR = new CurrencyEnumeration("OMR");
|
||||
|
||||
// <xs:enumeration value="PAB"/>
|
||||
public static final CurrencyEnumeration PAB = new CurrencyEnumeration("PAB");
|
||||
|
||||
// <xs:enumeration value="PEN"/>
|
||||
public static final CurrencyEnumeration PEN = new CurrencyEnumeration("PEN");
|
||||
|
||||
// <xs:enumeration value="PGK"/>
|
||||
public static final CurrencyEnumeration PGK = new CurrencyEnumeration("PGK");
|
||||
|
||||
// <xs:enumeration value="PHP"/>
|
||||
public static final CurrencyEnumeration PHP = new CurrencyEnumeration("PHP");
|
||||
|
||||
// <xs:enumeration value="PKR"/>
|
||||
public static final CurrencyEnumeration PKR = new CurrencyEnumeration("PKR");
|
||||
|
||||
// <xs:enumeration value="PLN"/>
|
||||
public static final CurrencyEnumeration PLN = new CurrencyEnumeration("PLN");
|
||||
|
||||
// <xs:enumeration value="PYG"/>
|
||||
public static final CurrencyEnumeration PYG = new CurrencyEnumeration("PYG");
|
||||
|
||||
// <xs:enumeration value="QAR"/>
|
||||
public static final CurrencyEnumeration QAR = new CurrencyEnumeration("QAR");
|
||||
|
||||
// <xs:enumeration value="RON"/>
|
||||
public static final CurrencyEnumeration RON = new CurrencyEnumeration("RON");
|
||||
|
||||
// <xs:enumeration value="RUB"/>
|
||||
public static final CurrencyEnumeration RUB = new CurrencyEnumeration("RUB");
|
||||
|
||||
// <xs:enumeration value="RWF"/>
|
||||
public static final CurrencyEnumeration RWF = new CurrencyEnumeration("MOP");
|
||||
|
||||
// <xs:enumeration value="SAR"/>
|
||||
public static final CurrencyEnumeration SAR = new CurrencyEnumeration("SAR");
|
||||
|
||||
// <xs:enumeration value="SBD"/>
|
||||
public static final CurrencyEnumeration SBD = new CurrencyEnumeration("SBD");
|
||||
|
||||
// <xs:enumeration value="SCR"/>
|
||||
public static final CurrencyEnumeration SCR = new CurrencyEnumeration("SCR");
|
||||
|
||||
// <xs:enumeration value="SDD"/>
|
||||
public static final CurrencyEnumeration SDD = new CurrencyEnumeration("SDD");
|
||||
|
||||
// <xs:enumeration value="SEK"/>
|
||||
public static final CurrencyEnumeration SEK = new CurrencyEnumeration("SEK");
|
||||
|
||||
// <xs:enumeration value="SGD"/>
|
||||
public static final CurrencyEnumeration SGD = new CurrencyEnumeration("SGD");
|
||||
|
||||
// <xs:enumeration value="SHP"/>
|
||||
public static final CurrencyEnumeration SHP = new CurrencyEnumeration("SHP");
|
||||
|
||||
// <xs:enumeration value="SIT"/>
|
||||
public static final CurrencyEnumeration SIT = new CurrencyEnumeration("SIT");
|
||||
|
||||
// <xs:enumeration value="SKK"/>
|
||||
public static final CurrencyEnumeration SKK = new CurrencyEnumeration("SKK");
|
||||
|
||||
// <xs:enumeration value="SLL"/>
|
||||
public static final CurrencyEnumeration SLL = new CurrencyEnumeration("SLL");
|
||||
|
||||
// <xs:enumeration value="SOS"/>
|
||||
public static final CurrencyEnumeration SOS = new CurrencyEnumeration("SOS");
|
||||
|
||||
// <xs:enumeration value="SPL"/>
|
||||
public static final CurrencyEnumeration SPL = new CurrencyEnumeration("SPL");
|
||||
|
||||
// <xs:enumeration value="SRD"/>
|
||||
public static final CurrencyEnumeration SRD = new CurrencyEnumeration("SRD");
|
||||
|
||||
// <xs:enumeration value="STD"/>
|
||||
public static final CurrencyEnumeration STD = new CurrencyEnumeration("STD");
|
||||
|
||||
// <xs:enumeration value="SVC"/>
|
||||
public static final CurrencyEnumeration SVC = new CurrencyEnumeration("SVC");
|
||||
|
||||
// <xs:enumeration value="SYP"/>
|
||||
public static final CurrencyEnumeration SYP = new CurrencyEnumeration("SYP");
|
||||
|
||||
// <xs:enumeration value="SZL"/>
|
||||
public static final CurrencyEnumeration SZL = new CurrencyEnumeration("SZL");
|
||||
|
||||
// <xs:enumeration value="THB"/>
|
||||
public static final CurrencyEnumeration THB = new CurrencyEnumeration("THB");
|
||||
|
||||
// <xs:enumeration value="TJS"/>
|
||||
public static final CurrencyEnumeration TJS = new CurrencyEnumeration("TJS");
|
||||
|
||||
// <xs:enumeration value="TMM"/>
|
||||
public static final CurrencyEnumeration TMM = new CurrencyEnumeration("TMM");
|
||||
|
||||
// <xs:enumeration value="TND"/>
|
||||
public static final CurrencyEnumeration TND = new CurrencyEnumeration("TND");
|
||||
|
||||
// <xs:enumeration value="TOP"/>
|
||||
public static final CurrencyEnumeration TOP = new CurrencyEnumeration("TOP");
|
||||
|
||||
// <xs:enumeration value="TRL"/>
|
||||
public static final CurrencyEnumeration TRL = new CurrencyEnumeration("TRL");
|
||||
|
||||
// <xs:enumeration value="TRY"/>
|
||||
public static final CurrencyEnumeration TRY = new CurrencyEnumeration("TRY");
|
||||
|
||||
// <xs:enumeration value="TTD"/>
|
||||
public static final CurrencyEnumeration TTD = new CurrencyEnumeration("TTD");
|
||||
|
||||
// <xs:enumeration value="TVD"/>
|
||||
public static final CurrencyEnumeration TVD = new CurrencyEnumeration("TVD");
|
||||
|
||||
// <xs:enumeration value="TWD"/>
|
||||
public static final CurrencyEnumeration TWD = new CurrencyEnumeration("TWD");
|
||||
|
||||
// <xs:enumeration value="TZS"/>
|
||||
public static final CurrencyEnumeration TZS = new CurrencyEnumeration("TZS");
|
||||
|
||||
// <xs:enumeration value="UAH"/>
|
||||
public static final CurrencyEnumeration UAH = new CurrencyEnumeration("UAH");
|
||||
|
||||
// <xs:enumeration value="UGX"/>
|
||||
public static final CurrencyEnumeration UGX = new CurrencyEnumeration("UGX");
|
||||
|
||||
// <xs:enumeration value="USD"/>
|
||||
public static final CurrencyEnumeration USD = new CurrencyEnumeration("USD");
|
||||
|
||||
// <xs:enumeration value="UYU"/>
|
||||
public static final CurrencyEnumeration UYU = new CurrencyEnumeration("UYU");
|
||||
|
||||
// <xs:enumeration value="UZS"/>
|
||||
public static final CurrencyEnumeration UZS = new CurrencyEnumeration("UZS");
|
||||
|
||||
// <xs:enumeration value="VEB"/>
|
||||
public static final CurrencyEnumeration VEB = new CurrencyEnumeration("VEB");
|
||||
|
||||
// <xs:enumeration value="VND"/>
|
||||
public static final CurrencyEnumeration VND = new CurrencyEnumeration("VND");
|
||||
|
||||
// <xs:enumeration value="VUV"/>
|
||||
public static final CurrencyEnumeration VUV = new CurrencyEnumeration("VUV");
|
||||
|
||||
// <xs:enumeration value="WST"/>
|
||||
public static final CurrencyEnumeration WST = new CurrencyEnumeration("WST");
|
||||
|
||||
// <xs:enumeration value="XAF"/>
|
||||
public static final CurrencyEnumeration XAF = new CurrencyEnumeration("XAF");
|
||||
|
||||
// <xs:enumeration value="XAG"/>
|
||||
public static final CurrencyEnumeration XAG = new CurrencyEnumeration("XAG");
|
||||
|
||||
// <xs:enumeration value="XAU"/>
|
||||
public static final CurrencyEnumeration XAU = new CurrencyEnumeration("XAU");
|
||||
|
||||
// <xs:enumeration value="XCD"/>
|
||||
public static final CurrencyEnumeration XCD = new CurrencyEnumeration("XCD");
|
||||
|
||||
// <xs:enumeration value="XDR"/>
|
||||
public static final CurrencyEnumeration XDR = new CurrencyEnumeration("XDR");
|
||||
|
||||
// <xs:enumeration value="XOF"/>
|
||||
public static final CurrencyEnumeration XOF = new CurrencyEnumeration("XOF");
|
||||
|
||||
// <xs:enumeration value="XPD"/>
|
||||
public static final CurrencyEnumeration XPD = new CurrencyEnumeration("XPD");
|
||||
|
||||
// <xs:enumeration value="XPF"/>
|
||||
public static final CurrencyEnumeration XPF = new CurrencyEnumeration("XPF");
|
||||
|
||||
// <xs:enumeration value="XPT"/>
|
||||
public static final CurrencyEnumeration XPT = new CurrencyEnumeration("XPT");
|
||||
|
||||
// <xs:enumeration value="YER"/>
|
||||
public static final CurrencyEnumeration YER = new CurrencyEnumeration("YER");
|
||||
|
||||
// <xs:enumeration value="ZAR"/>
|
||||
public static final CurrencyEnumeration ZAR = new CurrencyEnumeration("ZAR");
|
||||
|
||||
// <xs:enumeration value="ZMK"/>
|
||||
public static final CurrencyEnumeration ZMK = new CurrencyEnumeration("ZMK");
|
||||
|
||||
// <xs:enumeration value="ZWD"/>
|
||||
public static final CurrencyEnumeration ZWD = new CurrencyEnumeration("ZWD");
|
||||
|
||||
// </xs:restriction>
|
||||
private final String value;
|
||||
|
||||
/**
|
||||
* Creates a new instance of CurrencyEnumeration
|
||||
*
|
||||
* @param value DOCUMENT ME!
|
||||
*/
|
||||
private CurrencyEnumeration(final String value) {
|
||||
this.value = value;
|
||||
lookup.put(value, this);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public static CurrencyEnumeration findByValue(final String value) {
|
||||
return lookup.get(value.trim().toUpperCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
* DateTimeRange.java
|
||||
*
|
||||
* Created on November 16, 2005, 11:14 AM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.types;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Represents a time range.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public class DateTimeRange implements CloneableType {
|
||||
/**
|
||||
* end time
|
||||
*/
|
||||
private Date end;
|
||||
/**
|
||||
* start time
|
||||
*/
|
||||
private Date start;
|
||||
|
||||
/**
|
||||
* Creates a new instance of DateTimeRange
|
||||
*
|
||||
* @param start Beginning of the timeframe.
|
||||
* @param end End of the Timeframe.
|
||||
*/
|
||||
public DateTimeRange(final Date start, final Date end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
/**
|
||||
* The end of the timeframe.
|
||||
*
|
||||
* @return The end of the timeframe.
|
||||
*/
|
||||
public Date getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
/**
|
||||
* The beginning of the timeframe.
|
||||
*
|
||||
* @return The beginning of the timeframe.
|
||||
*/
|
||||
public Date getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones the object
|
||||
*
|
||||
* @return Duplicate of this object.
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
final DateTimeRange retValue = new DateTimeRange(null, null);
|
||||
|
||||
if (getStart() != null) {
|
||||
retValue.start = (Date) getStart().clone();
|
||||
}
|
||||
|
||||
if (getEnd() != null) {
|
||||
retValue.end = (Date) getEnd().clone();
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* String representation of the object.
|
||||
*
|
||||
* @return String representation of the object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Start: " + start + " End: " + end;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (!(o instanceof DateTimeRange) || o == null) {
|
||||
return false;
|
||||
}
|
||||
final DateTimeRange d = (DateTimeRange) o;
|
||||
if (start == d.getStart() && end == d.getEnd()) {
|
||||
return true;
|
||||
}
|
||||
if (start != null && !start.equals(d.getStart())) {
|
||||
return false;
|
||||
}
|
||||
if (end != null && !end.equals(d.getEnd())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
169
src/main/java/com/rometools/modules/base/types/FloatUnit.java
Normal file
169
src/main/java/com/rometools/modules/base/types/FloatUnit.java
Normal file
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* FloatUnit.java
|
||||
*
|
||||
* Created on November 16, 2005, 11:43 AM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.types;
|
||||
|
||||
import com.rometools.modules.base.io.GoogleBaseParser;
|
||||
|
||||
/**
|
||||
* This class represents a quantity consisting of a float value and an optional units specification.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public class FloatUnit implements CloneableType {
|
||||
/**
|
||||
* Units
|
||||
*/
|
||||
private String units;
|
||||
/**
|
||||
* Float value
|
||||
*/
|
||||
private final float value;
|
||||
|
||||
/**
|
||||
* Looks for a char in an array
|
||||
*
|
||||
* @param find char to search for
|
||||
* @param array array to search
|
||||
* @return boolean indicating presence.
|
||||
*/
|
||||
private boolean inCharArray(final char find, final char[] array) {
|
||||
for (final char element : array) {
|
||||
if (find == element) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new float unit by parsing a String value
|
||||
*
|
||||
* @param source String value to parse
|
||||
*/
|
||||
public FloatUnit(final String source) {
|
||||
final String parse = source.trim();
|
||||
int space = -1;
|
||||
for (int i = 0; i < parse.length(); i++) {
|
||||
if (!inCharArray(parse.charAt(i), GoogleBaseParser.FLOAT_CHARS)) {
|
||||
space = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (space == -1) {
|
||||
space = parse.length();
|
||||
}
|
||||
|
||||
value = Float.parseFloat(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.FLOAT_CHARS, parse.substring(0, space)));
|
||||
|
||||
if (space != parse.length()) {
|
||||
units = parse.substring(space, parse.length()).trim();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of FloatUnit
|
||||
*
|
||||
* @param value float value
|
||||
* @param units Units represented, or null.
|
||||
*/
|
||||
public FloatUnit(final float value, final String units) {
|
||||
this.value = value;
|
||||
this.units = units;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the units.
|
||||
*
|
||||
* @return Returns the units.
|
||||
*/
|
||||
public String getUnits() {
|
||||
return units;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the float value.
|
||||
*
|
||||
* @return Returns the float value.
|
||||
*/
|
||||
public float getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates the object.
|
||||
*
|
||||
* @return Duplicate FloatUnit
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new FloatUnit(0 + value, units);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of the object.
|
||||
*
|
||||
* @return Returns a String representation of the object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
if (units != null && units.trim().length() > 0) {
|
||||
return value + " " + units;
|
||||
} else {
|
||||
return Float.toString(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (!(o instanceof FloatUnit)) {
|
||||
return false;
|
||||
}
|
||||
final FloatUnit f = (FloatUnit) o;
|
||||
if (f.getValue() != value) {
|
||||
return false;
|
||||
}
|
||||
if (units == f.getUnits() || units != null && units.equals(f.getUnits())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* GenderEnumeration.java
|
||||
*
|
||||
* Created on November 16, 2005, 2:35 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.types;
|
||||
|
||||
/**
|
||||
* Simple enumeration for Genders.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public class GenderEnumeration implements CloneableType {
|
||||
/** Men */
|
||||
public static final GenderEnumeration MALE = new GenderEnumeration("Male");
|
||||
/** Women */
|
||||
public static final GenderEnumeration FEMALE = new GenderEnumeration("Female");
|
||||
private final String value;
|
||||
|
||||
private GenderEnumeration(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/** Returns the proper instance based on the string value */
|
||||
public static GenderEnumeration findByValue(final String value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final String gender = value.toUpperCase();
|
||||
|
||||
if (gender.charAt(0) == 'M') {
|
||||
return GenderEnumeration.MALE;
|
||||
} else if (gender.charAt(0) == 'F') {
|
||||
return GenderEnumeration.FEMALE;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the value of the instance */
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/** Returns a reference to the same object. :P */
|
||||
@Override
|
||||
public Object clone() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
124
src/main/java/com/rometools/modules/base/types/IntUnit.java
Normal file
124
src/main/java/com/rometools/modules/base/types/IntUnit.java
Normal file
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* IntUnit.java
|
||||
*
|
||||
* Created on November 16, 2005, 12:49 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.types;
|
||||
|
||||
import com.rometools.modules.base.io.GoogleBaseParser;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public class IntUnit implements CloneableType {
|
||||
private String units;
|
||||
private final int value;
|
||||
|
||||
private boolean inCharArray(final char find, final char[] array) {
|
||||
for (final char element : array) {
|
||||
if (find == element) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public IntUnit(final String source) {
|
||||
final String parse = source.trim();
|
||||
int space = -1;
|
||||
for (int i = 0; i < parse.length(); i++) {
|
||||
if (!inCharArray(parse.charAt(i), GoogleBaseParser.INTEGER_CHARS)) {
|
||||
space = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (space == -1) {
|
||||
space = parse.length();
|
||||
}
|
||||
|
||||
value = Integer.parseInt(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.INTEGER_CHARS, parse.substring(0, space)));
|
||||
|
||||
if (space != parse.length()) {
|
||||
units = parse.substring(space, parse.length()).trim();
|
||||
}
|
||||
}
|
||||
|
||||
/** Creates a new instance of IntUnit */
|
||||
public IntUnit(final int value, final String units) {
|
||||
this.value = value;
|
||||
this.units = units;
|
||||
}
|
||||
|
||||
public String getUnits() {
|
||||
return units;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new IntUnit(value, units);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (units != null && units.trim().length() > 0) {
|
||||
return value + " " + units;
|
||||
} else {
|
||||
return Integer.toString(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (!(o instanceof IntUnit)) {
|
||||
return false;
|
||||
}
|
||||
final IntUnit f = (IntUnit) o;
|
||||
if (f.getValue() != value) {
|
||||
return false;
|
||||
}
|
||||
if (units == f.getUnits() || units != null && units.equals(f.getUnits())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* PaymentTypeEnumeration.java
|
||||
*
|
||||
* Created on November 16, 2005, 11:49 AM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.types;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public class PaymentTypeEnumeration {
|
||||
|
||||
private static final HashMap<String, PaymentTypeEnumeration> lookup = new HashMap<String, PaymentTypeEnumeration>();
|
||||
|
||||
public static final PaymentTypeEnumeration CASH = new PaymentTypeEnumeration("Cash");
|
||||
public static final PaymentTypeEnumeration CHECK = new PaymentTypeEnumeration("Check");
|
||||
public static final PaymentTypeEnumeration TRAVELERS_CHECK = new PaymentTypeEnumeration("Traveler<EFBFBD>s Check");
|
||||
public static final PaymentTypeEnumeration VISA = new PaymentTypeEnumeration("Visa");
|
||||
public static final PaymentTypeEnumeration MASTERCARD = new PaymentTypeEnumeration("MasterCard");
|
||||
public static final PaymentTypeEnumeration AMERICAN_EXPRESS = new PaymentTypeEnumeration("American Express");
|
||||
public static final PaymentTypeEnumeration DISCOVER = new PaymentTypeEnumeration("Discover");
|
||||
public static final PaymentTypeEnumeration WIRE_TRANSFER = new PaymentTypeEnumeration("Wire transfer");
|
||||
public static final PaymentTypeEnumeration PAYPAL = new PaymentTypeEnumeration("Paypal");
|
||||
private final String value;
|
||||
|
||||
/** Creates a new instance of PaymentTypeEnumeration */
|
||||
private PaymentTypeEnumeration(final String value) {
|
||||
this.value = value;
|
||||
lookup.put(this.value.toUpperCase(), this);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static PaymentTypeEnumeration findByValue(final String value) {
|
||||
return lookup.get(value.toUpperCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* PriceTypeEnumeration.java
|
||||
*
|
||||
* Created on November 16, 2005, 11:45 AM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.types;
|
||||
|
||||
/**
|
||||
* Enumeration of values suitable for "price_type" or "salary_type".
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public class PriceTypeEnumeration implements CloneableType {
|
||||
/**
|
||||
* Indicates the value is a starting value.
|
||||
*/
|
||||
public static final PriceTypeEnumeration STARTING = new PriceTypeEnumeration("starting");
|
||||
/**
|
||||
* Indicates the value is negotiable
|
||||
*/
|
||||
public static final PriceTypeEnumeration NEGOTIABLE = new PriceTypeEnumeration("negotiable");
|
||||
/**
|
||||
* String value encapsulated
|
||||
*/
|
||||
private final String value;
|
||||
|
||||
/**
|
||||
* Creates a new instance of PriceTypeEnumeration
|
||||
*
|
||||
* @param value Value to encapsulate
|
||||
*/
|
||||
private PriceTypeEnumeration(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string value of this instance.
|
||||
*
|
||||
* @return Returns the string value of this instance.
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a PriceTypeEnumeration based on the String value or null.
|
||||
*
|
||||
* @param value Value to search for.
|
||||
* @return PriceTypeEnumeration or null.
|
||||
*/
|
||||
public static PriceTypeEnumeration findByValue(final String value) {
|
||||
if (value.equalsIgnoreCase("negotiable")) {
|
||||
return PriceTypeEnumeration.NEGOTIABLE;
|
||||
} else {
|
||||
return PriceTypeEnumeration.STARTING;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a duplicate of this instance
|
||||
*
|
||||
* @return The same instance.
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string value of this instance.
|
||||
*
|
||||
* @return Returns the string value of this instance.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
200
src/main/java/com/rometools/modules/base/types/ShippingType.java
Normal file
200
src/main/java/com/rometools/modules/base/types/ShippingType.java
Normal file
|
@ -0,0 +1,200 @@
|
|||
/*
|
||||
* ShippingType.java
|
||||
*
|
||||
* Created on November 16, 2005, 12:05 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.types;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* This class represents a specific shipping option for an item.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public class ShippingType implements CloneableType {
|
||||
/**
|
||||
* price of the shipping.
|
||||
*/
|
||||
private final FloatUnit price;
|
||||
/**
|
||||
* Service used.
|
||||
*/
|
||||
private final ServiceEnumeration service;
|
||||
/**
|
||||
* Country to ship to
|
||||
*/
|
||||
private final String country;
|
||||
|
||||
/**
|
||||
* Creates a new instance of ShippingType
|
||||
*
|
||||
* @param price The price of the shipping option
|
||||
* @param service Shipping service used.
|
||||
* @param country Country shipped to.
|
||||
*/
|
||||
public ShippingType(final FloatUnit price, final ServiceEnumeration service, final String country) {
|
||||
this.price = price;
|
||||
this.service = service;
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the destination country.
|
||||
*
|
||||
* @return Returns the destination country.
|
||||
*/
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the price of this shipping option.
|
||||
*
|
||||
* @return Returns the price of this shipping option.
|
||||
*/
|
||||
public FloatUnit getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ServiceEnumeration instance for the shipping service used.
|
||||
*
|
||||
* @return Returns the ServiceEnumeration instance for the shipping service used.
|
||||
*/
|
||||
public ServiceEnumeration getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones this object.
|
||||
*
|
||||
* @return Duplicate ShippingType object.
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new ShippingType(price, service, country);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of this object.
|
||||
*
|
||||
* @return String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return country + " " + price + " " + service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (!(o instanceof ShippingType)) {
|
||||
return false;
|
||||
}
|
||||
if (toString().equals(o.toString())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration class of valid options for ServiceType.
|
||||
*/
|
||||
public static class ServiceEnumeration {
|
||||
/**
|
||||
* Looks up a ServiceEnumeration based on the string value.
|
||||
*/
|
||||
private static final HashMap<String, ServiceEnumeration> lookup = new HashMap<String, ServiceEnumeration>();
|
||||
/**
|
||||
* Standard
|
||||
*/
|
||||
public static final ServiceEnumeration STANDARD = new ServiceEnumeration("Standard");
|
||||
/**
|
||||
* Freight
|
||||
*/
|
||||
public static final ServiceEnumeration FREIGHT = new ServiceEnumeration("Freight");
|
||||
/**
|
||||
* Overnight
|
||||
*/
|
||||
public static final ServiceEnumeration OVERNIGHT = new ServiceEnumeration("Overnight");
|
||||
|
||||
/**
|
||||
* String value
|
||||
*/
|
||||
private final String value;
|
||||
|
||||
/**
|
||||
* Creates a new instance of ServiceEnumeration.
|
||||
*
|
||||
* @param value String value to encapsulate.
|
||||
*/
|
||||
private ServiceEnumeration(final String value) {
|
||||
this.value = value;
|
||||
lookup.put(this.value.toUpperCase(), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* String value of this Service.
|
||||
*
|
||||
* @return String value of this Service.
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up a ServiceEnumeration based on the string value.
|
||||
*
|
||||
* @param value String value to search for.
|
||||
* @return ServiceEnumeration or null.
|
||||
*/
|
||||
public static ServiceEnumeration findByValue(final String value) {
|
||||
return lookup.get(value.toUpperCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* String value of this Service.
|
||||
*
|
||||
* @return String value of this Service.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* ShortDate.java
|
||||
*
|
||||
* Created on November 17, 2005, 1:04 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.types;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* This is a simple wrapper for java.util.Date that indicates it should be formatted without time of
|
||||
* day for Google Base. It should be transparent to module developers.
|
||||
*
|
||||
* Move along. Nothing to see here.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public class ShortDate extends Date implements CloneableType {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** Creates a new instance of ShortDate */
|
||||
public ShortDate() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Short Date based on a Date value.
|
||||
*
|
||||
* @param date Date value to read from.
|
||||
*/
|
||||
public ShortDate(final Date date) {
|
||||
super(date.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ShortDate based on a millisecond time.
|
||||
*
|
||||
* @param time Millisecond time to start with.
|
||||
*/
|
||||
public ShortDate(final long time) {
|
||||
super(time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a duplicate of this object.
|
||||
*
|
||||
* @return Duplicate of the object.
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new ShortDate(getTime());
|
||||
}
|
||||
}
|
168
src/main/java/com/rometools/modules/base/types/Size.java
Normal file
168
src/main/java/com/rometools/modules/base/types/Size.java
Normal file
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
* Size.java
|
||||
*
|
||||
* Created on November 16, 2005, 1:51 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.types;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* Represents the size on an item in 2 or 3 dimensions.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public class Size implements CloneableType {
|
||||
/**
|
||||
* height
|
||||
*/
|
||||
private FloatUnit height;
|
||||
/**
|
||||
* length
|
||||
*/
|
||||
private final FloatUnit length;
|
||||
/**
|
||||
* width
|
||||
*/
|
||||
private final FloatUnit width;
|
||||
|
||||
/**
|
||||
* Creates a new Size object parsing a string value.
|
||||
*
|
||||
* @param source String value to parse
|
||||
*/
|
||||
public Size(final String source) {
|
||||
final StringTokenizer tok = new StringTokenizer(source, "Xx");
|
||||
length = new FloatUnit(tok.nextToken());
|
||||
width = new FloatUnit(tok.nextToken());
|
||||
|
||||
if (tok.hasMoreTokens()) {
|
||||
height = new FloatUnit(tok.nextToken());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of Size
|
||||
*
|
||||
* @param length lenght value
|
||||
* @param width width value
|
||||
*/
|
||||
public Size(final FloatUnit length, final FloatUnit width) {
|
||||
this.length = length;
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of Size.
|
||||
*
|
||||
* @param length Length value.
|
||||
* @param width Width value.
|
||||
* @param height Height value.
|
||||
*/
|
||||
public Size(final FloatUnit length, final FloatUnit width, final FloatUnit height) {
|
||||
this.length = length;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Height value.
|
||||
*
|
||||
* @return Height value.
|
||||
*/
|
||||
public FloatUnit getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Length value.
|
||||
*
|
||||
* @return Length value.
|
||||
*/
|
||||
public FloatUnit getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Width value.
|
||||
*
|
||||
* @return Width value.
|
||||
*/
|
||||
public FloatUnit getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates this object.
|
||||
*
|
||||
* @return A duplicate Size object.
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
if (height != null) {
|
||||
return new Size(length, width, height);
|
||||
} else {
|
||||
return new Size(length, width);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this object.
|
||||
*
|
||||
* @return A string representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
if (height != null) {
|
||||
return length + "x" + width + "x" + height;
|
||||
} else {
|
||||
return length + "x" + width;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (!(o instanceof Size)) {
|
||||
return false;
|
||||
}
|
||||
if (toString().equals(o.toString())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
107
src/main/java/com/rometools/modules/base/types/YearType.java
Normal file
107
src/main/java/com/rometools/modules/base/types/YearType.java
Normal file
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* YearType.java
|
||||
*
|
||||
* Created on November 17, 2005, 11:42 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.base.types;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* This class represents a simple 4 digit year.
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public class YearType implements CloneableType {
|
||||
/**
|
||||
* year value
|
||||
*/
|
||||
int year;
|
||||
|
||||
/**
|
||||
* Creates a new year from a string value.
|
||||
*
|
||||
* @param year String to parse.
|
||||
*/
|
||||
public YearType(final String year) {
|
||||
this.year = Integer.parseInt(year.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of YearType
|
||||
*
|
||||
* @param date Date to get the year from.
|
||||
*/
|
||||
public YearType(final Date date) {
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
year = cal.get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates this object.
|
||||
*
|
||||
* @return Cloned Year.
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new YearType(Integer.toString(year));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String representation of this object.
|
||||
*
|
||||
* @return Returns a String representation of this object.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return Integer.toString(year);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (!(o instanceof YearType)) {
|
||||
return false;
|
||||
}
|
||||
if (toString().equals(o.toString())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
45
src/main/java/com/rometools/modules/base/types/package.html
Normal file
45
src/main/java/com/rometools/modules/base/types/package.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
This package contains complex and utility datatypes for use with Google Base.
|
||||
<pre>
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
61
src/main/java/com/rometools/modules/cc/CreativeCommons.java
Normal file
61
src/main/java/com/rometools/modules/cc/CreativeCommons.java
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* CreativeCommons.java
|
||||
*
|
||||
* Created on November 20, 2005, 5:05 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.cc;
|
||||
|
||||
import com.rometools.modules.cc.types.License;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public interface CreativeCommons extends Module {
|
||||
|
||||
public static final String URI = "rome:CreativeCommons";
|
||||
|
||||
public License[] getAllLicenses();
|
||||
|
||||
public void setAllLicenses(License[] licenses);
|
||||
|
||||
public License[] getLicenses();
|
||||
|
||||
public void setLicenses(License[] license);
|
||||
}
|
136
src/main/java/com/rometools/modules/cc/CreativeCommonsImpl.java
Normal file
136
src/main/java/com/rometools/modules/cc/CreativeCommonsImpl.java
Normal file
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
* AbstractCreativeCommons.java
|
||||
*
|
||||
* Created on November 20, 2005, 5:12 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.cc;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
import com.rometools.modules.cc.types.License;
|
||||
import com.rometools.rome.feed.CopyFrom;
|
||||
import com.rometools.rome.feed.impl.EqualsBean;
|
||||
import com.rometools.rome.feed.impl.ToStringBean;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.1 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class CreativeCommonsImpl implements CreativeCommons {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String RDF_URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
||||
public static final String RSS2_URI = "http://backend.userland.com/creativeCommonsRssModule";
|
||||
public static final String RSS1_URI = "http://web.resource.org/cc/";
|
||||
|
||||
private License[] allLicenses;
|
||||
private License[] licenses;
|
||||
|
||||
protected Object arrayCopy(final Object[] source) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final Object[] array = (Object[]) Array.newInstance(source.getClass().getComponentType(), source.length);
|
||||
|
||||
for (int i = 0; i < source.length; i++) {
|
||||
array[i] = source[i];
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
@Override
|
||||
public License[] getAllLicenses() {
|
||||
return allLicenses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllLicenses(final License[] allLicenses) {
|
||||
this.allLicenses = allLicenses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<CreativeCommons> getInterface() {
|
||||
return CreativeCommons.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUri() {
|
||||
return CreativeCommons.URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
final CreativeCommonsImpl clone = new CreativeCommonsImpl();
|
||||
clone.copyFrom(this);
|
||||
return clone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom object) {
|
||||
final CreativeCommons source = (CreativeCommons) object;
|
||||
setAllLicenses((License[]) arrayCopy(source.getAllLicenses()));
|
||||
setLicenses(source.getLicenses());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
final EqualsBean eBean = new EqualsBean(this.getClass(), this);
|
||||
|
||||
return eBean.beanEquals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public License[] getLicenses() {
|
||||
return licenses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLicenses(final License[] licenses) {
|
||||
this.licenses = licenses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final ToStringBean tsb = new ToStringBean(CreativeCommonsImpl.class, this);
|
||||
return tsb.toString();
|
||||
}
|
||||
|
||||
}
|
151
src/main/java/com/rometools/modules/cc/io/CCModuleGenerator.java
Normal file
151
src/main/java/com/rometools/modules/cc/io/CCModuleGenerator.java
Normal file
|
@ -0,0 +1,151 @@
|
|||
/*
|
||||
* CCModuleGenerator.java
|
||||
*
|
||||
* Created on November 20, 2005, 5:23 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.cc.io;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.rometools.modules.cc.CreativeCommons;
|
||||
import com.rometools.modules.cc.CreativeCommonsImpl;
|
||||
import com.rometools.modules.cc.types.License;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleGenerator;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.1 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class CCModuleGenerator implements ModuleGenerator {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CCModuleGenerator.class);
|
||||
|
||||
private static final Namespace RSS1 = Namespace.getNamespace("cc", CreativeCommonsImpl.RSS1_URI);
|
||||
private static final Namespace RSS2 = Namespace.getNamespace("creativeCommons", CreativeCommonsImpl.RSS2_URI);
|
||||
private static final Namespace RSS = Namespace.getNamespace("http://purl.org/rss/1.0/");
|
||||
private static final Namespace RDF = Namespace.getNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
|
||||
private static final HashSet<Namespace> NAMESPACES = new HashSet<Namespace>();
|
||||
static {
|
||||
NAMESPACES.add(RSS1);
|
||||
NAMESPACES.add(RSS2);
|
||||
NAMESPACES.add(RDF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of CCModuleGenerator
|
||||
*/
|
||||
public CCModuleGenerator() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(final Module module, final Element element) {
|
||||
Element root = element;
|
||||
while (root.getParentElement() != null) {
|
||||
root = root.getParentElement();
|
||||
}
|
||||
if (root.getNamespace().equals(RDF) || root.getNamespace().equals(RSS)) {
|
||||
generateRSS1((CreativeCommons) module, element);
|
||||
} else {
|
||||
generateRSS2((CreativeCommons) module, element);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Namespace> getNamespaces() {
|
||||
return NAMESPACES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return CreativeCommons.URI;
|
||||
}
|
||||
|
||||
private void generateRSS1(final CreativeCommons module, final Element element) {
|
||||
// throw new RuntimeException( "Generating RSS1 Feeds not currently Supported.");
|
||||
|
||||
LOG.debug(element.getName());
|
||||
if (element.getName().equals("channel")) {
|
||||
// Do all licenses list.
|
||||
final License[] all = module.getAllLicenses();
|
||||
for (final License element2 : all) {
|
||||
final Element license = new Element("License", RSS1);
|
||||
license.setAttribute("about", element2.getValue(), RDF);
|
||||
final License.Behaviour[] permits = element2.getPermits();
|
||||
for (int j = 0; permits != null && j < permits.length; j++) {
|
||||
final Element permit = new Element("permits", RSS1);
|
||||
permit.setAttribute("resource", permits[j].toString(), RDF);
|
||||
license.addContent(permit);
|
||||
}
|
||||
final License.Behaviour[] requires = element2.getPermits();
|
||||
for (int j = 0; requires != null && j < requires.length; j++) {
|
||||
final Element permit = new Element("requires", RSS1);
|
||||
permit.setAttribute("resource", permits[j].toString(), RDF);
|
||||
license.addContent(permit);
|
||||
}
|
||||
LOG.debug("Is Root? {}", element.getParentElement());
|
||||
element.getParentElement().addContent(license);
|
||||
}
|
||||
}
|
||||
|
||||
// Do local licenses
|
||||
final License[] licenses = module.getLicenses();
|
||||
for (final License license2 : licenses) {
|
||||
final Element license = new Element("license", RSS1);
|
||||
license.setAttribute("resource", license2.getValue(), RDF);
|
||||
element.addContent(license);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void generateRSS2(final CreativeCommons module, final Element element) {
|
||||
final License[] licenses = module.getLicenses();
|
||||
for (int i = 0; licenses != null && i < licenses.length; i++) {
|
||||
final Element license = new Element("license", RSS2);
|
||||
license.setText(licenses[i].getValue());
|
||||
element.addContent(license);
|
||||
}
|
||||
}
|
||||
}
|
139
src/main/java/com/rometools/modules/cc/io/ModuleParserRSS1.java
Normal file
139
src/main/java/com/rometools/modules/cc/io/ModuleParserRSS1.java
Normal file
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* CCModuleParser.java
|
||||
*
|
||||
* Created on November 20, 2005, 5:23 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.cc.io;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
||||
import com.rometools.modules.cc.CreativeCommonsImpl;
|
||||
import com.rometools.modules.cc.types.License;
|
||||
import com.rometools.modules.cc.types.License.Behaviour;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleParser;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.3 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class ModuleParserRSS1 implements ModuleParser {
|
||||
|
||||
private static final Namespace NS = Namespace.getNamespace(CreativeCommonsImpl.RSS1_URI);
|
||||
static final Namespace RDF = Namespace.getNamespace(CreativeCommonsImpl.RDF_URI);
|
||||
|
||||
/**
|
||||
* Creates a new instance of ModuleParserRSS1
|
||||
*/
|
||||
public ModuleParserRSS1() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module parse(final Element element, final Locale locale) {
|
||||
final CreativeCommonsImpl module = new CreativeCommonsImpl();
|
||||
{
|
||||
// Parsing Channel level.
|
||||
Element root = element;
|
||||
while (root.getParentElement() != null) {
|
||||
root = root.getParentElement();
|
||||
}
|
||||
final List<Element> licenseList = root.getChildren("License", NS);
|
||||
final ArrayList<License> licenses = new ArrayList<License>();
|
||||
final Iterator<Element> it = licenseList.iterator();
|
||||
while (it.hasNext()) {
|
||||
final Element licenseTag = it.next();
|
||||
final String licenseURI = licenseTag.getAttributeValue("about", RDF);
|
||||
if (licenseURI == null) {
|
||||
continue;
|
||||
}
|
||||
License license = License.findByValue(licenseURI);
|
||||
{
|
||||
final ArrayList<Behaviour> permitsValues = new ArrayList<Behaviour>();
|
||||
final ArrayList<Behaviour> requiresValues = new ArrayList<Behaviour>();
|
||||
final List<Element> permitsTags = licenseTag.getChildren("permits", NS);
|
||||
Iterator<Element> sit = permitsTags.iterator();
|
||||
while (sit.hasNext()) {
|
||||
final Element permitTag = sit.next();
|
||||
permitsValues.add(License.Behaviour.findByValue(permitTag.getAttributeValue("resource", RDF)));
|
||||
}
|
||||
final List<Element> requiresTags = licenseTag.getChildren("requires", NS);
|
||||
sit = requiresTags.iterator();
|
||||
while (sit.hasNext()) {
|
||||
final Element requireTag = sit.next();
|
||||
requiresValues.add(License.Behaviour.findByValue(requireTag.getAttributeValue("resource", RDF)));
|
||||
}
|
||||
license = new License(licenseURI, requiresValues.toArray(new License.Behaviour[requiresValues.size()]),
|
||||
permitsValues.toArray(new License.Behaviour[permitsValues.size()]));
|
||||
|
||||
}
|
||||
|
||||
licenses.add(license);
|
||||
}
|
||||
module.setAllLicenses(licenses.toArray(new License[0]));
|
||||
}
|
||||
final ArrayList<License> licenses = new ArrayList<License>();
|
||||
final List<Element> licenseTags = element.getChildren("license", NS);
|
||||
final Iterator<Element> lit = licenseTags.iterator();
|
||||
while (lit.hasNext()) {
|
||||
final Element licenseTag = lit.next();
|
||||
licenses.add(License.findByValue(licenseTag.getAttributeValue("resource", RDF)));
|
||||
}
|
||||
|
||||
if (!licenses.isEmpty()) {
|
||||
module.setLicenses(licenses.toArray(new License[licenses.size()]));
|
||||
}
|
||||
|
||||
if (module.getLicenses() != null || module.getAllLicenses() != null) {
|
||||
return module;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return CreativeCommonsImpl.RSS1_URI;
|
||||
}
|
||||
|
||||
}
|
127
src/main/java/com/rometools/modules/cc/io/ModuleParserRSS2.java
Normal file
127
src/main/java/com/rometools/modules/cc/io/ModuleParserRSS2.java
Normal file
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* ModuleParserRSS2.java
|
||||
*
|
||||
* Created on November 20, 2005, 6:15 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.cc.io;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
||||
import com.rometools.modules.cc.CreativeCommonsImpl;
|
||||
import com.rometools.modules.cc.types.License;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleParser;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version $Revision: 1.3 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class ModuleParserRSS2 implements ModuleParser {
|
||||
|
||||
private static final Namespace NS = Namespace.getNamespace(CreativeCommonsImpl.RSS2_URI);
|
||||
|
||||
/** Creates a new instance of ModuleParserRSS2 */
|
||||
public ModuleParserRSS2() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module parse(final Element element, final Locale locale) {
|
||||
final CreativeCommonsImpl module = new CreativeCommonsImpl();
|
||||
// Do channel global
|
||||
{
|
||||
Element root = element;
|
||||
while (!root.getName().equals("channel") && !root.getName().equals("feed")) {
|
||||
root = root.getParentElement();
|
||||
}
|
||||
final ArrayList<License> licenses = new ArrayList<License>();
|
||||
List<Element> items = null;
|
||||
if (root.getName().equals("channel")) {
|
||||
items = root.getChildren("item");
|
||||
} else {
|
||||
items = root.getChildren("entry");
|
||||
}
|
||||
|
||||
final Iterator<Element> iit = items.iterator();
|
||||
while (iit.hasNext()) {
|
||||
final Element item = iit.next();
|
||||
final List<Element> licenseTags = item.getChildren("license", NS);
|
||||
final Iterator<Element> lit = licenseTags.iterator();
|
||||
while (lit.hasNext()) {
|
||||
final Element licenseTag = lit.next();
|
||||
final License license = License.findByValue(licenseTag.getTextTrim());
|
||||
if (!licenses.contains(license)) {
|
||||
;
|
||||
}
|
||||
licenses.add(license);
|
||||
}
|
||||
}
|
||||
if (!licenses.isEmpty()) {
|
||||
module.setAllLicenses(licenses.toArray(new License[0]));
|
||||
}
|
||||
}
|
||||
// do element local
|
||||
final ArrayList<License> licenses = new ArrayList<License>();
|
||||
final List<Element> licenseTags = element.getChildren("license", NS);
|
||||
final Iterator<Element> it = licenseTags.iterator();
|
||||
while (it.hasNext()) {
|
||||
final Element licenseTag = it.next();
|
||||
licenses.add(License.findByValue(licenseTag.getTextTrim()));
|
||||
}
|
||||
if (!licenses.isEmpty()) {
|
||||
module.setLicenses(licenses.toArray(new License[0]));
|
||||
}
|
||||
|
||||
if (module.getLicenses() != null && module.getAllLicenses() != null) {
|
||||
return module;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return CreativeCommonsImpl.RSS2_URI;
|
||||
}
|
||||
}
|
80
src/main/java/com/rometools/modules/cc/package.html
Normal file
80
src/main/java/com/rometools/modules/cc/package.html
Normal file
|
@ -0,0 +1,80 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
This is a module for ROME that supports both the
|
||||
<a href="http://web.resource.org/rss/1.0/modules/cc/">"CC" RSS1</a> module and the
|
||||
<a href="backend.userland.com/creativeCommonsRssModule"> RSS 2 (and Atom)</a>
|
||||
module in a unified manner.
|
||||
|
||||
<p>It does this by superimposing the "rome:creativecommon" namespace over both of them
|
||||
for the purposes of the module, and synchronizes them into a unified structure. For RSS2
|
||||
it attempts to correlate the license into a code-capable fashion. If the license link
|
||||
goes to one of the standard licenses at creativecommons.org, it will populate the permissions
|
||||
based on it's know set (See License.Behaviour).</p>
|
||||
|
||||
<p>The module has 2 fields on it. One is "allLicenses". This is simply an array of all licenses
|
||||
in a feed. The second one "licenses" contains licenses that apply to a specific element (feed or
|
||||
entry). Licenses then contain "permits" and "requires" behaviours. If a license is used that
|
||||
the system can't determine anything about, these will be null. Zero-lenght means "known and
|
||||
empty."</p>
|
||||
|
||||
<p>At this time, because of a ROME limitation, writing RSS1 feeds is not possible. However,
|
||||
if you read an RSS1 feed, you can convert it to an RSS2 feed properly.</p>
|
||||
|
||||
<p>Sample Usage:
|
||||
<pre>
|
||||
|
||||
CreativeCommons commons = new CreativeCommonsImpl();
|
||||
commons.setLicense( new License[]{ License.NONCOMMERCIAL } );
|
||||
// Note, you do not have to setAllLicenses right now. When the RSS1 functionality is
|
||||
// added, this will be required at the Feed level only.
|
||||
ArrayList modules = new ArrayList()
|
||||
modules.add( commons );
|
||||
syndEntry.setModules( commons );
|
||||
|
||||
//Alternately, to get the module:
|
||||
CreativeCommons commons = (CreativeCommons) syndFeed.getModule( CreativeCommons.URI );
|
||||
|
||||
</pre>
|
||||
</p>
|
||||
<pre>
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
197
src/main/java/com/rometools/modules/cc/types/License.java
Normal file
197
src/main/java/com/rometools/modules/cc/types/License.java
Normal file
|
@ -0,0 +1,197 @@
|
|||
/*
|
||||
* LicenseEnumeration.java
|
||||
*
|
||||
* Created on November 20, 2005, 3:20 PM
|
||||
*
|
||||
* This library is provided under dual licenses. You may choose the terms of the Lesser General
|
||||
* Public License or the Apache License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU Lesser General Public License as published by the Free Software Foundation; either version
|
||||
* 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with this library;
|
||||
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.rometools.modules.cc.types;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.rometools.rome.feed.impl.EqualsBean;
|
||||
import com.rometools.rome.feed.impl.ToStringBean;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.1 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class License {
|
||||
|
||||
private static final String CC_START = "http://creativecommons.org/licenses/";
|
||||
private static final Map<String, License> lookupLicense = new ConcurrentHashMap<String, License>();
|
||||
private static final Logger LOG = LoggerFactory.getLogger(License.class);
|
||||
public static final License NO_DERIVS = new License("http://creativecommons.org/licenses/nd/1.0/", new Behaviour[0], new Behaviour[] {
|
||||
Behaviour.DISTRIBUTION, Behaviour.REPRODUCTION});
|
||||
public static final License NO_DERIVS_NONCOMMERCIAL = new License("http://creativecommons.org/licenses/nd-nc/1.0/",
|
||||
new Behaviour[] {Behaviour.NONCOMMERCIAL}, new Behaviour[] {Behaviour.DISTRIBUTION, Behaviour.REPRODUCTION});
|
||||
public static final License NONCOMMERCIAL = new License("http://creativecommons.org/licenses/nc/1.0/", new Behaviour[] {Behaviour.NONCOMMERCIAL},
|
||||
new Behaviour[] {Behaviour.DERIVATIVE, Behaviour.DISTRIBUTION, Behaviour.REPRODUCTION});
|
||||
public static final License SHARE_ALIKE = new License("http://creativecommons.org/licenses/sa/1.0/", new Behaviour[] {Behaviour.COPYLEFT}, new Behaviour[] {
|
||||
Behaviour.DERIVATIVE, Behaviour.DISTRIBUTION, Behaviour.REPRODUCTION});
|
||||
public static final License SHARE_ALIKE_NONCOMMERCIAL = new License("http://creativecommons.org/licenses/nc-sa/1.0/", new Behaviour[] {Behaviour.COPYLEFT,
|
||||
Behaviour.NONCOMMERCIAL}, new Behaviour[] {Behaviour.DERIVATIVE, Behaviour.DISTRIBUTION, Behaviour.REPRODUCTION});
|
||||
public static final License SHARE_ALIKE_ATTRIBUTION = new License("http://creativecommons.org/licenses/by-sa/2.5/", new Behaviour[] {Behaviour.COPYLEFT,
|
||||
Behaviour.ATTRIBUTION}, new Behaviour[] {Behaviour.DERIVATIVE, Behaviour.DISTRIBUTION, Behaviour.REPRODUCTION});
|
||||
public static final License SHARE_ALIKE_NONCOMMERCIAL_ATTRIBUTION = new License("http://creativecommons.org/licenses/by-nc-sa/2.5/", new Behaviour[] {
|
||||
Behaviour.COPYLEFT, Behaviour.ATTRIBUTION, Behaviour.NONCOMMERCIAL}, new Behaviour[] {Behaviour.DERIVATIVE, Behaviour.DISTRIBUTION,
|
||||
Behaviour.REPRODUCTION});
|
||||
public static final License NONCOMMERCIAL_ATTRIBUTION = new License("http://creativecommons.org/licenses/by-nc/2.5/", new Behaviour[] {
|
||||
Behaviour.ATTRIBUTION, Behaviour.NONCOMMERCIAL}, new Behaviour[] {Behaviour.DERIVATIVE, Behaviour.DISTRIBUTION, Behaviour.REPRODUCTION});
|
||||
public static final License NONCOMMERCIAL_ATTRIBUTION_NO_DERIVS = new License("http://creativecommons.org/licenses/by-nc-nd/2.5/", new Behaviour[] {
|
||||
Behaviour.ATTRIBUTION, Behaviour.NONCOMMERCIAL}, new Behaviour[] {Behaviour.DISTRIBUTION, Behaviour.REPRODUCTION});
|
||||
public static final License ATTRIBUTION_NO_DERIVS = new License("http://creativecommons.org/licenses/by-nd/2.5/", new Behaviour[] {Behaviour.ATTRIBUTION},
|
||||
new Behaviour[] {Behaviour.DISTRIBUTION, Behaviour.REPRODUCTION});
|
||||
public static final License ATTRIBUTION = new License("http://creativecommons.org/licenses/by/2.5/", new Behaviour[] {Behaviour.ATTRIBUTION},
|
||||
new Behaviour[] {Behaviour.DERIVATIVE, Behaviour.DISTRIBUTION, Behaviour.REPRODUCTION});
|
||||
private final String uri;
|
||||
private final Behaviour[] permits;
|
||||
private final Behaviour[] requires;
|
||||
|
||||
/**
|
||||
* Creates a new instance of License
|
||||
*/
|
||||
public License(final String uri, final Behaviour[] requires, final Behaviour[] permits) {
|
||||
this.requires = requires;
|
||||
this.permits = permits;
|
||||
this.uri = uri;
|
||||
License.lookupLicense.put(uri, this);
|
||||
|
||||
if (this.uri.endsWith("/")) {
|
||||
// LOG.debug(uri.substring(0,this.uri.lastIndexOf("/")));
|
||||
License.lookupLicense.put(uri.substring(0, this.uri.lastIndexOf("/")), this);
|
||||
}
|
||||
}
|
||||
|
||||
public static License findByValue(final String uri) {
|
||||
License found = License.lookupLicense.get(uri);
|
||||
|
||||
// No I am going to try an guess about unknown licenses
|
||||
// This is try and match known CC licenses of other versions or various URLs to
|
||||
// current licenses, then make a new one with the same permissions.
|
||||
if (found == null && uri.startsWith("http://") && uri.toLowerCase().indexOf("creativecommons.org") != -1) {
|
||||
final Iterator<String> it = License.lookupLicense.keySet().iterator();
|
||||
while (it.hasNext() && found == null) {
|
||||
final String key = it.next();
|
||||
try {
|
||||
if (key.startsWith(CC_START)) {
|
||||
final String licensePath = key.substring(CC_START.length(), key.length());
|
||||
final StringTokenizer tok = new StringTokenizer(licensePath, "/");
|
||||
final String license = tok.nextToken();
|
||||
// final String version = tok.nextToken();
|
||||
if (uri.toLowerCase().indexOf("creativecommons.org/licenses/" + license) != -1) {
|
||||
final License current = lookupLicense.get(key);
|
||||
found = new License(uri, current.getRequires(), current.getPermits());
|
||||
}
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
LOG.error("Error", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// OK, we got here. If we haven't found a match, return a new License with unknown
|
||||
// permissions.
|
||||
if (found == null) {
|
||||
found = new License(uri, null, null);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is just useful for testing to allow clearing of the looked up licenses.
|
||||
*/
|
||||
static void clear() {
|
||||
lookupLicense.clear();
|
||||
}
|
||||
|
||||
public Behaviour[] getPermits() {
|
||||
return permits;
|
||||
}
|
||||
|
||||
public Behaviour[] getRequires() {
|
||||
return requires;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
final ToStringBean tsb = new ToStringBean(License.class, this);
|
||||
return tsb.toString();
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
final EqualsBean eBean = new EqualsBean(License.class, this);
|
||||
return eBean.beanEquals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final EqualsBean equals = new EqualsBean(License.class, this);
|
||||
return equals.beanHashCode();
|
||||
}
|
||||
|
||||
public static class Behaviour {
|
||||
private static final Map<String, Behaviour> lookup = new HashMap<String, Behaviour>();
|
||||
public static final Behaviour REPRODUCTION = new Behaviour("http://web.resource.org/cc/Reproduction");
|
||||
public static final Behaviour DISTRIBUTION = new Behaviour("http://web.resource.org/cc/Distribution");
|
||||
public static final Behaviour DERIVATIVE = new Behaviour("http://web.resource.org/cc/DerivativeWorks");
|
||||
public static final Behaviour NOTICE = new Behaviour("http://web.resource.org/cc/Notice");
|
||||
public static final Behaviour ATTRIBUTION = new Behaviour("http://web.resource.org/cc/Attribution");
|
||||
public static final Behaviour COPYLEFT = new Behaviour("http://web.resource.org/cc/Copyleft");
|
||||
public static final Behaviour NONCOMMERCIAL = new Behaviour("http://web.resource.org/cc/Noncommercial");
|
||||
private final String uri;
|
||||
|
||||
private Behaviour(final String uri) {
|
||||
this.uri = uri;
|
||||
Behaviour.lookup.put(uri, this);
|
||||
}
|
||||
|
||||
public static Behaviour findByValue(final String uri) {
|
||||
return Behaviour.lookup.get(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
}
|
45
src/main/java/com/rometools/modules/cc/types/package.html
Normal file
45
src/main/java/com/rometools/modules/cc/types/package.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
This package contains datatypes for use with the plug in.
|
||||
<pre>
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
211
src/main/java/com/rometools/modules/content/ContentItem.java
Normal file
211
src/main/java/com/rometools/modules/content/ContentItem.java
Normal file
|
@ -0,0 +1,211 @@
|
|||
/*
|
||||
* ContentItem.java
|
||||
*
|
||||
* Created on January 12, 2005, 8:52 AM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*
|
||||
*/
|
||||
package com.rometools.modules.content;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jdom2.Content;
|
||||
import org.jdom2.Namespace;
|
||||
|
||||
/**
|
||||
* This class represents a content item per the "Original Syntax".
|
||||
* http://purl.org/rss/1.0/modules/content/
|
||||
*
|
||||
* @version $Revision: 1.1 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class ContentItem implements Cloneable {
|
||||
|
||||
private String contentFormat;
|
||||
private String contentEncoding;
|
||||
private String contentValue;
|
||||
private List<Content> contentValueDOM;
|
||||
private String contentAbout;
|
||||
private String contentValueParseType;
|
||||
private List<Namespace> contentValueNamespace;
|
||||
private String contentResource;
|
||||
|
||||
/** Creates a new instance of ContentItem */
|
||||
public ContentItem() {
|
||||
}
|
||||
|
||||
public String getContentFormat() {
|
||||
return contentFormat;
|
||||
}
|
||||
|
||||
public void setContentFormat(final String contentFormat) {
|
||||
this.contentFormat = contentFormat;
|
||||
}
|
||||
|
||||
public String getContentEncoding() {
|
||||
return contentEncoding;
|
||||
}
|
||||
|
||||
public void setContentEncoding(final String contentEncoding) {
|
||||
this.contentEncoding = contentEncoding;
|
||||
}
|
||||
|
||||
public String getContentValue() {
|
||||
return contentValue;
|
||||
}
|
||||
|
||||
public void setContentValue(final String contentValue) {
|
||||
this.contentValue = contentValue;
|
||||
}
|
||||
|
||||
public List<Content> getContentValueDOM() {
|
||||
return contentValueDOM;
|
||||
}
|
||||
|
||||
public void setContentValueDOM(final List<Content> contentValueDOM) {
|
||||
this.contentValueDOM = contentValueDOM;
|
||||
}
|
||||
|
||||
public String getContentAbout() {
|
||||
return contentAbout;
|
||||
}
|
||||
|
||||
public void setContentAbout(final String contentAbout) {
|
||||
this.contentAbout = contentAbout;
|
||||
}
|
||||
|
||||
public String getContentValueParseType() {
|
||||
return contentValueParseType;
|
||||
}
|
||||
|
||||
public void setContentValueParseType(final String contentValueParseType) {
|
||||
this.contentValueParseType = contentValueParseType;
|
||||
}
|
||||
|
||||
public List<Namespace> getContentValueNamespaces() {
|
||||
return contentValueNamespace;
|
||||
}
|
||||
|
||||
public void setContentValueNamespaces(final List<Namespace> contentValueNamespace) {
|
||||
this.contentValueNamespace = contentValueNamespace;
|
||||
}
|
||||
|
||||
public String getContentResource() {
|
||||
return contentResource;
|
||||
}
|
||||
|
||||
public void setContentResource(final String contentResource) {
|
||||
this.contentResource = contentResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ContentItem other = (ContentItem) obj;
|
||||
if (contentFormat == null ? other.contentFormat != null : !contentFormat.equals(other.contentFormat)) {
|
||||
// LOG.debug("format");
|
||||
return false;
|
||||
}
|
||||
if (contentEncoding == null ? other.contentEncoding != null : !contentEncoding.equals(other.contentEncoding)) {
|
||||
// LOG.debug("enc");
|
||||
return false;
|
||||
}
|
||||
final String thisCV = contentValue.replaceAll(" xmlns=\"http://www.w3.org/1999/xhtml\"", "").trim();
|
||||
;
|
||||
final String thatCV = other.contentValue.replaceAll(" xmlns=\"http://www.w3.org/1999/xhtml\"", "").trim();
|
||||
if (contentValue == null ? other.contentValue != null : !thisCV.equals(thatCV)) {
|
||||
|
||||
return false;
|
||||
}
|
||||
if (contentValueDOM != other.contentValueDOM && (contentValueDOM == null || !contentValueDOM.equals(other.contentValueDOM))) {
|
||||
// LOG.debug("vd");
|
||||
return false;
|
||||
}
|
||||
if (contentAbout == null ? other.contentAbout != null : !contentAbout.equals(other.contentAbout)) {
|
||||
// LOG.debug("abt");
|
||||
return false;
|
||||
}
|
||||
if (contentValueParseType == null ? other.contentValueParseType != null : !contentValueParseType.equals(other.contentValueParseType)) {
|
||||
// LOG.debug("pt");
|
||||
return false;
|
||||
}
|
||||
if (contentValueNamespace != other.contentValueNamespace
|
||||
&& (contentValueNamespace == null || !contentValueNamespace.equals(other.contentValueNamespace))) {
|
||||
// LOG.debug("ns");
|
||||
return false;
|
||||
}
|
||||
if (contentResource == null ? other.contentResource != null : !contentResource.equals(other.contentResource)) {
|
||||
// LOG.debug("res");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 97 * hash + (contentFormat != null ? contentFormat.hashCode() : 0);
|
||||
hash = 97 * hash + (contentEncoding != null ? contentEncoding.hashCode() : 0);
|
||||
hash = 97 * hash + (contentValue != null ? contentValue.hashCode() : 0);
|
||||
hash = 97 * hash + (contentValueDOM != null ? contentValueDOM.hashCode() : 0);
|
||||
hash = 97 * hash + (contentAbout != null ? contentAbout.hashCode() : 0);
|
||||
hash = 97 * hash + (contentValueParseType != null ? contentValueParseType.hashCode() : 0);
|
||||
hash = 97 * hash + (contentValueNamespace != null ? contentValueNamespace.hashCode() : 0);
|
||||
hash = 97 * hash + (contentResource != null ? contentResource.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
final ContentItem o = new ContentItem();
|
||||
o.contentAbout = contentAbout;
|
||||
o.contentEncoding = contentEncoding;
|
||||
o.contentFormat = contentFormat;
|
||||
o.contentResource = contentResource;
|
||||
o.contentValue = contentValue;
|
||||
o.contentValueDOM = contentValueDOM;
|
||||
o.contentValueNamespace = contentValueNamespace;
|
||||
o.contentValueParseType = contentValueParseType;
|
||||
|
||||
return o;
|
||||
}
|
||||
}
|
106
src/main/java/com/rometools/modules/content/ContentModule.java
Normal file
106
src/main/java/com/rometools/modules/content/ContentModule.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* ContentModule.java
|
||||
*
|
||||
* Created on January 11, 2005, 1:02 PM
|
||||
*
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.rometools.modules.content;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.1 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public interface ContentModule extends Module {
|
||||
|
||||
public static final String URI = "http://purl.org/rss/1.0/modules/content/";
|
||||
public static final String RDF_URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
||||
|
||||
/**
|
||||
* Returns a List of Strings containing the New Syntax Encoded values are in the element.
|
||||
*
|
||||
* @return List of content Strings
|
||||
*/
|
||||
public List<String> getEncodeds();
|
||||
|
||||
/**
|
||||
* Sets a List of Strings containing the New Syntax Encoded values are in the element.
|
||||
*
|
||||
* @return List of content Strings
|
||||
*/
|
||||
public void setEncodeds(List<String> encodeds);
|
||||
|
||||
@Override
|
||||
public String getUri();
|
||||
|
||||
public String toString(String str);
|
||||
|
||||
/**
|
||||
* Contains a list of ContentItems that represent the "Original Syntax" set.
|
||||
*
|
||||
* @see com.totsp.xml.syndication.content.ContentItem
|
||||
* @return List of ContentItems.
|
||||
*/
|
||||
public List<ContentItem> getContentItems();
|
||||
|
||||
/**
|
||||
* Contains a list of ContentItems that represent the "Original Syntax" set.
|
||||
*
|
||||
* @see com.totsp.xml.syndication.content.ContentItem
|
||||
* @param List of ContentItems.
|
||||
*/
|
||||
public void setContentItems(List<ContentItem> list);
|
||||
|
||||
/**
|
||||
* Returns a List of Strings containing whatever new or original syntax items are in the
|
||||
* element.
|
||||
*
|
||||
* @return List of content Strings
|
||||
*/
|
||||
public List<String> getContents();
|
||||
|
||||
/**
|
||||
* Sets a List of Strings containing whatever new or original syntax items are in the element.
|
||||
*
|
||||
* @return List of content Strings
|
||||
*/
|
||||
public void setContents(List<String> contents);
|
||||
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* ContentModuleImpl.java
|
||||
*
|
||||
* Created on January 11, 2005, 1:07 PM
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*
|
||||
*/
|
||||
package com.rometools.modules.content;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.rometools.rome.feed.CopyFrom;
|
||||
import com.rometools.rome.feed.module.ModuleImpl;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.4 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class ContentModuleImpl extends ModuleImpl implements ContentModule {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<String> encodeds;
|
||||
private List<String> contents;
|
||||
private List<ContentItem> contentItems;
|
||||
|
||||
public ContentModuleImpl() {
|
||||
super(ContentModuleImpl.class, URI);
|
||||
}
|
||||
|
||||
protected ContentModuleImpl(final Class<ContentModuleImpl> beanClass, final java.lang.String uri) {
|
||||
super(beanClass, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getEncodeds() {
|
||||
encodeds = encodeds == null ? new ArrayList<String>() : encodeds;
|
||||
return encodeds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEncodeds(final List<String> encodeds) {
|
||||
this.encodeds = encodeds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom obj) {
|
||||
final ContentModule cm = (ContentModule) obj;
|
||||
setEncodeds(cm.getEncodeds());
|
||||
setContentItems(cm.getContentItems());
|
||||
setContents(cm.getContents());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ContentModule> getInterface() {
|
||||
return ContentModule.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ContentItem> getContentItems() {
|
||||
contentItems = contentItems == null ? new ArrayList<ContentItem>() : contentItems;
|
||||
return contentItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentItems(final List<ContentItem> list) {
|
||||
contentItems = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getContents() {
|
||||
contents = contents == null ? new ArrayList<String>() : contents;
|
||||
return contents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContents(final List<String> contents) {
|
||||
this.contents = contents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String str) {
|
||||
return contentItems.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,201 @@
|
|||
/*
|
||||
* ContentModuleGenerator.java
|
||||
*
|
||||
* Created on January 11, 2005, 1:41 PM
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*
|
||||
*/
|
||||
package com.rometools.modules.content.io;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jdom2.Attribute;
|
||||
import org.jdom2.CDATA;
|
||||
import org.jdom2.Content;
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.rometools.modules.content.ContentItem;
|
||||
import com.rometools.modules.content.ContentModule;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class ContentModuleGenerator implements com.rometools.rome.io.ModuleGenerator {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ContentModuleGenerator.class);
|
||||
|
||||
private static final Namespace CONTENT_NS = Namespace.getNamespace("content", ContentModule.URI);
|
||||
private static final Namespace RDF_NS = Namespace.getNamespace("rdf", ContentModule.RDF_URI);
|
||||
private static final Set<Namespace> NAMESPACES;
|
||||
|
||||
static {
|
||||
final Set<Namespace> nss = new HashSet<Namespace>();
|
||||
nss.add(CONTENT_NS);
|
||||
NAMESPACES = Collections.unmodifiableSet(nss);
|
||||
}
|
||||
|
||||
/** Creates a new instance of ContentModuleGenerator */
|
||||
public ContentModuleGenerator() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(final com.rometools.rome.feed.module.Module module, final org.jdom2.Element element) {
|
||||
// this is not necessary, it is done to avoid the namespace definition in every item.
|
||||
Element root = element;
|
||||
|
||||
while (root.getParent() != null && root.getParent() instanceof Element) {
|
||||
root = (Element) root.getParent();
|
||||
}
|
||||
|
||||
root.addNamespaceDeclaration(CONTENT_NS);
|
||||
|
||||
if (!(module instanceof ContentModule)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final ContentModule cm = (ContentModule) module;
|
||||
|
||||
final List<String> encodeds = cm.getEncodeds();
|
||||
|
||||
if (encodeds != null) {
|
||||
LOG.debug("{}", cm.getEncodeds().size());
|
||||
for (int i = 0; i < encodeds.size(); i++) {
|
||||
element.addContent(generateCDATAElement("encoded", encodeds.get(i).toString()));
|
||||
}
|
||||
}
|
||||
|
||||
final List<ContentItem> contentItems = cm.getContentItems();
|
||||
|
||||
if (contentItems != null && !contentItems.isEmpty()) {
|
||||
final Element items = new Element("items", CONTENT_NS);
|
||||
final Element bag = new Element("Bag", RDF_NS);
|
||||
items.addContent(bag);
|
||||
|
||||
for (int i = 0; i < contentItems.size(); i++) {
|
||||
final ContentItem contentItem = contentItems.get(i);
|
||||
final Element li = new Element("li", RDF_NS);
|
||||
final Element item = new Element("item", CONTENT_NS);
|
||||
|
||||
if (contentItem.getContentAbout() != null) {
|
||||
final Attribute about = new Attribute("about", contentItem.getContentAbout(), RDF_NS);
|
||||
item.setAttribute(about);
|
||||
}
|
||||
|
||||
if (contentItem.getContentFormat() != null) {
|
||||
// LOG.debug( "Format");
|
||||
final Element format = new Element("format", CONTENT_NS);
|
||||
final Attribute formatResource = new Attribute("resource", contentItem.getContentFormat(), RDF_NS);
|
||||
format.setAttribute(formatResource);
|
||||
|
||||
item.addContent(format);
|
||||
}
|
||||
|
||||
if (contentItem.getContentEncoding() != null) {
|
||||
// LOG.debug( "Encoding");
|
||||
final Element encoding = new Element("encoding", CONTENT_NS);
|
||||
final Attribute encodingResource = new Attribute("resource", contentItem.getContentEncoding(), RDF_NS);
|
||||
encoding.setAttribute(encodingResource);
|
||||
item.addContent(encoding);
|
||||
}
|
||||
|
||||
if (contentItem.getContentValue() != null) {
|
||||
final Element value = new Element("value", RDF_NS);
|
||||
|
||||
if (contentItem.getContentValueParseType() != null) {
|
||||
final Attribute parseType = new Attribute("parseType", contentItem.getContentValueParseType(), RDF_NS);
|
||||
value.setAttribute(parseType);
|
||||
}
|
||||
|
||||
if (contentItem.getContentValueNamespaces() != null) {
|
||||
final List<Namespace> namespaces = contentItem.getContentValueNamespaces();
|
||||
|
||||
for (int ni = 0; ni < namespaces.size(); ni++) {
|
||||
value.addNamespaceDeclaration(namespaces.get(ni));
|
||||
}
|
||||
}
|
||||
|
||||
final List<Content> detached = new ArrayList<Content>();
|
||||
|
||||
for (int c = 0; c < contentItem.getContentValueDOM().size(); c++) {
|
||||
detached.add(contentItem.getContentValueDOM().get(c).clone().detach());
|
||||
}
|
||||
|
||||
value.setContent(detached);
|
||||
item.addContent(value);
|
||||
} // end value
|
||||
|
||||
li.addContent(item);
|
||||
bag.addContent(li);
|
||||
} // end contentItems loop
|
||||
|
||||
element.addContent(items);
|
||||
}
|
||||
}
|
||||
|
||||
protected Element generateSimpleElement(final String name, final String value) {
|
||||
final Element element = new Element(name, CONTENT_NS);
|
||||
element.addContent(value);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
protected Element generateCDATAElement(final String name, final String value) {
|
||||
final Element element = new Element(name, CONTENT_NS);
|
||||
final CDATA cdata = new CDATA(value);
|
||||
element.addContent(cdata);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return ContentModule.URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Namespace> getNamespaces() {
|
||||
return NAMESPACES;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* ContentModuleParser.java
|
||||
*
|
||||
* Created on January 11, 2005, 1:23 PM
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*
|
||||
*/
|
||||
package com.rometools.modules.content.io;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.jdom2.Attribute;
|
||||
import org.jdom2.Content;
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
import org.jdom2.output.XMLOutputter;
|
||||
|
||||
import com.rometools.modules.content.ContentItem;
|
||||
import com.rometools.modules.content.ContentModule;
|
||||
import com.rometools.modules.content.ContentModuleImpl;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.3 $
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class ContentModuleParser implements com.rometools.rome.io.ModuleParser {
|
||||
private static final Namespace CONTENT_NS = Namespace.getNamespace("content", ContentModule.URI);
|
||||
private static final Namespace RDF_NS = Namespace.getNamespace("rdf", ContentModule.RDF_URI);
|
||||
|
||||
/** Creates a new instance of ContentModuleParser */
|
||||
public ContentModuleParser() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return ContentModule.URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public com.rometools.rome.feed.module.Module parse(final Element element, final Locale locale) {
|
||||
boolean foundSomething = false;
|
||||
final ContentModule cm = new ContentModuleImpl();
|
||||
final List<Element> encodeds = element.getChildren("encoded", CONTENT_NS);
|
||||
final ArrayList<String> contentStrings = new ArrayList<String>();
|
||||
final ArrayList<String> encodedStrings = new ArrayList<String>();
|
||||
|
||||
if (!encodeds.isEmpty()) {
|
||||
foundSomething = true;
|
||||
|
||||
for (int i = 0; i < encodeds.size(); i++) {
|
||||
final Element encodedElement = encodeds.get(i);
|
||||
encodedStrings.add(encodedElement.getText());
|
||||
contentStrings.add(encodedElement.getText());
|
||||
}
|
||||
}
|
||||
|
||||
final ArrayList<ContentItem> contentItems = new ArrayList<ContentItem>();
|
||||
final List<Element> items = element.getChildren("items", CONTENT_NS);
|
||||
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
foundSomething = true;
|
||||
|
||||
final List<Element> lis = items.get(i).getChild("Bag", RDF_NS).getChildren("li", RDF_NS);
|
||||
|
||||
for (int j = 0; j < lis.size(); j++) {
|
||||
final ContentItem ci = new ContentItem();
|
||||
final Element li = lis.get(j);
|
||||
final Element item = li.getChild("item", CONTENT_NS);
|
||||
final Element format = item.getChild("format", CONTENT_NS);
|
||||
final Element encoding = item.getChild("encoding", CONTENT_NS);
|
||||
final Element value = item.getChild("value", RDF_NS);
|
||||
|
||||
if (value != null) {
|
||||
if (value.getAttributeValue("parseType", RDF_NS) != null) {
|
||||
ci.setContentValueParseType(value.getAttributeValue("parseType", RDF_NS));
|
||||
}
|
||||
|
||||
if (ci.getContentValueParseType() != null && ci.getContentValueParseType().equals("Literal")) {
|
||||
ci.setContentValue(getXmlInnerText(value));
|
||||
contentStrings.add(getXmlInnerText(value));
|
||||
ci.setContentValueNamespaces(value.getAdditionalNamespaces());
|
||||
} else {
|
||||
ci.setContentValue(value.getText());
|
||||
contentStrings.add(value.getText());
|
||||
}
|
||||
|
||||
ci.setContentValueDOM(value.clone().getContent());
|
||||
}
|
||||
|
||||
if (format != null) {
|
||||
ci.setContentFormat(format.getAttribute("resource", RDF_NS).getValue());
|
||||
}
|
||||
|
||||
if (encoding != null) {
|
||||
ci.setContentEncoding(encoding.getAttribute("resource", RDF_NS).getValue());
|
||||
}
|
||||
|
||||
if (item != null) {
|
||||
final Attribute about = item.getAttribute("about", RDF_NS);
|
||||
|
||||
if (about != null) {
|
||||
ci.setContentAbout(about.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
contentItems.add(ci);
|
||||
}
|
||||
}
|
||||
|
||||
cm.setEncodeds(encodedStrings);
|
||||
cm.setContentItems(contentItems);
|
||||
cm.setContents(contentStrings);
|
||||
|
||||
return foundSomething ? cm : null;
|
||||
}
|
||||
|
||||
protected String getXmlInnerText(final Element e) {
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
final XMLOutputter xo = new XMLOutputter();
|
||||
final List<Content> children = e.getContent();
|
||||
sb.append(xo.outputString(children));
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
66
src/main/java/com/rometools/modules/content/package.html
Normal file
66
src/main/java/com/rometools/modules/content/package.html
Normal file
|
@ -0,0 +1,66 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
This is a ROME plug in that implements the Content RSS extension.
|
||||
http://purl.org/rss/1.0/modules/content/
|
||||
|
||||
Note, this supports both the "Original" syntax via the ContentItem object
|
||||
and the "New" Syntax via the ".getEncodeds()" method on the ContentModule.
|
||||
|
||||
<h2>Sample Usage:</h2>
|
||||
<pre>
|
||||
SyndFeedInput input = new SyndFeedInput();
|
||||
SyndFeed syndfeed = input.build(new XmlReader(feed.toURL()));
|
||||
|
||||
Module module = syndfeed.getModule("http://purl.org/rss/1.0/modules/content/");
|
||||
ContentModule content = (ContentModule) module;
|
||||
|
||||
Iterator it = content.getEncodeds().iterator();
|
||||
System.out.println( it.next() );
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
|
||||
<pre>
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright 2011 robert.cooper.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package com.rometools.modules.feedburner;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
|
||||
/**
|
||||
* Interface for the FeedBurner RSS extension.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author Georg Schmidl <georg.schmidl@scandio.de>
|
||||
*
|
||||
*/
|
||||
public interface FeedBurner extends Module, Serializable, Cloneable {
|
||||
|
||||
public static final String URI = "http://rssnamespace.org/feedburner/ext/1.0";
|
||||
|
||||
public String getAwareness();
|
||||
|
||||
public void setAwareness(String awareness);
|
||||
|
||||
public String getOrigLink();
|
||||
|
||||
public void setOrigLink(String origLink);
|
||||
|
||||
public String getOrigEnclosureLink();
|
||||
|
||||
public void setOrigEnclosureLink(String origEnclosureLink);
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright 2010 Scandio GmbH.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.rometools.modules.feedburner;
|
||||
|
||||
import com.rometools.rome.feed.CopyFrom;
|
||||
|
||||
/**
|
||||
* Implementation of the FeedBurner RSS extension.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author Georg Schmidl <georg.schmidl@scandio.de>
|
||||
*
|
||||
*/
|
||||
public class FeedBurnerImpl implements FeedBurner {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String awareness;
|
||||
private String origLink;
|
||||
private String origEnclosureLink;
|
||||
|
||||
@Override
|
||||
public String getAwareness() {
|
||||
return awareness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAwareness(final String awareness) {
|
||||
this.awareness = awareness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOrigLink() {
|
||||
return origLink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrigLink(final String origLink) {
|
||||
this.origLink = origLink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOrigEnclosureLink() {
|
||||
return origEnclosureLink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrigEnclosureLink(final String origEnclosureLink) {
|
||||
this.origEnclosureLink = origEnclosureLink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUri() {
|
||||
return FeedBurner.URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom object) {
|
||||
final FeedBurner source = (FeedBurner) object;
|
||||
setAwareness(source.getAwareness());
|
||||
setOrigLink(source.getOrigLink());
|
||||
setOrigEnclosureLink(source.getOrigEnclosureLink());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<FeedBurner> getInterface() {
|
||||
return FeedBurner.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
final FeedBurnerImpl fbi = new FeedBurnerImpl();
|
||||
fbi.copyFrom(this);
|
||||
return fbi;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright 2010 Scandio GmbH.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package com.rometools.modules.feedburner.io;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
||||
import com.rometools.modules.feedburner.FeedBurner;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleGenerator;
|
||||
|
||||
/**
|
||||
* ModuleGenerator implementation for the FeedBurner RSS extension.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author Georg Schmidl <georg.schmidl@scandio.de>
|
||||
*
|
||||
*/
|
||||
public class FeedBurnerModuleGenerator implements ModuleGenerator {
|
||||
private static final Namespace NS = Namespace.getNamespace("feedburner", FeedBurner.URI);
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return FeedBurner.URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Namespace> getNamespaces() {
|
||||
final HashSet<Namespace> set = new HashSet<Namespace>();
|
||||
set.add(FeedBurnerModuleGenerator.NS);
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(final Module module, final Element element) {
|
||||
if (!(module instanceof FeedBurner)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final FeedBurner feedBurner = (FeedBurner) module;
|
||||
|
||||
if (feedBurner.getAwareness() != null) {
|
||||
element.addContent(generateSimpleElement("awareness", feedBurner.getAwareness()));
|
||||
}
|
||||
|
||||
if (feedBurner.getOrigLink() != null) {
|
||||
element.addContent(generateSimpleElement("origLink", feedBurner.getOrigLink()));
|
||||
}
|
||||
|
||||
if (feedBurner.getOrigEnclosureLink() != null) {
|
||||
element.addContent(generateSimpleElement("origEnclosureLink", feedBurner.getOrigEnclosureLink()));
|
||||
}
|
||||
}
|
||||
|
||||
protected Element generateSimpleElement(final String name, final String value) {
|
||||
final Element element = new Element(name, FeedBurnerModuleGenerator.NS);
|
||||
element.addContent(value);
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright 2010 Scandio GmbH.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package com.rometools.modules.feedburner.io;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
||||
import com.rometools.modules.feedburner.FeedBurner;
|
||||
import com.rometools.modules.feedburner.FeedBurnerImpl;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleParser;
|
||||
|
||||
/**
|
||||
* ModuleParser implementation for the FeedBurner RSS extension.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author Georg Schmidl <georg.schmidl@scandio.de>
|
||||
*
|
||||
*/
|
||||
public class FeedBurnerModuleParser implements ModuleParser {
|
||||
private static final Namespace NS = Namespace.getNamespace(FeedBurner.URI);
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return FeedBurner.URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module parse(final Element element, final Locale locale) {
|
||||
final FeedBurnerImpl fbi = new FeedBurnerImpl();
|
||||
boolean returnObj = false;
|
||||
Element tag = element.getChild("awareness", FeedBurnerModuleParser.NS);
|
||||
|
||||
if (tag != null) {
|
||||
fbi.setAwareness(tag.getText().trim());
|
||||
returnObj = true;
|
||||
}
|
||||
|
||||
tag = element.getChild("origLink", FeedBurnerModuleParser.NS);
|
||||
|
||||
if (tag != null) {
|
||||
fbi.setOrigLink(tag.getText().trim());
|
||||
returnObj = true;
|
||||
}
|
||||
|
||||
tag = element.getChild("origEnclosureLink", FeedBurnerModuleParser.NS);
|
||||
|
||||
if (tag != null) {
|
||||
fbi.setOrigEnclosureLink(tag.getText().trim());
|
||||
returnObj = true;
|
||||
}
|
||||
|
||||
if (returnObj) {
|
||||
return fbi;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
30
src/main/java/com/rometools/modules/feedburner/package.html
Normal file
30
src/main/java/com/rometools/modules/feedburner/package.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<pre>
|
||||
* This library is provided under dual licenses.
|
||||
* You may choose the terms of the Lesser General Public License or the Apache
|
||||
* License at your discretion.
|
||||
*
|
||||
* Copyright (C) 2011 The ROME Team
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
173
src/main/java/com/rometools/modules/georss/GMLGenerator.java
Normal file
173
src/main/java/com/rometools/modules/georss/GMLGenerator.java
Normal file
|
@ -0,0 +1,173 @@
|
|||
/*
|
||||
* Copyright 2006 Marc Wick, geonames.org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package com.rometools.modules.georss;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
||||
import com.rometools.modules.georss.geometries.AbstractGeometry;
|
||||
import com.rometools.modules.georss.geometries.AbstractRing;
|
||||
import com.rometools.modules.georss.geometries.Envelope;
|
||||
import com.rometools.modules.georss.geometries.LineString;
|
||||
import com.rometools.modules.georss.geometries.LinearRing;
|
||||
import com.rometools.modules.georss.geometries.Point;
|
||||
import com.rometools.modules.georss.geometries.Polygon;
|
||||
import com.rometools.modules.georss.geometries.Position;
|
||||
import com.rometools.modules.georss.geometries.PositionList;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleGenerator;
|
||||
|
||||
/**
|
||||
* GMLGenerator produces georss elements in georss GML format.
|
||||
*
|
||||
* @author Marc Wick
|
||||
* @version $Id: GMLGenerator.java,v 1.1 2007/04/18 09:59:29 marcwick Exp $
|
||||
*
|
||||
*/
|
||||
public class GMLGenerator implements ModuleGenerator {
|
||||
|
||||
private static final Set<Namespace> NAMESPACES;
|
||||
|
||||
static {
|
||||
final Set<Namespace> nss = new HashSet<Namespace>();
|
||||
nss.add(GeoRSSModule.GML_NS);
|
||||
NAMESPACES = Collections.unmodifiableSet(nss);
|
||||
}
|
||||
|
||||
private Element createPosListElement(final PositionList posList) {
|
||||
final Element posElement = new Element("posList", GeoRSSModule.GML_NS);
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < posList.size(); ++i) {
|
||||
sb.append(posList.getLatitude(i)).append(" ").append(posList.getLongitude(i)).append(" ");
|
||||
}
|
||||
|
||||
posElement.addContent(sb.toString());
|
||||
return posElement;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.rometools.rome.io.ModuleGenerator#getNamespaceUri()
|
||||
*/
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return GeoRSSModule.GEORSS_GML_URI;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.rometools.rome.io.ModuleGenerator#getNamespaces()
|
||||
*/
|
||||
@Override
|
||||
public Set<Namespace> getNamespaces() {
|
||||
return NAMESPACES;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.rometools.rome.io.ModuleGenerator#generate(com.rometools.rome.feed.module.Module,
|
||||
* org.jdom2.Element)
|
||||
*/
|
||||
@Override
|
||||
public void generate(final Module module, final Element element) {
|
||||
// this is not necessary, it is done to avoid the namespace definition
|
||||
// in every item.
|
||||
Element root = element;
|
||||
while (root.getParent() != null && root.getParent() instanceof Element) {
|
||||
root = (Element) element.getParent();
|
||||
}
|
||||
root.addNamespaceDeclaration(GeoRSSModule.SIMPLE_NS);
|
||||
root.addNamespaceDeclaration(GeoRSSModule.GML_NS);
|
||||
|
||||
final Element whereElement = new Element("where", GeoRSSModule.SIMPLE_NS);
|
||||
element.addContent(whereElement);
|
||||
|
||||
final GeoRSSModule geoRSSModule = (GeoRSSModule) module;
|
||||
final AbstractGeometry geometry = geoRSSModule.getGeometry();
|
||||
|
||||
if (geometry instanceof Point) {
|
||||
final Position pos = ((Point) geometry).getPosition();
|
||||
|
||||
final Element pointElement = new Element("Point", GeoRSSModule.GML_NS);
|
||||
whereElement.addContent(pointElement);
|
||||
|
||||
final Element posElement = new Element("pos", GeoRSSModule.GML_NS);
|
||||
posElement.addContent(String.valueOf(pos.getLatitude()) + " " + String.valueOf(pos.getLongitude()));
|
||||
pointElement.addContent(posElement);
|
||||
}
|
||||
|
||||
else if (geometry instanceof LineString) {
|
||||
final PositionList posList = ((LineString) geometry).getPositionList();
|
||||
|
||||
final Element lineElement = new Element("LineString", GeoRSSModule.GML_NS);
|
||||
lineElement.addContent(createPosListElement(posList));
|
||||
whereElement.addContent(lineElement);
|
||||
} else if (geometry instanceof Polygon) {
|
||||
final Element polygonElement = new Element("Polygon", GeoRSSModule.GML_NS);
|
||||
{
|
||||
final AbstractRing ring = ((Polygon) geometry).getExterior();
|
||||
if (ring instanceof LinearRing) {
|
||||
final Element exteriorElement = new Element("exterior", GeoRSSModule.GML_NS);
|
||||
polygonElement.addContent(exteriorElement);
|
||||
final Element ringElement = new Element("LinearRing", GeoRSSModule.GML_NS);
|
||||
exteriorElement.addContent(ringElement);
|
||||
ringElement.addContent(createPosListElement(((LinearRing) ring).getPositionList()));
|
||||
|
||||
} else {
|
||||
System.err.println("GeoRSS GML format can't handle rings of type: " + ring.getClass().getName());
|
||||
}
|
||||
}
|
||||
final List<AbstractRing> interiorList = ((Polygon) geometry).getInterior();
|
||||
final Iterator<AbstractRing> it = interiorList.iterator();
|
||||
while (it.hasNext()) {
|
||||
final AbstractRing ring = it.next();
|
||||
if (ring instanceof LinearRing) {
|
||||
final Element interiorElement = new Element("interior", GeoRSSModule.GML_NS);
|
||||
polygonElement.addContent(interiorElement);
|
||||
final Element ringElement = new Element("LinearRing", GeoRSSModule.GML_NS);
|
||||
interiorElement.addContent(ringElement);
|
||||
ringElement.addContent(createPosListElement(((LinearRing) ring).getPositionList()));
|
||||
|
||||
} else {
|
||||
System.err.println("GeoRSS GML format can't handle rings of type: " + ring.getClass().getName());
|
||||
}
|
||||
}
|
||||
whereElement.addContent(polygonElement);
|
||||
} else if (geometry instanceof Envelope) {
|
||||
final Envelope envelope = (Envelope) geometry;
|
||||
final Element envelopeElement = new Element("Envelope", GeoRSSModule.GML_NS);
|
||||
whereElement.addContent(envelopeElement);
|
||||
|
||||
final Element lowerElement = new Element("lowerCorner", GeoRSSModule.GML_NS);
|
||||
lowerElement.addContent(String.valueOf(envelope.getMinLatitude()) + " " + String.valueOf(envelope.getMinLongitude()));
|
||||
envelopeElement.addContent(lowerElement);
|
||||
|
||||
final Element upperElement = new Element("upperCorner", GeoRSSModule.GML_NS);
|
||||
upperElement.addContent(String.valueOf(envelope.getMaxLatitude()) + " " + String.valueOf(envelope.getMaxLongitude()));
|
||||
envelopeElement.addContent(upperElement);
|
||||
|
||||
} else {
|
||||
System.err.println("GeoRSS GML format can't handle geometries of type: " + geometry.getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 2006 Marc Wick, geonames.org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package com.rometools.modules.georss;
|
||||
|
||||
/**
|
||||
* GMLModuleImpl is the implementation of the {@link GeoRSSModule} Interface for the gml GeoRSS
|
||||
* format.
|
||||
*
|
||||
* @author Marc Wick
|
||||
* @version $Id: GMLModuleImpl.java,v 1.1 2007/04/18 09:59:29 marcwick Exp $
|
||||
*
|
||||
*/
|
||||
public class GMLModuleImpl extends GeoRSSModule {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public GMLModuleImpl() {
|
||||
super(GeoRSSModule.class, GeoRSSModule.GEORSS_GML_URI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<GeoRSSModule> getInterface() {
|
||||
return GeoRSSModule.class;
|
||||
}
|
||||
|
||||
}
|
148
src/main/java/com/rometools/modules/georss/GMLParser.java
Normal file
148
src/main/java/com/rometools/modules/georss/GMLParser.java
Normal file
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
* Copyright 2006 Marc Wick, geonames.org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package com.rometools.modules.georss;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.jdom2.Element;
|
||||
|
||||
import com.rometools.modules.georss.geometries.Envelope;
|
||||
import com.rometools.modules.georss.geometries.LineString;
|
||||
import com.rometools.modules.georss.geometries.LinearRing;
|
||||
import com.rometools.modules.georss.geometries.Point;
|
||||
import com.rometools.modules.georss.geometries.Polygon;
|
||||
import com.rometools.modules.georss.geometries.Position;
|
||||
import com.rometools.modules.georss.geometries.PositionList;
|
||||
import com.rometools.rome.feed.module.Module;
|
||||
import com.rometools.rome.io.ModuleParser;
|
||||
import com.rometools.utils.Strings;
|
||||
|
||||
/**
|
||||
* GMLParser is a parser for the GML georss format.
|
||||
*
|
||||
* @author Marc Wick
|
||||
* @version $Id: GMLParser.java,v 1.2 2007/06/05 20:44:53 marcwick Exp $
|
||||
*
|
||||
*/
|
||||
public class GMLParser implements ModuleParser {
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return GeoRSSModule.GEORSS_GEORSS_URI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module parse(final Element element, final Locale locale) {
|
||||
final Module geoRssModule = parseGML(element);
|
||||
return geoRssModule;
|
||||
}
|
||||
|
||||
private static PositionList parsePosList(final Element element) {
|
||||
final String coordinates = element.getText();
|
||||
final String[] coord = Strings.trimToEmpty(coordinates).split(" ");
|
||||
final PositionList posList = new PositionList();
|
||||
for (int i = 0; i < coord.length; i += 2) {
|
||||
posList.add(Double.parseDouble(coord[i]), Double.parseDouble(coord[i + 1]));
|
||||
}
|
||||
return posList;
|
||||
}
|
||||
|
||||
static Module parseGML(final Element element) {
|
||||
GeoRSSModule geoRSSModule = null;
|
||||
|
||||
final Element pointElement = element.getChild("Point", GeoRSSModule.GML_NS);
|
||||
final Element lineStringElement = element.getChild("LineString", GeoRSSModule.GML_NS);
|
||||
final Element polygonElement = element.getChild("Polygon", GeoRSSModule.GML_NS);
|
||||
final Element envelopeElement = element.getChild("Envelope", GeoRSSModule.GML_NS);
|
||||
if (pointElement != null) {
|
||||
final Element posElement = pointElement.getChild("pos", GeoRSSModule.GML_NS);
|
||||
if (posElement != null) {
|
||||
geoRSSModule = new GMLModuleImpl();
|
||||
final String coordinates = posElement.getText();
|
||||
final String[] coord = Strings.trimToEmpty(coordinates).split(" ");
|
||||
final Position pos = new Position(Double.parseDouble(coord[0]), Double.parseDouble(coord[1]));
|
||||
geoRSSModule.setGeometry(new Point(pos));
|
||||
}
|
||||
} else if (lineStringElement != null) {
|
||||
final Element posListElement = lineStringElement.getChild("posList", GeoRSSModule.GML_NS);
|
||||
if (posListElement != null) {
|
||||
geoRSSModule = new GMLModuleImpl();
|
||||
geoRSSModule.setGeometry(new LineString(parsePosList(posListElement)));
|
||||
}
|
||||
} else if (polygonElement != null) {
|
||||
Polygon poly = null;
|
||||
|
||||
// The external ring
|
||||
final Element exteriorElement = polygonElement.getChild("exterior", GeoRSSModule.GML_NS);
|
||||
if (exteriorElement != null) {
|
||||
final Element linearRingElement = exteriorElement.getChild("LinearRing", GeoRSSModule.GML_NS);
|
||||
if (linearRingElement != null) {
|
||||
final Element posListElement = linearRingElement.getChild("posList", GeoRSSModule.GML_NS);
|
||||
if (posListElement != null) {
|
||||
if (poly == null) {
|
||||
poly = new Polygon();
|
||||
}
|
||||
poly.setExterior(new LinearRing(parsePosList(posListElement)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The internal rings (holes)
|
||||
final List<Element> interiorElementList = polygonElement.getChildren("interior", GeoRSSModule.GML_NS);
|
||||
final Iterator<Element> it = interiorElementList.iterator();
|
||||
while (it.hasNext()) {
|
||||
final Element interiorElement = it.next();
|
||||
if (interiorElement != null) {
|
||||
final Element linearRingElement = interiorElement.getChild("LinearRing", GeoRSSModule.GML_NS);
|
||||
if (linearRingElement != null) {
|
||||
final Element posListElement = linearRingElement.getChild("posList", GeoRSSModule.GML_NS);
|
||||
if (posListElement != null) {
|
||||
if (poly == null) {
|
||||
poly = new Polygon();
|
||||
}
|
||||
poly.getInterior().add(new LinearRing(parsePosList(posListElement)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (poly != null) {
|
||||
geoRSSModule = new GMLModuleImpl();
|
||||
geoRSSModule.setGeometry(poly);
|
||||
}
|
||||
} else if (envelopeElement != null) {
|
||||
final Element lowerElement = envelopeElement.getChild("lowerCorner", GeoRSSModule.GML_NS);
|
||||
final Element upperElement = envelopeElement.getChild("upperCorner", GeoRSSModule.GML_NS);
|
||||
if (lowerElement != null && upperElement != null) {
|
||||
geoRSSModule = new GMLModuleImpl();
|
||||
final String lowerCoordinates = lowerElement.getText();
|
||||
final String[] lowerCoord = Strings.trimToEmpty(lowerCoordinates).split(" ");
|
||||
final String upperCoordinates = upperElement.getText();
|
||||
final String[] upperCoord = Strings.trimToEmpty(upperCoordinates).split(" ");
|
||||
final Envelope envelope = new Envelope(Double.parseDouble(lowerCoord[0]), Double.parseDouble(lowerCoord[1]), Double.parseDouble(upperCoord[0]),
|
||||
Double.parseDouble(upperCoord[1]));
|
||||
geoRSSModule.setGeometry(envelope);
|
||||
}
|
||||
}
|
||||
|
||||
return geoRSSModule;
|
||||
}
|
||||
|
||||
}
|
150
src/main/java/com/rometools/modules/georss/GeoRSSModule.java
Normal file
150
src/main/java/com/rometools/modules/georss/GeoRSSModule.java
Normal file
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
* Copyright 2006 Marc Wick, geonames.org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.rometools.modules.georss;
|
||||
|
||||
import org.jdom2.Namespace;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.rometools.modules.georss.geometries.AbstractGeometry;
|
||||
import com.rometools.modules.georss.geometries.Point;
|
||||
import com.rometools.modules.georss.geometries.Position;
|
||||
import com.rometools.rome.feed.CopyFrom;
|
||||
import com.rometools.rome.feed.module.ModuleImpl;
|
||||
|
||||
/**
|
||||
* GeoRSSModule is the main georss interface defining the methods to produce and consume georss
|
||||
* elements.
|
||||
*
|
||||
* @author Marc Wick
|
||||
* @version $Id: GeoRSSModule.java,v 1.8 2007/06/06 09:47:32 marcwick Exp $
|
||||
*/
|
||||
public abstract class GeoRSSModule extends ModuleImpl implements Cloneable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GeoRSSModule.class);
|
||||
|
||||
protected AbstractGeometry geometry;
|
||||
|
||||
public static final String version = "0.9.8";
|
||||
|
||||
/**
|
||||
* namespace URI for georss simple: <i>"http://www.georss.org/georss"</i>
|
||||
*/
|
||||
public static final String GEORSS_GEORSS_URI = "http://www.georss.org/georss";
|
||||
|
||||
/**
|
||||
* namespace URI for w3c georss : <i>"http://www.w3.org/2003/01/geo/wgs84_pos#"</i>
|
||||
*/
|
||||
public static final String GEORSS_W3CGEO_URI = "http://www.w3.org/2003/01/geo/wgs84_pos#";
|
||||
|
||||
/**
|
||||
* namespace URI for GML georss : <i>"http://www.opengis.net/gml"</i>
|
||||
*/
|
||||
public static final String GEORSS_GML_URI = "http://www.opengis.net/gml";
|
||||
|
||||
/**
|
||||
* Namespace for georss simple : <i>xmlns:georss="http://www.georss.org/georss"</i>
|
||||
*/
|
||||
public static final Namespace SIMPLE_NS = Namespace.getNamespace("georss", GeoRSSModule.GEORSS_GEORSS_URI);
|
||||
|
||||
/**
|
||||
*
|
||||
* Namespace for w3c georss : <i>xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"</i>
|
||||
*/
|
||||
public static final Namespace W3CGEO_NS = Namespace.getNamespace("geo", GeoRSSModule.GEORSS_W3CGEO_URI);
|
||||
|
||||
/**
|
||||
*
|
||||
* Namespace for gml georss : <i>xmlns:gml="http://www.opengis.net/gml"</i>
|
||||
*/
|
||||
public static final Namespace GML_NS = Namespace.getNamespace("gml", GeoRSSModule.GEORSS_GML_URI);
|
||||
|
||||
protected GeoRSSModule(final Class<? extends GeoRSSModule> beanClass, final java.lang.String uri) {
|
||||
super(beanClass, uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set geometry of georss element
|
||||
*
|
||||
* @param geometry geometry
|
||||
*/
|
||||
public void setGeometry(final AbstractGeometry geometry) {
|
||||
this.geometry = geometry;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the geometry
|
||||
*
|
||||
* @return geometry
|
||||
*/
|
||||
public AbstractGeometry getGeometry() {
|
||||
return geometry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to return point geometry. Returns null if the geometry is non-point.
|
||||
*
|
||||
* @return geometry
|
||||
*/
|
||||
public Position getPosition() {
|
||||
if (geometry instanceof Point) {
|
||||
return ((Point) geometry).getPosition();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to set point geometry.
|
||||
*
|
||||
* @return geometry
|
||||
*/
|
||||
public void setPosition(final Position pos) {
|
||||
if (pos != null) {
|
||||
geometry = new Point(pos);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.rometools.rome.feed.CopyFrom#copyFrom(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom obj) {
|
||||
final GeoRSSModule geoRSSModule = (GeoRSSModule) obj;
|
||||
geometry = geoRSSModule.getGeometry();
|
||||
try {
|
||||
geometry = (AbstractGeometry) geometry.clone();
|
||||
} catch (final CloneNotSupportedException ex) {
|
||||
LOG.error("Error", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
try {
|
||||
final GeoRSSModule retval = (GeoRSSModule) super.clone();
|
||||
if (geometry != null) {
|
||||
retval.geometry = (AbstractGeometry) geometry.clone();
|
||||
}
|
||||
return retval;
|
||||
} catch (final Exception ex) {
|
||||
LOG.error("Error", ex);
|
||||
}
|
||||
throw new CloneNotSupportedException();
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue