Class: RecordType

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
models/recordtype.rb

Overview

Record type definition

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from DataMapper::Resource

#make_dirty

Class Method Details

+ (Boolean) active(repository = nil)

Returns True if this RecordType is active

Returns:

  • (Boolean)

    True if this RecordType is active



15
# File 'models/recordtype.rb', line 15

property :active,			Boolean, :default => true

+ (Array<RecordType>) allAppRecordTypes

Get all RecordTypes that refer to Application objects

Returns:



97
98
99
# File 'models/recordtype.rb', line 97

def self.allAppRecordTypes()
	all(:object => LINK_TYPE::APPLICATION)
end

+ (Array<RecordType>) appRecordTypes

Get active RecordTypes that refer to Application objects

Returns:



90
91
92
# File 'models/recordtype.rb', line 90

def self.appRecordTypes()
	all(:active => true, :object => LINK_TYPE::APPLICATION)
end

+ (Boolean) canBePassedToCon(repository = nil)

Returns True if this RecordType can be passed to a contractor for testing

Returns:

  • (Boolean)

    True if this RecordType can be passed to a contractor for testing



23
# File 'models/recordtype.rb', line 23

property :canBePassedToCon,	Boolean, :default => false

+ (Boolean) canBeProvPassed(repository = nil)

Returns True if Tests on Applications of this RecordType can be provisionally passed

Returns:

  • (Boolean)

    True if Tests on Applications of this RecordType can be provisionally passed



24
# File 'models/recordtype.rb', line 24

property :canBeProvPassed,	Boolean, :default => false

+ (Boolean) defaultPrivate(repository = nil)

Returns If True, Applications of this RecordType will be marked private by default

Returns:

  • (Boolean)

    If True, Applications of this RecordType will be marked private by default



25
# File 'models/recordtype.rb', line 25

property :defaultPrivate,	Boolean, :default => false

+ (String) description(repository = nil)

Returns Description of the RecordType

Returns:

  • (String)

    Description of the RecordType



18
# File 'models/recordtype.rb', line 18

property :description,		Text

+ (ExportFormat) exportFormat(repository = nil)

Returns Report format this RecordType uses

Returns:



21
# File 'models/recordtype.rb', line 21

property :exportFormat,		Integer, :default => 0

+ (Integer) id(repository = nil)

Returns Primary Key

Returns:

  • (Integer)

    Primary Key



13
# File 'models/recordtype.rb', line 13

property :id,				Serial

+ (Boolean) isLinked(repository = nil)

Returns True if this RecordType links to an object using a VRLinkedObject

Returns:

  • (Boolean)

    True if this RecordType links to an object using a VRLinkedObject



19
# File 'models/recordtype.rb', line 19

property :isLinked,			Boolean, :default => false

+ (LINK_TYPE) linkedObjectKey(repository = nil)

Returns The key of the VRLinkedObject this RecordType is linked to (as an invariant)

Returns:



20
# File 'models/recordtype.rb', line 20

property :linkedObjectKey,	String

+ (String) name(repository = nil)

Returns Name of the RecordType

Returns:

  • (String)

    Name of the RecordType



17
# File 'models/recordtype.rb', line 17

property :name,				String,	:length => 100

+ (LINK_TYPE) object(repository = nil)

Returns Object this RecordType defines a type for

Returns:

  • (LINK_TYPE)

    Object this RecordType defines a type for



14
# File 'models/recordtype.rb', line 14

property :object,			Integer

+ (String) vulnPriorities(repository = nil)

Returns Stores the 5 vuln priority strings (Critical, High, Medium, Low, Informational) in CSV form. Limit 50 chars per priority.

Returns:

  • (String)

    Stores the 5 vuln priority strings (Critical, High, Medium, Low, Informational) in CSV form. Limit 50 chars per priority.



26
# File 'models/recordtype.rb', line 26

property :vulnPriorities,	String, :length => 255, :default => "Critical,High,Medium,Low,Informational"

Instance Method Details

- (Boolean) active

Returns True if this RecordType is active

Returns:

  • (Boolean)

    True if this RecordType is active



