예제 #1
0
 ///
 ///	 <summary> * returns true if this is the same phase, i.e. the
 ///	 *  </summary>
 ///	 * <param name="lastphase"> the phase to compare with </param>
 ///	 * <param name="bExact"> if true, use startTime as hook, else compare stati
 ///	 * @return </param>
 ///
 public virtual bool isSamePhase(JDFJobPhase lastphase, bool bExact)
 {
     if (lastphase == null)
     {
         return(false);
     }
     if (bExact)
     {
         JDFDate startTime     = getPhaseStartTime();
         JDFDate lastStartTime = lastphase.getPhaseStartTime();
         return(startTime != null && startTime.Equals(lastStartTime));
     }
     if (!ContainerUtil.Equals(getStatus(), lastphase.getStatus()))
     {
         return(false);
     }
     if (!ContainerUtil.Equals(getStatusDetails(), lastphase.getStatusDetails()))
     {
         return(false);
     }
     if (!ContainerUtil.Equals(getIdentifier(), lastphase.getIdentifier()))
     {
         return(false);
     }
     return(true);
 }
예제 #2
0
        ///
        ///	 <summary> * Create or modify a PhaseTime Audit and fill it If the phase is identical to the prior phase that has been set,
        ///	 * the existing PhaseTime is modified otherwise an existing phaseTime is closed and a new phaseTime is appended
        ///	 * Phasetime elements with different Parts are treated independently
        ///	 *  </summary>
        ///	 * <param name="status"> the node status at this time </param>
        ///	 * <param name="statusDetails"> details of this status </param>
        ///	 * <param name="vmParts"> defines a vector of map of parts for which the PhaseTime is valid </param>
        ///	 * <param name="employees"> Vector of employees that are currently registered for this job </param>
        ///	 * <returns> JDFPhaseTime the newly created PhaseTime audit
        ///	 *
        ///	 *         default: SetPhase(status, null,null,null) </returns>
        ///
        public virtual JDFPhaseTime setPhase(EnumNodeStatus status, string statusDetails, VJDFAttributeMap vmParts, VElement employees)
        {
            string statusDetailsLocal = statusDetails;

            JDFPhaseTime pt = getLastPhase(vmParts, null);

            statusDetailsLocal = StringUtil.getNonEmpty(statusDetailsLocal);
            bool     bChanged    = false;
            VElement ptEmployees = pt == null ? new VElement() : pt.getChildElementVector(ElementName.EMPLOYEE, null);

            if (pt == null)
            {
                bChanged = true;
            }
            else if (!ContainerUtil.Equals(pt.getStatus(), status) || !ContainerUtil.Equals(statusDetailsLocal, pt.getAttribute(AttributeName.STATUSDETAILS, null, null)) || !ptEmployees.isEqual(employees))
            {
                pt.setEnd(new JDFDate());
                bChanged = true;
            }
            if (bChanged)
            {
                pt = addPhaseTime(status, null, vmParts);
                pt.setStatusDetails(statusDetailsLocal);
                pt.copyElements(employees, null);
            }
            return(pt);
        }
예제 #3
0
        ///
        ///	 <summary> * returns true if the input object is equivalent to this or null</br> valid
        ///	 * object types are:<br/> Employee<br/> EmployeeDef<br/> String - must match @PersonalID
        ///	 * <br/> (non-Javadoc)
        ///	 *  </summary>
        ///	 * <seealso cref= org.cip4.jdflib.ifaces.IMatches#matches(java.lang.Object) </seealso>
        ///
        public virtual bool matches(object subset)
        {
            if (subset == null)
            {
                return(true); // ( matches contract requires true for null to allow
            }
            // wildcards

            if (subset is JDFEmployee)
            {
                // TODO more criteria - person etc.
                JDFEmployee employee = (JDFEmployee)subset;
                return(ContainerUtil.Equals(getPersonalID(), employee.getPersonalID()));
            }
            else if (subset is JDFEmployeeDef)
            {
                JDFEmployeeDef ed = (JDFEmployeeDef)subset;
                return(ContainerUtil.Equals(getPersonalID(), ed.getPersonalID()));
            }
            else if (subset is string)
            {
                return(ContainerUtil.Equals(getPersonalID(), subset));
            }

            return(false);
        }
예제 #4
0
        ///
        ///	 <summary> * sets the QueueEntry/@Status if the queue is automated, also resorts the queue to reflect the new Status and sets
        ///	 * the Queue/@Status based on the maximum number of concurrently running jobs also sets StartTime and EndTime
        ///	 * appropriately if the queue is automated
        ///	 *  </summary>
        ///	 * <param name="value"> the queuentry status to set
        ///	 *  </param>
        ///	 * <seealso cref= org.cip4.jdflib.auto.JDFAutoQueueEntry#setQueueEntryStatus(org.cip4.jdflib.auto.JDFAutoQueueEntry.EnumQueueEntryStatus) </seealso>
        ///
        public override void setQueueEntryStatus(EnumQueueEntryStatus @value)
        {
            EnumQueueEntryStatus oldVal = getQueueEntryStatus();

            if (isAutomated() && !ContainerUtil.Equals(oldVal, @value))
            {
                JDFQueue queue = (JDFQueue)getParentNode_KElement();
                lock (queue)
                {
                    base.setQueueEntryStatus(@value);
                    if (isCompleted())
                    {
                        if (!hasAttribute(AttributeName.ENDTIME))
                        {
                            base.setEndTime(new JDFDate());
                        }
                        queue.cleanup();
                    }
                    if (EnumQueueEntryStatus.Running.Equals(@value))
                    {
                        if (!hasAttribute(AttributeName.STARTTIME))
                        {
                            base.setStartTime(new JDFDate());
                        }
                        removeAttribute(AttributeName.ENDTIME);
                    }
                    queue.sortChildren();
                    queue.setStatusFromEntries();
                }
            }
            else if (!ContainerUtil.Equals(oldVal, @value)) // non automated
            {
                base.setQueueEntryStatus(@value);
            }
        }
예제 #5
0
        ///
        ///	 <summary> * Get a PartAmount that fits to the filter defined by mPart
        ///	 *  </summary>
        ///	 * <param name="vPart"> filter for the part to set the status </param>
        ///	 * <returns> the PartAmount that fits </returns>
        ///
        public virtual JDFPartAmount getPartAmount(VJDFAttributeMap vPart)
        {
            VElement vPartAmount = getChildElementVector(ElementName.PARTAMOUNT, null, null, true, 0, false);

            for (int i = vPartAmount.Count - 1; i >= 0; i--)
            {
                JDFPartAmount    partAmount = (JDFPartAmount)vPartAmount[i];
                VJDFAttributeMap vMapPart   = partAmount.getPartMapVector();

                if (ContainerUtil.Equals(vMapPart, vPart))
                {
                    return(partAmount); // exact match
                }
            }
            return(null);
        }