Search in sources :

Example 16 with Group

use of org.eclipse.bpmn2.Group in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method testUnmarshallBusinessRuleTask.

@Test
public void testUnmarshallBusinessRuleTask() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_BUSINESSRULETASKRULEFLOWGROUP);
    BusinessRuleTask businessRuleTask = null;
    Iterator<Element> it = nodesIterator(diagram);
    while (it.hasNext()) {
        Element element = it.next();
        if (element.getContent() instanceof View) {
            Object oDefinition = ((View) element.getContent()).getDefinition();
            if (oDefinition instanceof BusinessRuleTask) {
                businessRuleTask = (BusinessRuleTask) oDefinition;
                break;
            }
        }
    }
    assertNotNull(businessRuleTask);
    assertNotNull(businessRuleTask.getExecutionSet());
    assertNotNull(businessRuleTask.getExecutionSet().getRuleFlowGroup());
    assertNotNull(businessRuleTask.getGeneral());
    assertNotNull(businessRuleTask.getGeneral().getName());
    assertEquals(businessRuleTask.getTaskType().getValue(), TaskTypes.BUSINESS_RULE);
    assertEquals("my business rule task", businessRuleTask.getGeneral().getName().getValue());
    assertEquals("my-ruleflow-group", businessRuleTask.getExecutionSet().getRuleFlowGroup().getValue());
    assertEquals("true", businessRuleTask.getExecutionSet().getIsAsync().getValue().toString());
    assertEquals("true", businessRuleTask.getExecutionSet().getIsAsync().getValue().toString());
    assertEquals("System.out.println(\"Hello\");", businessRuleTask.getExecutionSet().getOnEntryAction().getValue().getValues().get(0).getScript());
    assertEquals("java", businessRuleTask.getExecutionSet().getOnEntryAction().getValue().getValues().get(0).getLanguage());
    assertEquals("System.out.println(\"Bye\");", businessRuleTask.getExecutionSet().getOnExitAction().getValue().getValues().get(0).getScript());
    assertEquals("java", businessRuleTask.getExecutionSet().getOnExitAction().getValue().getValues().get(0).getLanguage());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) FlowElement(org.eclipse.bpmn2.FlowElement) RootElement(org.eclipse.bpmn2.RootElement) Element(org.kie.workbench.common.stunner.core.graph.Element) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) BusinessRuleTask(org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Test(org.junit.Test)

Example 17 with Group

use of org.eclipse.bpmn2.Group in project sis by apache.

the class DecoderWrapper method numericValue.

/**
 * Returns the value of the attribute of the given name as a number, or {@code null} if none.
 *
 * @param  name  the name of the attribute to search, or {@code null}.
 * @return the attribute value, or {@code null} if none or unparsable or if the given name was null.
 */
@Override
public Number numericValue(final String name) {
    if (name != null) {
        for (final Group group : groups) {
            final Attribute attribute = findAttribute(group, name);
            if (attribute != null) {
                final Number value = attribute.getNumericValue();
                if (value != null) {
                    return value;
                }
                String asString = attribute.getStringValue();
                if (asString != null && !(asString = asString.trim()).isEmpty()) {
                    return parseNumber(asString);
                }
            }
        }
    }
    return null;
}
Also used : Group(ucar.nc2.Group) Attribute(ucar.nc2.Attribute)

Example 18 with Group

use of org.eclipse.bpmn2.Group in project openflowplugin by opendaylight.

the class SalGroupsBatchServiceImpl method updateGroupsBatch.

@Override
public Future<RpcResult<UpdateGroupsBatchOutput>> updateGroupsBatch(final UpdateGroupsBatchInput input) {
    final List<BatchUpdateGroups> batchUpdateGroups = input.getBatchUpdateGroups();
    LOG.trace("Updating groups @ {} : {}", PathUtil.extractNodeId(input.getNode()), batchUpdateGroups.size());
    final ArrayList<ListenableFuture<RpcResult<UpdateGroupOutput>>> resultsLot = new ArrayList<>();
    for (BatchUpdateGroups batchGroup : batchUpdateGroups) {
        final UpdateGroupInput updateGroupInput = new UpdateGroupInputBuilder(input).setOriginalGroup(new OriginalGroupBuilder(batchGroup.getOriginalBatchedGroup()).build()).setUpdatedGroup(new UpdatedGroupBuilder(batchGroup.getUpdatedBatchedGroup()).build()).setGroupRef(createGroupRef(input.getNode(), batchGroup)).setNode(input.getNode()).build();
        resultsLot.add(JdkFutureAdapters.listenInPoolThread(salGroupService.updateGroup(updateGroupInput)));
    }
    final Iterable<Group> groups = batchUpdateGroups.stream().map(BatchGroupInputUpdateGrouping::getUpdatedBatchedGroup).collect(Collectors.toList());
    final ListenableFuture<RpcResult<List<BatchFailedGroupsOutput>>> commonResult = Futures.transform(Futures.allAsList(resultsLot), GroupUtil.<UpdateGroupOutput>createCumulatingFunction(groups, batchUpdateGroups.size()));
    ListenableFuture<RpcResult<UpdateGroupsBatchOutput>> updateGroupsBulkFuture = Futures.transform(commonResult, GroupUtil.GROUP_UPDATE_TRANSFORM);
    if (input.isBarrierAfter()) {
        updateGroupsBulkFuture = BarrierUtil.chainBarrier(updateGroupsBulkFuture, input.getNode(), transactionService, GroupUtil.GROUP_UPDATE_COMPOSING_TRANSFORM);
    }
    return updateGroupsBulkFuture;
}
Also used : Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group) UpdateGroupOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput) BatchFailedGroupsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.batch.group.output.list.grouping.BatchFailedGroupsOutput) ArrayList(java.util.ArrayList) OriginalGroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.OriginalGroupBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) UpdateGroupInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInputBuilder) UpdatedGroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroupBuilder) UpdateGroupInput(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput) BatchUpdateGroups(org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.update.groups.batch.input.BatchUpdateGroups) ListenableFuture(com.google.common.util.concurrent.ListenableFuture)

