Search in sources :

Example 16 with Group

use of controlP5.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 17 with Group

use of controlP5.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 18 with Group

use of controlP5.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)

Example 19 with Group

use of controlP5.Group in project ORCID-Source by ORCID.

the class Api2_0_rc3_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(GroupsContainer groupsContainerRc3) {
    if (groupsContainerRc3.retrieveGroups() != null && !groupsContainerRc3.retrieveGroups().isEmpty()) {
        List<? extends Group> groupsRc1 = new ArrayList<>(groupsContainerRc3.retrieveGroups());
        List<org.orcid.jaxb.model.record_rc3.Group> groupsRc3 = new ArrayList<>(groupsContainerRc3.retrieveGroups());
        if (groupsRc1.get(0).getActivities() != null && !groupsRc1.get(0).getActivities().isEmpty()) {
            LastModifiedDate latest = null;
            for (Group group : groupsRc3) {
                calculateLastModified(group);
                if (group.getLastModifiedDate() != null && group.getLastModifiedDate().after(latest)) {
                    latest = group.getLastModifiedDate();
                }
            }
            groupsContainerRc3.setLastModifiedDate(latest);
        }
    }
}
Also used : Group(org.orcid.jaxb.model.record_rc3.Group) LastModifiedDate(org.orcid.jaxb.model.common_rc3.LastModifiedDate) ArrayList(java.util.ArrayList)

Example 20 with Group

use of controlP5.Group in project ORCID-Source by ORCID.

the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.

public static Date calculateLatest(GroupsContainer groupsContainerRc2) {
    Date latestGrp = null;
    if (groupsContainerRc2.retrieveGroups() != null && !groupsContainerRc2.retrieveGroups().isEmpty()) {
        List<? extends Group> groupsRc1 = new ArrayList<>(groupsContainerRc2.retrieveGroups());
        List<org.orcid.jaxb.model.record_rc2.Group> groupsRc2 = new ArrayList<>(groupsContainerRc2.retrieveGroups());
        if (groupsRc1.get(0).getActivities() != null && !groupsRc1.get(0).getActivities().isEmpty()) {
            for (int index = 0; index < groupsRc2.size(); index++) {
                latestGrp = calculateLatest(groupsRc2.get(index));
            }
            groupsContainerRc2.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendarNoTimeZoneNoMillis(latestGrp)));
        }
    }
    return latestGrp;
}
Also used : Group(org.orcid.jaxb.model.record_rc2.Group) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) ArrayList(java.util.ArrayList) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Date(java.util.Date)

Aggregations

ArrayList (java.util.ArrayList)9 Group (org.gluu.oxtrust.model.scim2.Group)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 Test (org.junit.Test)5 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 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)3 Artifact (org.eclipse.bpmn2.Artifact)3