source: branches/work_320/ARInside.h @ 679

Revision 595, 6.5 KB checked in by jls17, 5 years ago (diff)
Line 
1//Copyright (C) 2009 Stefan Nerlich | stefan.nerlich@hotmail.com
2//
3//This file is part of ARInside.
4//
5//    ARInside is free software: you can redistribute it and/or modify
6//    it under the terms of the GNU General Public License as published by
7//    the Free Software Foundation, version 2 of the License.
8//
9//    ARInside is distributed in the hope that it will be useful,
10//    but WITHOUT ANY WARRANTY; without even the implied warranty of
11//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12//    GNU General Public License for more details.
13//
14//    You should have received a copy of the GNU General Public License
15//    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
16
17#pragma once
18
19#include "ARApi.h"
20#include "core/ARActiveLink.h"
21#include "core/ARFilter.h"
22#include "core/AREscalation.h"
23#include "core/ARCharMenu.h"
24#include "core/ARContainer.h"
25#include "core/ARSchema.h"
26#include "core/ARField.h"
27#include "core/ARVui.h"
28#include "core/AREnum.h"
29#include "core/ARServerInfo.h"
30#include "core/ARGlobalField.h"
31#include "core/ARUser.h"
32#include "core/ARGroup.h"
33#include "core/ARRole.h"
34#include "core/ARImage.h"
35#include "output/WebPage.h"
36#include "output/IFileStructure.h"
37#include "util/BlackListItem.h"
38#include "FileSystemUtil.h"
39#include "AppConfig.h"
40#include "util/RefItem.h"
41#include "util/AppTimer.h"
42#include "lists/ARSchemaList.h"
43#include "lists/ARActiveLinkList.h"
44#include "lists/ARFilterList.h"
45#include "lists/AREscalationList.h"
46#include "lists/ARContainerList.h"
47#include "lists/ARMenuList.h"
48#include "lists/ARImageList.h"
49#include "lists/BlackList.h"
50#include "lists/ARUserList.h"
51#include "lists/ARGroupList.h"
52#include "lists/ARRoleList.h"
53#include "lists/ARServerInfoList.h"
54
55extern const string AppVersion;
56
57// forward declarations
58class Context;
59class LookupFormContext;
60
61class CARInside
62{
63public:
64        CARInside(AppConfig &appConfig);
65public:
66        ~CARInside(void);
67
68        ARControlStruct         arControl;
69        AppConfig                       appConfig;
70
71        int                                     arXmlVersion;
72        string                          arServerVersion;
73        int                                     vMajor;
74        int                                     vMinor;
75        int                                     vRevision;
76
77        inline static CARInside* GetInstance() { return CARInside::pInsideInstance; }
78       
79        int Init(string user, string pw, string server, int port, int rpc);
80        void DoWork(int nMode);
81        int Terminate(void);
82
83        bool FileExists(string fName);
84        void LoadServerObjects(int nMode);
85        void LoadFromServer(void);
86        void LoadFromFile(void);
87        void SetupOverlaySupport();
88
89        bool InBlacklist(int refType, const string &objName) {  return blackList.Contains(refType, objName.c_str()); }
90        void Prepare(void);             
91        void ExtractResources(void);
92        void Documentation(void);
93
94
95        string srvHostName;
96        string srvFullHostName;
97        int overlayMode;
98        CARSchemaList schemaList;
99        CARFilterList filterList;
100        CAREscalationList escalationList;
101        CARActiveLinkList alList;
102        CARContainerList containerList;
103        CARMenuList menuList;
104        CARUserList userList;
105        CARGroupList groupList;
106        CARRoleList roleList;
107        CARServerInfoList serverInfoList;
108
109        list<CARGlobalField> globalFieldList;
110        CBlackList blackList;
111        map<string, vector<CRefItem> > missingMenuReferences;
112#if AR_CURRENT_API_VERSION >= AR_API_VERSION_750
113        CARImageList    imageList;
114#endif
115
116        string LinkToServerInfo(const std::string &srvName, int rootLevel);
117        string LinkToServerInfo(Context &context, const std::string &srvName);
118
119        int SchemaGetInsideId(string searchObjName);
120
121        string LinkToVui(int schemaInsideId, int vuiInsideId, int fromRootLevel);
122        string LinkToField(const string& schemaName, int fieldInsideId, int fromRootLevel);     
123        string LinkToField(int schemaInsideId, int fieldInsideId, const string& linkText, int fromRootLevel);
124        string LinkToField(int schemaInsideId, int fieldInsideId, int fromRootLevel);
125        string LinkToField(Context &context, int fieldInsideId);
126        string LinkToField(LookupFormContext &context, int fuieldInsideId);
127        string LinkToMenuField(int schemaInsideId, int fieldInsideId, int fromRootLevel);
128
129        string LinkToContainer(string containerName, int rootLevel);
130        string LinkToContainer(const CRefItem& refItem, int rootLevel);
131        string LinkToAl(const string& alName, int rootLevel);
132        string LinkToAl(int alInsideId, int rootLevel);
133        string LinkToFilter(string filterName, int rootLevel); 
134#if AR_CURRENT_API_VERSION >= AR_API_VERSION_750
135        string LinkToImage(unsigned int imageIndex, int rootLevel);
136        string LinkToImage(const string &imageName, int rootLevel);
137#endif
138        string LinkToSchema(const string& schemaName, int fromRootLevel);
139        string LinkToSchema(int insideId, int fromRootLevel);
140        string LinkToSchema(int schemaInsideId, const string &nameToUseIfSchemaNotExists, int rootLevel);
141        string LinkToSchemaIndex(string indexName, int schemaInsideId, int fromRootLevel);     
142        string LinkToEscalation(const string& escalationName, int fromRootLevel);
143        string LinkToEscalation(const CRefItem& refItem, int fromRootLevel);
144        string LinkToUser(string loginName, int rootLevel);     
145        string LinkToSchemaTypeList(int schemaType, int rootLevel);     
146        string LinkToGroup(const string& appRefName, int permissionId, int rootLevel);
147        string GetFieldEnumValue(int schemaInsideId, int fieldInsideId, int enumPosition);
148
149        void AddFieldReference(int schemaId, int fieldId, const CRefItem& ref);
150        void AddMenuReference(const string& menuName, const CRefItem& ref);
151
152        string TextFindFields(const string &inText, const string &fieldSeparator, int schemaInsideId, int rootLevel, bool findKeywords, const CRefItem *refItem);
153        string TextFindFields(Context &context, const string &inText, bool findKeywords, const CRefItem *refItem);
154        string XMLFindFields(string inText, int schemaInsideId, int rootLevel, const CRefItem *refItem);
155
156        bool FieldreferenceExists(int schemaInsideId, int fieldInsideId, const CRefItem &refItem);
157
158        string ServerObjectHistory(CARServerObject *obj, int rootLevel, bool noTableDescription = false);
159        string DataObjectHistory(CARDataObject *obj, int rootLevel);
160        bool ValidateGroup(const string& appRefName, int permissionId);
161        int CompareServerVersion(int major, int minor = -1, int revision = -1);
162
163        float nDurationLoad;
164        float nDurationDocumentation;
165private:
166        static CARInside*       pInsideInstance;
167private:       
168        int LoadActiveLinks(void);
169        int LoadFilters(void);
170        int LoadEscalations(void);
171        int LoadCharMenus(void);
172        int LoadContainer(void);
173        int LoadForms(void);
174#if AR_CURRENT_API_VERSION >= AR_API_VERSION_750
175        int LoadImages(void);
176#endif
177
178        void ParseVersionString(string version);
179        void ParseVersionString(int xmlVersion);
180
181        bool WriteHTAccess();
182};
Note: See TracBrowser for help on using the repository browser.