コード例 #1
0
ファイル: UPAUtils.cs プロジェクト: nesrinesghaier/upa
 public static void PreparePostAdd(Net.Vpc.Upa.PersistenceUnit persistenceUnit, Net.Vpc.Upa.UPAObject item)
 {
     //        DefaultBeanAdapter adapter = new DefaultBeanAdapter(item);
     Net.Vpc.Upa.I18NStringStrategy strategy = persistenceUnit.GetI18NStringStrategy();
     Net.Vpc.Upa.Types.I18NString   s        = null;
     Net.Vpc.Upa.Types.I18NString   t        = null;
     Net.Vpc.Upa.Types.I18NString   d        = null;
     if (item is Net.Vpc.Upa.Package)
     {
         s = strategy.GetPackageString(((Net.Vpc.Upa.Package)item));
         t = s.Append("title");
         d = s.Append("desc");
     }
     else if (item is Net.Vpc.Upa.Relationship)
     {
         s = strategy.GetRelationshipString((Net.Vpc.Upa.Relationship)item);
         t = s.Append("title");
         d = s.Append("desc");
     }
     else if (item is Net.Vpc.Upa.Entity)
     {
         s = strategy.GetEntityString((Net.Vpc.Upa.Entity)item);
         t = s.Append("title");
         d = s.Append("desc");
     }
     else if (item is Net.Vpc.Upa.Section)
     {
         s = strategy.GetSectionString(((Net.Vpc.Upa.Section)item).GetEntity(), item.GetName());
         t = s.Append("title");
         d = s.Append("desc");
     }
     else if (item is Net.Vpc.Upa.Field)
     {
         s = strategy.GetFieldString((Net.Vpc.Upa.Field)item);
         t = s.Append("title");
         d = s.Append("desc");
     }
     else if (item is Net.Vpc.Upa.RelationshipRole)
     {
         Net.Vpc.Upa.RelationshipRole r = (Net.Vpc.Upa.RelationshipRole)item;
         s = strategy.GetRelationshipRoleString(r);
         t = s.Append("title");
         d = (s.Append("desc").Union(r.GetEntity().GetDescription()));
     }
     item.SetI18NString(s);
     item.SetTitle(t);
     item.SetDescription(d);
 }