com.mandiant.schemas._2010.ioc.IndicatorOfCompromise Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stix Show documentation
Show all versions of stix Show documentation
The Java bindings for STIX v.1.2.0.2
/**
* 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 com.mandiant.schemas._2010.ioc;
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.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
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;
/**
* Java class for IndicatorOfCompromise complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType name="IndicatorOfCompromise">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="short_description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="keywords" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="authored_by" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="authored_date" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
* <element name="links" type="{http://schemas.mandiant.com/2010/ioc}ArrayOfLink" minOccurs="0"/>
* <element name="definition" type="{http://schemas.mandiant.com/2010/ioc}ArrayOfIocIndicator" minOccurs="0"/>
* </sequence>
* <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="last-modified" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "IndicatorOfCompromise", propOrder = { "shortDescription",
"description", "keywords", "authoredBy", "authoredDate", "links",
"definition" })
public class IndicatorOfCompromise implements Equals, HashCode, ToString {
@XmlElement(name = "short_description")
protected String shortDescription;
protected String description;
protected String keywords;
@XmlElement(name = "authored_by")
protected String authoredBy;
@XmlElement(name = "authored_date", required = true, nillable = true)
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar authoredDate;
protected ArrayOfLink links;
protected ArrayOfIocIndicator definition;
@XmlAttribute(name = "id")
protected String id;
@XmlAttribute(name = "last-modified", required = true)
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar lastModified;
/**
* Default no-arg constructor
*
*/
public IndicatorOfCompromise() {
super();
}
/**
* Fully-initialising value constructor
*
*/
public IndicatorOfCompromise(final String shortDescription,
final String description, final String keywords,
final String authoredBy, final XMLGregorianCalendar authoredDate,
final ArrayOfLink links, final ArrayOfIocIndicator definition,
final String id, final XMLGregorianCalendar lastModified) {
this.shortDescription = shortDescription;
this.description = description;
this.keywords = keywords;
this.authoredBy = authoredBy;
this.authoredDate = authoredDate;
this.links = links;
this.definition = definition;
this.id = id;
this.lastModified = lastModified;
}
/**
* Gets the value of the shortDescription property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getShortDescription() {
return shortDescription;
}
/**
* Sets the value of the shortDescription property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setShortDescription(String value) {
this.shortDescription = value;
}
/**
* Gets the value of the description property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/**
* Gets the value of the keywords property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getKeywords() {
return keywords;
}
/**
* Sets the value of the keywords property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setKeywords(String value) {
this.keywords = value;
}
/**
* Gets the value of the authoredBy property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAuthoredBy() {
return authoredBy;
}
/**
* Sets the value of the authoredBy property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthoredBy(String value) {
this.authoredBy = value;
}
/**
* Gets the value of the authoredDate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getAuthoredDate() {
return authoredDate;
}
/**
* Sets the value of the authoredDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setAuthoredDate(XMLGregorianCalendar value) {
this.authoredDate = value;
}
/**
* Gets the value of the links property.
*
* @return
* possible object is
* {@link ArrayOfLink }
*
*/
public ArrayOfLink getLinks() {
return links;
}
/**
* Sets the value of the links property.
*
* @param value
* allowed object is
* {@link ArrayOfLink }
*
*/
public void setLinks(ArrayOfLink value) {
this.links = value;
}
/**
* Gets the value of the definition property.
*
* @return
* possible object is
* {@link ArrayOfIocIndicator }
*
*/
public ArrayOfIocIndicator getDefinition() {
return definition;
}
/**
* Sets the value of the definition property.
*
* @param value
* allowed object is
* {@link ArrayOfIocIndicator }
*
*/
public void setDefinition(ArrayOfIocIndicator value) {
this.definition = 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;
}
/**
* Gets the value of the lastModified property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getLastModified() {
return lastModified;
}
/**
* Sets the value of the lastModified property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setLastModified(XMLGregorianCalendar value) {
this.lastModified = value;
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator,
Object object, EqualsStrategy strategy) {
if (!(object instanceof IndicatorOfCompromise)) {
return false;
}
if (this == object) {
return true;
}
final IndicatorOfCompromise that = ((IndicatorOfCompromise) object);
{
String lhsShortDescription;
lhsShortDescription = this.getShortDescription();
String rhsShortDescription;
rhsShortDescription = that.getShortDescription();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"shortDescription", lhsShortDescription), LocatorUtils
.property(thatLocator, "shortDescription",
rhsShortDescription), lhsShortDescription,
rhsShortDescription)) {
return false;
}
}
{
String lhsDescription;
lhsDescription = this.getDescription();
String rhsDescription;
rhsDescription = that.getDescription();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"description", lhsDescription), LocatorUtils.property(
thatLocator, "description", rhsDescription),
lhsDescription, rhsDescription)) {
return false;
}
}
{
String lhsKeywords;
lhsKeywords = this.getKeywords();
String rhsKeywords;
rhsKeywords = that.getKeywords();
if (!strategy
.equals(LocatorUtils.property(thisLocator, "keywords",
lhsKeywords), LocatorUtils.property(thatLocator,
"keywords", rhsKeywords), lhsKeywords, rhsKeywords)) {
return false;
}
}
{
String lhsAuthoredBy;
lhsAuthoredBy = this.getAuthoredBy();
String rhsAuthoredBy;
rhsAuthoredBy = that.getAuthoredBy();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"authoredBy", lhsAuthoredBy), LocatorUtils.property(
thatLocator, "authoredBy", rhsAuthoredBy), lhsAuthoredBy,
rhsAuthoredBy)) {
return false;
}
}
{
XMLGregorianCalendar lhsAuthoredDate;
lhsAuthoredDate = this.getAuthoredDate();
XMLGregorianCalendar rhsAuthoredDate;
rhsAuthoredDate = that.getAuthoredDate();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"authoredDate", lhsAuthoredDate), LocatorUtils.property(
thatLocator, "authoredDate", rhsAuthoredDate),
lhsAuthoredDate, rhsAuthoredDate)) {
return false;
}
}
{
ArrayOfLink lhsLinks;
lhsLinks = this.getLinks();
ArrayOfLink rhsLinks;
rhsLinks = that.getLinks();
if (!strategy.equals(
LocatorUtils.property(thisLocator, "links", lhsLinks),
LocatorUtils.property(thatLocator, "links", rhsLinks),
lhsLinks, rhsLinks)) {
return false;
}
}
{
ArrayOfIocIndicator lhsDefinition;
lhsDefinition = this.getDefinition();
ArrayOfIocIndicator rhsDefinition;
rhsDefinition = that.getDefinition();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"definition", lhsDefinition), LocatorUtils.property(
thatLocator, "definition", rhsDefinition), lhsDefinition,
rhsDefinition)) {
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;
}
}
{
XMLGregorianCalendar lhsLastModified;
lhsLastModified = this.getLastModified();
XMLGregorianCalendar rhsLastModified;
rhsLastModified = that.getLastModified();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"lastModified", lhsLastModified), LocatorUtils.property(
thatLocator, "lastModified", rhsLastModified),
lhsLastModified, rhsLastModified)) {
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 theShortDescription;
theShortDescription = this.getShortDescription();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator,
"shortDescription", theShortDescription), currentHashCode,
theShortDescription);
}
{
String theDescription;
theDescription = this.getDescription();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator,
"description", theDescription), currentHashCode,
theDescription);
}
{
String theKeywords;
theKeywords = this.getKeywords();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "keywords", theKeywords),
currentHashCode, theKeywords);
}
{
String theAuthoredBy;
theAuthoredBy = this.getAuthoredBy();
currentHashCode = strategy
.hashCode(LocatorUtils.property(locator, "authoredBy",
theAuthoredBy), currentHashCode, theAuthoredBy);
}
{
XMLGregorianCalendar theAuthoredDate;
theAuthoredDate = this.getAuthoredDate();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator,
"authoredDate", theAuthoredDate), currentHashCode,
theAuthoredDate);
}
{
ArrayOfLink theLinks;
theLinks = this.getLinks();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "links", theLinks),
currentHashCode, theLinks);
}
{
ArrayOfIocIndicator theDefinition;
theDefinition = this.getDefinition();
currentHashCode = strategy
.hashCode(LocatorUtils.property(locator, "definition",
theDefinition), currentHashCode, theDefinition);
}
{
String theId;
theId = this.getId();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "id", theId),
currentHashCode, theId);
}
{
XMLGregorianCalendar theLastModified;
theLastModified = this.getLastModified();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator,
"lastModified", theLastModified), currentHashCode,
theLastModified);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public IndicatorOfCompromise withShortDescription(String value) {
setShortDescription(value);
return this;
}
public IndicatorOfCompromise withDescription(String value) {
setDescription(value);
return this;
}
public IndicatorOfCompromise withKeywords(String value) {
setKeywords(value);
return this;
}
public IndicatorOfCompromise withAuthoredBy(String value) {
setAuthoredBy(value);
return this;
}
public IndicatorOfCompromise withAuthoredDate(XMLGregorianCalendar value) {
setAuthoredDate(value);
return this;
}
public IndicatorOfCompromise withLinks(ArrayOfLink value) {
setLinks(value);
return this;
}
public IndicatorOfCompromise withDefinition(ArrayOfIocIndicator value) {
setDefinition(value);
return this;
}
public IndicatorOfCompromise withId(String value) {
setId(value);
return this;
}
public IndicatorOfCompromise withLastModified(XMLGregorianCalendar value) {
setLastModified(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 theShortDescription;
theShortDescription = this.getShortDescription();
strategy.appendField(locator, this, "shortDescription", buffer,
theShortDescription);
}
{
String theDescription;
theDescription = this.getDescription();
strategy.appendField(locator, this, "description", buffer,
theDescription);
}
{
String theKeywords;
theKeywords = this.getKeywords();
strategy.appendField(locator, this, "keywords", buffer, theKeywords);
}
{
String theAuthoredBy;
theAuthoredBy = this.getAuthoredBy();
strategy.appendField(locator, this, "authoredBy", buffer,
theAuthoredBy);
}
{
XMLGregorianCalendar theAuthoredDate;
theAuthoredDate = this.getAuthoredDate();
strategy.appendField(locator, this, "authoredDate", buffer,
theAuthoredDate);
}
{
ArrayOfLink theLinks;
theLinks = this.getLinks();
strategy.appendField(locator, this, "links", buffer, theLinks);
}
{
ArrayOfIocIndicator theDefinition;
theDefinition = this.getDefinition();
strategy.appendField(locator, this, "definition", buffer,
theDefinition);
}
{
String theId;
theId = this.getId();
strategy.appendField(locator, this, "id", buffer, theId);
}
{
XMLGregorianCalendar theLastModified;
theLastModified = this.getLastModified();
strategy.appendField(locator, this, "lastModified", buffer,
theLastModified);
}
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, IndicatorOfCompromise.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 IndicatorOfCompromise instance for XML String
*
* @param text
* XML String for the document
* @return The IndicatorOfCompromise instance for the passed XML String
*/
public static IndicatorOfCompromise fromXMLString(String text) {
JAXBContext jaxbContext;
try {
jaxbContext = JAXBContext.newInstance(IndicatorOfCompromise.class
.getPackage().getName());
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
unmarshaller.setSchema(STIXSchema.getInstance().getSchema());
unmarshaller.setEventHandler(new ValidationEventHandler());
StreamSource streamSource = new StreamSource(new StringReader(text));
return (IndicatorOfCompromise) unmarshaller.unmarshal(streamSource);
} catch (JAXBException e) {
throw new RuntimeException(e);
}
}
/**
* Validates the XML representation of this IndicatorOfCompromise instance
* Returning true indicating a successful validation, false if not.
*
* @return boolean
*/
public boolean validate() {
return STIXSchema.getInstance().validate(toXMLString());
}
}