/// <summary>
/// ファイル出力QueryExpression組合せ
/// </summary>
/// <param name="entityName">対象エンティティ名</param>
private QueryExpression GetQueryExpression(string entityName)
{
// データ検索
var values = new string[] { "team", "systemuser" };
var queryExpression = new QueryExpression(_context.LogicName)
{
ColumnSet = new ColumnSet("principalobjectaccessid", "principaltypecode", "principalid", "objecttypecode", "objectid", "accessrightsmask"),
Criteria =
{
Conditions =
{
new ConditionExpression("principaltypecode", ConditionOperator.In, values),
new ConditionExpression("principalid", ConditionOperator.NotEqual, _context.TSBTeamID),
new ConditionExpression("accessrightsmask", ConditionOperator.GreaterEqual, 1),
new ConditionExpression("objecttypecode", ConditionOperator.Equal, entityName)
},
},
};
// 共通
var linkTeam = new LinkEntity
{
JoinOperator = JoinOperator.LeftOuter,
LinkFromEntityName = "principalobjectaccess",
LinkFromAttributeName = "principalid",
LinkToEntityName = "team",
LinkToAttributeName = "teamid",
EntityAlias = "team",
Columns = new ColumnSet("name"),
};
// 共通
var linkSystemUser = new LinkEntity
{
JoinOperator = JoinOperator.LeftOuter,
LinkFromEntityName = "principalobjectaccess",
LinkFromAttributeName = "principalid",
LinkToEntityName = "systemuser",
LinkToAttributeName = "systemuserid",
EntityAlias = "systemuser",
Columns = new ColumnSet("fullname"),
};
// 共通
var linkOrg = new LinkEntity
{
JoinOperator = JoinOperator.LeftOuter,
LinkFromEntityName = "principalobjectaccess",
LinkFromAttributeName = "principalid",
LinkToEntityName = "new_organization",
LinkToAttributeName = "new_team",
EntityAlias = "org",
Columns = new ColumnSet("new_field1", "new_field2", "new_field3"),
};
// 共通
var linkLineTeam = new LinkEntity
{
JoinOperator = JoinOperator.LeftOuter,
LinkFromEntityName = "new_organization",
LinkFromAttributeName = "new_team_share",
LinkToEntityName = "team",
LinkToAttributeName = "teamid",
EntityAlias = "lineteam",
Columns = new ColumnSet("name"),
};
queryExpression.LinkEntities.Add(linkTeam);
queryExpression.LinkEntities.Add(linkSystemUser);
if (_getOrganization)
{
linkOrg.LinkEntities.Add(linkLineTeam);
queryExpression.LinkEntities.Add(linkOrg);
}
// 顧客情報出力
var linkAccount = new LinkEntity
{
JoinOperator = JoinOperator.LeftOuter,
LinkFromEntityName = "principalobjectaccess",
LinkFromAttributeName = "objectid",
LinkToEntityName = "account",
LinkToAttributeName = "accountid",
EntityAlias = "acct",
Columns = new ColumnSet("statecode", "new_field1", "new_field2", "new_field3"),
};
// 連絡先出力
var linkCatct = new LinkEntity
{
JoinOperator = JoinOperator.LeftOuter,
LinkFromEntityName = "principalobjectaccess",
LinkFromAttributeName = "objectid",
LinkToEntityName = "contact",
LinkToAttributeName = "contactid",
EntityAlias = "catct",
Columns = new ColumnSet("statecode", "new_field1", "new_field2", "new_field3"),
};
var catctLinkAccount = new LinkEntity
{
JoinOperator = JoinOperator.LeftOuter,
LinkFromEntityName = "contact",
LinkFromAttributeName = "parentcustomerid",
LinkToEntityName = "account",
LinkToAttributeName = "accountid",
EntityAlias = "catct_acct",
Columns = new ColumnSet("statecode", "new_field1", "new_field2", "new_field3"),
};
linkCatct.LinkEntities.Add(catctLinkAccount);
switch (entityName)
{
case "account":
queryExpression.LinkEntities.Add(linkAccount);
break;
case "contact":
queryExpression.LinkEntities.Add(linkCatct);
break;
case "new_execution_pipeline":
queryExpression.LinkEntities.Add(linkPipl);
break;
default:
break;
}
return queryExpression;
}
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme