1 | "use strict";
|
2 | var __extends = (this && this.__extends) || function (d, b) {
|
3 | for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
4 | function __() { this.constructor = d; }
|
5 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
6 | };
|
7 | var job_1 = require("./job");
|
8 | var file_1 = require("./file");
|
9 | var FileJob = (function (_super) {
|
10 | __extends(FileJob, _super);
|
11 | |
12 |
|
13 |
|
14 |
|
15 |
|
16 | function FileJob(e, path) {
|
17 | _super.call(this, e, path);
|
18 | this.file = new file_1.File(e, path);
|
19 | }
|
20 | |
21 |
|
22 |
|
23 |
|
24 | FileJob.prototype.getFile = function () {
|
25 | return this.file;
|
26 | };
|
27 | |
28 |
|
29 |
|
30 |
|
31 | FileJob.prototype.getName = function () {
|
32 | return this.file.getName();
|
33 | };
|
34 | |
35 |
|
36 |
|
37 |
|
38 | FileJob.prototype.getNameProper = function () {
|
39 | return this.file.getNameProper();
|
40 | };
|
41 | |
42 |
|
43 |
|
44 |
|
45 | FileJob.prototype.getDirname = function () {
|
46 | return this.file.getDirname();
|
47 | };
|
48 | |
49 |
|
50 |
|
51 |
|
52 | FileJob.prototype.getPath = function () {
|
53 | return this.file.getPath();
|
54 | };
|
55 | |
56 |
|
57 |
|
58 |
|
59 | FileJob.prototype.setPath = function (path) {
|
60 | this.file.setPath(path);
|
61 | };
|
62 | |
63 |
|
64 |
|
65 |
|
66 | FileJob.prototype.setName = function (filename) {
|
67 | this.createLifeEvent("set name", this.getName(), filename);
|
68 | this.file.setName(filename);
|
69 | };
|
70 | |
71 |
|
72 |
|
73 |
|
74 | FileJob.prototype.getContentType = function () {
|
75 | return this.file.getContentType();
|
76 | };
|
77 | |
78 |
|
79 |
|
80 |
|
81 | FileJob.prototype.getExtension = function () {
|
82 | return this.file.getExtension();
|
83 | };
|
84 | |
85 |
|
86 |
|
87 |
|
88 | FileJob.prototype.getBasename = function () {
|
89 | return this.file.getBasename();
|
90 | };
|
91 | |
92 |
|
93 |
|
94 |
|
95 | FileJob.prototype.isFolder = function () {
|
96 | return false;
|
97 | };
|
98 | |
99 |
|
100 |
|
101 |
|
102 | FileJob.prototype.isFile = function () {
|
103 | return true;
|
104 | };
|
105 | |
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 | FileJob.prototype.move = function (destinationNest, callback) {
|
121 | var fj = this;
|
122 | try {
|
123 | destinationNest.take(fj, function (newJob) {
|
124 |
|
125 | fj.e.log(1, "Job \"" + fj.getBasename() + "\" was moved to Nest \"" + destinationNest.name + "\".", fj);
|
126 | if (callback) {
|
127 | callback(newJob);
|
128 | }
|
129 | });
|
130 | }
|
131 | catch (e) {
|
132 | fj.e.log(3, "Job \"" + fj.getBasename() + "\" was not moved to Nest \"" + destinationNest.name + "\". " + e, fj);
|
133 | if (callback) {
|
134 | callback();
|
135 | }
|
136 | }
|
137 | };
|
138 | |
139 |
|
140 |
|
141 |
|
142 | FileJob.prototype.rename = function (newName) {
|
143 | var file = this.getFile();
|
144 | file.setName(newName);
|
145 | file.renameLocal();
|
146 | };
|
147 | return FileJob;
|
148 | }(job_1.Job));
|
149 | exports.FileJob = FileJob;
|