/** * Creates a new {@code TaskGroupExecutionLimitationType} instance by deeply copying a given {@code TaskGroupExecutionLimitationType} instance. * * * @param o * The instance to copy. * @throws NullPointerException * if {@code o} is {@code null}. */ public TaskGroupExecutionLimitationType(final TaskGroupExecutionLimitationType o) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 super(); if (o == null) { throw new NullPointerException("Cannot create a copy of 'TaskGroupExecutionLimitationType' from 'null'."); } // CBuiltinLeafInfo: java.lang.String this.groupName = ((o.groupName == null)?null:o.getGroupName()); // CBuiltinLeafInfo: java.lang.Integer this.limit = ((o.limit == null)?null:o.getLimit()); }
/** * Creates and returns a deep copy of this object. * * * @return * A deep copy of this object. */ @Override public TaskGroupExecutionLimitationType clone() { try { { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 final TaskGroupExecutionLimitationType clone = ((TaskGroupExecutionLimitationType) super.clone()); // CBuiltinLeafInfo: java.lang.String clone.groupName = ((this.groupName == null)?null:this.getGroupName()); // CBuiltinLeafInfo: java.lang.Integer clone.limit = ((this.limit == null)?null:this.getLimit()); return clone; } } catch (CloneNotSupportedException e) { // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ throw new AssertionError(e); } }
private static Integer getNodeLimitation(NodeType node, String group) { if (node.getTaskExecutionLimitations() == null) { return null; } group = MiscUtil.nullIfEmpty(group); for (TaskGroupExecutionLimitationType limit : node.getTaskExecutionLimitations().getGroupLimitation()) { if (Objects.equals(group, MiscUtil.nullIfEmpty(limit.getGroupName()))) { return limit.getLimit(); } } for (TaskGroupExecutionLimitationType limit : node.getTaskExecutionLimitations().getGroupLimitation()) { if (TaskConstants.LIMIT_FOR_OTHER_GROUPS.equals(limit.getGroupName())) { return limit.getLimit(); } } return null; }
void setLocalExecutionLimitations(Scheduler scheduler, TaskExecutionLimitationsType limitations) { try { Map<String, Integer> newLimits = new HashMap<>(); if (limitations != null) { for (TaskGroupExecutionLimitationType limit : limitations.getGroupLimitation()) { newLimits.put(MiscUtil.nullIfEmpty(limit.getGroupName()), limit.getLimit()); } } else { // no limits -> everything is allowed } Map<String, Integer> oldLimits = scheduler.getExecutionLimits(); // just for the logging purposes scheduler.setExecutionLimits(newLimits); if (oldLimits == null || !new HashMap<>(oldLimits).equals(newLimits)) { LOGGER.info("Quartz scheduler execution limits set to: {} (were: {})", newLimits, oldLimits); } } catch (SchedulerException e) { // should never occur, as local scheduler shouldn't throw such exceptions throw new SystemException("Couldn't set local Quartz scheduler execution capabilities: " + e.getMessage(), e); } } }
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = 1; { String theGroupName; theGroupName = this.getGroupName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "groupName", theGroupName), currentHashCode, theGroupName); } { Integer theLimit; theLimit = this.getLimit(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "limit", theLimit), currentHashCode, theLimit); } return currentHashCode; }
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof TaskGroupExecutionLimitationType)) { return false; } if (this == object) { return true; } final TaskGroupExecutionLimitationType that = ((TaskGroupExecutionLimitationType) object); { String lhsGroupName; lhsGroupName = this.getGroupName(); String rhsGroupName; rhsGroupName = that.getGroupName(); if (!strategy.equals(LocatorUtils.property(thisLocator, "groupName", lhsGroupName), LocatorUtils.property(thatLocator, "groupName", rhsGroupName), lhsGroupName, rhsGroupName)) { return false; } } { Integer lhsLimit; lhsLimit = this.getLimit(); Integer rhsLimit; rhsLimit = that.getLimit(); if (!strategy.equals(LocatorUtils.property(thisLocator, "limit", lhsLimit), LocatorUtils.property(thatLocator, "limit", rhsLimit), lhsLimit, rhsLimit)) { return false; } } return true; }