Example 19 with Group

use of org.eclipse.bpmn2.Group in project bioformats by openmicroscopy.

the class NetCDFServiceImpl method getDimension.

@Override
public int getDimension(String name) {
    String groupName = getDirectory(name);
    String variableName = getName(name);
    Group group = getGroup(groupName);
    return group.findDimension(variableName).getLength();
}
Also used : Group(ucar.nc2.Group)

Example 20 with Group

use of org.eclipse.bpmn2.Group in project bioformats by openmicroscopy.

the class NetCDFServiceImpl method getArray.

/* (non-Javadoc)
   * @see loci.formats.NetCDFService#getArray(java.lang.String, int[], int[])
   */
@Override
public Object getArray(String path, int[] origin, int[] shape) throws ServiceException {
    String groupName = getDirectory(path);
    String variableName = getName(path);
    Group group = getGroup(groupName);
    Variable variable = group.findVariable(variableName);
    try {
        if (origin != null && shape != null) {
            return variable.read(origin, shape).reduce().copyToNDJavaArray();
        }
        return variable.read().copyToNDJavaArray();
    } catch (InvalidRangeException e) {
        throw new ServiceException(e);
    } catch (IOException e) {
        throw new ServiceException(e);
    } catch (NullPointerException e) {
        return null;
    }
}
Also used : Group(ucar.nc2.Group) Variable(ucar.nc2.Variable) ServiceException(loci.common.services.ServiceException) InvalidRangeException(ucar.ma2.InvalidRangeException) IOException(java.io.IOException)

Aggregations

ArrayList (java.util.ArrayList)9 Group (org.gluu.oxtrust.model.scim2.Group)8 Test (org.junit.Test)8 Group (org.openstack4j.model.identity.v3.Group)8 Group (ucar.nc2.Group)8 GluuGroup (org.gluu.oxtrust.model.GluuGroup)7 DuplicateEntryException (org.gluu.site.ldap.exception.DuplicateEntryException)7 Group (com.google.monitoring.v3.Group)5 EntryPersistenceException (org.gluu.site.ldap.persistence.exception.EntryPersistenceException)5 FlowElement (org.eclipse.bpmn2.FlowElement)4 RootElement (org.eclipse.bpmn2.RootElement)4 GroupName (com.google.monitoring.v3.GroupName)3 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)3 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)3 URI (java.net.URI)3 Date (java.util.Date)3 DefaultValue (javax.ws.rs.DefaultValue)3 HeaderParam (javax.ws.rs.HeaderParam)3 Produces (javax.ws.rs.Produces)3 Response (javax.ws.rs.core.Response)3