Skip to content

Commit

Permalink
merge from 2.12.3 to dev
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBlaa committed Apr 25, 2019
2 parents 69b3305 + c1fb641 commit 0490281
Show file tree
Hide file tree
Showing 32 changed files with 867 additions and 358 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void Reject(long decisionId, string reason)
var mergedDecision = decisionRepository.Get(decision.Id);
decisionRepository.Put(mergedDecision);

if (decisionRepository.Query(m => m.Request.Id == decision.Request.Id)
if (decisionRepository.Query(m => m.Request.Id == decision.Request.Id).ToList()
.All(m => m.Status != DecisionStatus.Open))
{
var request = requestRepository.Get(decision.Request.Id);
Expand Down
41 changes: 39 additions & 2 deletions Components/AAA/BExIS.Security.Services/Utilities/MessageHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,27 @@ public static string GetDeleteDatasetMessage(long datasetid, string userName)
return message + ".";
}

public static string GetTryToDeleteDatasetHeader()
{
return $"Someone tried to delete a dataset";
}

public static string GetTryToDeleteDatasetMessage(long datasetid, string userName)
{
string message = $"An unsuccessful attempt was made to delete a Dataset with id <b>({datasetid})</b>";

if (!string.IsNullOrEmpty(userName))

return message += $" by <b>{userName}</b>";

return message + ".";
}

public static string GetPurgeDatasetHeader()
{
return $"Dataset was purged";
}

public static string GetPurgeDatasetMessage(long datasetid, string userName)
{
string message = $"Dataset with id <b>({datasetid})</b> was purged";
Expand All @@ -45,6 +66,22 @@ public static string GetPurgeDatasetMessage(long datasetid, string userName)
return message + ".";
}

public static string GetTryToPurgeDatasetHeader()
{
return $"Someone tried to purge a dataset";
}

public static string GetTryToPurgeDatasetMessage(long datasetid, string userName)
{
string message = $"An unsuccessful attempt was made to purge a Dataset with id <b>({datasetid})</b>";

if (!string.IsNullOrEmpty(userName))

return message += $" by <b>{userName}</b>";

return message + ".";
}

public static string GetDownloadDatasetHeader()
{
return $"Dataset was downloaded";
Expand Down Expand Up @@ -78,12 +115,12 @@ public static string GetRegisterUserMessage(long userId, string userName, string

public static string GetSendRequestHeader(long datasetid)
{
return $"Request to dataset width id {datasetid}";
return $"Request to dataset with id {datasetid}";
}

public static string GetSendRequestMessage(long datasetid, string title, string requester)
{
return $"User \"{requester}\" send a request for Dataset <b>\"{title}\"</b> with id <b>({datasetid})</b>";
return $"User \"{requester}\" sent a request for Dataset <b>\"{title}\"</b> with id <b>({datasetid})</b>";
}

public static string GetTryToRegisterUserHeader()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
<column name="ShortName" index="idx_DataContainers_shortName"/>
</property>

<property name="Description" type="String">
<column name="Description" />
<property name="Description" type="String" >
<column name="Description" sql-type="varchar" />
</property>

<property name="IsMultiValue" type="yes_no">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ private string createDownloadFile(string ns, long datastructureId, string title,
// text based files
case ".csv":
case ".txt":
case ".tsv":
AsciiWriter asciiwriter = (AsciiWriter)writer;
return asciiwriter.CreateFile(ns, title, ext);

Expand Down
119 changes: 88 additions & 31 deletions Components/XML/BExIS.Xml.Helpers/XmlMetadataWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,35 +92,36 @@ public XDocument CreateMetadataXml(long metadataStructureId, XDocument importXml
package.SetAttributeValue("number", "1");
role.Add(package);

setChildren(package, mpu, importXml);

attributes = mpu.MetadataPackage.MetadataAttributeUsages.ToList();
//attributes = mpu.MetadataPackage.MetadataAttributeUsages.ToList();

foreach (MetadataAttributeUsage mau in attributes)
{
XElement attribute;
//foreach (MetadataAttributeUsage mau in attributes)
//{
// XElement attribute;

XElement attributeRole = CreateXElement(mau.Label, XmlNodeType.MetadataAttributeUsage);
if (_mode.Equals(XmlNodeMode.xPath))
{
attributeRole.SetAttributeValue("name", mau.Label);
attributeRole.SetAttributeValue("id", mau.Id.ToString());
}
package.Add(attributeRole);
// XElement attributeRole = CreateXElement(mau.Label, XmlNodeType.MetadataAttributeUsage);
// if (_mode.Equals(XmlNodeMode.xPath))
// {
// attributeRole.SetAttributeValue("name", mau.Label);
// attributeRole.SetAttributeValue("id", mau.Id.ToString());
// }
// package.Add(attributeRole);

attribute = CreateXElement(mau.MetadataAttribute.Name, XmlNodeType.MetadataAttribute);
if (_mode.Equals(XmlNodeMode.xPath)) attribute.SetAttributeValue("name", mau.MetadataAttribute.Name);
// attribute = CreateXElement(mau.MetadataAttribute.Name, XmlNodeType.MetadataAttribute);
// if (_mode.Equals(XmlNodeMode.xPath)) attribute.SetAttributeValue("name", mau.MetadataAttribute.Name);

attribute.SetAttributeValue("roleId", mau.Id.ToString());
attribute.SetAttributeValue("id", mau.MetadataAttribute.Id.ToString());
attribute.SetAttributeValue("number", "1");
// attribute.SetAttributeValue("roleId", mau.Id.ToString());
// attribute.SetAttributeValue("id", mau.MetadataAttribute.Id.ToString());
// attribute.SetAttributeValue("number", "1");

string xpath = attributeRole.GetAbsoluteXPath() + attribute.GetAbsoluteXPath();
// string xpath = attributeRole.GetAbsoluteXPath() + attribute.GetAbsoluteXPath();

attributeRole.Add(attribute);
// attributeRole.Add(attribute);

setChildren(attribute, mau, importXml);
// setChildren(attribute, mau, importXml);

}
//}
}

return doc;
Expand All @@ -129,53 +130,52 @@ public XDocument CreateMetadataXml(long metadataStructureId, XDocument importXml

private XElement setChildren(XElement element, BaseUsage usage, XDocument importDocument = null)
{
MetadataAttribute metadataAttribute;
MetadataAttribute metadataAttribute = null;
MetadataPackage metadataPackage = null;

if (usage is MetadataAttributeUsage)
{
MetadataAttributeUsage metadataAttributeUsage = (MetadataAttributeUsage)usage;
metadataAttribute = metadataAttributeUsage.MetadataAttribute;

}
else
else if (usage is MetadataNestedAttributeUsage)
{
MetadataNestedAttributeUsage mnau = (MetadataNestedAttributeUsage)usage;
metadataAttribute = mnau.Member;

}
else
{
MetadataPackageUsage mpu = (MetadataPackageUsage)usage;
metadataPackage = mpu.MetadataPackage;

}

if (metadataAttribute.Self is MetadataCompoundAttribute)
if (metadataAttribute != null && metadataAttribute.Self is MetadataCompoundAttribute)
{
//MetadataCompoundAttribute mca = (MetadataCompoundAttribute)metadataAttribute.Self;

MetadataCompoundAttribute mca = this.GetUnitOfWork().GetReadOnlyRepository<MetadataCompoundAttribute>().Get(metadataAttribute.Self.Id);

foreach (MetadataNestedAttributeUsage nestedUsage in mca.MetadataNestedAttributeUsages)
{
//Debug.WriteLine("MetadataCompoundAttribute: " + element.Name);
//Debug.WriteLine("*************************: " + element.Name);
//XElement x = element.Descendants().Where(e => e.Name.Equals(nestedUsage.Member.Name)).First();

if (importDocument != null)
{
string parentPath = element.GetAbsoluteXPathWithIndex();

string usagePath = parentPath + "/" + nestedUsage.Label;
//+"/"+ nestedUsage.Member.Name;

XElement usageElement = importDocument.XPathSelectElement(usagePath);
List<XElement> typeList = new List<XElement>();

if (usageElement != null && usageElement.HasElements)
{
int num = usageElement.Elements().Count();
//importDocument.XPathSelectElements(childPath).Count();
//num = XmlUtility.ToXmlDocument(importDocument).SelectNodes(childPath).Count;

if (num == 0)
{
typeList = AddAndReturnAttribute(element, nestedUsage, 1, 1);
//x = setChildren(x, nestedUsage, importDocument);
}
else
{
Expand Down Expand Up @@ -207,6 +207,63 @@ private XElement setChildren(XElement element, BaseUsage usage, XDocument import

}
}
else
{
if (metadataPackage != null)
{

foreach (MetadataAttributeUsage attrUsage in metadataPackage.MetadataAttributeUsages)
{

if (importDocument != null)
{
string parentPath = element.GetAbsoluteXPathWithIndex();

string usagePath = parentPath + "/" + attrUsage.Label;


XElement usageElement = importDocument.XPathSelectElement(usagePath);
List<XElement> typeList = new List<XElement>();

if (usageElement != null && usageElement.HasElements)
{
int num = usageElement.Elements().Count();

if (num == 0)
{
typeList = AddAndReturnAttribute(element, attrUsage, 1, 1);
}
else
{
typeList = AddAndReturnAttribute(element, attrUsage, 1, num);
}


}
else
{
Debug.WriteLine("NULL OR EMPTY:------> " + usagePath);

typeList = AddAndReturnAttribute(element, attrUsage, 1, 1);
}

foreach (var type in typeList)
{
setChildren(type, attrUsage, importDocument);
}

}
else
{
List<XElement> typeList = new List<XElement>();

typeList = AddAndReturnAttribute(element, attrUsage, 1, 1);
setChildren(typeList.FirstOrDefault(), attrUsage, importDocument);
}

}
}
}

return element;
}
Expand Down
30 changes: 30 additions & 0 deletions Console/BExIS.Web.Shell/Areas/DCM/Content/bexis-metadata.css
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,34 @@ input:disabled, textarea:disabled, .bx-input.bx-disabled, .bx-textarea.bx-disabl

.bx-info {
cursor:help !important;
}



/****HELP*****/
#help_container {
position: relative
}

#help_nested {
position: absolute;
top: -4px;
left: -2px;
font-size: 200%;
color: rgba(217, 83, 79, 0.7);
}

#show_help_all, #hide_help_all {
float: right;
margin-top: 10px;
margin-right: 20px;
cursor: help !important;
}

#hide_help_all {
display: none;
}

#show_help_all .fa-info, #hide_help_all .fa-ban {
cursor: pointer !important;
}
Loading

0 comments on commit 0490281

Please sign in to comment.