15
# File 'models/recordtype.rb', line 15

property :active,			Boolean, :default => true

- (Boolean) active=(value)

Returns True if this RecordType is active

Returns:

  • (Boolean)

    True if this RecordType is active



15
# File 'models/recordtype.rb', line 15

property :active,			Boolean, :default => true

- (Boolean) canBePassedToCon

Returns True if this RecordType can be passed to a contractor for testing

Returns:

  • (Boolean)

    True if this RecordType can be passed to a contractor for testing



23
# File 'models/recordtype.rb', line 23

property :canBePassedToCon,	Boolean, :default => false

- (Boolean) canBePassedToCon=(value)

Returns True if this RecordType can be passed to a contractor for testing

Returns:

  • (Boolean)

    True if this RecordType can be passed to a contractor for testing



23
# File 'models/recordtype.rb', line 23

property :canBePassedToCon,	Boolean, :default => false

- (Boolean) canBeProvPassed

Returns True if Tests on Applications of this RecordType can be provisionally passed

Returns:

  • (Boolean)

    True if Tests on Applications of this RecordType can be provisionally passed



24
# File 'models/recordtype.rb', line 24

property :canBeProvPassed,	Boolean, :default => false

- (Boolean) canBeProvPassed=(value)

Returns True if Tests on Applications of this RecordType can be provisionally passed

Returns:

  • (Boolean)

    True if Tests on Applications of this RecordType can be provisionally passed



24
# File 'models/recordtype.rb', line 24

property :canBeProvPassed,	Boolean, :default => false

- (Boolean) defaultPrivate

Returns If True, Applications of this RecordType will be marked private by default

Returns:

  • (Boolean)

    If True, Applications of this RecordType will be marked private by default



25
# File 'models/recordtype.rb', line 25

property :defaultPrivate,	Boolean, :default => false

- (Boolean) defaultPrivate=(value)

Returns If True, Applications of this RecordType will be marked private by default

Returns:

  • (Boolean)

    If True, Applications of this RecordType will be marked private by default



25
# File 'models/recordtype.rb', line 25

property :defaultPrivate,	Boolean, :default => false

- (String) description

Returns Description of the RecordType

Returns:

  • (String)

    Description of the RecordType



18
# File 'models/recordtype.rb', line 18

property :description,		Text

- (String) description=(value)

Returns Description of the RecordType

Returns:

  • (String)

    Description of the RecordType



18
# File 'models/recordtype.rb', line 18

property :description,		Text

- (ExportFormat) exportFormat

Returns Report format this RecordType uses

Returns:



21
# File 'models/recordtype.rb', line 21

property :exportFormat,		Integer, :default => 0

- (ExportFormat) exportFormat=(value)

Returns Report format this RecordType uses

Returns:



21
# File 'models/recordtype.rb', line 21

property :exportFormat,		Integer, :default => 0

- (String) getVulnPriorityString(level)

Get the human-readable string for a given vulnerability priority level of a vuln on an Application of this RecordType

Parameters:

  • level (VULN_PRIORITY)

    The priority level to get the string for

Returns:

  • (String)

    Vuln priority level string (e.g. “Critical”)



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'models/recordtype.rb', line 33

def getVulnPriorityString(level)
	levelStrArray = self.vulnPriorities.split(",")
	
	if(level == VULN_PRIORITY::CRITICAL)
		if(levelStrArray[0].nil? || levelStrArray[0].empty?)
			return "Critical"
		else
			return levelStrArray[0]
		end
	elsif(level == VULN_PRIORITY::HIGH)
		if(levelStrArray[1].nil? || levelStrArray[1].empty?)
			return "High"
		else
			return levelStrArray[1]
		end
	elsif(level == VULN_PRIORITY::MEDIUM)
		if(levelStrArray[2].nil? || levelStrArray[2].empty?)
			return "Medium"
		else
			return levelStrArray[2]
		end
	elsif(level == VULN_PRIORITY::LOW)
		if(levelStrArray[3].nil? || levelStrArray[3].empty?)
			return "Low"
		else
			return levelStrArray[3]
		end
	elsif(level == VULN_PRIORITY::INFORMATIONAL)
		if(levelStrArray[4].nil? || levelStrArray[4].empty?)
			return "Informational"
		else
			return levelStrArray[4]
		end
	else
		return "None"
	end
