Пример #1
0
  /**
   * execute the call and return the results. If there is a problem calling the service, an
   * exception will be thrown
   *
   * @return the results
   */
  public WsMemberChangeSubjectResults execute() {
    this.validate();
    WsMemberChangeSubjectResults wsMemberChangeSubjectResults = null;
    try {
      // Make the body of the request, in this case with beans and marshaling, but you can make
      // your request document in whatever language or way you want
      WsRestMemberChangeSubjectRequest memberChangeSubject = new WsRestMemberChangeSubjectRequest();

      memberChangeSubject.setActAsSubjectLookup(this.actAsSubject);

      WsMemberChangeSubject wsMemberChangeSubject = new WsMemberChangeSubject();
      if (this.deleteOldMember != null) {
        wsMemberChangeSubject.setDeleteOldMember(this.deleteOldMember ? "T" : "F");
      }
      wsMemberChangeSubject.setOldSubjectLookup(this.oldSubjectLookup);
      wsMemberChangeSubject.setNewSubjectLookup(this.newSubjectLookup);
      memberChangeSubject.setWsMemberChangeSubjects(
          new WsMemberChangeSubject[] {wsMemberChangeSubject});

      memberChangeSubject.setTxType(this.txType == null ? null : this.txType.name());

      if (this.includeSubjectDetail != null) {
        memberChangeSubject.setIncludeSubjectDetail(this.includeSubjectDetail ? "T" : "F");
      }

      if (this.subjectAttributeNames.size() > 0) {
        memberChangeSubject.setSubjectAttributeNames(
            GrouperClientUtils.toArray(this.subjectAttributeNames, String.class));
      }

      // add params if there are any
      if (this.params.size() > 0) {
        memberChangeSubject.setParams(GrouperClientUtils.toArray(this.params, WsParam.class));
      }

      GrouperClientWs grouperClientWs = new GrouperClientWs();

      // kick off the web service
      wsMemberChangeSubjectResults =
          (WsMemberChangeSubjectResults)
              grouperClientWs.executeService(
                  "members", memberChangeSubject, "memberChangeSubject", this.clientVersion, false);

      String resultMessage = wsMemberChangeSubjectResults.getResultMetadata().getResultMessage();
      grouperClientWs.handleFailure(
          wsMemberChangeSubjectResults, wsMemberChangeSubjectResults.getResults(), resultMessage);

    } catch (Exception e) {
      GrouperClientUtils.convertToRuntimeException(e);
    }
    return wsMemberChangeSubjectResults;
  }
  /**
   * Get the prefix for the stem containing uPortal groups. If this value is non-empty, all groups
   * will be required to be prefixed with the specified stem name.
   *
   * @return the uportal stem in the registry, without trailing colon
   */
  protected static String getStemPrefix() {

    String uportalStem = GrouperClientUtils.propertiesValue(STEM_PREFIX, false);

    // make sure it ends in colon
    if (!StringUtils.isBlank(uportalStem)) {
      if (uportalStem.endsWith(":")) {
        uportalStem = uportalStem.substring(0, uportalStem.length() - 1);
      }
    }

    return uportalStem;
  }
  /* (non-Javadoc)
   * @see org.jasig.portal.groups.IEntityGroupStore#contains(org.jasig.portal.groups.IEntityGroup, org.jasig.portal.groups.IGroupMember)
   */
  public boolean contains(IEntityGroup group, IGroupMember member) throws GroupsException {

    String groupContainerName = group.getLocalKey();
    String groupMemberName = member.getKey();

    if (!validKey(groupContainerName) || !validKey(groupMemberName)) {
      return false;
    }

    GcHasMember gcHasMember = new GcHasMember();
    gcHasMember.assignGroupName(groupContainerName);
    gcHasMember.addSubjectLookup(new WsSubjectLookup(null, "g:gsa", groupMemberName));
    WsHasMemberResults wsHasMemberResults = gcHasMember.execute();
    if (GrouperClientUtils.length(wsHasMemberResults.getResults()) == 1) {
      WsHasMemberResult wsHasMemberResult = wsHasMemberResults.getResults()[0];
      return StringUtils.equals("IS_MEMBER", wsHasMemberResult.getResultMetadata().getResultCode());
    }
    return false;
  }