예제 #1
0
        }       //	getWhereClause

        /// <summary>
        /// Get Child IDs
        /// </summary>
        /// <param name="ID">start node</param>
        /// <returns>array if IDs</returns>
        public int?[] GetChildIDs(int ID)
        {
            log.Fine("(" + _ElementType + ") ID=" + ID);
            List <int?> list = new List <int?>();
            //
            VTreeNode node = _tree.GetRootNode().FindNode(ID);

            log.Finest("Root=" + node);
            //
            if (node != null && node.IsSummary)
            {
                System.Collections.IEnumerator en = node.preorderEnumeration();
                while (en.MoveNext())
                {
                    VTreeNode nn = (VTreeNode)en.Current;
                    if (!nn.IsSummary)
                    {
                        list.Add(Utility.Util.GetValueOfInt(nn.GetNode_ID()));
                        log.Finest("- " + nn);
                    }
                    else
                    {
                        log.Finest("- skipped parent (" + nn + ")");
                    }
                }
            }
            else //	not found or not summary
            {
                list.Add(Utility.Util.GetValueOfInt(ID));
            }
            //
            int?[] retValue = new int?[list.Count];
            retValue = list.ToArray();
            return(retValue);
        }       //	getWhereClause
예제 #2
0
        }       //	doIt

        /// <summary>
        /// Copy Stage
        /// </summary>
        /// <param name="node">node</param>
        /// <param name="path">path</param>
        /// <param name="isRedeploy">is dedeploy</param>
        private void CopyStage(VTreeNode node, String path, bool isRedeploy)
        {
            CacheHandler thisHandler = new CacheHandler
                                           (CacheHandler.ConvertJNPURLToCacheURL
                                               (_apps_host.Apps_host), log, GetCtx(), Get_Trx());
            int?    ID    = Utility.Util.GetValueOfInt(node.GetNode_ID());
            MCStage stage = _map.Get(ID.Value);
            //
            //int size = node.getChildCount();
            int size = node.Nodes.Count;

            for (int i = 0; i < size; i++)
            {
                VTreeNode child = (VTreeNode)node.Nodes[i];                  // .getChildAt(i);
                int?      ID1   = Utility.Util.GetValueOfInt(child.Node_ID); //.getNode_ID());
                stage = _map.Get(ID1);
                if (stage == null)
                {
                    log.Warning("Not Found ID=" + ID);
                    continue;
                }
                if (!stage.IsActive())
                {
                    continue;
                }
                // If we have a stage and it is modified we will update!
                if (stage != null)
                {
                    if (isRedeploy || stage.IsModified() || stage.IsSummary())
                    {
                        log.Log(Level.INFO, "Deploying container: " + path + stage.ToString());
                        MContainer cc = MContainer.Deploy(_project, stage, path);
                        if (cc != null)
                        {
                            AddLog(0, null, null, "@Updated@: " + cc.GetName());
                            _idList.Add(ID1.Value);
                        }
                        // Remove Container from cache
                        thisHandler.CleanContainer(cc.Get_ID());
                        // Reset Modified flag...
                        stage.SetIsModified(false);
                        stage.Save(stage.Get_Trx());
                    }
                    else
                    {
                        // If not modified we should check update status...
                        // But even if updtodate we need to add it to the list, because otherwise it will get deleted!
                        _idList.Add(ID1.Value);
                    }
                }
                if (child.IsSummary)
                {
                    CopyStage(child, path + stage.GetRelativeURL() + "/", isRedeploy);
                }
            }
        }       //	copyStage
예제 #3
0
        }       //	getTreeType

        /// <summary>
        /// Get Where Clause
        /// </summary>
        /// <param name="ID">start node</param>
        /// <returns>ColumnName = 1 or ColumnName IN (1,2,3)</returns>
        public String GetWhereClause(int ID)
        {
            log.Fine("(" + _ElementType + ") ID=" + ID);
            String ColumnName = MAcctSchemaElement.GetColumnName(_ElementType);

            if (ID == 0)        //	All
            {
                return(ColumnName + " IS NOT NULL");
            }
            VTreeNode nod = _tree.GetRootNode().FindNode(ID);

            log.Finest("Root=" + nod);
            //
            StringBuilder result = null;

            if (nod != null && nod.IsSummary)
            {
                StringBuilder sb = new StringBuilder();
                System.Collections.IEnumerator en = nod.preorderEnumeration();

                while (en.MoveNext())
                {
                    VTreeNode nn = (VTreeNode)en.Current;
                    if (!nn.IsSummary)
                    {
                        if (sb.Length > 0)
                        {
                            sb.Append(",");
                        }
                        sb.Append(nn.GetNode_ID());
                        log.Finest("- " + nn);
                    }
                    else
                    {
                        log.Finest("- skipped parent (" + nn + ")");
                    }
                }

                result = new StringBuilder(ColumnName).Append(" IN (").Append(sb).Append(")");
            }
            else        //	not found or not summary
            {
                result = new StringBuilder(ColumnName).Append("=").Append(ID);
            }
            //
            log.Finest(result.ToString());
            return(result.ToString());
        }       //	getWhereClause