Пример #1
0
 public static ObjectIdentifier processObjectIdentifier(final ObjectIdentity oi) {
   if (oi == null) {
     throw new NullPointerException("ObjectIdentity cannot be null");
   }
   checkAddlArgs(oi.getAdditionalProperties(), oi.getClass());
   if (oi.getRef() != null) {
     verifyRefOnly(oi);
     return ObjectIdentifier.parseObjectReference(oi.getRef());
   }
   return processObjectIdentifier(
       oi.getWorkspace(), oi.getWsid(), oi.getName(), oi.getObjid(), oi.getVer());
 }
Пример #2
0
 private static void verifyRefOnly(final ObjectIdentity oi) {
   final List<String> err = new LinkedList<String>();
   if (oi.getWorkspace() != null) {
     err.add("Workspace: " + oi.getWorkspace());
   }
   if (oi.getWsid() != null) {
     err.add("Workspace id: " + oi.getWsid());
   }
   if (oi.getName() != null) {
     err.add("Object name: " + oi.getName());
   }
   if (oi.getObjid() != null) {
     err.add("Object id: " + oi.getObjid());
   }
   if (oi.getVer() != null) {
     err.add("Version: " + oi.getVer());
   }
   if (!err.isEmpty()) {
     throw new IllegalArgumentException(
         String.format(
             "Object reference %s provided; cannot provide any other "
                 + "means of identifying an object. %s",
             oi.getRef(), StringUtils.join(err, " ")));
   }
 }