Search in sources :

Example 1 with InstanceDetails

use of com.cognifide.cq.cqsm.api.history.InstanceDetails in project APM by Cognifide.

the class RemoteScriptExecutionActionReceiver method handleAction.

@Override
public void handleAction(final ValueMap valueMap) {
    Preconditions.checkState(instanceTypeProvider.isOnAuthor(), "Action Receiver has to be called in author");
    String userId = valueMap.get(ReplicationAction.PROPERTY_USER_ID, String.class);
    SlingHelper.operateTraced(resolverFactory, userId, new OperateCallback() {

        @Override
        public void operate(ResourceResolver resolver) throws Exception {
            // FIXME would be lovely to cast ValueMap -> ModifiableEntryBuilder
            String scriptLocation = valueMap.get(ModifiableEntryBuilder.FILE_PATH_PROPERTY, String.class);
            Resource scriptResource = resolver.getResource(scriptLocation);
            Script script = scriptResource.adaptTo(ScriptImpl.class);
            InstanceDetails instanceDetails = getInstanceDetails(valueMap);
            Progress progress = getProgress(valueMap, resolver.getUserID());
            Calendar executionTime = getCalendar(valueMap);
            Mode mode = getMode(valueMap);
            history.logRemote(script, mode, progress, instanceDetails, executionTime);
        }
    });
}
Also used : Script(com.cognifide.cq.cqsm.api.scripts.Script) Progress(com.cognifide.cq.cqsm.api.logger.Progress) InstanceDetails(com.cognifide.cq.cqsm.api.history.InstanceDetails) ScriptImpl(com.cognifide.cq.cqsm.core.scripts.ScriptImpl) Calendar(java.util.Calendar) Mode(com.cognifide.cq.cqsm.api.executors.Mode) ResourceResolver(org.apache.sling.api.resource.ResourceResolver) Resource(org.apache.sling.api.resource.Resource) OperateCallback(com.cognifide.cq.cqsm.core.utils.sling.OperateCallback)

Aggregations

Mode (com.cognifide.cq.cqsm.api.executors.Mode)1 InstanceDetails (com.cognifide.cq.cqsm.api.history.InstanceDetails)1 Progress (com.cognifide.cq.cqsm.api.logger.Progress)1 Script (com.cognifide.cq.cqsm.api.scripts.Script)1 ScriptImpl (com.cognifide.cq.cqsm.core.scripts.ScriptImpl)1 OperateCallback (com.cognifide.cq.cqsm.core.utils.sling.OperateCallback)1 Calendar (java.util.Calendar)1 Resource (org.apache.sling.api.resource.Resource)1 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)1