1 //////////////////////////////////////////////////////////////////////////
2 //
3 // pgAdmin III - PostgreSQL Tools
4 //
5 // Copyright (C) 2002 - 2016, The pgAdmin Development Team
6 // This software is released under the PostgreSQL Licence
7 //
8 // pgaStep.h - PostgreSQL Agent Job Step
9 //
10 //////////////////////////////////////////////////////////////////////////
11 
12 #ifndef PGASTEP_H
13 #define PGASTEP_H
14 
15 #include "agent/pgaJob.h"
16 
17 
18 
19 class pgaStepFactory : public pgaJobObjFactory
20 {
21 public:
22 	pgaStepFactory();
23 	virtual dlgProperty *CreateDialog(frmMain *frame, pgObject *node, pgObject *parent);
24 	virtual pgObject *CreateObjects(pgCollection *obj, ctlTree *browser, const wxString &restr = wxEmptyString);
25 	virtual pgCollection *CreateCollection(pgObject *obj);
26 };
27 extern pgaStepFactory stepFactory;
28 
29 
30 class pgaStep : public pgaJobObject
31 {
32 public:
33 	pgaStep(pgCollection *collection, const wxString &newName = wxT(""));
34 
35 	wxString GetTranslatedMessage(int kindOfMessage) const;
36 	void ShowTreeDetail(ctlTree *browser, frmMain *form = 0, ctlListView *properties = 0, ctlSQLBox *sqlPane = 0);
37 	void ShowStatistics(frmMain *form, ctlListView *statistics);
38 	pgObject *Refresh(ctlTree *browser, const wxTreeItemId item);
39 	bool DropObject(wxFrame *frame, ctlTree *browser, bool cascaded);
40 
GetEnabled()41 	bool GetEnabled() const
42 	{
43 		return enabled;
44 	}
iSetEnabled(const bool b)45 	void iSetEnabled(const bool b)
46 	{
47 		enabled = b;
48 	}
GetKindChar()49 	wxChar GetKindChar() const
50 	{
51 		return kindChar;
52 	}
iSetKindChar(const wxChar c)53 	void iSetKindChar(const wxChar c)
54 	{
55 		kindChar = c;
56 	}
GetKind()57 	wxString GetKind() const
58 	{
59 		return kind;
60 	}
iSetKind(const wxString & s)61 	void iSetKind(const wxString &s)
62 	{
63 		kind = s;
64 	}
GetCode()65 	wxString GetCode() const
66 	{
67 		return code;
68 	}
iSetCode(const wxString & s)69 	void iSetCode(const wxString &s)
70 	{
71 		code = s;
72 	}
GetDbname()73 	wxString GetDbname() const
74 	{
75 		return dbname;
76 	}
iSetDbname(const wxString & s)77 	void iSetDbname(const wxString &s)
78 	{
79 		dbname = s;
80 	}
GetConnStr()81 	wxString GetConnStr() const
82 	{
83 		return connstr;
84 	}
iSetConnStr(const wxString & s)85 	void iSetConnStr(const wxString &s)
86 	{
87 		connstr = s;
88 	}
GetOnError()89 	wxString GetOnError() const
90 	{
91 		return onError;
92 	}
iSetOnError(const wxString & s)93 	void iSetOnError(const wxString &s)
94 	{
95 		onError = s;
96 	}
GetOnErrorChar()97 	wxChar GetOnErrorChar() const
98 	{
99 		return onErrorChar;
100 	}
iSetOnErrorChar(const wxChar c)101 	void iSetOnErrorChar(const wxChar c)
102 	{
103 		onErrorChar = c;
104 	}
GetRecId()105 	long GetRecId() const
106 	{
107 		return recId;
108 	}
iSetRecId(const long l)109 	void iSetRecId(const long l)
110 	{
111 		recId = l;
112 	}
113 
HasConnectionString()114 	bool HasConnectionString() const
115 	{
116 		return !connstr.IsEmpty();
117 	}
118 
119 	bool IsUpToDate();
120 
GetHelpPage(bool forCreate)121 	wxString GetHelpPage(bool forCreate) const
122 	{
123 		return wxT("pgagent-steps");
124 	}
125 
126 private:
127 	bool enabled;
128 	wxString kind, code, dbname, connstr, onError;
129 	wxChar kindChar, onErrorChar;
130 	long recId;
131 };
132 
133 class pgaStepCollection : public pgaJobObjCollection
134 {
135 public:
136 	pgaStepCollection(pgaFactory *factory, pgaJob *job);
137 	wxString GetTranslatedMessage(int kindOfMessage) const;
138 };
139 
140 #endif
141