本文整理了Java中org.ogema.core.model.Resource.deactivate
方法的一些代码示例,展示了Resource.deactivate
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.deactivate
方法的具体详情如下:
包路径:org.ogema.core.model.Resource
类名称:Resource
方法名:deactivate
暂无
代码示例来源:origin: org.ogema.ref-impl/resource-manager
@Override
public void rollback() throws IllegalStateException {
if (!done)
throw new IllegalStateException("Transaction has not been executed yet, cannot set back");
if (setBack)
throw new IllegalStateException("Transaction has been rolled back already");
setBack =true;
// if (!existed) {
// target.delete();
// return;
// }
try {
if (oldState && !activate)
target.activate(false);
else if (!oldState && activate)
target.deactivate(false);
} catch (Exception e) {
// we better ignore this... e.g. it could fail due to missing permissions, in which case already the original action should have failed
}
rollbackSubactions();
}
代码示例来源:origin: org.ogema.widgets/widget-extended
@Override
public void onPOSTComplete(String data, OgemaHttpRequest req) {
final Resource r = getResource(req);
if (r == null)
return;
if (r.isActive())
r.deactivate(activateRecursively);
else
r.activate(activateRecursively);
}
代码示例来源:origin: org.ogema.ref-impl/resource-manager
@Override
public void execute() throws Exception {
if (done || setBack)
throw new IllegalStateException("Transaction has been executed already");
done = true;
buildActionsTree(); // we cannot do this earlier, e.g. in the constructor, since at that time no resource lock is held
executeSubActions();
if (!target.exists())
throw new VirtualResourceException("Target resource " + target + " is virtual");
oldState = target.isActive();
if (activate)
target.activate(false);
else
target.deactivate(false);
}
代码示例来源:origin: org.ogema.ref-impl/resource-manager
@Override
public void deactivate() {
final Collection<Resource> resources = getResources();
m_dbMan.lockStructureWrite();
m_dbMan.startTransaction();
try {
for (Resource resource : resources) {
resource.deactivate(false);
}
} finally {
m_dbMan.finishTransaction();
m_dbMan.unlockStructureWrite();
}
}
代码示例来源:origin: org.ogema.tools/resource-manipulators
/**
* returns true iff value of target resource remains to be set
*/
@SuppressWarnings("fallthrough")
private boolean handleFilter(float targetValue, Filter filter) {
if (filterSatisfied(targetValue, filter)) {
return true;
}
int mode = 0;
if (filter.mode().isActive())
mode = filter.mode().getValue();
switch (mode) {
case 0:
target.deactivate(false);
default: // includes case 1
return false;
}
}
代码示例来源:origin: org.ogema.tools/resource-manipulators
sum = Float.NaN;
if (m_config.deactivateEmptySum().getValue()) {
m_config.resultBase().deactivate(false);
m_config.resultBase().deactivate(false);
代码示例来源:origin: org.ogema.tools/resource-manipulators
/**
* Note: this is not only called because of the timer having elapsed. It is
* also called explicitly by other methods in this controller.
*/
@Override
public void timerElapsed(Timer timer) {
timer.stop();
// only do something if you actually can actually write to the target.
final boolean targetWriteable = requiredWriteAccessGranted && target.exists();
if (!targetWriteable) {
return;
}
final long t0 = appMan.getFrameworkTime();
final SampledValue currentProgramValue = (program.isActive()) ? program.getValue(t0) : null;
final boolean hasGoodProgramValue = (currentProgramValue != null)
&& (currentProgramValue.getQuality() == Quality.GOOD);
if (hasGoodProgramValue) {
setProgramValue(currentProgramValue, rangeFilter);
// target.activate(false); // moved to setProgramValue method, since it may happen that target needs
// to be deactived, if filter condition not satisfied
}
else { // no good program: de-activate.
if (deactivateIfValueMissing.getValue())
target.deactivate(false);
}
// if there is a valid program, estimate the next required call to this.
if (program.isActive()) {
restartTimer(t0);
}
}
内容来源于网络,如有侵权,请联系作者删除!