}
}
public void put(RequestContext requestContext) throws RegistryException {
String path = requestContext.getResourcePath().getPath();
Resource resource = requestContext.getResource();
if (resource == null || resource.getProperties() == null) {
return;
}
boolean allItemsAreChecked = true;
String currentState = null;
String lastState = resource.getProperty("registry.dlcm.last.state");
String aspectName = resource.getProperty("registry.LC.name");
Properties props = resource.getProperties();
Iterator iKeys = props.keySet().iterator();
while (iKeys.hasNext()) {
String propKey = (String) iKeys.next();
if (propKey.matches("registry\\p{Punct}lifecycle\\p{Punct}.*\\p{Punct}state")) {
currentState = resource.getProperty(propKey);
if (lastState != null) {
break;
}
}
}
if (currentState == null || (lastState != null && lastState.equals(currentState))) {
return;
}
iKeys = props.keySet().iterator();
while (iKeys.hasNext()) {
String propKey = (String) iKeys.next();
if (propKey.matches("registry\\p{Punct}.*\\p{Punct}checklist\\p{Punct}.*")) {
List<String> propValues = (List<String>) props.get(propKey);
if (propValues == null)
continue;
if (propValues.size() > 2) {
String value = null;
String lifeCycleState = null;
for (String param : propValues) {
if (param.startsWith("status:")) {
lifeCycleState = param.substring(7);
} else if (param.startsWith("value:")) {
value = param.substring(6);
}
}
if ((lifeCycleState != null) && (value != null)) {
if (lifeCycleState.equalsIgnoreCase(currentState)) {
if (value.equalsIgnoreCase("false")) {
allItemsAreChecked = false;
break;
}
}
}
}
}
}
if (!allItemsAreChecked) {
return;
}
String[] actions = null;
try {
Resource oldResource = requestContext.getRepository().get(path);
requestContext.getRepository().put(path, resource);
actions = requestContext.getRegistry().getAspectActions(path, aspectName);
requestContext.getRepository().put(path, oldResource);
if (actions == null) {
return;