use of org.apache.commons.collections.Closure in project head by mifos.
the class MultipleLoanAccountsCreationActionForm method reset.
@Override
public void reset(ActionMapping mapping, HttpServletRequest request) {
super.reset(mapping, request);
CollectionUtils.forAllDo(clientDetails, new Closure() {
@Override
public void execute(Object arg0) {
((MultipleLoanCreationDto) arg0).resetSelected();
}
});
}
use of org.apache.commons.collections.Closure in project gocd by gocd.
the class BuildAssignmentService method onConfigChange.
public void onConfigChange(CruiseConfig newCruiseConfig) {
LOGGER.info("[Configuration Changed] Removing jobs for pipelines that no longer exist in configuration.");
synchronized (this) {
List<JobPlan> jobsToRemove = new ArrayList<>();
for (JobPlan jobPlan : jobPlans) {
if (!newCruiseConfig.hasBuildPlan(new CaseInsensitiveString(jobPlan.getPipelineName()), new CaseInsensitiveString(jobPlan.getStageName()), jobPlan.getName(), true)) {
jobsToRemove.add(jobPlan);
}
}
forAllDo(jobsToRemove, new Closure() {
@Override
public void execute(Object o) {
removeJob((JobPlan) o);
}
});
}
}
use of org.apache.commons.collections.Closure in project smarthome by eclipse.
the class JavaSoundAudioSink method getVolume.
@Override
public PercentType getVolume() throws IOException {
if (!isMac) {
final Float[] volumes = new Float[1];
runVolumeCommand(new Closure() {
@Override
public void execute(Object input) {
FloatControl volumeControl = (FloatControl) input;
volumes[0] = volumeControl.getValue();
}
});
if (volumes[0] != null) {
return new PercentType(new BigDecimal(volumes[0] * 100f));
} else {
throw new IOException("Cannot determine master volume level");
}
} else {
// we use a cache of the value as the script execution is pretty slow
if (macVolumeValue == null) {
Process p = Runtime.getRuntime().exec(new String[] { "osascript", "-e", "output volume of (get volume settings)" });
String value = IOUtils.toString(p.getInputStream()).trim();
macVolumeValue = new PercentType(value);
}
return macVolumeValue;
}
}
use of org.apache.commons.collections.Closure in project smarthome by eclipse.
the class JavaSoundAudioSink method setVolume.
@Override
public void setVolume(final PercentType volume) throws IOException {
if (volume.intValue() < 0 || volume.intValue() > 100) {
throw new IllegalArgumentException("Volume value must be in the range [0,100]!");
}
if (!isMac) {
runVolumeCommand(new Closure() {
@Override
public void execute(Object input) {
FloatControl volumeControl = (FloatControl) input;
volumeControl.setValue(volume.floatValue() / 100f);
}
});
} else {
Runtime.getRuntime().exec(new String[] { "osascript", "-e", "set volume output volume " + volume.intValue() });
macVolumeValue = volume;
}
}
use of org.apache.commons.collections.Closure in project mule by mulesoft.
the class PersistentXaTransactionContext method size.
public int size(QueueStore queue) {
final AtomicInteger addSize = new AtomicInteger(0);
CollectionUtils.forAllDo(this.transactionJournal.getLogEntriesForTx(xid), new Closure() {
@Override
public void execute(Object value) {
if (((XaQueueTxJournalEntry) value).isAdd() || ((XaQueueTxJournalEntry) value).isAddFirst()) {
addSize.incrementAndGet();
}
}
});
return queue.getSize() + addSize.get();
}
Aggregations