Search in sources :

Example 16 with Group

use of ucar.nc2.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 ucar.nc2.Group in project openstack4j by ContainX.

the class KeystoneGroupServiceTests method group_get_byName_byDomainId_NotExist_Test.

public void group_get_byName_byDomainId_NotExist_Test() throws Exception {
    respondWith(JSON_GROUPS_EMPTY_LIST);
    Group group = osv3().identity().groups().getByName(GROUP_NAME, GROUP_DOMAIN_ID);
    assertNull(group);
}
Also used : Group(org.openstack4j.model.identity.v3.Group)

Example 18 with Group

use of ucar.nc2.Group in project openstack4j by ContainX.

the class KeystoneGroupServiceTests method group_crud_test.

// ------------ Group Tests ------------
// The following tests are to verify the update() method of the GroupService
// using HTTP PATCH, which is not supported by betamax.
// Find more tests in KeystoneGroupServiceSpec in core-integration-test
// module.
public void group_crud_test() throws Exception {
    Group group = Builders.group().name(GROUP_NAME).description(GROUP_DESCRIPTION).domainId(GROUP_DOMAIN_ID).build();
    respondWith(JSON_GROUPS_CREATE);
    Group newGroup = osv3().identity().groups().create(group);
    assertEquals(newGroup.getName(), GROUP_NAME);
    assertEquals(newGroup.getDomainId(), GROUP_DOMAIN_ID);
    assertEquals(newGroup.getDescription(), GROUP_DESCRIPTION);
    String GROUP_ID = newGroup.getId();
    respondWith(JSON_GROUPS_GET_BYID);
    Group group_setToUpdate = osv3().identity().groups().get(GROUP_ID);
    respondWith(JSON_GROUPS_UPDATE);
    Group updatedGroup = osv3.identity().groups().update(group_setToUpdate.toBuilder().description(GROUP_DESCRIPTION_UPDATE).build());
    assertEquals(updatedGroup.getId(), GROUP_ID);
    assertEquals(updatedGroup.getName(), GROUP_NAME);
    assertEquals(updatedGroup.getDomainId(), GROUP_DOMAIN_ID);
    assertEquals(updatedGroup.getDescription(), GROUP_DESCRIPTION_UPDATE);
}
Also used : Group(org.openstack4j.model.identity.v3.Group)

Example 19 with Group

use of ucar.nc2.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 ucar.nc2.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