~fkhan-zivios/zivios/devel

« back to all changes in this revision

Viewing changes to application/modules/openafs/models/EMSAfsVolume.php

  • Committer: Faraz Khan
  • Date: 2008-09-15 13:29:33 UTC
  • Revision ID: fkhan@zivios.org-20080915132933-d27jml5l29xw4gsr
Initial release to bazaar, code in sync with 0.5.0-release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Copyright (c) 2008 Zivios, LLC.
 
4
 *
 
5
 * This file is part of Zivios.
 
6
 *
 
7
 * Zivios is free software: you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation, either version 3 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * Zivios is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with Zivios.  If not, see <http://www.gnu.org/licenses/>.
 
19
 *
 
20
 * @package             mod_openafs
 
21
 * @copyright   Copyright (c) 2008 Zivios, LLC. (http://www.zivios.org)
 
22
 * @license             http://www.zivios.org/legal/license
 
23
 * @version             $Id: EMSAfsVolume.php 919 2008-08-25 11:45:23Z fkhan $
 
24
 * @lastchangeddate $LastChangedDate: 2008-08-25 17:45:23 +0600 (Mon, 25 Aug 2008) $
 
25
 **/
 
26
 
 
27
class EMSAfsVolume extends EMSSecurityObject
 
28
{
 
29
        public function __construct(Ecl_LdapObject $lobj)
 
30
        {
 
31
                parent::__construct($lobj);
 
32
 
 
33
                /**
 
34
                 * Volume Parameters for an AFS Volume
 
35
                 * Note: validators are added for any parameters where user
 
36
                 * intervention comes in or we feel is required.
 
37
                 */
 
38
                $this->addParameter('cn','Volume ID',1);
 
39
                $this->addParameter('emsafsvolid','Volume ID', 1);
 
40
 
 
41
                $param = $this->addParameter('emsafsvolname','Volume Name', 1);
 
42
                /**
 
43
                 * Need to confirm the max possible length of a volume name from
 
44
                 * the AFS team.
 
45
                 */
 
46
                $param->addValidator(new Zend_Validate_StringLength(1,32),
 
47
                        Ecl_Validate::errorCode2Array('stringlength',$param->dispname));
 
48
 
 
49
                $this->addParameter('emsafsvollocation','Volume Location', 1);
 
50
                $this->addParameter('emsafsvolpartition','Volume Partition', 1);
 
51
                $this->addParameter('emsafsvolstatus','Volume Status', 1);
 
52
                $this->addParameter('emsafsvolbackupid','Backup Volume ID', 1);
 
53
                $this->addParameter('emsafsvolparentid','Parent Volume ID', 1);
 
54
                $this->addParameter('emsafsvolcloneid','Clone Volume ID', 1);
 
55
                $this->addParameter('emsafsvolinuse','Volume in Use', 1);
 
56
                $this->addParameter('emsafsvolneedssalvage','Volume Needs Salvage', 1);
 
57
                $this->addParameter('emsafsvoldestroyme','Volume Destroy', 1);
 
58
                $this->addParameter('emsafsvoltype','Volume Type', 1);
 
59
                $this->addParameter('emsafsvolcreationdate','Volume Creation Date', 1);
 
60
                $this->addParameter('emsafsvolaccessdate','Volume Access Date', 1);
 
61
                $this->addParameter('emsafsvolcopydate','Volume Copy Date', 1);
 
62
                $this->addParameter('emsafsvolbackupdate','Volume Backup Date', 1);
 
63
                $this->addParameter('emsafsvolupdatedate','Volume Update Date', 1);
 
64
                $this->addParameter('emsafsvoldiskused','Volume Disk Used', 1);
 
65
 
 
66
                /**
 
67
                 * Validator added for max afs volume quota.
 
68
                 */
 
69
                $param = $this->addParameter('emsafsvolmaxquota','Volume Max Quota', 1);
 
70
                $param->addValidator(new Zend_Validate_Digits(),
 
71
                        Ecl_Validate::errorCode2Array('digits',$param->dispname));
 
72
 
 
73
                $this->addParameter('emsafsvolmountpoint','Volume Mount Point', 1);
 
74
                $this->addParameter('emsafsvolfilecount','Volume File Count', 1);
 
75
                $this->addParameter('emsafsvoldayuse','Volume Day Use', 1);
 
76
                $this->addParameter('emsafsvolweekuse','Volume Week Use', 1);
 
77
                $this->addParameter('emsafsvolflags','Volume Flags', 1);
 
78
                $this->addParameter('emstype','EMS Object Type', 1);
 
79
 
 
80
        }
 
81
 
 
82
        public function add(EMSObject $parent,Ecl_Transaction_Handler $handler=null)
 
83
        {
 
84
                if ($handler == null) {
 
85
                        $handler = $this->getTransaction();
 
86
                }
 
87
                if (get_class($this) == 'EMSAfsVolume') {
 
88
 
 
89
                        $this->addParameter('o','Volume Entry',1);
 
90
                        $this->setProperty('o', $this->getProperty('cn'));
 
91
 
 
92
                        $this->addObjectClass('emsafsvolume');
 
93
                        $this->addObjectClass('organization');
 
94
                        $this->addObjectClass('emsIgnore');
 
95
                }
 
96
                return parent::add($parent,$handler);
 
97
        }
 
98
}