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

xml.metadatasharing.FieldDataEntry Maven / Gradle / Ivy

The 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.07.01 at 03:19:53 PM EDT 
//

package xml.metadatasharing;

import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
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.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.datatype.XMLGregorianCalendar;
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;
import org.xml.sax.SAXException;

/**
 * 
 *      Data structure to hold prevalence information. The data includes a reference to another object (which is an xpath 
 *      expression pointing to an object inside the 'ref' element), together with a time period (startDate -> endDate), 
 *      an origin - where the object came from, and various location tags. This allows rich information on prevalence to be recorded.
 *      
 *      By convention, time periods should be wherever possible standard time periods, e.g. minute, hour, 24 hours, week, month, quarter, year. This
 *      will facilitate combination of data from multiple sources.
 *      
 *      To represent a single entry, make startDate == endDate.
 *      
 *      Commonality is calculated from the sightings of malware objects (and so such calculation is easier to automate).
 *      Importance is reserved for cases when “commonality” is not available or if there is a need to communicate the 
 *      importance when commonality is low. 
 *      
 *      We define the commonality on a scale 0 to 100 (0 means “never found in the field” and 100 means “found very frequently”). Scaling commonality to 0..100 range instead of using actual sample counts is to avoid the effect of the user base size on the commonality. We derive commonality from the number of affected computers – not from the number of samples (for example, a hundred parasitic infections of the same virus on a single computer are to be counted as one).  
 *      
 *      To calculate the commonality we use two-stage approach and logarithmic scale:
 *      -	If the number of affected users exceeds 0.1% of your user base (more frequent than 1 in a 1000) set commonality to “100”
 *      -	Otherwise, calculate the ratio of infected computers amongst your user base by dividing the real number of affected computers ‘n’ by the total number ‘N’ 
 *      -	Apply the following formula to get the commonality –( log2(1+n*1000/N) ) * 100
 *      -	Round to the closest integer
 *     
 *      
 *      Obviously, the calculation above can only be applied to counting of malware sightings on desktops.
 *      If telemetry is collected from a fraction of such desktops then an appropriate correction should be used. 
 *      For all other cases (e.g. sighting on gateways, in some network security appliance, on an ISP level, etc.) 
 *      please exercise your best judgment and apply provided desktop guideline as an example to make sure
 *      the commonality factor is as comparable as possible.
 *      
 *      For a URL object the commonality could reflect, for example, how widely it was spammed.
 *      
 *      “Importance” should not be used together with “commonality” (unless commonality=“0”) to avoid possible confusion. High “importance”, for example, can be assigned to samples that are over-hyped by media when their commonality is still “0”. 
 *      
 *      Use the following guidelines for “importance” which is also defined on a scale 0..100:
 *      100 – you’d  expect your CEO and/or media to call you any second about this object
 *      80 – you might get a call from your CEO and/or media
 *      60 –  you’d  expect your boss to call you any second
 *      40 – you might get a call from your boss
 *      20 – someone is very likely to contact you about this object
 *      10 – you might get contacted about this object
 *      0 – you’d be surprised if anyone would ever contact you about this object
 *     
 *     
 * 
 * 

Java class for fieldDataEntry complex type. * *

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

 * <complexType name="fieldDataEntry">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="references">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <sequence>
 *                   <element name="ref" type="{http://xml/metadataSharing.xsd}reference" maxOccurs="unbounded"/>
 *                 </sequence>
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="startDate" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
 *         <element name="endDate" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
 *         <element name="firstSeenDate" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
 *         <element name="origin" type="{http://xml/metadataSharing.xsd}OriginTypeEnum"/>
 *         <element name="commonality" type="{http://xml/metadataSharing.xsd}intBetween0and100" minOccurs="0"/>
 *         <element name="volume" maxOccurs="unbounded" minOccurs="0">
 *           <complexType>
 *             <simpleContent>
 *               <extension base="<http://www.w3.org/2001/XMLSchema>int">
 *                 <attribute name="units" use="required" type="{http://xml/metadataSharing.xsd}VolumeUnitsEnum" />
 *               </extension>
 *             </simpleContent>
 *           </complexType>
 *         </element>
 *         <element name="importance" type="{http://xml/metadataSharing.xsd}intBetween0and100" minOccurs="0"/>
 *         <element name="location" minOccurs="0">
 *           <complexType>
 *             <simpleContent>
 *               <extension base="<http://www.w3.org/2001/XMLSchema>string">
 *                 <attribute name="type" type="{http://xml/metadataSharing.xsd}LocationTypeEnum" />
 *               </extension>
 *             </simpleContent>
 *           </complexType>
 *         </element>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "fieldDataEntry", propOrder = { "references", "startDate", "endDate", "firstSeenDate", "origin", "commonality", "volumes", "importance", "location" }) public class FieldDataEntry implements Equals, HashCode, ToString { @XmlElement(required = true) protected FieldDataEntry.References references; @XmlElement(required = true) @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar startDate; @XmlElement(required = true) @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar endDate; @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar firstSeenDate; @XmlElement(required = true) protected OriginTypeEnum origin; protected Integer commonality; @XmlElement(name = "volume") protected List volumes; protected Integer importance; protected FieldDataEntry.Location location; /** * Default no-arg constructor * */ public FieldDataEntry() { super(); } /** * Fully-initialising value constructor * */ public FieldDataEntry(final FieldDataEntry.References references, final XMLGregorianCalendar startDate, final XMLGregorianCalendar endDate, final XMLGregorianCalendar firstSeenDate, final OriginTypeEnum origin, final Integer commonality, final List volumes, final Integer importance, final FieldDataEntry.Location location) { this.references = references; this.startDate = startDate; this.endDate = endDate; this.firstSeenDate = firstSeenDate; this.origin = origin; this.commonality = commonality; this.volumes = volumes; this.importance = importance; this.location = location; } /** * Gets the value of the references property. * * @return * possible object is * {@link FieldDataEntry.References } * */ public FieldDataEntry.References getReferences() { return references; } /** * Sets the value of the references property. * * @param value * allowed object is * {@link FieldDataEntry.References } * */ public void setReferences(FieldDataEntry.References value) { this.references = value; } /** * Gets the value of the startDate property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getStartDate() { return startDate; } /** * Sets the value of the startDate property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setStartDate(XMLGregorianCalendar value) { this.startDate = value; } /** * Gets the value of the endDate property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getEndDate() { return endDate; } /** * Sets the value of the endDate property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setEndDate(XMLGregorianCalendar value) { this.endDate = value; } /** * Gets the value of the firstSeenDate property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getFirstSeenDate() { return firstSeenDate; } /** * Sets the value of the firstSeenDate property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setFirstSeenDate(XMLGregorianCalendar value) { this.firstSeenDate = value; } /** * Gets the value of the origin property. * * @return * possible object is * {@link OriginTypeEnum } * */ public OriginTypeEnum getOrigin() { return origin; } /** * Sets the value of the origin property. * * @param value * allowed object is * {@link OriginTypeEnum } * */ public void setOrigin(OriginTypeEnum value) { this.origin = value; } /** * Gets the value of the commonality property. * * @return * possible object is * {@link Integer } * */ public Integer getCommonality() { return commonality; } /** * Sets the value of the commonality property. * * @param value * allowed object is * {@link Integer } * */ public void setCommonality(Integer value) { this.commonality = value; } /** * Gets the value of the volumes property. * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the volumes property. * *

* For example, to add a new item, do as follows: *

	 *    getVolumes().add(newItem);
	 * 
* * *

* Objects of the following type(s) are allowed in the list * {@link FieldDataEntry.Volume } * * */ public List getVolumes() { if (volumes == null) { volumes = new ArrayList(); } return this.volumes; } /** * Gets the value of the importance property. * * @return * possible object is * {@link Integer } * */ public Integer getImportance() { return importance; } /** * Sets the value of the importance property. * * @param value * allowed object is * {@link Integer } * */ public void setImportance(Integer value) { this.importance = value; } /** * Gets the value of the location property. * * @return * possible object is * {@link FieldDataEntry.Location } * */ public FieldDataEntry.Location getLocation() { return location; } /** * Sets the value of the location property. * * @param value * allowed object is * {@link FieldDataEntry.Location } * */ public void setLocation(FieldDataEntry.Location value) { this.location = value; } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof FieldDataEntry)) { return false; } if (this == object) { return true; } final FieldDataEntry that = ((FieldDataEntry) object); { FieldDataEntry.References lhsReferences; lhsReferences = this.getReferences(); FieldDataEntry.References rhsReferences; rhsReferences = that.getReferences(); if (!strategy.equals(LocatorUtils.property(thisLocator, "references", lhsReferences), LocatorUtils.property( thatLocator, "references", rhsReferences), lhsReferences, rhsReferences)) { return false; } } { XMLGregorianCalendar lhsStartDate; lhsStartDate = this.getStartDate(); XMLGregorianCalendar rhsStartDate; rhsStartDate = that.getStartDate(); if (!strategy.equals(LocatorUtils.property(thisLocator, "startDate", lhsStartDate), LocatorUtils.property( thatLocator, "startDate", rhsStartDate), lhsStartDate, rhsStartDate)) { return false; } } { XMLGregorianCalendar lhsEndDate; lhsEndDate = this.getEndDate(); XMLGregorianCalendar rhsEndDate; rhsEndDate = that.getEndDate(); if (!strategy.equals( LocatorUtils.property(thisLocator, "endDate", lhsEndDate), LocatorUtils.property(thatLocator, "endDate", rhsEndDate), lhsEndDate, rhsEndDate)) { return false; } } { XMLGregorianCalendar lhsFirstSeenDate; lhsFirstSeenDate = this.getFirstSeenDate(); XMLGregorianCalendar rhsFirstSeenDate; rhsFirstSeenDate = that.getFirstSeenDate(); if (!strategy.equals(LocatorUtils.property(thisLocator, "firstSeenDate", lhsFirstSeenDate), LocatorUtils.property( thatLocator, "firstSeenDate", rhsFirstSeenDate), lhsFirstSeenDate, rhsFirstSeenDate)) { return false; } } { OriginTypeEnum lhsOrigin; lhsOrigin = this.getOrigin(); OriginTypeEnum rhsOrigin; rhsOrigin = that.getOrigin(); if (!strategy.equals( LocatorUtils.property(thisLocator, "origin", lhsOrigin), LocatorUtils.property(thatLocator, "origin", rhsOrigin), lhsOrigin, rhsOrigin)) { return false; } } { Integer lhsCommonality; lhsCommonality = this.getCommonality(); Integer rhsCommonality; rhsCommonality = that.getCommonality(); if (!strategy.equals(LocatorUtils.property(thisLocator, "commonality", lhsCommonality), LocatorUtils.property( thatLocator, "commonality", rhsCommonality), lhsCommonality, rhsCommonality)) { return false; } } { List lhsVolumes; lhsVolumes = (((this.volumes != null) && (!this.volumes.isEmpty())) ? this .getVolumes() : null); List rhsVolumes; rhsVolumes = (((that.volumes != null) && (!that.volumes.isEmpty())) ? that .getVolumes() : null); if (!strategy.equals( LocatorUtils.property(thisLocator, "volumes", lhsVolumes), LocatorUtils.property(thatLocator, "volumes", rhsVolumes), lhsVolumes, rhsVolumes)) { return false; } } { Integer lhsImportance; lhsImportance = this.getImportance(); Integer rhsImportance; rhsImportance = that.getImportance(); if (!strategy.equals(LocatorUtils.property(thisLocator, "importance", lhsImportance), LocatorUtils.property( thatLocator, "importance", rhsImportance), lhsImportance, rhsImportance)) { return false; } } { FieldDataEntry.Location lhsLocation; lhsLocation = this.getLocation(); FieldDataEntry.Location rhsLocation; rhsLocation = that.getLocation(); if (!strategy .equals(LocatorUtils.property(thisLocator, "location", lhsLocation), LocatorUtils.property(thatLocator, "location", rhsLocation), lhsLocation, rhsLocation)) { 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; { FieldDataEntry.References theReferences; theReferences = this.getReferences(); currentHashCode = strategy .hashCode(LocatorUtils.property(locator, "references", theReferences), currentHashCode, theReferences); } { XMLGregorianCalendar theStartDate; theStartDate = this.getStartDate(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "startDate", theStartDate), currentHashCode, theStartDate); } { XMLGregorianCalendar theEndDate; theEndDate = this.getEndDate(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "endDate", theEndDate), currentHashCode, theEndDate); } { XMLGregorianCalendar theFirstSeenDate; theFirstSeenDate = this.getFirstSeenDate(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "firstSeenDate", theFirstSeenDate), currentHashCode, theFirstSeenDate); } { OriginTypeEnum theOrigin; theOrigin = this.getOrigin(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "origin", theOrigin), currentHashCode, theOrigin); } { Integer theCommonality; theCommonality = this.getCommonality(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "commonality", theCommonality), currentHashCode, theCommonality); } { List theVolumes; theVolumes = (((this.volumes != null) && (!this.volumes.isEmpty())) ? this .getVolumes() : null); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "volumes", theVolumes), currentHashCode, theVolumes); } { Integer theImportance; theImportance = this.getImportance(); currentHashCode = strategy .hashCode(LocatorUtils.property(locator, "importance", theImportance), currentHashCode, theImportance); } { FieldDataEntry.Location theLocation; theLocation = this.getLocation(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "location", theLocation), currentHashCode, theLocation); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } public FieldDataEntry withReferences(FieldDataEntry.References value) { setReferences(value); return this; } public FieldDataEntry withStartDate(XMLGregorianCalendar value) { setStartDate(value); return this; } public FieldDataEntry withEndDate(XMLGregorianCalendar value) { setEndDate(value); return this; } public FieldDataEntry withFirstSeenDate(XMLGregorianCalendar value) { setFirstSeenDate(value); return this; } public FieldDataEntry withOrigin(OriginTypeEnum value) { setOrigin(value); return this; } public FieldDataEntry withCommonality(Integer value) { setCommonality(value); return this; } public FieldDataEntry withVolumes(FieldDataEntry.Volume... values) { if (values != null) { for (FieldDataEntry.Volume value : values) { getVolumes().add(value); } } return this; } public FieldDataEntry withVolumes(Collection values) { if (values != null) { getVolumes().addAll(values); } return this; } public FieldDataEntry withImportance(Integer value) { setImportance(value); return this; } public FieldDataEntry withLocation(FieldDataEntry.Location value) { setLocation(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) { { FieldDataEntry.References theReferences; theReferences = this.getReferences(); strategy.appendField(locator, this, "references", buffer, theReferences); } { XMLGregorianCalendar theStartDate; theStartDate = this.getStartDate(); strategy.appendField(locator, this, "startDate", buffer, theStartDate); } { XMLGregorianCalendar theEndDate; theEndDate = this.getEndDate(); strategy.appendField(locator, this, "endDate", buffer, theEndDate); } { XMLGregorianCalendar theFirstSeenDate; theFirstSeenDate = this.getFirstSeenDate(); strategy.appendField(locator, this, "firstSeenDate", buffer, theFirstSeenDate); } { OriginTypeEnum theOrigin; theOrigin = this.getOrigin(); strategy.appendField(locator, this, "origin", buffer, theOrigin); } { Integer theCommonality; theCommonality = this.getCommonality(); strategy.appendField(locator, this, "commonality", buffer, theCommonality); } { List theVolumes; theVolumes = (((this.volumes != null) && (!this.volumes.isEmpty())) ? this .getVolumes() : null); strategy.appendField(locator, this, "volumes", buffer, theVolumes); } { Integer theImportance; theImportance = this.getImportance(); strategy.appendField(locator, this, "importance", buffer, theImportance); } { FieldDataEntry.Location theLocation; theLocation = this.getLocation(); strategy.appendField(locator, this, "location", buffer, theLocation); } 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="type" type="{http://xml/metadataSharing.xsd}LocationTypeEnum" />
	 *     </extension>
	 *   </simpleContent>
	 * </complexType>
	 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "value" }) public static class Location implements Equals, HashCode, ToString { @XmlValue protected String value; @XmlAttribute(name = "type") protected LocationTypeEnum type; /** * Default no-arg constructor * */ public Location() { super(); } /** * Fully-initialising value constructor * */ public Location(final String value, final LocationTypeEnum type) { this.value = value; this.type = type; } /** * 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 type property. * * @return * possible object is * {@link LocationTypeEnum } * */ public LocationTypeEnum getType() { return type; } /** * Sets the value of the type property. * * @param value * allowed object is * {@link LocationTypeEnum } * */ public void setType(LocationTypeEnum value) { this.type = value; } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof FieldDataEntry.Location)) { return false; } if (this == object) { return true; } final FieldDataEntry.Location that = ((FieldDataEntry.Location) 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; } } { LocationTypeEnum lhsType; lhsType = this.getType(); LocationTypeEnum rhsType; rhsType = that.getType(); if (!strategy.equals( LocatorUtils.property(thisLocator, "type", lhsType), LocatorUtils.property(thatLocator, "type", rhsType), lhsType, rhsType)) { 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); } { LocationTypeEnum theType; theType = this.getType(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "type", theType), currentHashCode, theType); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } public FieldDataEntry.Location withValue(String value) { setValue(value); return this; } public FieldDataEntry.Location withType(LocationTypeEnum value) { setType(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); } { LocationTypeEnum theType; theType = this.getType(); strategy.appendField(locator, this, "type", buffer, theType); } return buffer; } } /** *

Java class for anonymous complex type. * *

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

	 * <complexType>
	 *   <complexContent>
	 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
	 *       <sequence>
	 *         <element name="ref" type="{http://xml/metadataSharing.xsd}reference" maxOccurs="unbounded"/>
	 *       </sequence>
	 *     </restriction>
	 *   </complexContent>
	 * </complexType>
	 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "reves" }) public static class References implements Equals, HashCode, ToString { @XmlElement(name = "ref", required = true) protected List reves; /** * Default no-arg constructor * */ public References() { super(); } /** * Fully-initialising value constructor * */ public References(final List reves) { this.reves = reves; } /** * Gets the value of the reves property. * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the reves property. * *

* For example, to add a new item, do as follows: *

		 *    getReves().add(newItem);
		 * 
* * *

* Objects of the following type(s) are allowed in the list * {@link Reference } * * */ public List getReves() { if (reves == null) { reves = new ArrayList(); } return this.reves; } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof FieldDataEntry.References)) { return false; } if (this == object) { return true; } final FieldDataEntry.References that = ((FieldDataEntry.References) object); { List lhsReves; lhsReves = (((this.reves != null) && (!this.reves.isEmpty())) ? this .getReves() : null); List rhsReves; rhsReves = (((that.reves != null) && (!that.reves.isEmpty())) ? that .getReves() : null); if (!strategy.equals( LocatorUtils.property(thisLocator, "reves", lhsReves), LocatorUtils.property(thatLocator, "reves", rhsReves), lhsReves, rhsReves)) { 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; { List theReves; theReves = (((this.reves != null) && (!this.reves.isEmpty())) ? this .getReves() : null); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "reves", theReves), currentHashCode, theReves); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } public FieldDataEntry.References withReves(Reference... values) { if (values != null) { for (Reference value : values) { getReves().add(value); } } return this; } public FieldDataEntry.References withReves(Collection values) { if (values != null) { getReves().addAll(values); } 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) { { List theReves; theReves = (((this.reves != null) && (!this.reves.isEmpty())) ? this .getReves() : null); strategy.appendField(locator, this, "reves", buffer, theReves); } 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>int">
	 *       <attribute name="units" use="required" type="{http://xml/metadataSharing.xsd}VolumeUnitsEnum" />
	 *     </extension>
	 *   </simpleContent>
	 * </complexType>
	 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "value" }) public static class Volume implements Equals, HashCode, ToString { @XmlValue protected int value; @XmlAttribute(name = "units", required = true) protected VolumeUnitsEnum units; /** * Default no-arg constructor * */ public Volume() { super(); } /** * Fully-initialising value constructor * */ public Volume(final int value, final VolumeUnitsEnum units) { this.value = value; this.units = units; } /** * Gets the value of the value property. * */ public int getValue() { return value; } /** * Sets the value of the value property. * */ public void setValue(int value) { this.value = value; } /** * Gets the value of the units property. * * @return * possible object is * {@link VolumeUnitsEnum } * */ public VolumeUnitsEnum getUnits() { return units; } /** * Sets the value of the units property. * * @param value * allowed object is * {@link VolumeUnitsEnum } * */ public void setUnits(VolumeUnitsEnum value) { this.units = value; } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof FieldDataEntry.Volume)) { return false; } if (this == object) { return true; } final FieldDataEntry.Volume that = ((FieldDataEntry.Volume) object); { int lhsValue; lhsValue = (true ? this.getValue() : 0); int rhsValue; rhsValue = (true ? that.getValue() : 0); if (!strategy.equals( LocatorUtils.property(thisLocator, "value", lhsValue), LocatorUtils.property(thatLocator, "value", rhsValue), lhsValue, rhsValue)) { return false; } } { VolumeUnitsEnum lhsUnits; lhsUnits = this.getUnits(); VolumeUnitsEnum rhsUnits; rhsUnits = that.getUnits(); if (!strategy.equals( LocatorUtils.property(thisLocator, "units", lhsUnits), LocatorUtils.property(thatLocator, "units", rhsUnits), lhsUnits, rhsUnits)) { 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; { int theValue; theValue = (true ? this.getValue() : 0); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "value", theValue), currentHashCode, theValue); } { VolumeUnitsEnum theUnits; theUnits = this.getUnits(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "units", theUnits), currentHashCode, theUnits); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } public FieldDataEntry.Volume withValue(int value) { setValue(value); return this; } public FieldDataEntry.Volume withUnits(VolumeUnitsEnum value) { setUnits(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) { { int theValue; theValue = (true ? this.getValue() : 0); strategy.appendField(locator, this, "value", buffer, theValue); } { VolumeUnitsEnum theUnits; theUnits = this.getUnits(); strategy.appendField(locator, this, "units", buffer, theUnits); } 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, FieldDataEntry.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 FieldDataEntry instance for XML String * * @param text * XML String for the document * @return The FieldDataEntry instance for the passed XML String */ public static FieldDataEntry fromXMLString(String text) { JAXBContext jaxbContext; try { jaxbContext = JAXBContext.newInstance(FieldDataEntry.class .getPackage().getName()); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(STIXSchema.getInstance().getSchema()); unmarshaller.setEventHandler(new ValidationEventHandler()); StreamSource streamSource = new StreamSource(new StringReader(text)); return (FieldDataEntry) unmarshaller.unmarshal(streamSource); } catch (JAXBException e) { throw new RuntimeException(e); } } /** * Validates the XML representation of this FieldDataEntry instance * Returning true indicating a successful validation, false if not. * * @return boolean True If it validates against the schema * @throws SAXException * If the a validation ErrorHandler has not been set, and * validation throws a SAXException */ public boolean validate() throws SAXException { return STIXSchema.getInstance().validate(toXMLString()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy