How "old fndmob" c# annotations map to projections in Aurena Native:
AssemblyInfo.cs:
[assembly: AppVersion(Name = "FndmobApp" , Major = 1, Minor = 0, Revision = 0, Component = "FNDMOB")] [assembly: AppSettings(CustomFieldEnabled = true, UseMessaging = true, UseServerSideErrorHandler = true, AllowMultipleDevices = false, GPSEnabled = true)]
.app file:
Entity resource is defined by a c# class and extending DynamicEntityResource class. Entity resources is normally based on a LU view.
[Entity("IsoUnit", "ISO_UNIT", "BasicData", PackageName = "ISO_UNIT_API", DefaultWhere = “”, WriteEnabled = false, DeliveryMethod = EntityAttribute.DeliveryType.NewBatch, DefaultSchedule = "DAILY AT 23:00", TableName = "ISO_UNIT_TAB", ObjversionFormat = "number" )] class ConnectToolsFacilities : DynamicEntityResource { }
Entity is defined in the projection by overriding the default entity definition. A corresponding entityset definition is also required for the entity to be accessible in the client.
@Override entity IsoUnit { syncpolicy Batch { syncschedule = monthly on day 3 at 20:30; } crud = Create, Read, Update; exclude attributes = ‘TYPE’; OR use attribute Abc, Xyz where = "country like ‘A%’"; } }
We only added attributes we want to sync down to the device.
Derived Attributes
private String mStdJobDefinition; [Field("STD_JOB_DEFINITION", SqlExpression = "Standard_Job_API.Get_Definition(std_job_id,contract,STD_JOB_REVISION)")] public String std_job_definition { get { return mStdJobDefinition; } set { mStdJobDefinition = value; } }
Key/Parent key Attribute
[Field("FUNCTION_ID", Key = true)] [Field("WO_NO", TableColumnName = "WO_NO", ParentKey = true)]
Temporary Client keys
[Field("MOB_SIGNATURE_LINE_NO", TableColumnName = "MOB_SIGNATURE_LINE_NO", Key = true, TemporaryClientKey = true)]
By default, projection entity will add all LU view attributes to the meta data. So, in UXX, you will need to exclude un wanted attributes.
All attributes are added to the entity. Unless they have been excluded.
exclude attributes = MyAttrib;
It is also possible to explicitly specify the list of attributes to include in the entity
use attributes = MyAttrib;
Attributes with fetch Statement
attribute StdJobDefinition Text { label = "Std Job"; fetch = "Standard_Job_API.Get_Definition (std_job_id,contract,STD_JOB_REVISION)"; type = String; required = [false]; editable = [false]; }
Key/Parent Attribute are now derived from the entity model flags.
Temporary Client keys are now derived from the entity model meta data
[PlsqlBlock("WorkOrders", "AddJournalEntry", Statement = AddJournalEntry.SQL)] class AddJournalEntry : DynamicPlsqlBlockResource { public const String SQL = @"DECLARE wo_no VARCHAR2(35); user_id VARCHAR2(35); BEGIN user_id := :user_id; wo_no := :wo_no; &AO.Mobile_Work_Order_Util_API. Create_Mobile_Download_Journal(wo_no); END;"; }
Action in Projection Model Implement the corresponding pl/sql method in the svc package
not in use
[Entity("EquipmentSpareStructure", "EQUIPMENT_SPARE_STRUCTURE", "Parts", PackageName = "Equipment_Spare_Structure_API", WriteEnabled = false, QueryStatement = MobileEquipSpareStructure.QUERY, TableName = "EQUIPMENT_SPARE_STRUCTURE_TAB", ObjversionFormat = "number", DeliveryMethod = EntityAttribute.DeliveryType.NewBatch)] class MobileEquipSpareStructure : DynamicEntityResource { const String QUERY = @"SELECT………. FROM <view_name> WHERE <attr> like ‘A%’ }
Entity in Projection Model (Based on SQL/VIEW)
Entity in the projection with from clause to fetch data from the PL view. So same SQL statement can be added as view in the LU.
entity Flight { from = "<view_name>"; where = "<attr> like ‘A%’"; attribute Description Text; attribute Company Text; }
It is also possible to use query definitions in the projection model
[EntityDependency(typeof(TstCompany), new String[] { "COMPANY" }, new String[] { "COMPANY" }, false)] [EntityDependency(typeof(TstCustomer), new String[] { "COMPANY" }, new String[] { "COMPANY" }, true)]
reference CompanyRef(Company) to TstCompany(Company); array Customers(Company) to TstCustomer(Company);