Exemplo n.º 1
0
 private CMetadata createComplexMetadataObject(
     MdObjectStore objectStore, String objectName, String metadataType, String repoId)
     throws RemoteException {
   return connection
       .getFactory()
       .createComplexMetadataObject(objectStore, objectName, MetadataObjects.PERSON, repoId);
 }
Exemplo n.º 2
0
 public void dispose() {
   configuration = null;
   if (connection != null) {
     connection.dispose();
     connection = null;
   }
 }
Exemplo n.º 3
0
 public void test() {
   configuration.validate();
   try {
     connection.validate();
   } catch (RemoteException e) {
     throw new ConnectorException(e);
   } catch (MdException e) {
     throw new ConnectorException(e);
   }
 }
Exemplo n.º 4
0
  public void executeQuery(
      ObjectClass objClass, String query, ResultsHandler handler, OperationOptions options) {
    // TODO Auto-generated method stub
    LOG.ok("Query {0} ", query);

    if (!isAccount(objClass)) {
      throw new UnsupportedOperationException(
          "Could not execute query. Object class not supported: " + objClass);
    }

    try {
      String repoId = getFoundationRepoId();

      String template = "<Templates>" + "<Person>" + "</Person>" + "</Templates>";

      int flags = MdOMIUtil.OMI_GET_METADATA | MdOMIUtil.OMI_ALL | MdOMIUtil.OMI_TEMPLATE;
      List objects =
          connection
              .getFactory()
              .getOMIUtil()
              .getMetadataObjects(repoId, MetadataObjects.PERSON, flags, template);

      Iterator iterator = objects.iterator();
      while (iterator.hasNext()) {
        Object obj = iterator.next();
        RootImpl p = (RootImpl) obj;
        ConnectorObjectBuilder cob = new ConnectorObjectBuilder();

        cob.addAttribute(Name.NAME, p.getName());
        cob.addAttribute(Uid.NAME, p.getId());

        Set<Entry<String, String>> attrs = p.getAttrs().entrySet();
        Iterator<Entry<String, String>> attrIterator = attrs.iterator();
        while (attrIterator.hasNext()) {
          Entry<String, String> attr = attrIterator.next();
          // skip id and name..it was set before (icf_name and icf_uid)
          if (attr.getKey().equals(CMetadata.ATTRIBUTE_ID_NAME)) {
            continue;
          }

          if (attr.getKey().equals(CMetadata.ATTRIBUTE_NAME_NAME)) {
            continue;
          }
          if (StringUtil.isEmpty(attr.getValue())) {
            LOG.ok("Skipping setting attribute {0}. Attribute value is blank", attr.getKey());
          } else {
            LOG.ok("Setting attribute {0} with value {1}", attr.getKey(), attr.getValue());
            cob.addAttribute(attr.getKey(), attr.getValue());
          }
        }

        handler.handle(cob.build());
      }

    } catch (RemoteException e) {
      // TODO Auto-generated catch block
      throw new ConnectorException(e);
    } catch (MdException e) {
      // TODO Auto-generated catch block
      throw new ConnectorException(e);
    }
  }
Exemplo n.º 5
0
 private MdObjectStore createObjectStore() throws RemoteException {
   return connection.getFactory().createObjectStore();
 }
Exemplo n.º 6
0
 private MdOMIUtil getOmiUtil() throws RemoteException {
   if (omiUtil == null) {
     omiUtil = connection.getFactory().getOMIUtil();
   }
   return omiUtil;
 }