All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xml.metadatasharing.SoftwarePackageObject Maven / Gradle / Ivy

There is a newer version: 1.2.0.2
Show newest version
/**
 * Copyright (c) 2015, The MITRE Corporation. All rights reserved.
 * See LICENSE for complete terms.
 */

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2 
// See http://java.sun.com/xml/jaxb 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2015.06.23 at 10:59:44 AM EDT 
//

package xml.metadatasharing;

import java.io.StringReader;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
import org.mitre.stix.DocumentUtilities;
import org.mitre.stix.STIXSchema;
import org.mitre.stix.ValidationEventHandler;

/**
 * Software package object, used to store information about a software package, such as the vendor and version. Intended primarily for the clean-file metadata sharing use case.
 * 
 * 

Java class for softwarePackageObject complex type. * *

The following schema fragment specifies the expected content contained within this class. * *

 * <complexType name="softwarePackageObject">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="vendor" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="productgroup" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="product" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="version" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="update" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="edition" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="language" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="CPEname" minOccurs="0">
 *           <complexType>
 *             <simpleContent>
 *               <extension base="<http://www.w3.org/2001/XMLSchema>string">
 *                 <attribute name="cpeVersion" type="{http://www.w3.org/2001/XMLSchema}string" />
 *               </extension>
 *             </simpleContent>
 *           </complexType>
 *         </element>
 *       </sequence>
 *       <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "softwarePackageObject", propOrder = { "vendor", "productgroup", "product", "version", "update", "edition", "language", "cpEname" }) public class SoftwarePackageObject implements Equals, HashCode, ToString { @XmlElement(required = true) protected String vendor; protected String productgroup; @XmlElement(required = true) protected String product; protected String version; protected String update; protected String edition; protected String language; @XmlElement(name = "CPEname") protected SoftwarePackageObject.CPEname cpEname; @XmlAttribute(name = "id", required = true) protected String id; /** * Default no-arg constructor * */ public SoftwarePackageObject() { super(); } /** * Fully-initialising value constructor * */ public SoftwarePackageObject(final String vendor, final String productgroup, final String product, final String version, final String update, final String edition, final String language, final SoftwarePackageObject.CPEname cpEname, final String id) { this.vendor = vendor; this.productgroup = productgroup; this.product = product; this.version = version; this.update = update; this.edition = edition; this.language = language; this.cpEname = cpEname; this.id = id; } /** * Gets the value of the vendor property. * * @return * possible object is * {@link String } * */ public String getVendor() { return vendor; } /** * Sets the value of the vendor property. * * @param value * allowed object is * {@link String } * */ public void setVendor(String value) { this.vendor = value; } /** * Gets the value of the productgroup property. * * @return * possible object is * {@link String } * */ public String getProductgroup() { return productgroup; } /** * Sets the value of the productgroup property. * * @param value * allowed object is * {@link String } * */ public void setProductgroup(String value) { this.productgroup = value; } /** * Gets the value of the product property. * * @return * possible object is * {@link String } * */ public String getProduct() { return product; } /** * Sets the value of the product property. * * @param value * allowed object is * {@link String } * */ public void setProduct(String value) { this.product = value; } /** * Gets the value of the version property. * * @return * possible object is * {@link String } * */ public String getVersion() { return version; } /** * Sets the value of the version property. * * @param value * allowed object is * {@link String } * */ public void setVersion(String value) { this.version = value; } /** * Gets the value of the update property. * * @return * possible object is * {@link String } * */ public String getUpdate() { return update; } /** * Sets the value of the update property. * * @param value * allowed object is * {@link String } * */ public void setUpdate(String value) { this.update = value; } /** * Gets the value of the edition property. * * @return * possible object is * {@link String } * */ public String getEdition() { return edition; } /** * Sets the value of the edition property. * * @param value * allowed object is * {@link String } * */ public void setEdition(String value) { this.edition = value; } /** * Gets the value of the language property. * * @return * possible object is * {@link String } * */ public String getLanguage() { return language; } /** * Sets the value of the language property. * * @param value * allowed object is * {@link String } * */ public void setLanguage(String value) { this.language = value; } /** * Gets the value of the cpEname property. * * @return * possible object is * {@link SoftwarePackageObject.CPEname } * */ public SoftwarePackageObject.CPEname getCPEname() { return cpEname; } /** * Sets the value of the cpEname property. * * @param value * allowed object is * {@link SoftwarePackageObject.CPEname } * */ public void setCPEname(SoftwarePackageObject.CPEname value) { this.cpEname = value; } /** * Gets the value of the id property. * * @return * possible object is * {@link String } * */ public String getId() { return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link String } * */ public void setId(String value) { this.id = value; } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof SoftwarePackageObject)) { return false; } if (this == object) { return true; } final SoftwarePackageObject that = ((SoftwarePackageObject) object); { String lhsVendor; lhsVendor = this.getVendor(); String rhsVendor; rhsVendor = that.getVendor(); if (!strategy.equals( LocatorUtils.property(thisLocator, "vendor", lhsVendor), LocatorUtils.property(thatLocator, "vendor", rhsVendor), lhsVendor, rhsVendor)) { return false; } } { String lhsProductgroup; lhsProductgroup = this.getProductgroup(); String rhsProductgroup; rhsProductgroup = that.getProductgroup(); if (!strategy.equals(LocatorUtils.property(thisLocator, "productgroup", lhsProductgroup), LocatorUtils.property( thatLocator, "productgroup", rhsProductgroup), lhsProductgroup, rhsProductgroup)) { return false; } } { String lhsProduct; lhsProduct = this.getProduct(); String rhsProduct; rhsProduct = that.getProduct(); if (!strategy.equals( LocatorUtils.property(thisLocator, "product", lhsProduct), LocatorUtils.property(thatLocator, "product", rhsProduct), lhsProduct, rhsProduct)) { return false; } } { String lhsVersion; lhsVersion = this.getVersion(); String rhsVersion; rhsVersion = that.getVersion(); if (!strategy.equals( LocatorUtils.property(thisLocator, "version", lhsVersion), LocatorUtils.property(thatLocator, "version", rhsVersion), lhsVersion, rhsVersion)) { return false; } } { String lhsUpdate; lhsUpdate = this.getUpdate(); String rhsUpdate; rhsUpdate = that.getUpdate(); if (!strategy.equals( LocatorUtils.property(thisLocator, "update", lhsUpdate), LocatorUtils.property(thatLocator, "update", rhsUpdate), lhsUpdate, rhsUpdate)) { return false; } } { String lhsEdition; lhsEdition = this.getEdition(); String rhsEdition; rhsEdition = that.getEdition(); if (!strategy.equals( LocatorUtils.property(thisLocator, "edition", lhsEdition), LocatorUtils.property(thatLocator, "edition", rhsEdition), lhsEdition, rhsEdition)) { return false; } } { String lhsLanguage; lhsLanguage = this.getLanguage(); String rhsLanguage; rhsLanguage = that.getLanguage(); if (!strategy .equals(LocatorUtils.property(thisLocator, "language", lhsLanguage), LocatorUtils.property(thatLocator, "language", rhsLanguage), lhsLanguage, rhsLanguage)) { return false; } } { SoftwarePackageObject.CPEname lhsCPEname; lhsCPEname = this.getCPEname(); SoftwarePackageObject.CPEname rhsCPEname; rhsCPEname = that.getCPEname(); if (!strategy.equals( LocatorUtils.property(thisLocator, "cpEname", lhsCPEname), LocatorUtils.property(thatLocator, "cpEname", rhsCPEname), lhsCPEname, rhsCPEname)) { return false; } } { String lhsId; lhsId = this.getId(); String rhsId; rhsId = that.getId(); if (!strategy.equals( LocatorUtils.property(thisLocator, "id", lhsId), LocatorUtils.property(thatLocator, "id", rhsId), lhsId, rhsId)) { return false; } } return true; } public boolean equals(Object object) { final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE; return equals(null, null, object, strategy); } public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = 1; { String theVendor; theVendor = this.getVendor(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "vendor", theVendor), currentHashCode, theVendor); } { String theProductgroup; theProductgroup = this.getProductgroup(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "productgroup", theProductgroup), currentHashCode, theProductgroup); } { String theProduct; theProduct = this.getProduct(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "product", theProduct), currentHashCode, theProduct); } { String theVersion; theVersion = this.getVersion(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "version", theVersion), currentHashCode, theVersion); } { String theUpdate; theUpdate = this.getUpdate(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "update", theUpdate), currentHashCode, theUpdate); } { String theEdition; theEdition = this.getEdition(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "edition", theEdition), currentHashCode, theEdition); } { String theLanguage; theLanguage = this.getLanguage(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "language", theLanguage), currentHashCode, theLanguage); } { SoftwarePackageObject.CPEname theCPEname; theCPEname = this.getCPEname(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "cpEname", theCPEname), currentHashCode, theCPEname); } { String theId; theId = this.getId(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "id", theId), currentHashCode, theId); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } public SoftwarePackageObject withVendor(String value) { setVendor(value); return this; } public SoftwarePackageObject withProductgroup(String value) { setProductgroup(value); return this; } public SoftwarePackageObject withProduct(String value) { setProduct(value); return this; } public SoftwarePackageObject withVersion(String value) { setVersion(value); return this; } public SoftwarePackageObject withUpdate(String value) { setUpdate(value); return this; } public SoftwarePackageObject withEdition(String value) { setEdition(value); return this; } public SoftwarePackageObject withLanguage(String value) { setLanguage(value); return this; } public SoftwarePackageObject withCPEname(SoftwarePackageObject.CPEname value) { setCPEname(value); return this; } public SoftwarePackageObject withId(String value) { setId(value); return this; } public String toString() { final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE; final StringBuilder buffer = new StringBuilder(); append(null, buffer, strategy); return buffer.toString(); } public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { strategy.appendStart(locator, this, buffer); appendFields(locator, buffer, strategy); strategy.appendEnd(locator, this, buffer); return buffer; } public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { { String theVendor; theVendor = this.getVendor(); strategy.appendField(locator, this, "vendor", buffer, theVendor); } { String theProductgroup; theProductgroup = this.getProductgroup(); strategy.appendField(locator, this, "productgroup", buffer, theProductgroup); } { String theProduct; theProduct = this.getProduct(); strategy.appendField(locator, this, "product", buffer, theProduct); } { String theVersion; theVersion = this.getVersion(); strategy.appendField(locator, this, "version", buffer, theVersion); } { String theUpdate; theUpdate = this.getUpdate(); strategy.appendField(locator, this, "update", buffer, theUpdate); } { String theEdition; theEdition = this.getEdition(); strategy.appendField(locator, this, "edition", buffer, theEdition); } { String theLanguage; theLanguage = this.getLanguage(); strategy.appendField(locator, this, "language", buffer, theLanguage); } { SoftwarePackageObject.CPEname theCPEname; theCPEname = this.getCPEname(); strategy.appendField(locator, this, "cpEname", buffer, theCPEname); } { String theId; theId = this.getId(); strategy.appendField(locator, this, "id", buffer, theId); } return buffer; } /** *

Java class for anonymous complex type. * *

The following schema fragment specifies the expected content contained within this class. * *

	 * <complexType>
	 *   <simpleContent>
	 *     <extension base="<http://www.w3.org/2001/XMLSchema>string">
	 *       <attribute name="cpeVersion" type="{http://www.w3.org/2001/XMLSchema}string" />
	 *     </extension>
	 *   </simpleContent>
	 * </complexType>
	 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "value" }) public static class CPEname implements Equals, HashCode, ToString { @XmlValue protected String value; @XmlAttribute(name = "cpeVersion") protected String cpeVersion; /** * Default no-arg constructor * */ public CPEname() { super(); } /** * Fully-initialising value constructor * */ public CPEname(final String value, final String cpeVersion) { this.value = value; this.cpeVersion = cpeVersion; } /** * Gets the value of the value property. * * @return * possible object is * {@link String } * */ public String getValue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link String } * */ public void setValue(String value) { this.value = value; } /** * Gets the value of the cpeVersion property. * * @return * possible object is * {@link String } * */ public String getCpeVersion() { return cpeVersion; } /** * Sets the value of the cpeVersion property. * * @param value * allowed object is * {@link String } * */ public void setCpeVersion(String value) { this.cpeVersion = value; } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof SoftwarePackageObject.CPEname)) { return false; } if (this == object) { return true; } final SoftwarePackageObject.CPEname that = ((SoftwarePackageObject.CPEname) object); { String lhsValue; lhsValue = this.getValue(); String rhsValue; rhsValue = that.getValue(); if (!strategy.equals( LocatorUtils.property(thisLocator, "value", lhsValue), LocatorUtils.property(thatLocator, "value", rhsValue), lhsValue, rhsValue)) { return false; } } { String lhsCpeVersion; lhsCpeVersion = this.getCpeVersion(); String rhsCpeVersion; rhsCpeVersion = that.getCpeVersion(); if (!strategy.equals(LocatorUtils.property(thisLocator, "cpeVersion", lhsCpeVersion), LocatorUtils.property( thatLocator, "cpeVersion", rhsCpeVersion), lhsCpeVersion, rhsCpeVersion)) { return false; } } return true; } public boolean equals(Object object) { final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE; return equals(null, null, object, strategy); } public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = 1; { String theValue; theValue = this.getValue(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "value", theValue), currentHashCode, theValue); } { String theCpeVersion; theCpeVersion = this.getCpeVersion(); currentHashCode = strategy.hashCode(LocatorUtils.property( locator, "cpeVersion", theCpeVersion), currentHashCode, theCpeVersion); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } public SoftwarePackageObject.CPEname withValue(String value) { setValue(value); return this; } public SoftwarePackageObject.CPEname withCpeVersion(String value) { setCpeVersion(value); return this; } public String toString() { final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE; final StringBuilder buffer = new StringBuilder(); append(null, buffer, strategy); return buffer.toString(); } public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { strategy.appendStart(locator, this, buffer); appendFields(locator, buffer, strategy); strategy.appendEnd(locator, this, buffer); return buffer; } public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { { String theValue; theValue = this.getValue(); strategy.appendField(locator, this, "value", buffer, theValue); } { String theCpeVersion; theCpeVersion = this.getCpeVersion(); strategy.appendField(locator, this, "cpeVersion", buffer, theCpeVersion); } return buffer; } } /** * Returns A Document representation of this instance that is not formatted. * * @return The Document representation for this instance. */ public org.w3c.dom.Document toDocument() { return toDocument(false); } /** * Returns A Document representation for this instance. * * @param prettyPrint * True for pretty print, otherwise false * * @return The Document representation for this instance. */ public org.w3c.dom.Document toDocument(boolean prettyPrint) { return DocumentUtilities.toDocument(toJAXBElement(), prettyPrint); } /** * Returns JAXBElement for this instance. * * @return The JAXBElement for this instance. */ @SuppressWarnings({ "rawtypes", "unchecked" }) public JAXBElement toJAXBElement() { QName qualifiedName = STIXSchema.getQualifiedName(this); return new JAXBElement(qualifiedName, SoftwarePackageObject.class, this); } /** * Returns String representation of this instance that is not formatted. * * @return The String containing the XML mark-up. */ public String toXMLString() { return toXMLString(false); } /** * Returns XML String for JAXB Document Object Model object. * * @param prettyPrint * True for pretty print, otherwise false * * @return The String containing the XML mark-up. */ public String toXMLString(boolean prettyPrint) { return DocumentUtilities.toXMLString(toDocument(), prettyPrint); } /** * Creates SoftwarePackageObject instance for XML String * * @param text * XML String for the document * @return The SoftwarePackageObject instance for the passed XML String */ public static SoftwarePackageObject fromXMLString(String text) { JAXBContext jaxbContext; try { jaxbContext = JAXBContext.newInstance(SoftwarePackageObject.class .getPackage().getName()); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(STIXSchema.getInstance().getSchema()); unmarshaller.setEventHandler(new ValidationEventHandler()); StreamSource streamSource = new StreamSource(new StringReader(text)); return (SoftwarePackageObject) unmarshaller.unmarshal(streamSource); } catch (JAXBException e) { throw new RuntimeException(e); } } /** * Validates the XML representation of this SoftwarePackageObject instance * Returning true indicating a successful validation, false if not. * * @return boolean */ public boolean validate() { return STIXSchema.getInstance().validate(toXMLString()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy