Search in sources :

Example 1 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action in project dhis2-core by dhis2.

the class LoginInterceptor method intercept.

@Override
public String intercept(ActionInvocation invocation) throws Exception {
    Boolean jli = (Boolean) ServletActionContext.getRequest().getSession().getAttribute(LoginInterceptor.JLI_SESSION_VARIABLE);
    if (jli != null) {
        log.debug("JLI marker is present. Running " + actions.size() + " JLI actions.");
        for (Action a : actions) {
            a.execute();
        }
        ServletActionContext.getRequest().getSession().removeAttribute(LoginInterceptor.JLI_SESSION_VARIABLE);
    }
    return invocation.invoke();
}
Also used : Action(com.opensymphony.xwork2.Action)

Example 2 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action in project atlasmap by atlasmap.

the class DefaultAtlasFieldActionService method internalProcessActions.

protected Field internalProcessActions(Actions actions, Object sourceObject, FieldType targetType) throws AtlasException {
    Field processedField = new SimpleField();
    processedField.setValue(sourceObject);
    processedField.setFieldType(targetType);
    if (FieldType.COMPLEX.equals(targetType)) {
        return processedField;
    }
    Object tmpSourceObject = sourceObject;
    FieldType sourceType = (sourceObject != null ? getConversionService().fieldTypeFromClass(sourceObject.getClass()) : FieldType.NONE);
    if (actions == null || actions.getActions() == null || actions.getActions().isEmpty()) {
        if (sourceObject == null) {
            return processedField;
        }
        processedField.setValue(getConversionService().convertType(sourceObject, sourceType, targetType));
        processedField.setFieldType(targetType);
        return processedField;
    }
    FieldType currentType = sourceType;
    for (Action action : actions.getActions()) {
        ActionDetail detail = findActionDetail(action.getDisplayName(), currentType);
        if (!detail.getSourceType().equals(currentType) && !FieldType.ANY.equals(detail.getSourceType())) {
            tmpSourceObject = getConversionService().convertType(sourceObject, currentType, detail.getSourceType());
        }
        processedField.setValue(processAction(action, detail, tmpSourceObject));
        processedField.setFieldType(detail.getTargetType());
        currentType = detail.getTargetType();
    }
    return processedField;
}
Also used : Field(io.atlasmap.v2.Field) SimpleField(io.atlasmap.v2.SimpleField) AtlasFieldAction(io.atlasmap.api.AtlasFieldAction) Action(io.atlasmap.v2.Action) ActionDetail(io.atlasmap.v2.ActionDetail) SimpleField(io.atlasmap.v2.SimpleField) FieldType(io.atlasmap.v2.FieldType)

Example 3 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action in project atlasmap by atlasmap.

the class DefaultAtlasFieldActionsServiceTest method testProcessActionWithActionActionDetailObject.

@Test
public void testProcessActionWithActionActionDetailObject() throws AtlasException {
    ActionDetail actionDetail = null;
    Object sourceObject = "String";
    Action action = new Trim();
    assertEquals(sourceObject, fieldActionsService.processAction(action, actionDetail, sourceObject));
    action = new GenerateUUID();
    actionDetail = new ActionDetail();
    actionDetail.setClassName("io.atlasmap.actions.StringComplexFieldActions");
    actionDetail.setSourceType(FieldType.ANY);
    actionDetail.setMethod("genareteUUID");
    assertNotNull(fieldActionsService.processAction(action, actionDetail, sourceObject));
}
Also used : Action(io.atlasmap.v2.Action) ActionDetail(io.atlasmap.v2.ActionDetail) Trim(io.atlasmap.v2.Trim) GenerateUUID(io.atlasmap.v2.GenerateUUID) Test(org.junit.Test)

Example 4 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action in project weicoder by wdcode.

the class StrutsAction method getAction.

/**
 * 获得当前Action
 * @param <E> 泛型
 * @return Action
 */
@SuppressWarnings("unchecked")
public <E extends Action> E getAction() {
    // 获得值栈里的对象
    Object action = ActionContext.getContext().getValueStack().peek();
    // 判断对象是Action类型的
    if (action instanceof Action) {
        // 返回Action
        return (E) action;
    }
    // 获得Action拦截器
    ActionInvocation ai = ActionContext.getContext().getActionInvocation();
    // 如果拦截器不为空
    if (ai != null) {
        return (E) ai.getAction();
    }
    // 如果都不符合返回null
    return null;
}
Also used : Action(com.opensymphony.xwork2.Action) ActionInvocation(com.opensymphony.xwork2.ActionInvocation)

Example 5 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action in project netvirt by opendaylight.

the class ElanInterfaceManager method bindElanService.

private void bindElanService(long elanTag, String elanInstanceName, String interfaceName, int lportTag, WriteTransaction tx) {
    int instructionKey = 0;
    List<Instruction> instructions = new ArrayList<>();
    instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(ElanHelper.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE, ++instructionKey));
    List<Action> actions = new ArrayList<>();
    actions.add(new ActionRegLoad(0, NxmNxReg1.class, 0, ElanConstants.INTERFACE_TAG_LENGTH - 1, lportTag).buildAction());
    actions.add(new ActionRegLoad(1, ElanConstants.ELAN_REG_ID, 0, ElanConstants.ELAN_TAG_LENGTH - 1, elanTag).buildAction());
    instructions.add(MDSALUtil.buildApplyActionsInstruction(actions, ++instructionKey));
    instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.ARP_CHECK_TABLE, ++instructionKey));
    short elanServiceIndex = ServiceIndex.getIndex(NwConstants.ELAN_SERVICE_NAME, NwConstants.ELAN_SERVICE_INDEX);
    BoundServices serviceInfo = ElanUtils.getBoundServices(String.format("%s.%s.%s", "elan", elanInstanceName, interfaceName), elanServiceIndex, NwConstants.ELAN_SERVICE_INDEX, NwConstants.COOKIE_ELAN_INGRESS_TABLE, instructions);
    InstanceIdentifier<BoundServices> bindServiceId = ElanUtils.buildServiceId(interfaceName, elanServiceIndex);
    Optional<BoundServices> existingElanService = ElanUtils.read(broker, LogicalDatastoreType.CONFIGURATION, bindServiceId);
    if (!existingElanService.isPresent()) {
        tx.put(LogicalDatastoreType.CONFIGURATION, bindServiceId, serviceInfo, WriteTransaction.CREATE_MISSING_PARENTS);
    }
}
Also used : BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) ArrayList(java.util.ArrayList) ActionRegLoad(org.opendaylight.genius.mdsalutil.actions.ActionRegLoad) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)

Aggregations

ArrayList (java.util.ArrayList)254 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)204 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)176 Test (org.junit.Test)131 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder)127 GroupActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder)126 PushMplsActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder)121 PushPbbActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder)121 PopVlanActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder)110 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)108 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)107 PopMplsActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder)105 PopPbbActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder)105 PushVlanActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder)105 InstructionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)105 SetVlanIdActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder)98 ApplyActionsCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder)98 ActionKey (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey)97 InstructionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder)97 ApplyActionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder)96