Skip to content

Commit

Permalink
Fixed subscription for substance administrations. Updated small bug o…
Browse files Browse the repository at this point in the history
…n long view. Added code to SQLite report datasource to output SQL to be run
  • Loading branch information
Justin Fyfe committed Feb 15, 2018
1 parent 7839fe5 commit 541007b
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 2 deletions.
11 changes: 11 additions & 0 deletions Minims/MiniAppletManagerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ public class MiniAppletManagerService : LocalAppletManagerService
// Applet bas directory
internal Dictionary<AppletManifest, String> m_appletBaseDir = new Dictionary<AppletManifest, string>();

/// <summary>
/// Install applet
/// </summary>
/// <param name="package"></param>
/// <param name="isUpgrade"></param>
/// <returns></returns>
public override bool Install(AppletPackage package, bool isUpgrade = false)
{
return false;
}

/// <summary>
/// Mime types
/// </summary>
Expand Down
11 changes: 10 additions & 1 deletion OizDebug/Shell/DebuggerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,16 @@ public void UuidInfo()
[Command("uuid", "Displays information about the provided uuid")]
public void UuidInfo(String uuid)
{
var g = Guid.Parse(uuid);
Guid g;
if (uuid.StartsWith("x", StringComparison.OrdinalIgnoreCase))
{
uuid = uuid.Substring(1);
g = new Guid(Enumerable.Range(0, uuid.Length)
.Where(x => x % 2 == 0)
.Select(x => Convert.ToByte(uuid.Substring(x, 2), 16)).ToArray());
}
else
g = Guid.Parse(uuid);
Console.WriteLine("UUID: {0}", g);
Console.WriteLine("HEX: {0}", BitConverter.ToString(g.ToByteArray()).Replace("-", ""));
Console.WriteLine("DEC: {0}", new BigInteger(g.ToByteArray()));
Expand Down
16 changes: 16 additions & 0 deletions OpenIZ.Mobile.Core.Xamarin/Data/SQLiteReportDatasource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ public IEnumerable<dynamic> ExecuteDataset(List<ReportConnectionString> connecti
cmd.Parameters.Add(parm);
}

#if DEBUG
var filledSql = cmd.CommandText;
for(int i = 0; i < cmd.Parameters.Count; i++ )
{
var idx = filledSql.IndexOf("?");
filledSql = filledSql.Remove(idx, 1);
var var = cmd.Parameters[i].Value;
if (var is byte[])
var = $"x'{BitConverter.ToString((byte[])var).Replace("-", "")}'";
else if (var == null)
var = "null";
filledSql = filledSql.Insert(idx, var.ToString());
}
this.m_tracer.TraceVerbose(filledSql);
#endif

// data reader
try
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using OpenIZ.Core.Model.Acts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OpenIZ.Mobile.Core.Configuration.Data.Migrations
{
/// <summary>
/// Subscribe to primary location update
/// </summary>
class SubscribePrimaryLocationUpdate : IDbMigration
{
/// <summary>
/// Description
/// </summary>
public string Description
{
get
{
return "Updates subscriptions to include all data the location authored";
}
}

/// <summary>
/// Gets id of the update
/// </summary>
public string Id
{
get
{
return "update-subscription-primary-location";
}
}

/// <summary>
/// Install the migration
/// </summary>
public bool Install()
{

var syncSection = ApplicationContext.Current.Configuration.GetSection<SynchronizationConfigurationSection>();

// Un-subscribe to SubstanceAdministration
syncSection.SynchronizationResources.RemoveAll(o => o.ResourceType == typeof(SubstanceAdministration));

// Re-add substance administrations
syncSection.SynchronizationResources.Add(new SynchronizationResource()
{
Always = false,
Filters = syncSection.Facilities.SelectMany(o=> new String[] {
$"participation[RecordTarget].player.relationship[DedicatedServiceDeliveryLocation|IncidentalServiceDeliveryLocation].target={o}",
$"participation[Location|InformationRecipient|EntryLocation].player={o}&participation[RecordTarget].player.relationship[DedicatedServiceDeliveryLocation|IncidentalServiceDeliveryLocation].target=!{o}"
}).ToList(),
ResourceType = typeof(SubstanceAdministration),
Triggers = SynchronizationPullTriggerType.Always
});
return true;
}
}
}
1 change: 1 addition & 0 deletions OpenIZ.Mobile.Core/OpenIZ.Mobile.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<ItemGroup>
<Compile Include="Configuration\Data\Migrations\CatalogEdmonton4Update.cs" />
<Compile Include="Configuration\Data\Migrations\InitialAuditCatalog.cs" />
<Compile Include="Configuration\Data\Migrations\SubscribePrimaryLocationUpdate.cs" />
<Compile Include="DataModelExtensions.cs" />
<Compile Include="Data\Connection\LockableSQLiteConnection.cs" />
<Compile Include="Data\Connection\ReadonlySQLiteConnection.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h2 class="panel-title text-center">{{ 'locale.security.login.title' | i18n }} <
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-12 col-sm-4"><img src="~/img/logo.png" class="img-responsive center-block" /></div>
<div class="col-xs-12 col-sm-4"><img src="~/img/icon.png" class="img-responsive center-block" /></div>
<div class="col-xs-12 col-sm-8"><!-- #include virtual="/org.openiz.core/views/common/security/login.html" --></div>
</div>
</div>
Expand Down

0 comments on commit 541007b

Please sign in to comment.