Using the below class we can publish entities to BYOD
class Entitypublish
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
DmfPublishedEntity dmfPublishedEntity;
MV2EntityList EntityList;
DMFDataSource dmfDataSource;
container listOfUnPublishedEntites,listOfPublishedEnties;
boolean alreadyPublished;
Entitypublish class1 = new Entitypublish();
while select * from EntityList
{
DMFEntity entityloc = DMFEntity::find(EntityList.EntityName);
dmfDataSource = dmfDataSource::find("BYOD10");
select firstonly EntityName from dmfPublishedEntity
where dmfPublishedEntity.EntityName == entityloc.EntityName
&& dmfPublishedEntity.SourceFormat == dmfDataSource.SourceName;
if (dmfPublishedEntity.RecId)
{
alreadyPublished = true;
listOfPublishedEnties =conIns(listOfPublishedEnties,1, dmfPublishedEntity.EntityName);
}
else
{
listOfUnPublishedEntites =conIns(listOfUnPublishedEntites,1,entityloc.EntityName);
}
class1.changetracking(entityloc);
}
if (alreadyPublished)
{
str publishedEnties = con2Str(listOfPublishedEnties,',');
DialogButton dialogBox = Box::yesNo(strFmt('@DMF:DMFEntityRePublishConfirm',publishedEnties,dmfDataSource.SourceName),DialogButton::No);
if (dialogBox == DialogButton::Yes)
{
DMFEntityDbPublish::publishSchemaAsync(str2con(dmfDataSource.SourceName),listOfPublishedEnties,NoYes::Yes, '');
}
}
if (conLen(listOfUnPublishedEntites))
{
DMFEntityDbPublish::publishSchemaAsync(str2con(dmfDataSource.SourceName),listOfUnPublishedEntites,NoYes::No, '');
}
}
//Change tracking
public void changetracking(DMFEntity _entityloc)
{
DictDataEntity dictEntity = new DictDataEntity(tableName2Id(_entityloc.TargetEntity));
Query query = DMFEntityBase::defaultCTQuery(dictEntity);
if(query == null)
{
if (DMFEntityBase::enableChangeTracking(_entityloc, true, true, false))
{
this.listOfTablesCTEnabled(_entityloc, DMFChangeTrackingType::ALL);
}
}
else
{
if(DMFEntityBase::enableChangeTracking(_entityloc, true, true,true))
{
this.listOfTablesCTEnabled(_entityloc, DMFChangeTrackingType::CustomQuery);
}
}
}
public void listOfTablesCTEnabled(DMFEntity _entity,DMFChangeTrackingType __changeTrackingType)
{
AifSqlChangeTrackingEnabledTables CTEnabledTablesloc;
container listOfEnabledTables;
while select TableName from CTEnabledTablesloc
where CTEnabledTablesloc.EntityName == _entity.TargetEntity
{
listOfEnabledTables = conIns(listOfEnabledTables,1,CTEnabledTablesloc.TableName);
}
if (conLen(listOfEnabledTables))
{
info(strFmt("@DMF:DMFCTEnableSuccess", _entity.EntityName));
info(strFmt("@DMF:DMFCTEnabledList",con2Str(listOfEnabledTables)));
info("@DMF:DMFCTIncrementalPush");
}
}
}
No comments:
Post a Comment