end

- (Integer) id

Returns Primary Key

Returns:

  • (Integer)

    Primary Key



13
# File 'models/recordtype.rb', line 13

property :id,				Serial

- (Integer) id=(value)

Returns Primary Key

Returns:

  • (Integer)

    Primary Key



13
# File 'models/recordtype.rb', line 13

property :id,				Serial

- (Boolean) isLinked

Returns True if this RecordType links to an object using a VRLinkedObject

Returns:

  • (Boolean)

    True if this RecordType links to an object using a VRLinkedObject



19
# File 'models/recordtype.rb', line 19

property :isLinked,			Boolean, :default => false

- (Boolean) isLinked=(value)

Returns True if this RecordType links to an object using a VRLinkedObject

Returns:

  • (Boolean)

    True if this RecordType links to an object using a VRLinkedObject



19
# File 'models/recordtype.rb', line 19

property :isLinked,			Boolean, :default => false

- (LINK_TYPE) linkedObjectKey

Returns The key of the VRLinkedObject this RecordType is linked to (as an invariant)

Returns:



20
# File 'models/recordtype.rb', line 20

property :linkedObjectKey,	String

- (LINK_TYPE) linkedObjectKey=(value)

Returns The key of the VRLinkedObject this RecordType is linked to (as an invariant)

Returns:



20
# File 'models/recordtype.rb', line 20

property :linkedObjectKey,	String

- (String) name

Returns Name of the RecordType

Returns:

  • (String)

    Name of the RecordType



17
# File 'models/recordtype.rb', line 17

property :name,				String,	:length => 100

- (String) name=(value)

Returns Name of the RecordType

Returns:

  • (String)

    Name of the RecordType



17
# File 'models/recordtype.rb', line 17

property :name,				String,	:length => 100

- (LINK_TYPE) object

Returns Object this RecordType defines a type for

Returns:

  • (LINK_TYPE)

    Object this RecordType defines a type for



14
# File 'models/recordtype.rb', line 14

property :object,			Integer

- (LINK_TYPE) object=(value)

Returns Object this RecordType defines a type for

Returns:

  • (LINK_TYPE)

    Object this RecordType defines a type for



14
# File 'models/recordtype.rb', line 14

property :object,			Integer

- (Object) setVulnPriorityString(level, str)

Set the human-readable string for a given vulnerability priority level of a vuln on an Application of this RecordType

Parameters:

  • level (VULN_PRIORITY)

    The priority level to set the string for

  • str (String)

    Vuln priority level string (e.g. “Critical”)



76
77
78
79
80
81
82
83
84
85
# File 'models/recordtype.rb', line 76

def setVulnPriorityString(level, str)
	levelStrArray = self.vulnPriorities.split(",")
	return false if(level >= levelStrArray.size)
	return false if(str.length > 50)

	levelStrArray[level] = str
	self.vulnPriorities = levelStrArray.join(',')

	return self.save
end

- (String) vulnPriorities

Returns Stores the 5 vuln priority strings (Critical, High, Medium, Low, Informational) in CSV form. Limit 50 chars per priority.

Returns:

  • (String)

    Stores the 5 vuln priority strings (Critical, High, Medium, Low, Informational) in CSV form. Limit 50 chars per priority.



26
# File 'models/recordtype.rb', line 26

property :vulnPriorities,	String, :length => 255, :default => "Critical,High,Medium,Low,Informational"

- (String) vulnPriorities=(value)

Returns Stores the 5 vuln priority strings (Critical, High, Medium, Low, Informational) in CSV form. Limit 50 chars per priority.

Returns:

  • (String)

    Stores the 5 vuln priority strings (Critical, High, Medium, Low, Informational) in CSV form. Limit 50 chars per priority.



26
# File 'models/recordtype.rb', line 26

property :vulnPriorities,	String, :length => 255, :default => "Critical,High,Medium,Low,Informational"