require 'date'
module HelixWebServices
# Detailed information about each file, as provided by the `p4 fstat` command.
class FstatCommand
# Depot path to file.\nFor files containing special characters, the filename is displayed containing the ASCII expression of the character’s hexadecimal value.
attr_accessor :depot_file
# Name in depot of moved to/from file.
attr_accessor :moved_file
# Set to `shelved` if file is shelved.
attr_accessor :shelved
# Action taken at head revision, if in depot.\n\nOne of: add, edit, delete, branch, move/add, move/delete, integrate, import, purge, or archive.
attr_accessor :head_action
# Head revision changelist number, if in depot.
attr_accessor :head_change
# Head revision number, if in depot.
attr_accessor :head_rev
# Head revision type, if in depot.
attr_accessor :head_type
# Head charset, for unicode files.
attr_accessor :head_charset
# Head revision changelist time, if in depot.\nTime is measured in seconds since 00:00:00 UTC, January 1, 1970.
attr_accessor :head_time
# Head revision modification time (the time that the file was last modified on the client before submit), if in depot.
attr_accessor :head_mod_time
# Head revision of moved file.
attr_accessor :moved_rev
# MD5 digest of a file.
attr_accessor :digest
# File length in bytes.
attr_accessor :file_size
# User who opened the file, if open.
attr_accessor :action_owner
# The number, if any, of resovled integration records.
attr_accessor :resolved
# The number, if any, of unresolved integration records.
attr_accessor :unresolved
# The number, if any, of re-resolvable integration records.
attr_accessor :reresolvable
# For each user with the file open, the workspace and user with the open file.
attr_accessor :other_opens
# For each user with the file locked, the workspace and user holding the lock.
attr_accessor :other_locks
# For each user with the file open, the action taken.
attr_accessor :other_actions
# The changelist number with this file open.
attr_accessor :other_changes
# Pending integration action.
attr_accessor :resolve_actions
# Pending base files.
attr_accessor :resolve_base_files
# Pending base revision numbers.
attr_accessor :resolve_base_revs
# Pending from files.
attr_accessor :resolve_from_files
# Pending starting revisions.
attr_accessor :resolve_start_from_revs
# Pending ending revisions.
attr_accessor :resolve_end_from_revs
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'depot_file' => :'depotFile',
:'moved_file' => :'movedFile',
:'shelved' => :'shelved',
:'head_action' => :'headAction',
:'head_change' => :'headChange',
:'head_rev' => :'headRev',
:'head_type' => :'headType',
:'head_charset' => :'headCharset',
:'head_time' => :'headTime',
:'head_mod_time' => :'headModTime',
:'moved_rev' => :'movedRev',
:'digest' => :'digest',
:'file_size' => :'fileSize',
:'action_owner' => :'actionOwner',
:'resolved' => :'resolved',
:'unresolved' => :'unresolved',
:'reresolvable' => :'reresolvable',
:'other_opens' => :'otherOpens',
:'other_locks' => :'otherLocks',
:'other_actions' => :'otherActions',
:'other_changes' => :'otherChanges',
:'resolve_actions' => :'resolveActions',
:'resolve_base_files' => :'resolveBaseFiles',
:'resolve_base_revs' => :'resolveBaseRevs',
:'resolve_from_files' => :'resolveFromFiles',
:'resolve_start_from_revs' => :'resolveStartFromRevs',
:'resolve_end_from_revs' => :'resolveEndFromRevs'
}
end
# Attribute type mapping.
def self.swagger_types
{
:'depot_file' => :'String',
:'moved_file' => :'String',
:'shelved' => :'String',
:'head_action' => :'String',
:'head_change' => :'String',
:'head_rev' => :'String',
:'head_type' => :'String',
:'head_charset' => :'String',
:'head_time' => :'DateTime',
:'head_mod_time' => :'DateTime',
:'moved_rev' => :'String',
:'digest' => :'String',
:'file_size' => :'String',
:'action_owner' => :'String',
:'resolved' => :'String',
:'unresolved' => :'String',
:'reresolvable' => :'String',
:'other_opens' => :'Array<String>',
:'other_locks' => :'Array<String>',
:'other_actions' => :'Array<String>',
:'other_changes' => :'Array<String>',
:'resolve_actions' => :'Array<String>',
:'resolve_base_files' => :'Array<String>',
:'resolve_base_revs' => :'Array<String>',
:'resolve_from_files' => :'Array<String>',
:'resolve_start_from_revs' => :'Array<String>',
:'resolve_end_from_revs' => :'Array<String>'
}
end
def initialize(attributes = {})
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
if attributes[:'depotFile']
self.depot_file = attributes[:'depotFile']
end
if attributes[:'movedFile']
self.moved_file = attributes[:'movedFile']
end
if attributes[:'shelved']
self.shelved = attributes[:'shelved']
end
if attributes[:'headAction']
self.head_action = attributes[:'headAction']
end
if attributes[:'headChange']
self.head_change = attributes[:'headChange']
end
if attributes[:'headRev']
self.head_rev = attributes[:'headRev']
end
if attributes[:'headType']
self.head_type = attributes[:'headType']
end
if attributes[:'headCharset']
self.head_charset = attributes[:'headCharset']
end
if attributes[:'headTime']
self.head_time = attributes[:'headTime']
end
if attributes[:'headModTime']
self.head_mod_time = attributes[:'headModTime']
end
if attributes[:'movedRev']
self.moved_rev = attributes[:'movedRev']
end
if attributes[:'digest']
self.digest = attributes[:'digest']
end
if attributes[:'fileSize']
self.file_size = attributes[:'fileSize']
end
if attributes[:'actionOwner']
self.action_owner = attributes[:'actionOwner']
end
if attributes[:'resolved']
self.resolved = attributes[:'resolved']
end
if attributes[:'unresolved']
self.unresolved = attributes[:'unresolved']
end
if attributes[:'reresolvable']
self.reresolvable = attributes[:'reresolvable']
end
if attributes[:'otherOpens']
if (value = attributes[:'otherOpens']).is_a?(Array)
self.other_opens = value
end
end
if attributes[:'otherLocks']
if (value = attributes[:'otherLocks']).is_a?(Array)
self.other_locks = value
end
end
if attributes[:'otherActions']
if (value = attributes[:'otherActions']).is_a?(Array)
self.other_actions = value
end
end
if attributes[:'otherChanges']
if (value = attributes[:'otherChanges']).is_a?(Array)
self.other_changes = value
end
end
if attributes[:'resolveActions']
if (value = attributes[:'resolveActions']).is_a?(Array)
self.resolve_actions = value
end
end
if attributes[:'resolveBaseFiles']
if (value = attributes[:'resolveBaseFiles']).is_a?(Array)
self.resolve_base_files = value
end
end
if attributes[:'resolveBaseRevs']
if (value = attributes[:'resolveBaseRevs']).is_a?(Array)
self.resolve_base_revs = value
end
end
if attributes[:'resolveFromFiles']
if (value = attributes[:'resolveFromFiles']).is_a?(Array)
self.resolve_from_files = value
end
end
if attributes[:'resolveStartFromRevs']
if (value = attributes[:'resolveStartFromRevs']).is_a?(Array)
self.resolve_start_from_revs = value
end
end
if attributes[:'resolveEndFromRevs']
if (value = attributes[:'resolveEndFromRevs']).is_a?(Array)
self.resolve_end_from_revs = value
end
end
end
# Check equality by comparing each attribute.
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
depot_file == o.depot_file &&
moved_file == o.moved_file &&
shelved == o.shelved &&
head_action == o.head_action &&
head_change == o.head_change &&
head_rev == o.head_rev &&
head_type == o.head_type &&
head_charset == o.head_charset &&
head_time == o.head_time &&
head_mod_time == o.head_mod_time &&
moved_rev == o.moved_rev &&
digest == o.digest &&
file_size == o.file_size &&
action_owner == o.action_owner &&
resolved == o.resolved &&
unresolved == o.unresolved &&
reresolvable == o.reresolvable &&
other_opens == o.other_opens &&
other_locks == o.other_locks &&
other_actions == o.other_actions &&
other_changes == o.other_changes &&
resolve_actions == o.resolve_actions &&
resolve_base_files == o.resolve_base_files &&
resolve_base_revs == o.resolve_base_revs &&
resolve_from_files == o.resolve_from_files &&
resolve_start_from_revs == o.resolve_start_from_revs &&
resolve_end_from_revs == o.resolve_end_from_revs
end
# @see the `==` method
def eql?(o)
self == o
end
# Calculate hash code according to all attributes.
def hash
[depot_file, moved_file, shelved, head_action, head_change, head_rev, head_type, head_charset, head_time, head_mod_time, moved_rev, digest, file_size, action_owner, resolved, unresolved, reresolvable, other_opens, other_locks, other_actions, other_changes, resolve_actions, resolve_base_files, resolve_base_revs, resolve_from_files, resolve_start_from_revs, resolve_end_from_revs].hash
end
# build the object from hash
def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /^Array<(.*)>/i
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
else
#TODO show warning in debug mode
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
else
# data not found in attributes(hash), not an issue as the data can be optional
end
end
self
end
def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i
true
else
false
end
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
when :Object
value
else # model
_model = HelixWebServices.const_get(type).new
_model.build_from_hash(value)
end
end
def to_s
to_hash.to_s
end
# to_body is an alias to to_body (backward compatibility))
def to_body
to_hash
end
# return the object in the form of hash
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Method to output non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
def _to_hash(value)
if value.is_a?(Array)
value.compact.map{ |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end