public static string GetFileExtension(CommonContentType type) { switch (type) { case CommonContentType.Bin: return(".bin"); case CommonContentType.Flat: return(".txt"); case CommonContentType.ODF: return(".odf"); case CommonContentType.OTHER: return(".dat"); case CommonContentType.XML: return(".xml"); case CommonContentType.ZIP: return(".zip"); case CommonContentType.HTML: return(".html"); case CommonContentType.PDF: return(".pdf"); case CommonContentType.GML: return(".gml"); default: return(".unknown"); } }
public Document(string documentId, string documentName, CommonContentType type, byte[] content) : base(type, content) { _documentId = documentId; _documentName = documentName; _contentByteSize = (content == null) ? 0 : content.Length; }
public void CreateDocument(string transactionId, string id, CommonContentType documentType, string documentName, string documentId, CommonTransactionStatusCode documentStatus, string documentStatusDetail) { try { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException("document id"); } DoInsert(TABLE_NAME, "Id;TransactionId;DocumentName;Type;DocumentId;Status;StatusDetail", id, transactionId, documentName ?? string.Empty, documentType.ToString(), documentId ?? string.Empty, documentStatus.ToString(), documentStatusDetail ?? string.Empty); } catch (Spring.Dao.DataIntegrityViolationException e) { throw new ArgumentException(string.Format("The document \"{0}\" already exists for the transaction \"{1}\"", documentName ?? string.Empty, transactionId), e); } }
public string[] DownloadByName(string flow, string transactionId, params string[] documentNames) { if (CollectionUtils.IsNullOrEmpty(documentNames)) { throw new ArgumentException("documentNames cannot be empty"); } Windsor.Node.Proxy11.WSDL.NodeDocument[] documents = new Windsor.Node.Proxy11.WSDL.NodeDocument[documentNames.Length]; for (int i = 0; i < documentNames.Length; ++i) { Windsor.Node.Proxy11.WSDL.NodeDocument document = new Windsor.Node.Proxy11.WSDL.NodeDocument(); document.name = documentNames[i]; CommonContentType type = CommonContentAndFormatProvider.GetFileTypeFromName(document.name); if (type == CommonContentType.OTHER) { type = CommonContentType.XML; // Assume XML } document.type = type.ToString(); documents[i] = document; } _requestor.Download(Authenticate(), transactionId, flow, ref documents); return(SaveDownloadedDocuments(documents, null)); //throw new InvalidOperationException("DownloadByName() is not a valid method call for Client11"); }
protected override string DoProcessQuerySolicit(out CommonContentType contentType) { contentType = CommonContentType.ZIP; Dictionary <string, DbAppendSelectWhereClause> selectClauses = new Dictionary <string, DbAppendSelectWhereClause>(); string beachActivityClause = null; List <object> beachActivityParams = null; string beachClause = null; List <object> beachParams = null; string beachActivityMonStationClause = null; List <object> beachActivityMonStationParams = null; string activityIndicatorClause = null; List <object> activityIndicatorParams = null; const string organizationAlias = "O"; const string beachAlias = "B"; const string beachActivityAlias = "BA"; const string beachActivityMonStationAlias = "BAMS"; const string activityIndicatorAlias = "AI"; if (_actualStartDate.HasValue) { beachActivityClause = AppendToDbClause(beachActivityClause, beachActivityAlias + "." + "ACTUALSTARTDATE >= ?"); beachActivityParams = CollectionUtils.Add(_actualStartDate.Value, beachActivityParams); } if (_actualStopDate.HasValue) { beachActivityClause = AppendToDbClause(beachActivityClause, beachActivityAlias + "." + "ACTUALSTOPDATE <= ?"); beachActivityParams = CollectionUtils.Add(_actualStopDate.Value, beachActivityParams); } if (!string.IsNullOrEmpty(_beachName)) { beachClause = AppendToDbClause(beachClause, "UPPER(" + beachAlias + "." + "BEACHNAME) LIKE " + _baseDao.SqlConcat("'%'", "UPPER(?)", "'%'")); beachParams = CollectionUtils.Add(_beachName, beachParams); } if (!string.IsNullOrEmpty(_beachIdentifier)) { beachClause = AppendToDbClause(beachClause, "UPPER(" + beachAlias + "." + "BEACHIDENTIFIER) = UPPER(?)"); beachParams = CollectionUtils.Add(_beachIdentifier, beachParams); } if (!string.IsNullOrEmpty(_monitoringStationIdentifier)) { beachActivityMonStationClause = AppendToDbClause(beachActivityMonStationClause, "UPPER(" + beachActivityMonStationAlias + "." + "MONITORINGSTATIONIDENTIFIER) = UPPER(?)"); beachActivityMonStationParams = CollectionUtils.Add(_monitoringStationIdentifier, beachActivityMonStationParams); } if (!string.IsNullOrEmpty(_beachAccessType)) { beachClause = AppendToDbClause(beachClause, "UPPER(" + beachAlias + "." + "BEACHACCESSTYPE) = UPPER(?)"); beachParams = CollectionUtils.Add(_beachAccessType, beachParams); } if (!string.IsNullOrEmpty(_activityIndicatorType)) { activityIndicatorClause = AppendToDbClause(activityIndicatorClause, "UPPER(" + activityIndicatorAlias + "." + "INDICATORTYPE) = UPPER(?)"); activityIndicatorParams = CollectionUtils.Add(_activityIndicatorType, activityIndicatorParams); } if (_activeAdvisoryIndicator.HasValue) { if (_activeAdvisoryIndicator.Value) { beachActivityClause = AppendToDbClause(beachActivityClause, beachActivityAlias + "." + "ACTUALSTOPDATE IS NULL"); } } if (beachActivityMonStationClause != null) { selectClauses.Add("NOTIF_BEACHACTIVITYMONSTATION", new DbAppendSelectWhereClause(beachActivityMonStationAlias, _baseDao, beachActivityMonStationClause, beachActivityMonStationParams)); beachActivityClause = AppendToDbClause(beachActivityClause, string.Format("{2}.ID IN (SELECT {1}.ACTIVITY_ID FROM NOTIF_BEACHACTIVITYMONSTATION {1} WHERE {0})", beachActivityMonStationClause, beachActivityMonStationAlias, beachActivityAlias)); CollectionUtils.AddRange(beachActivityMonStationParams, ref beachActivityParams); } if (activityIndicatorClause != null) { selectClauses.Add("NOTIF_ACTIVITYINDICATOR", new DbAppendSelectWhereClause(activityIndicatorAlias, _baseDao, activityIndicatorClause, activityIndicatorParams)); beachActivityClause = AppendToDbClause(beachActivityClause, string.Format("{2}.ID IN (SELECT {1}.ACTIVITY_ID FROM NOTIF_ACTIVITYINDICATOR {1} WHERE {0})", activityIndicatorClause, activityIndicatorAlias, beachActivityAlias)); CollectionUtils.AddRange(activityIndicatorParams, ref beachActivityParams); } if (beachActivityClause != null) { selectClauses.Add("NOTIF_BEACHACTIVITY", new DbAppendSelectWhereClause(beachActivityAlias, _baseDao, beachActivityClause, beachActivityParams)); beachClause = AppendToDbClause(beachClause, string.Format("{2}.ID IN (SELECT {1}.BEACH_ID FROM NOTIF_BEACHACTIVITY {1} WHERE {0})", beachActivityClause, beachActivityAlias, beachAlias)); CollectionUtils.AddRange(beachActivityParams, ref beachParams); } if (beachClause != null) { selectClauses.Add("NOTIF_BEACH", new DbAppendSelectWhereClause(beachAlias, _baseDao, beachClause, beachParams)); } AppendAuditLogEvent("Querying database for BEACHES data ..."); List <BeachDetailDataType> beachDetails = _objectsFromDatabase.LoadFromDatabase <BeachDetailDataType>(_baseDao, selectClauses); List <OrganizationDetailDataType> organizationDetails = null; if (!CollectionUtils.IsNullOrEmpty(beachDetails)) { string organizationClause; if (beachClause != null) { organizationClause = string.Format("({2}.ID IN (SELECT DISTINCT OBR.ORGANIZATION_ID FROM NOTIF_ORGANIZATIONBEACHROLE OBR WHERE OBR.BEACH_ID IN (SELECT {1}.ID FROM NOTIF_BEACH {1} WHERE {0})))", beachClause, beachAlias, organizationAlias); selectClauses.Add("NOTIF_ORGANIZATION", new DbAppendSelectWhereClause(organizationAlias, _baseDao, organizationClause, beachParams)); } else { organizationClause = string.Format("({0}.ID IN (SELECT DISTINCT OBR.ORGANIZATION_ID FROM NOTIF_ORGANIZATIONBEACHROLE OBR))", organizationAlias); } organizationDetails = _objectsFromDatabase.LoadFromDatabase <OrganizationDetailDataType>(_baseDao, selectClauses); } BeachDataSubmissionDataType data = new BeachDataSubmissionDataType(); data.BeachDetail = CollectionUtils.IsNullOrEmpty(beachDetails) ? null : beachDetails.ToArray(); data.OrganizationDetail = CollectionUtils.IsNullOrEmpty(organizationDetails) ? null : organizationDetails.ToArray(); AppendAuditLogEvent(GetQuerySolicitResultsString(data)); data.AfterLoadFromDatabase(); string submissionFile = GenerateQuerySolicitFileAndAddToTransaction(data); return(submissionFile); }
public EndpointDocument(byte[] contentBytes, string docName, CommonContentType docType) { _contentBytes = contentBytes; _docName = docName; _docType = docType; }
public EndpointDocument(string contentFilePath, string docName, CommonContentType docType) { _contentFilePath = contentFilePath; _docName = docName; _docType = docType; }
public Document(string documentId, string documentName, CommonContentType type) : this(documentId, documentName, type, null) { }
public PaginatedContentResult(int rowIndex, int rowCount, bool isLast, CommonContentType contentType, string filePath) : this(rowIndex, rowCount, isLast, contentType, File.ReadAllBytes(filePath)) { }
protected abstract string DoProcessQuerySolicit(out CommonContentType contentType);
public static string ConvertToMimeType(CommonContentType type) { return(_commonContentToFormatMap.ContainsKey(type) ? _commonContentToFormatMap[type] : _commonContentToFormatMap[CommonContentType.OTHER]); }
public PaginatedContentResult(int rowIndex, int rowCount, bool isLast, CommonContentType contentType, byte[] content) { _paging = new PaginationIndicator(rowIndex, rowCount, isLast); _content = new SimpleContent(contentType, content); }
public static string ConvertTo11Enum(CommonContentType type) { return(EnumUtils.ParseEnum <Wsdl11ContentType>(type.ToString()).ToString()); }
public SimpleContent(CommonContentType type, byte[] content) { _type = type; _content = content; }
/// <inheritdoc /> public void WithCommonContentType(CommonContentType contentType) { WithContentType(contentType.ToString()); }
protected virtual void DoDownloadResponse(byte[] content, string documentName, CommonContentType contentType) { Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("Content-Disposition", string.Format("attachment;filename=\"{0}\"", documentName)); Response.AddHeader("Content-Length", content.Length.ToString()); Response.ContentType = CommonContentAndFormatProvider.ConvertToMimeType(contentType); Response.BinaryWrite(content); Response.End(); }
protected byte[] GetServices(ServiceType returnServiceTypes, out int rowCount, out CommonContentType contentType) { NetworkNodeType networkNodeType = GetServices(returnServiceTypes); rowCount = networkNodeType.NodeServiceList.Length; NetworkNodeListType networkNodeListType = new NetworkNodeListType(); networkNodeListType.NetworkNodeDetails = new NetworkNodeType[1] { networkNodeType }; byte[] content = _serializationHelper.Serialize(networkNodeListType); contentType = CommonContentType.XML; content = CheckToXsltTransformContent(content, "xml_schema.XsltTransforms.zip", _xsltTransformName, ref contentType); string docId = _documentManager.AddDocument(_dataRequest.TransactionId, CommonTransactionStatusCode.Completed, null, new Document(null, contentType, content)); return(content); }
public string NotifyDocument11(string nodeEndpoint, string flow, string name, CommonContentType type, string content) { throw new InvalidOperationException("NotifyDocument11() is not supported by a v2.0 client"); }
/// <summary> /// NotifyDocument11 /// </summary> /// <returns></returns> public string NotifyDocument11(string nodeEndpoint, string flow, string name, CommonContentType type, string content) { string transactionId = _requestor.Notify(Authenticate(), nodeEndpoint, flow, name, CommonContentAndFormatProvider.ConvertTo11Enum(type), content); return(transactionId); }