Overview

Namespaces

  • Mapbender
    • Component
      • HTTP
    • CoreBundle
      • Command
      • Component
        • Exception
      • Controller
      • DataFixtures
        • ORM
      • DependencyInjection
      • Element
        • Type
      • Entity
      • EventListener
      • Extension
      • Form
        • DataTransformer
        • EventListener
        • Type
      • Security
      • Template
    • KmlBundle
      • Element
    • ManagerBundle
      • Controller
      • Form
        • DataTransformer
        • Type
    • MonitoringBundle
      • Command
      • Component
      • Controller
      • DependencyInjection
      • Entity
      • EventListener
      • Form
    • PrintBundle
      • Component
      • Controller
    • WmcBundle
      • Component
        • Exception
      • Element
        • Type
      • Entity
      • Form
        • Type
    • WmsBundle
      • Component
        • Exception
      • Controller
      • DependencyInjection
      • Element
        • Type
      • Entity
      • Event
      • Form
        • EventListener
        • Type
    • WmtsBundle
      • Component
        • Exception
      • Controller
      • Entity
      • Form
        • Type
  • None
  • PHP

Classes

  • MonitoringDefinition
  • MonitoringJob
  • SchedulerProfile
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
  1: <?php
  2: namespace Mapbender\MonitoringBundle\Entity;
  3: use Doctrine\ORM\Mapping as ORM;
  4: use Doctrine\Common\Collections\ArrayCollection;
  5: /**
  6:  * Definition of Scheduler
  7:  * 
  8:  * @author Paul Schmidt
  9:  * @ORM\Entity
 10:  */
 11: class SchedulerProfile {
 12:     public static $HOUR_MS = 3600;
 13: //    public static $STATUS_STARTED = "started";
 14:     private static $STATUS_ENDED = "ended";
 15:     private static $STATUS_RUNNING = "running";
 16:     private static $STATUS_ERROR = "error";
 17: //    public static $STATUS_UNDEFINED = "undefined";
 18:     private static $STATUS_NO_JOB = "nojob";
 19:     private static $STATUS_WAITSTART = "waitstart";
 20:     private static $STATUS_WAITJOBSTART = "waitjobstart";
 21:     private static $STATUS_CANNOTSTART = "cannotstart";
 22:     public static $STATUS_ABORTED = "aborted";
 23:     
 24:     public static $TIMEINTERVAL_1_4HOURLY = "quarter of a hour";
 25:     public static $TIMEINTERVAL_1_2HOURLY = "half-hourly";
 26:     public static $TIMEINTERVAL_HOURLY = "hourly";
 27:     public static $TIMEINTERVAL_DAILY = "daily";
 28:     public static $TIMEINTERVAL_WEEKLY = "weekly";
 29:     
 30:     public static $TIMEINTERVAL_0MIN = "no";
 31:     public static $TIMEINTERVAL_1_4MIN = "1/4 min";
 32:     public static $TIMEINTERVAL_1_2MIN = "1/2 min";
 33:     public static $TIMEINTERVAL_3_4MIN = "3/4 min";
 34:     public static $TIMEINTERVAL_1MIN = "1 min";
 35:     public static $TIMEINTERVAL_2MIN = "2 min";
 36:     public static $TIMEINTERVAL_3MIN = "3 min";
 37:     public static $TIMEINTERVAL_4MIN = "4 min";
 38:     public static $TIMEINTERVAL_5MIN = "5 min";
 39:     public static $TIMEINTERVAL_10MIN = "10 min";
 40:     /**
 41:      *
 42:      * @ORM\Id
 43:      * @ORM\Column(type="integer")
 44:      * @ORM\GeneratedValue(strategy="AUTO")
 45:      */
 46:     protected $id;
 47:     /**
 48:      *
 49:      * @ORM\Column(type="string", nullable=false)
 50:      */
 51:     protected $title;
 52:     /**
 53:      *
 54:      * @ORM\Column(type="time", nullable=false)
 55:      */
 56:     protected $starttime;
 57:     
 58:     protected $starttimeStr;
 59:     /**
 60:      *
 61:      * @ORM\Column(type="integer", nullable=false)
 62:      */
 63:     protected $starttimeinterval;
 64:     /**
 65:      *
 66:      * @ORM\Column(type="integer", nullable=false)
 67:      */
 68:     protected $jobcontinuity;
 69:     /**
 70:      *
 71:      * @ORM\Column(type="integer", nullable=false)
 72:      */
 73:     protected $jobinterval = 0;
 74:     /**
 75:      *
 76:      * @ORM\Column(type="datetime", nullable=true)
 77:      */
 78:     protected $laststarttime;
 79:     
 80:     /**
 81:      *
 82:      * @ORM\Column(type="datetime", nullable=true)
 83:      */
 84:     protected $nextstarttime;
 85:     /**
 86:      *
 87:      * @ORM\Column(type="datetime", nullable=true)
 88:      */
 89:     protected $lastendtime;
 90:     /**
 91:      *
 92:      * @ORM\Column(type="boolean", nullable=false)
 93:      */
 94:     protected $current = false;
 95:     /**
 96:      *
 97:      * @ORM\Column(type="string", nullable=true)
 98:      */
 99:     protected $status;
100:     
101:     public function __construct() {
102: //        $this->status = SchedulerProfile::$STATUS_UNDEFINED;
103:     }
104:     
105:     public function getId() {
106:         return $this->id;
107:     }
108:     
109:     public function setId($id) {
110:         $this->id = $id;
111:     }
112:     
113:     public function getTitle() {
114:         return $this->title;
115:     }
116:     
117:     public function setTitle($title) {
118:         $this->title = $title;
119:     }
120:     
121:     public function getStarttime() {
122:         return $this->starttime;
123:     }
124:     
125:     public function setStarttime($starttime) {
126: //        if($starttime == null){
127: //            $this->starttimeStr = $starttime;
128: //        } else if(gettype ($starttime) == "string"){
129: //            $this->starttimeStr = $starttime;
130: //            $timestamp = strtotime($starttime);
131: //            $starttime = date("H:i",$timestamp);
132: //            $starttime = new \DateTime($starttime);
133: //        } else {
134: //            $this->starttimeStr = date("H:i",date_timestamp_get($starttime));
135: //        }
136:         $this->starttime = $starttime;
137:     }
138:     
139:     public function getStarttimeStr() {
140:         $starttime = $this->getStarttime();
141:         if($starttime !=null){
142:             $this->starttimeStr = date("H:i",date_timestamp_get($this->getStarttime()));
143:         } else {
144:             $this->starttimeStr = null;
145:         }
146:         return $this->starttimeStr;
147:     }
148:     
149: //    public function setStarttimeStr($starttime) {
150: //        $this->starttimeStr = $starttime;
151: //        $this->setStarttime($this->starttimeStr);
152: //    }
153:     
154:     public function getStarttimeinterval() {
155:         return $this->starttimeinterval;
156:     }
157:     
158:     public function setStarttimeinterval($starttimeinterval) {
159:         $this->starttimeinterval = $starttimeinterval;
160:     }
161:     
162:     public function getStarttimeintervalOpts() {
163:         return array(
164:             0                                    => SchedulerProfile::$TIMEINTERVAL_0MIN,
165: //            // TEST START to delete
166:             (SchedulerProfile::$HOUR_MS / 60) => SchedulerProfile::$TIMEINTERVAL_1MIN,
167:             (SchedulerProfile::$HOUR_MS / 30) => SchedulerProfile::$TIMEINTERVAL_2MIN,
168:             (SchedulerProfile::$HOUR_MS / 20) => SchedulerProfile::$TIMEINTERVAL_3MIN,
169:             (SchedulerProfile::$HOUR_MS / 15) => SchedulerProfile::$TIMEINTERVAL_4MIN,
170:             (SchedulerProfile::$HOUR_MS / 12) => SchedulerProfile::$TIMEINTERVAL_5MIN,
171:             (SchedulerProfile::$HOUR_MS / 6) => SchedulerProfile::$TIMEINTERVAL_10MIN,
172:             (SchedulerProfile::$HOUR_MS / 4) => SchedulerProfile::$TIMEINTERVAL_1_4HOURLY,
173:             (SchedulerProfile::$HOUR_MS / 2) => SchedulerProfile::$TIMEINTERVAL_1_2HOURLY,
174: //            // TEST END 
175:             SchedulerProfile::$HOUR_MS => SchedulerProfile::$TIMEINTERVAL_HOURLY,
176:             (SchedulerProfile::$HOUR_MS * 24) => SchedulerProfile::$TIMEINTERVAL_DAILY,
177:             (SchedulerProfile::$HOUR_MS * 24 * 7) => SchedulerProfile::$TIMEINTERVAL_WEEKLY);
178:     }
179:     
180:     public function getJobcontinuity() {
181:         return $this->jobcontinuity;
182:     }
183:     
184: //    public function getJobcontinuityOpts() {
185: //        return array(
186: //            (SchedulerProfile::$HOUR_MS / 60) => SchedulerProfile::$TIMEINTERVAL_1MIN,
187: //            (SchedulerProfile::$HOUR_MS / 30) => SchedulerProfile::$TIMEINTERVAL_2MIN,
188: //            (SchedulerProfile::$HOUR_MS / 20) => SchedulerProfile::$TIMEINTERVAL_3MIN,
189: //            (SchedulerProfile::$HOUR_MS / 15) => SchedulerProfile::$TIMEINTERVAL_4MIN,
190: //            (SchedulerProfile::$HOUR_MS / 12) => SchedulerProfile::$TIMEINTERVAL_5MIN);
191: //    }
192:     
193:     public function setJobcontinuity($jobcontinuity) {
194:         $this->jobcontinuity = $jobcontinuity;
195:     }
196:     
197:     public function getJobinterval() {
198:         return $this->jobinterval;
199:     }
200:     
201:     public function getJobintervalOpts() {
202:         return array(
203:             0                                    => SchedulerProfile::$TIMEINTERVAL_0MIN,
204:             (SchedulerProfile::$HOUR_MS / 240)  => SchedulerProfile::$TIMEINTERVAL_1_4MIN,
205:             (SchedulerProfile::$HOUR_MS / 120)  => SchedulerProfile::$TIMEINTERVAL_1_2MIN,
206:             (SchedulerProfile::$HOUR_MS / 80)   => SchedulerProfile::$TIMEINTERVAL_3_4MIN,
207:             (SchedulerProfile::$HOUR_MS / 60)   => SchedulerProfile::$TIMEINTERVAL_1MIN,
208:             (SchedulerProfile::$HOUR_MS / 30)   => SchedulerProfile::$TIMEINTERVAL_2MIN,
209:             (SchedulerProfile::$HOUR_MS / 12)   => SchedulerProfile::$TIMEINTERVAL_5MIN,
210:             (SchedulerProfile::$HOUR_MS / 6)    => SchedulerProfile::$TIMEINTERVAL_10MIN);
211:     }
212:     
213:     public function setJobinterval($jobinterval) {
214:         $this->jobinterval = $jobinterval;
215:     }
216:     
217:     public function getLaststarttime() {
218:         return $this->laststarttime;
219:     }
220:     
221:     public function setLaststarttime($laststarttime) {
222:         $this->laststarttime = $laststarttime;
223:     }
224:     
225:     public function getNextstarttime() {
226:         return $this->nextstarttime;
227:     }
228:     
229:     public function setNextstarttime($nextstarttime) {
230:         $this->nextstarttime = $nextstarttime;
231:     }
232:     
233:     public function getLastendtime() {
234:         return $this->lastendtime;
235:     }
236:     
237:     public function setLastendtime($lastendtime) {
238:         $this->lastendtime = $lastendtime;
239:     }
240:     
241:     public function getCurrent() {
242:         return $this->current;
243:     }
244:     
245:     public function setCurrent($current) {
246:         $this->current = $current;
247:     }
248:     
249:     public function getStatus() {
250:         return $this->status;
251:     }
252:     
253:     public function setStatus($status) {
254:         $this->status = $status;
255:     }
256:     
257:     public function getTimeinterval($timeinterval) {
258:         switch ($timeinterval) {
259:         case SchedulerProfile::$HOUR_MS: return SchedulerProfile::$TIMEINTERVAL_HOURLY; break;
260:         case SchedulerProfile::$HOUR_MS * 24: return SchedulerProfile::$TIMEINTERVAL_DAILY; break;
261:         case SchedulerProfile::$HOUR_MS * 24 * 7: return SchedulerProfile::$TIMEINTERVAL_WEEKLY; break;
262:         case 0: return SchedulerProfile::$TIMEINTERVAL_0MIN; break;
263:         case SchedulerProfile::$HOUR_MS / 240: return SchedulerProfile::$TIMEINTERVAL_1_4MIN; break;
264:         case SchedulerProfile::$HOUR_MS / 120: return SchedulerProfile::$TIMEINTERVAL_1_2MIN; break;
265:         case SchedulerProfile::$HOUR_MS / 80: return SchedulerProfile::$TIMEINTERVAL_3_4MIN; break;
266:         case SchedulerProfile::$HOUR_MS / 60: return SchedulerProfile::$TIMEINTERVAL_1MIN; break;
267:         case SchedulerProfile::$HOUR_MS / 30: return SchedulerProfile::$TIMEINTERVAL_2MIN; break;
268:         case SchedulerProfile::$HOUR_MS / 20: return SchedulerProfile::$TIMEINTERVAL_3MIN; break;
269:         case SchedulerProfile::$HOUR_MS / 15: return SchedulerProfile::$TIMEINTERVAL_4MIN; break;
270:         case SchedulerProfile::$HOUR_MS / 12: return SchedulerProfile::$TIMEINTERVAL_5MIN; break;
271:         case SchedulerProfile::$HOUR_MS / 6: return SchedulerProfile::$TIMEINTERVAL_10MIN; break;
272: 
273:         default:
274:         return null;
275:         }
276:     }
277:     
278:     public function canStart() {
279:         return $this->status == SchedulerProfile::$STATUS_ENDED
280:                 || $this->status == null
281:                 || $this->status == SchedulerProfile::$STATUS_ERROR;
282:     }
283:     
284:     
285:     public function isStatusCannotstart() {
286:         return $this->status == SchedulerProfile::$STATUS_CANNOTSTART;
287:     }
288:     public function isStatusEnded() {
289:         return $this->status == SchedulerProfile::$STATUS_ENDED;
290:     }
291:     public function isStatusError() {
292:         return $this->status == SchedulerProfile::$STATUS_ERROR;
293:     }
294:     public function isStatusNojob() {
295:         return $this->status == SchedulerProfile::$STATUS_NO_JOB;
296:     }
297:     public function isStatusRunning() {
298:         return $this->status == SchedulerProfile::$STATUS_RUNNING;
299:     }
300:     public function isStatusWaitjobstart() {
301:         return $this->status == SchedulerProfile::$STATUS_WAITJOBSTART;
302:     }
303:     public function isStatusWaitstart() {
304:         return $this->status == SchedulerProfile::$STATUS_WAITSTART;
305:     }
306:     
307:     public function setStatusCannotstart() {
308:         $this->status == SchedulerProfile::$STATUS_CANNOTSTART;
309:     }
310:     public function setStatusEnded() {
311:         $this->status = SchedulerProfile::$STATUS_ENDED;
312:     }
313:     public function setStatusError() {
314:         $this->status = SchedulerProfile::$STATUS_ERROR;
315:     }
316:     public function setStatusNojob() {
317:         $this->status = SchedulerProfile::$STATUS_NO_JOB;
318:     }
319:     public function setStatusRunning() {
320:         $this->status = SchedulerProfile::$STATUS_RUNNING;
321:     }
322:     public function setStatusWaitjobstart() {
323:         $this->status = SchedulerProfile::$STATUS_WAITJOBSTART;
324:     }
325:     public function setStatusWaitstart() {
326:         $this->status = SchedulerProfile::$STATUS_WAITSTART;
327:     }
328: }
329: ?>
330: 
Mapbender3 API documenation API documentation generated by ApiGen 2.8.0