Author: rdonkin
Date: Fri Dec 6 09:36:08 2013
New Revision: 1548465
URL: http://svn.apache.org/r1548465
Log:
Format Code.
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
URL:
http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java?rev=1548465&r1=1548464&r2=1548465&view=diff
==============================================================================
---
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
(original)
+++
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
Fri Dec 6 09:36:08 2013
@@ -15,78 +15,85 @@
* KIND, either express or implied. See the License for the *
* specific language governing permissions and limitations *
* under the License. *
- */
+ */
package org.apache.rat.analysis.license;
import org.apache.rat.api.Document;
import org.apache.rat.api.MetaData;
public class BaseLicense {
- private String licenseFamilyCategory;
- private String licenseFamilyName;
- private String notes;
-
- public BaseLicense() {
- }
-
- public BaseLicense(final MetaData.Datum licenseFamilyCategory, final
MetaData.Datum licenseFamilyName, final String notes)
- {
- if
(!MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY.equals(licenseFamilyCategory.getName()))
{
- throw new IllegalStateException("Expected " +
MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY
- + ", got " + licenseFamilyCategory.getName());
- }
- setLicenseFamilyCategory(licenseFamilyCategory.getValue());
- if
(!MetaData.RAT_URL_LICENSE_FAMILY_NAME.equals(licenseFamilyName.getName())) {
- throw new IllegalStateException("Expected " +
MetaData.RAT_URL_LICENSE_FAMILY_NAME
- + ", got " + licenseFamilyName.getName());
- }
- setLicenseFamilyName(licenseFamilyName.getValue());
- setNotes(notes);
- }
-
- public String getLicenseFamilyCategory() {
- return licenseFamilyCategory;
- }
-
- public void setLicenseFamilyCategory(String pDocumentCategory) {
- licenseFamilyCategory = pDocumentCategory;
- }
-
- public String getLicenseFamilyName() {
- return licenseFamilyName;
- }
-
- public void setLicenseFamilyName(String pLicenseFamilyCategory) {
- licenseFamilyName = pLicenseFamilyCategory;
- }
-
- public String getNotes() {
- return notes;
- }
-
- public void setNotes(String pNotes) {
- notes = pNotes;
- }
-
- public final void reportOnLicense(Document subject) {
- final MetaData metaData = subject.getMetaData();
- metaData.set(new MetaData.Datum(MetaData.RAT_URL_HEADER_SAMPLE,
notes));
- final String licFamilyCategory = getLicenseFamilyCategory();
- metaData.set(new MetaData.Datum(MetaData.RAT_URL_HEADER_CATEGORY,
licFamilyCategory));
- metaData.set(new
MetaData.Datum(MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY, licFamilyCategory));
- metaData.set(new MetaData.Datum(MetaData.RAT_URL_LICENSE_FAMILY_NAME,
getLicenseFamilyName()));
- }
-
- protected static final String prune(String text) {
- final int length = text.length();
- final StringBuilder buffer = new StringBuilder(length);
- for (int i = 0; i < length; i++) {
- char at = text.charAt(i);
- if (Character.isLetterOrDigit(at)) {
- buffer.append(at);
- }
- }
- return buffer.toString();
- }
+ private String licenseFamilyCategory;
+ private String licenseFamilyName;
+ private String notes;
+
+ public BaseLicense() {
+ }
+
+ public BaseLicense(final MetaData.Datum licenseFamilyCategory,
+ final MetaData.Datum licenseFamilyName, final String
notes) {
+ if (!MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY
+ .equals(licenseFamilyCategory.getName())) {
+ throw new IllegalStateException("Expected "
+ +
MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY + ", got "
+ + licenseFamilyCategory.getName());
+ }
+ setLicenseFamilyCategory(licenseFamilyCategory.getValue());
+ if
(!MetaData.RAT_URL_LICENSE_FAMILY_NAME.equals(licenseFamilyName
+ .getName())) {
+ throw new IllegalStateException("Expected "
+ + MetaData.RAT_URL_LICENSE_FAMILY_NAME
+ ", got "
+ + licenseFamilyName.getName());
+ }
+ setLicenseFamilyName(licenseFamilyName.getValue());
+ setNotes(notes);
+ }
+
+ public String getLicenseFamilyCategory() {
+ return licenseFamilyCategory;
+ }
+
+ public void setLicenseFamilyCategory(String pDocumentCategory) {
+ licenseFamilyCategory = pDocumentCategory;
+ }
+
+ public String getLicenseFamilyName() {
+ return licenseFamilyName;
+ }
+
+ public void setLicenseFamilyName(String pLicenseFamilyCategory) {
+ licenseFamilyName = pLicenseFamilyCategory;
+ }
+
+ public String getNotes() {
+ return notes;
+ }
+
+ public void setNotes(String pNotes) {
+ notes = pNotes;
+ }
+
+ public final void reportOnLicense(Document subject) {
+ final MetaData metaData = subject.getMetaData();
+ metaData.set(new MetaData.Datum(MetaData.RAT_URL_HEADER_SAMPLE,
notes));
+ final String licFamilyCategory = getLicenseFamilyCategory();
+ metaData.set(new
MetaData.Datum(MetaData.RAT_URL_HEADER_CATEGORY,
+ licFamilyCategory));
+ metaData.set(new MetaData.Datum(
+ MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY,
licFamilyCategory));
+ metaData.set(new
MetaData.Datum(MetaData.RAT_URL_LICENSE_FAMILY_NAME,
+ getLicenseFamilyName()));
+ }
+
+ protected static final String prune(String text) {
+ final int length = text.length();
+ final StringBuilder buffer = new StringBuilder(length);
+ for (int i = 0; i < length; i++) {
+ char at = text.charAt(i);
+ if (Character.isLetterOrDigit(at)) {
+ buffer.append(at);
+ }
+ }
+ return buffer.toString();
+ }
}