diff --git a/client/bugLogService.cfc b/client/bugLogService.cfc index 3d699b8..db4baca 100644 --- a/client/bugLogService.cfc +++ b/client/bugLogService.cfc @@ -12,7 +12,9 @@ - + + + @@ -33,6 +35,7 @@ + var wsParams = structNew(); @@ -60,12 +63,13 @@ variables.protocol = "CFC"; // store settings - variables.bugLogListener = arguments.bugLogListener; - variables.bugEmailSender = arguments.bugEmailSender; - variables.bugEmailRecipients = arguments.bugEmailRecipients; - variables.apikey = arguments.apikey; - variables.maxDumpDepth = arguments.maxDumpDepth; - variables.writeToCFLog = arguments.writeToCFLog; + variables.bugLogListener = arguments.bugLogListener; + variables.bugEmailSender = arguments.bugEmailSender; + variables.bugEmailRecipients = arguments.bugEmailRecipients; + variables.apikey = arguments.apikey; + variables.maxDumpDepth = arguments.maxDumpDepth; + variables.writeToCFLog = arguments.writeToCFLog; + variables.sensitiveFieldNames = arguments.sensitiveFieldNames; if(arguments.appName neq "") variables.appName = arguments.appName; @@ -128,7 +132,8 @@ - + + @@ -148,6 +153,12 @@ + + + + + + @@ -167,6 +178,7 @@ "hostName" = variables.hostName, "exceptionMessage" = arguments.exception.message, "exceptionDetails" = arguments.exception.detail, + "domain" = arguments.domain, "CFID" = tmpCFID, "CFTOKEN" = tmpCFTOKEN, "userAgent" = cgi.HTTP_USER_AGENT, @@ -204,7 +216,8 @@ data.userAgent, data.templatePath, sanitizeForXML(data.HTMLReport), - data.apikey)> + data.apikey, + cgi.server_name)> @@ -513,4 +526,28 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/bugLogListener.cfc b/components/bugLogListener.cfc index 8173a88..a77c9f3 100644 --- a/components/bugLogListener.cfc +++ b/components/bugLogListener.cfc @@ -41,6 +41,7 @@ variables.oHostFinder = createObject("component","bugLog.components.hostFinder").init( variables.oDAOFactory.getDAO("host") ); variables.oSeverityFinder = createObject("component","bugLog.components.severityFinder").init( variables.oDAOFactory.getDAO("severity") ); variables.oSourceFinder = createObject("component","bugLog.components.sourceFinder").init( variables.oDAOFactory.getDAO("source") ); + variables.oDomainFinder = createObject("component","bugLog.components.domainFinder").init( variables.oDAOFactory.getDAO("domain") ); variables.oUserFinder = createObject("component","bugLog.components.userFinder").init( variables.oDAOFactory.getDAO("user") ); // load the rule processor @@ -54,6 +55,7 @@ variables.oHostCache = createObject("component","bugLog.components.lib.cache.cacheService").init(50, cacheTTL, false); variables.oSeverityCache = createObject("component","bugLog.components.lib.cache.cacheService").init(10, cacheTTL, false); variables.oSourceCache = createObject("component","bugLog.components.lib.cache.cacheService").init(5, cacheTTL, false); + variables.oDomainCache = createObject("component","bugLog.components.lib.cache.cacheService").init(50, cacheTTL, false); variables.oUserCache = createObject("component","bugLog.components.lib.cache.cacheService").init(50, cacheTTL, false); // load scheduler @@ -91,12 +93,15 @@ var autoCreateHost = allowAutoCreate("host"); var autoCreateSeverity = allowAutoCreate("severity"); var autoCreateSource = allowAutoCreate("source"); - + var autoCreateDomain = true; //TODO change this to a setting + // extract related objects from bean oApp = getApplicationFromBean( bean, autoCreateApp ); oHost = getHostFromBean( bean, autoCreateHost ); oSeverity = getSeverityFromBean( bean, autoCreateSeverity ); oSource = getSourceFromBean( bean, autoCreateSource ); + oDomain = getDomainFromBean( bean, autoCreateDomain ); + // create entry oEntry = createObject("component","bugLog.components.entry").init( oDF.getDAO("entry") ); @@ -108,6 +113,7 @@ oEntry.setHostID(oHost.getHostID()); oEntry.setExceptionMessage(bean.getexceptionMessage()); oEntry.setExceptionDetails(bean.getexceptionDetails()); + oEntry.setDomainId(oDomain.getDomainID()); oEntry.setCFID(bean.getcfid()); oEntry.setCFTOKEN(bean.getcftoken()); oEntry.setUserAgent(bean.getuserAgent()); @@ -383,6 +389,42 @@ + + + + + var key = ""; + var bean = arguments.entryBean; + var oDomain = 0; + var oDF = variables.oDAOFactory; + + key = bean.getDomain(); + + try { + // first we try to get it from the cache + oDomain = variables.oDomainCache.retrieve( key ); + + } catch(cacheService.itemNotFound e) { + // entry not in cache, so we get it from DB + try { + oDomain = variables.oDomainFinder.findByName( key ); + } catch(domainFinderException.domainNotFound e) { + // code does not exist, so we need to create it (if autocreate enabled) + if(!arguments.createIfNeeded){ + throw(message="Invalid Domain",type="invalidDomain"); + } + oDomain = createObject("component","bugLog.components.domain").init( oDF.getDAO("domain") ); + oDomain.setDomain( key ); + oDomain.save(); + } + + // store entry in cache + variables.oDomainCache.store( key, oDomain ); + } + + + + var oRule = 0; diff --git a/components/db/domainDAO.cfc b/components/db/domainDAO.cfc new file mode 100644 index 0000000..7e8424d --- /dev/null +++ b/components/db/domainDAO.cfc @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/components/db/entryDAO.cfc b/components/db/entryDAO.cfc index 474ef21..24631fa 100644 --- a/components/db/entryDAO.cfc +++ b/components/db/entryDAO.cfc @@ -11,6 +11,7 @@ + @@ -102,5 +103,30 @@ WHERE severityID = + + + + + + + + DELETE + FROM #getTableName()# + WHERE domainId = + + + + + + + + + + + UPDATE #getTableName()# + SET domainId = + WHERE domainId = + + diff --git a/components/domain.cfc b/components/domain.cfc new file mode 100644 index 0000000..858847d --- /dev/null +++ b/components/domain.cfc @@ -0,0 +1,30 @@ + + + + variables.oDAO = 0; + variables.instance.domainId = 0; + variables.instance.domain = ""; + + function setDomainId(data) {variables.instance.domainId = arguments.data;} + function setDomain(data) {variables.instance.domain = arguments.data;} + + function getDomainId() {return variables.instance.domainId;} + function getDomain() {return variables.instance.domain;} + + function getID() {return getDomainId();} + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/domainFinder.cfc b/components/domainFinder.cfc new file mode 100644 index 0000000..03d08f0 --- /dev/null +++ b/components/domainFinder.cfc @@ -0,0 +1,42 @@ + + + + + + var qry = variables.oDAO.get(arguments.id); + var o = 0; + + if(qry.recordCount gt 0) { + o = createObject("component","bugLog.components.domain").init( variables.oDAO ); + o.setDomainID(qry.domainID); + o.setDomain(qry.domain); + return o; + } else { + throw("ID not found","domainFinderException.IDNotFound"); + } + + + + + + + var qry = variables.oDAO.getByLabel(arguments.name); + var o = 0; + + if(qry.recordCount gt 0) { + o = createObject("component","bugLog.components.domain").init( variables.oDAO ); + o.setDomainID(qry.domainID); + o.setDomain(qry.domain); + return o; + } else { + throw("domain not found","domainFinderException.domainNotFound"); + } + + + + + + + + + \ No newline at end of file diff --git a/components/entry.cfc b/components/entry.cfc index 4aff947..7a02ee7 100644 --- a/components/entry.cfc +++ b/components/entry.cfc @@ -17,6 +17,7 @@ variables.instance.templatePath = ""; variables.instance.HTMLReport = ""; variables.instance.createdOn = now(); + variables.instance.domainId = 0; function setEntryID(data) {variables.instance.ID = arguments.data;} function setDateTime(data) {variables.instance.mydateTime = arguments.data;} @@ -33,6 +34,7 @@ function setTemplatePath(data) {variables.instance.templatePath = left(arguments.data,500);} function setHTMLReport(data) {variables.instance.HTMLReport = arguments.data;} function setCreatedOn(data) {variables.instance.createdOn = arguments.data;} + function setDomainId(data) {variables.instance.domainId = arguments.data;} function getEntryID() {return variables.instance.ID;} function getDateTime() {return variables.instance.mydateTime;} @@ -49,6 +51,7 @@ function getTemplate_Path() {return variables.instance.templatePath;} function getHTMLReport() {return variables.instance.HTMLReport;} function getCreatedOn() {return variables.instance.createdOn;} + function getDomainId() {return variables.instance.domainId;} function getID() {return variables.instance.ID;} @@ -89,4 +92,10 @@ + + + + + + \ No newline at end of file diff --git a/components/entryFinder.cfc b/components/entryFinder.cfc index ccf3cf1..89ea4f7 100644 --- a/components/entryFinder.cfc +++ b/components/entryFinder.cfc @@ -23,6 +23,9 @@ o.setTemplatePath(qry.templatePath); o.setHTMLReport(qry.HTMLReport); o.setCreatedOn(qry.createdOn); + if(len(qry.domainId)){ + o.setDomainID(qry.domainID); + } return o; } else { throw("ID not found","entryFinderException.IDNotFound"); @@ -46,6 +49,9 @@ + + + @@ -64,6 +70,7 @@ SELECT e.entryID, e.message, e.cfid, e.cftoken, e.mydateTime, e.exceptionMessage, e.exceptionDetails, e.templatePath, e.userAgent, a.code as ApplicationCode, h.hostName, s.code AS SeverityCode, src.name AS SourceName, e.applicationID, e.hostID, e.severityID, e.sourceID, e.createdOn, + e.domainID, d.domain, datePart(year, e.createdOn) as entry_year, @@ -99,6 +106,7 @@ INNER JOIN bl_Host h ON e.hostID = h.hostID INNER JOIN bl_Severity s ON e.severityID = s.severityID INNER JOIN bl_Source src ON e.sourceID = src.SourceID + LEFT JOIN bl_Domain d ON e.domainID = d.domainID WHERE (1=1) AND ( @@ -139,6 +147,15 @@ AND h.hostName = + + + AND e.domainID NOT IN + () + + + AND d.domain = + + AND e.severityID NOT IN () diff --git a/components/hq/appService.cfc b/components/hq/appService.cfc index 4769971..9b2ac04 100644 --- a/components/hq/appService.cfc +++ b/components/hq/appService.cfc @@ -42,6 +42,7 @@ + @@ -113,6 +114,7 @@ + @@ -139,6 +141,12 @@ args.hostID = 0; args.hostName = trim(arguments.hostID); } + + // if domainId is not numeric, assume it is the domain + if(Not isNumeric(arguments.domainId)) { + args.domainId = 0; + args.domain = trim(arguments.domainId); + } // if severityID is not numeric and is not a list and is not _ALL_, assume it is the severityCode if(Not isNumeric(arguments.severityID) and listlen(arguments.severityID) eq 1 and arguments.severityID neq "_ALL_") { @@ -228,6 +236,16 @@ + + + + SELECT * + FROM qry + ORDER BY [DOMAIN] + + + + @@ -429,6 +447,7 @@ + SELECT @@ -437,6 +456,9 @@ HostName, HostID, + + [Domain], DomainID, + Message, COUNT(entryID) AS bugCount, MAX(createdOn) as createdOn, @@ -450,6 +472,9 @@ HostName, HostID, + + [Domain], DomainID, + Message ORDER BY createdOn DESC @@ -729,6 +754,14 @@ + + + + + + + @@ -762,7 +795,18 @@ - + + + + + + + + + + + + diff --git a/components/rawEntryBean.cfc b/components/rawEntryBean.cfc index ffe2456..423b918 100644 --- a/components/rawEntryBean.cfc +++ b/components/rawEntryBean.cfc @@ -6,6 +6,8 @@ variables.instance.message = ""; variables.instance.applicationCode = ""; variables.instance.sourceID = 0; + variables.instance.domainId = 0; + variables.instance.domain = ""; variables.instance.severityCode = ""; variables.instance.hostName = ""; variables.instance.exceptionMessage = ""; @@ -22,6 +24,8 @@ function setMessage(data) {variables.instance.message = arguments.data; return this;} function setApplicationCode(data) {variables.instance.applicationCode = arguments.data; return this;} function setSourceID(data) {variables.instance.sourceID = arguments.data; return this;} + function setDomainId(data) {variables.instance.domainId = arguments.data; return this;} + function setDomain(data) {variables.instance.domain = arguments.data; return this;} function setSeverityCode(data) {variables.instance.severityCode = arguments.data; return this;} function setHostName(data) {variables.instance.hostName = arguments.data; return this;} function setExceptionMessage(data) {variables.instance.exceptionMessage = arguments.data; return this;} @@ -38,6 +42,8 @@ function getMessage() {return variables.instance.message;} function getApplicationCode() {return variables.instance.applicationCode;} function getSourceID() {return variables.instance.sourceID;} + function getDomainID() {return variables.instance.domainID;} + function getDomain() {return variables.instance.domain;} function getSeverityCode() {return variables.instance.severityCode;} function getHostName() {return variables.instance.hostName;} function getExceptionMessage() {return variables.instance.exceptionMessage;} diff --git a/hq/handlers/admin.cfc b/hq/handlers/admin.cfc index dd5eec6..91864e8 100644 --- a/hq/handlers/admin.cfc +++ b/hq/handlers/admin.cfc @@ -51,6 +51,11 @@ if(not user.getIsAdmin()) throw(type="validation", message=variables.msgs.userNotAllowed); setValue("qryData", app.getHosts() ); break; + + case "domainManagement": + if(not user.getIsAdmin()) throw(type="validation", message=variables.msgs.userNotAllowed); + setValue("qryData", app.getDomains() ); + break; case "severityManagement": if(not user.getIsAdmin()) throw(type="validation", message=variables.msgs.userNotAllowed); @@ -101,7 +106,6 @@ setValue("allowConfigEditing", isConfigEditingAllowed()); setValue("pageTitle", "BugLog Settings & Management"); setView("admin"); - } catch(validation e) { setMessage("warning",e.message); setNextEvent("main"); @@ -554,7 +558,61 @@ } - + + + + var id = getValue("id"); + var domain = getValue("domain"); + var user = getValue("currentUser"); + + try { + if(not user.getIsAdmin()) {setMessage("warning",variables.msgs.userNotAllowedAction); setNextEvent("admin.main");} + if(domain eq "") throw(type="validation", message="Domain cannot be empty"); + + getService("app").saveDomain(id,domain); + + setMessage("info","Domain has been saved"); + setNextEvent("admin.main","panel=domainManagement"); + } catch(validation e) { + setMessage("warning",e.message); + setNextEvent("admin.main","panel=domainManagement&id=#id#&domain=#domain#"); + } catch(any e) { + setMessage("error",e.message); + getService("bugTracker").notifyService(e.message, e); + setNextEvent("admin.main","panel=domainManagement&id=#id#&domain=#domain#"); + } + + + + + + var id = val(getValue("id")); + var entryAction = getValue("entryAction"); + var moveToDomainID = val(getValue("moveToDomainID")); + var user = getValue("currentUser"); + + try { + if(not user.getIsAdmin()) {setMessage("warning",variables.msgs.userNotAllowedAction); setNextEvent("admin.main");} + if(id eq 0) setNextEvent("admin.main"); + if(entryAction eq "") throw(type="validation", message="Select what action to take with existing bug reports that link to this domain"); + if(entryAction eq "move" and moveToHostID eq 0) throw(type="validation", message="Select the domain name to migrate existing bug reports that link to this domain"); + + getService("app").deleteDomain(id,entryAction,moveToDomainID); + + setMessage("info","Domain has been deleted"); + setNextEvent("admin.main","panel=domainManagement"); + + } catch(validation e) { + setMessage("warning",e.message); + setNextEvent("admin.main","panel=domainManagement&id=DELETE:#id#"); + } catch(any e) { + setMessage("error",e.message); + getService("bugTracker").notifyService(e.message, e); + setNextEvent("admin.main","panel=domainManagement&id=DELETE:#id#"); + } + + + diff --git a/hq/handlers/general.cfc b/hq/handlers/general.cfc index 97a0206..e6b4d6e 100644 --- a/hq/handlers/general.cfc +++ b/hq/handlers/general.cfc @@ -180,7 +180,7 @@ setValue("pageTitle", "Summary"); // perform grouping for summary display - qryEntries = appService.applyGroupings(qryEntries, criteria.groupByApp, criteria.groupByHost); + qryEntries = appService.applyGroupings(qryEntries, criteria.groupByApp, criteria.groupByHost, criteria.groupByDomain); setValue("qryEntries", qryEntries); setValue("refreshSeconds",refreshSeconds); @@ -608,6 +608,8 @@ if(not structKeyExists(criteria,"enddate")) criteria.enddate = "1/1/3000"; if(not structKeyExists(criteria,"groupByApp")) criteria.groupByApp = true; if(not structKeyExists(criteria,"groupByHost")) criteria.groupByHost = true; + if(not structKeyExists(criteria,"groupByDomain")) criteria.groupByDomain = true; + if(not structKeyExists(criteria,"domainID")) criteria.domainID = 0; if(not structKeyExists(criteria,"searchHTMLReport")) criteria.searchHTMLReport = false; if(not structKeyExists(criteria,"sortBy")) criteria.sortBy = ""; if(not structKeyExists(criteria,"sortDir")) criteria.sortDir = "asc"; @@ -625,6 +627,8 @@ enddate = getValue("endDate", criteria.enddate), groupByApp = getValue("groupByApp", criteria.groupByApp), groupByHost = getValue("groupByHost", criteria.groupByHost), + groupByDomain = getValue("groupByDomain", criteria.groupByDomain), + domainID = getValue("domainID", criteria.domainID), searchHTMLReport = getValue("searchHTMLReport", criteria.searchHTMLReport), sortBy = getValue("sortBy", criteria.sortBy), sortDir = getValue("sortDir", criteria.sortDir), diff --git a/hq/includes/filters.cfm b/hq/includes/filters.cfm index f82200b..0be0d37 100644 --- a/hq/includes/filters.cfm +++ b/hq/includes/filters.cfm @@ -1,6 +1,7 @@ + + + + SELECT DISTINCT domainID, [domain] + FROM rs.qryEntries + ORDER BY [domain] + + + + +
@@ -91,6 +102,23 @@ + + style="color:red;">Domain: + +   diff --git a/hq/views/admin.cfm b/hq/views/admin.cfm index ab0e957..0957de8 100644 --- a/hq/views/admin.cfm +++ b/hq/views/admin.cfm @@ -19,7 +19,9 @@ { id = "userManagement", label = "Users", display = isAdmin, href="admin/userManagement.cfm" }, { id = "appManagement", label = "Applications", display = isAdmin, href="admin/appManagement.cfm" }, { id = "hostManagement", label = "Hosts", display = isAdmin, href="admin/hostManagement.cfm" }, - { id = "severityManagement", label = "Severities", display = isAdmin, href="admin/severityManagement.cfm" } + { id = "severityManagement", label = "Severities", display = isAdmin, href="admin/severityManagement.cfm" }, + { id = "domainManagement", label = "Domains", display = isAdmin, href="admin/domainManagement.cfm" } + ]> diff --git a/hq/views/admin/domainManagement.cfm b/hq/views/admin/domainManagement.cfm new file mode 100644 index 0000000..630b41c --- /dev/null +++ b/hq/views/admin/domainManagement.cfm @@ -0,0 +1,96 @@ + + + + +

Domain Management:

+ +
+ + + + SELECT * FROM qryData WHERE domainID = + + + + + + + + + +
Name:
+ +    + Cancel + +   |   + View Bug Reports (Last 30 days) + + +


+ + + + SELECT * FROM qryData WHERE domainID = + +
+ + + + + + + + + + + +
Name:
Existing Bug Reports... + + +
+ +    + Cancel + +   |   + View Bug Reports (Last 30 days) + +
+


+
+ + + + + + + + + + + + + + + + + + +
 Name 
#qryData.currentRow#.#qryData.domain# + [ Edit ] +   + [ Delete ] +
+ [ Create New Domain ] +

+
+
diff --git a/hq/views/entry.cfm b/hq/views/entry.cfm index 1ec834b..71e26d1 100644 --- a/hq/views/entry.cfm +++ b/hq/views/entry.cfm @@ -6,6 +6,9 @@ + + + @@ -194,6 +197,11 @@ #oEntry.getCFID()#   /   #oEntry.getCFTOKEN()#
+ + Domain: + #oDomain.getDomain()#  + + diff --git a/hq/views/main.cfm b/hq/views/main.cfm index 7644e5b..437bf65 100644 --- a/hq/views/main.cfm +++ b/hq/views/main.cfm @@ -11,6 +11,8 @@ + + diff --git a/install/mssql-2005-domain.sql b/install/mssql-2005-domain.sql new file mode 100644 index 0000000..8361af5 --- /dev/null +++ b/install/mssql-2005-domain.sql @@ -0,0 +1,45 @@ +USE [bugloghq] + +GO + +IF (NOT EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_Domain]'))) + BEGIN + CREATE TABLE [dbo].[bl_Domain] ( + [DomainID] int IDENTITY (1,1) NOT NULL, + [domain] varchar(512) NULL + ) + ON [PRIMARY] + END + +GO + +-- Add Primary Key PK_bl_ExtensionLog to bl_DomainId +GO +IF (EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_Domain]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sys.indexes WHERE [name]=N'PK_bl_Domain' AND [object_id]=OBJECT_ID(N'[dbo].[bl_Domain]'))) + BEGIN + Print 'Add Primary Key PK_bl_Domain to bl_DomainId' + ALTER TABLE [dbo].[bl_Domain] + ADD + CONSTRAINT [PK_bl_Domain] + PRIMARY KEY + ([DomainID]) + ON [PRIMARY] + END +GO + +IF (NOT EXISTS(SELECT * FROM sys.columns WHERE Name = 'domainId' and Object_ID = Object_ID('bl_Entry'))) + BEGIN + ALTER TABLE [bl_Entry] + ADD domainId INT NULL + END + +IF OBJECT_ID(N'[dbo].[bl_Entry]') IS NOT NULL + AND OBJECT_ID(N'[dbo].[bl_Domain]') IS NOT NULL + AND NOT EXISTS (SELECT * FROM sys.objects WHERE [object_id]=OBJECT_ID(N'[dbo].[FK_bl_Entry_bl_Domain]') AND [parent_object_id]=OBJECT_ID(N'[dbo].[bl_Entry]')) + BEGIN + ALTER TABLE [dbo].[bl_Entry] + ADD CONSTRAINT [FK_bl_Entry_bl_Domain] + FOREIGN KEY ([DomainID]) REFERENCES [dbo].[bl_Domain] ([DomainId]) + END +GO + diff --git a/install/mssql-2005-optimized.sql b/install/mssql-2005-optimized.sql new file mode 100644 index 0000000..c0e43fb --- /dev/null +++ b/install/mssql-2005-optimized.sql @@ -0,0 +1,478 @@ +-- BEGINNING TRANSACTION STRUCTURE +PRINT 'Beginning transaction STRUCTURE' +BEGIN TRANSACTION _STRUCTURE_ +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +SET ANSI_PADDING ON +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Create Table bl_Application +Print 'Create Table bl_Application' +GO +CREATE TABLE [dbo].[bl_Application] ( + [ApplicationID] int IDENTITY (1,1) NOT NULL, + [Code] varchar(100) NOT NULL, + [Name] varchar(250) NOT NULL +) +ON [PRIMARY] +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Add Primary Key PK_bl_Application to bl_Application +Print 'Add Primary Key PK_bl_Application to bl_Application' +GO +IF (EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_Application]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sys.indexes WHERE [name]=N'PK_bl_Application' AND [object_id]=OBJECT_ID(N'[dbo].[bl_Application]'))) +ALTER TABLE [dbo].[bl_Application] + ADD + CONSTRAINT [PK_bl_Application] + PRIMARY KEY + ([ApplicationID]) + ON [PRIMARY] +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Add Unique IX_bl_Application to bl_Application +Print 'Add Unique IX_bl_Application to bl_Application' +GO +IF (EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_Application]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sys.indexes WHERE [name]=N'IX_bl_Application' AND [object_id]=OBJECT_ID(N'[dbo].[bl_Application]'))) +ALTER TABLE [dbo].[bl_Application] + ADD + CONSTRAINT [IX_bl_Application] + UNIQUE + ([Code]) + ON [PRIMARY] +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +SET ANSI_PADDING ON +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Create Table bl_Entry +Print 'Create Table bl_Entry' +GO +CREATE TABLE [dbo].[bl_Entry] ( + [EntryID] int IDENTITY (1,1) NOT NULL, + [myDateTime] datetime NOT NULL, + [Message] varchar(500) NOT NULL, + [ApplicationID] int NOT NULL, + [SourceID] int NOT NULL, + [SeverityID] int NOT NULL, + [HostID] int NOT NULL, + [ExceptionMessage] varchar(500) NULL, + [ExceptionDetails] varchar(5000) NULL, + [CFID] varchar(255) NULL, + [CFTOKEN] varchar(255) NULL, + [UserAgent] varchar(500) NULL, + [TemplatePath] varchar(500) NULL, + [HTMLReport] text NULL, + [createdOn] datetime NOT NULL +) +ON [PRIMARY] +TEXTIMAGE_ON [PRIMARY] +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Add Primary Key PK_bl_Entry to bl_Entry +Print 'Add Primary Key PK_bl_Entry to bl_Entry' +GO +IF (EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_Entry]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sys.indexes WHERE [name]=N'PK_bl_Entry' AND [object_id]=OBJECT_ID(N'[dbo].[bl_Entry]'))) +ALTER TABLE [dbo].[bl_Entry] + ADD + CONSTRAINT [PK_bl_Entry] + PRIMARY KEY + ([EntryID]) + ON [PRIMARY] +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Add Default Constraint DF_bl_Entry_createdOn to bl_Entry +Print 'Add Default Constraint DF_bl_Entry_createdOn to bl_Entry' +GO +IF (EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_Entry]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sys.objects WHERE [object_id]=OBJECT_ID(N'[dbo].[DF_bl_Entry_createdOn]') AND [parent_object_id]=OBJECT_ID(N'[dbo].[bl_Entry]'))) +ALTER TABLE [dbo].[bl_Entry] + ADD + CONSTRAINT [DF_bl_Entry_createdOn] + DEFAULT (getdate()) FOR [createdOn] +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO + +-- Add Default Constraint DF_bl_Entry_myDateTime to bl_Entry +Print 'Add Default Constraint DF_bl_Entry_myDateTime to bl_Entry' +GO +IF (EXISTS(SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[dbo].[bl_Entry]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sysobjects WHERE id=OBJECT_ID(N'[dbo].[DF_bl_Entry_createdOn]') AND parent_obj=OBJECT_ID(N'[dbo].[bl_Entry]'))) +ALTER TABLE [dbo].[bl_Entry] + ADD + CONSTRAINT [DF_bl_Entry_myDateTime] + DEFAULT (getdate()) FOR [myDateTime] +GO + + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +SET ANSI_PADDING ON +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Create Table bl_Host +Print 'Create Table bl_Host' +GO +CREATE TABLE [dbo].[bl_Host] ( + [HostID] int IDENTITY (1,1) NOT NULL, + [HostName] varchar(250) NOT NULL +) +ON [PRIMARY] +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Add Primary Key PK_bl_Host to bl_Host +Print 'Add Primary Key PK_bl_Host to bl_Host' +GO +IF (EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_Host]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sys.indexes WHERE [name]=N'PK_bl_Host' AND [object_id]=OBJECT_ID(N'[dbo].[bl_Host]'))) +ALTER TABLE [dbo].[bl_Host] + ADD + CONSTRAINT [PK_bl_Host] + PRIMARY KEY + ([HostID]) + ON [PRIMARY] +GO + + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +SET ANSI_PADDING ON +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Create Table bl_Severity +Print 'Create Table bl_Severity' +GO +CREATE TABLE [dbo].[bl_Severity] ( + [SeverityID] int IDENTITY (1,1) NOT NULL, + [Name] varchar(250) NOT NULL, + [Code] varchar(50) NOT NULL +) +ON [PRIMARY] +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Add Primary Key PK_bl_Severity to bl_Severity +Print 'Add Primary Key PK_bl_Severity to bl_Severity' +GO +IF (EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_Severity]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sys.indexes WHERE [name]=N'PK_bl_Severity' AND [object_id]=OBJECT_ID(N'[dbo].[bl_Severity]'))) +ALTER TABLE [dbo].[bl_Severity] + ADD + CONSTRAINT [PK_bl_Severity] + PRIMARY KEY + ([SeverityID]) + ON [PRIMARY] +GO + + + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +SET ANSI_PADDING ON +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Create Table bl_Source +Print 'Create Table bl_Source' +GO +CREATE TABLE [dbo].[bl_Source] ( + [SourceID] int IDENTITY (1,1) NOT NULL, + [Name] varchar(250) NOT NULL +) +ON [PRIMARY] +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Add Primary Key PK_bl_Source to bl_Source +Print 'Add Primary Key PK_bl_Source to bl_Source' +GO +IF (EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_Source]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sys.indexes WHERE [name]=N'PK_bl_Source' AND [object_id]=OBJECT_ID(N'[dbo].[bl_Source]'))) +ALTER TABLE [dbo].[bl_Source] + ADD + CONSTRAINT [PK_bl_Source] + PRIMARY KEY + ([SourceID]) + ON [PRIMARY] +GO + + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO + +SET ANSI_NULLS ON +SET QUOTED_IDENTIFIER ON +SET ANSI_PADDING ON +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Create Table bl_User +Print 'Create Table bl_User' +GO +CREATE TABLE [dbo].[bl_User] ( + [UserID] int IDENTITY (1,1) NOT NULL, + [Username] varchar(250) NOT NULL, + [Password] varchar(50) NOT NULL, + [IsAdmin] int NOT NULL, + [email] VARCHAR(255) NULL, + [apiKey] VARCHAR(100) NULL +) +ON [PRIMARY] +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Add Primary Key PK_bl_User to bl_User +Print 'Add Primary Key PK_bl_User to bl_User' +GO +IF (EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_User]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sys.indexes WHERE [name]=N'PK_bl_User' AND [object_id]=OBJECT_ID(N'[dbo].[bl_User]'))) +ALTER TABLE [dbo].[bl_User] + ADD + CONSTRAINT [PK_bl_User] + PRIMARY KEY + ([UserID]) + ON [PRIMARY] +GO + + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO + +-- Create Foreign Key FK_bl_Entry_bl_Application on bl_Entry +Print 'Create Foreign Key FK_bl_Entry_bl_Application on bl_Entry' +GO +IF OBJECT_ID(N'[dbo].[bl_Entry]') IS NOT NULL + AND OBJECT_ID(N'[dbo].[bl_Application]') IS NOT NULL + AND NOT EXISTS (SELECT * FROM sys.objects WHERE [object_id]=OBJECT_ID(N'[dbo].[FK_bl_Entry_bl_Application]') AND [parent_object_id]=OBJECT_ID(N'[dbo].[bl_Entry]')) +BEGIN + ALTER TABLE [dbo].[bl_Entry] + WITH NOCHECK + ADD CONSTRAINT [FK_bl_Entry_bl_Application] + FOREIGN KEY ([ApplicationID]) REFERENCES [dbo].[bl_Application] ([ApplicationID]) + ALTER TABLE [dbo].[bl_Entry] + CHECK CONSTRAINT [FK_bl_Entry_bl_Application] + +END +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Create Foreign Key FK_bl_Entry_bl_Host on bl_Entry +Print 'Create Foreign Key FK_bl_Entry_bl_Host on bl_Entry' +GO +IF OBJECT_ID(N'[dbo].[bl_Entry]') IS NOT NULL + AND OBJECT_ID(N'[dbo].[bl_Host]') IS NOT NULL + AND NOT EXISTS (SELECT * FROM sys.objects WHERE [object_id]=OBJECT_ID(N'[dbo].[FK_bl_Entry_bl_Host]') AND [parent_object_id]=OBJECT_ID(N'[dbo].[bl_Entry]')) +BEGIN + ALTER TABLE [dbo].[bl_Entry] + ADD CONSTRAINT [FK_bl_Entry_bl_Host] + FOREIGN KEY ([HostID]) REFERENCES [dbo].[bl_Host] ([HostID]) +END +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Create Foreign Key FK_bl_Entry_bl_Severity on bl_Entry +Print 'Create Foreign Key FK_bl_Entry_bl_Severity on bl_Entry' +GO +IF OBJECT_ID(N'[dbo].[bl_Entry]') IS NOT NULL + AND OBJECT_ID(N'[dbo].[bl_Severity]') IS NOT NULL + AND NOT EXISTS (SELECT * FROM sys.objects WHERE [object_id]=OBJECT_ID(N'[dbo].[FK_bl_Entry_bl_Severity]') AND [parent_object_id]=OBJECT_ID(N'[dbo].[bl_Entry]')) +BEGIN + ALTER TABLE [dbo].[bl_Entry] + ADD CONSTRAINT [FK_bl_Entry_bl_Severity] + FOREIGN KEY ([SeverityID]) REFERENCES [dbo].[bl_Severity] ([SeverityID]) +END +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO +-- Create Foreign Key FK_bl_Entry_bl_Source on bl_Entry +Print 'Create Foreign Key FK_bl_Entry_bl_Source on bl_Entry' +GO +IF OBJECT_ID(N'[dbo].[bl_Entry]') IS NOT NULL + AND OBJECT_ID(N'[dbo].[bl_Source]') IS NOT NULL + AND NOT EXISTS (SELECT * FROM sys.objects WHERE [object_id]=OBJECT_ID(N'[dbo].[FK_bl_Entry_bl_Source]') AND [parent_object_id]=OBJECT_ID(N'[dbo].[bl_Entry]')) +BEGIN + ALTER TABLE [dbo].[bl_Entry] + ADD CONSTRAINT [FK_bl_Entry_bl_Source] + FOREIGN KEY ([SourceID]) REFERENCES [dbo].[bl_Source] ([SourceID]) +END +GO + +IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN IF @@TRANCOUNT>0 ROLLBACK SET NOEXEC ON END +GO + +-- COMMITTING TRANSACTION STRUCTURE +PRINT 'Committing transaction STRUCTURE' +IF @@TRANCOUNT>0 + COMMIT TRANSACTION _STRUCTURE_ +GO + +SET NOEXEC OFF +GO +-- BEGINNING TRANSACTION DATA +PRINT 'Beginning transaction DATA' +BEGIN TRANSACTION _DATA_ +GO + +SET NOCOUNT ON +GO + +-- Deleting from table: bl_User +PRINT 'Deleting from table: bl_User' +DELETE FROM [dbo].[bl_User] + +-- Insert scripts for table: bl_User +PRINT 'Inserting rows into table: bl_User' +INSERT INTO [dbo].[bl_User] ([Username], [Password], [IsAdmin]) VALUES ('admin', 'admin', 1) + + +-- COMMITTING TRANSACTION DATA +PRINT 'Committing transaction DATA' +IF @@TRANCOUNT>0 + COMMIT TRANSACTION _DATA_ +GO + +SET NOEXEC OFF +GO + +CREATE TABLE [dbo].[bl_Extension] ( + [ExtensionID] int IDENTITY (1,1) NOT NULL, + [name] varchar(255) NOT NULL, + [type] varchar(255) NOT NULL, + [enabled] bit NOT NULL, + [description] varchar(500) NULL, + [properties] text NULL, + [createdBy] int NULL, + [createdOn] datetime NOT NULL +) +ON [PRIMARY] + +-- Add Primary Key PK_bl_Extension to bl_Extension +Print 'Add Primary Key PK_bl_Extension to bl_Extension' +GO +IF (EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_Extension]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sys.indexes WHERE [name]=N'PK_bl_Extension' AND [object_id]=OBJECT_ID(N'[dbo].[bl_Extension]'))) +ALTER TABLE [dbo].[bl_Extension] + ADD + CONSTRAINT [PK_bl_Extension] + PRIMARY KEY + ([ExtensionID]) + ON [PRIMARY] +GO + +GO + +ALTER TABLE [dbo].[bl_Extension] + ADD + CONSTRAINT [DF_bl_Extension_enabled] + DEFAULT 0 FOR [enabled] +GO + +ALTER TABLE [dbo].[bl_Extension] + ADD + CONSTRAINT [DF_bl_Extension_createdOn] + DEFAULT (getdate()) FOR [createdOn] +GO + +CREATE TABLE [dbo].[bl_ExtensionLog] ( + [ExtensionLogID] int IDENTITY (1,1) NOT NULL, + [extensionID] int NULL, + [createdOn] datetime NOT NULL, + [entryID] int NULL +) +ON [PRIMARY] +GO + +-- Add Primary Key PK_bl_ExtensionLog to bl_ExtensionLog +Print 'Add Primary Key PK_bl_ExtensionLog to bl_ExtensionLog' +GO +IF (EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_ExtensionLog]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sys.indexes WHERE [name]=N'PK_bl_ExtensionLog' AND [object_id]=OBJECT_ID(N'[dbo].[bl_Application]'))) +ALTER TABLE [dbo].[bl_ExtensionLog] + ADD + CONSTRAINT [PK_bl_ExtensionLog] + PRIMARY KEY + ([ExtensionLogID]) + ON [PRIMARY] +GO + +ALTER TABLE [dbo].[bl_ExtensionLog] + ADD + CONSTRAINT [DF_bl_ExtensionLog_createdOn] + DEFAULT (getdate()) FOR [createdOn] +GO + + +CREATE TABLE [dbo].[bl_userApplication] ( + [userApplicationID] int IDENTITY (1,1) NOT NULL, + [userID] int NULL, + [applicationID] int NULL +) +ON [PRIMARY] +GO + +-- Add Primary Key PK_bl_userApplication to bl_userApplication +Print 'Add Primary Key PK_bl_userApplication to bl_userApplication' +GO +IF (EXISTS(SELECT * FROM sys.objects WHERE [object_id] = OBJECT_ID(N'[dbo].[bl_userApplication]') AND [type]='U')) AND NOT (EXISTS (SELECT * FROM sys.indexes WHERE [name]=N'PK_bl_userApplication' AND [object_id]=OBJECT_ID(N'[dbo].[bl_userApplication]'))) +ALTER TABLE [dbo].[bl_userApplication] + ADD + CONSTRAINT [PK_bl_userApplication] + PRIMARY KEY + ([userApplicationID]) + ON [PRIMARY] +GO + +ALTER TABLE [dbo].[bl_userApplication] + ADD + CONSTRAINT [FK_bl_userApplication_bl_user] + FOREIGN KEY ([userID]) REFERENCES [dbo].[bl_User] ([userID]) +GO + +ALTER TABLE [dbo].[bl_userApplication] + ADD + CONSTRAINT [FK_bl_userApplication_bl_application] + FOREIGN KEY ([applicationID]) REFERENCES [dbo].[bl_application] ([applicationID]) +GO + diff --git a/listeners/bugLogListenerREST.cfm b/listeners/bugLogListenerREST.cfm index e2bf9db..8624698 100644 --- a/listeners/bugLogListenerREST.cfm +++ b/listeners/bugLogListenerREST.cfm @@ -21,6 +21,7 @@ + diff --git a/listeners/bugLogListenerWS.cfc b/listeners/bugLogListenerWS.cfc index a8da31b..9de3e79 100644 --- a/listeners/bugLogListenerWS.cfc +++ b/listeners/bugLogListenerWS.cfc @@ -14,7 +14,8 @@ - + + diff --git a/listeners/listener.cfc b/listeners/listener.cfc index 03e2f92..889fd46 100644 --- a/listeners/listener.cfc +++ b/listeners/listener.cfc @@ -22,6 +22,7 @@ + // get listener service wrapper var serviceLoader = createObject("component", "bugLog.components.service").init( instanceName = variables.instanceName ); @@ -40,6 +41,7 @@ .setHostName(arguments.hostName) .setExceptionMessage(arguments.exceptionMessage) .setExceptionDetails(arguments.exceptionDetails) + .setDomain(arguments.domain) .setCFID(arguments.cfid) .setCFTOKEN(arguments.cftoken) .setUserAgent(arguments.userAgent) diff --git a/test/client.cfm b/test/client.cfm index 31b3208..cd8f1c0 100644 --- a/test/client.cfm +++ b/test/client.cfm @@ -75,7 +75,7 @@ Notify service via [#protocol#] using severity [#severity#]....
- +