Example usage for java.util UUID equals

List of usage examples for java.util UUID equals

Introduction

In this page you can find the example usage for java.util UUID equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Compares this object to the specified object.

Usage

From source file:net.sf.maltcms.chromaui.project.spi.project.ChromAUIProject.java

/**
 *
 * @param <T> the IDescriptor type to query for
 * @param descriptorId the requested id of the container
 * @param descriptorClass the explicit class of the container
 * @throws ConstraintViolationException if more than one object with the
 * requested id was found//w w w.ja  v  a2s  .  com
 * @throws ResourceNotAvailableException if no object with the requested id
 * was found
 * @throws IllegalStateException if the database was not yet initialized
 * @return
 */
@Override
public <T extends IBasicDescriptor> T getDescriptorById(final UUID descriptorId,
        Class<? extends T> descriptorClass) {
    if (icp != null) {
        ICrudSession ics = icp.createSession();
        try {
            IQuery<? extends T> query = ics.newQuery(descriptorClass);
            Collection<T> results = query.retrieve(new Predicate<T>() {
                private static final long serialVersionUID = -7402207122617612419L;

                @Override
                public boolean match(T et) {
                    return descriptorId.equals(et.getId());
                }
            });
            if (results.isEmpty()) {
                throw new ResourceNotAvailableException(
                        "Object with id=" + descriptorId.toString() + " not found in database!");
            }
            if (results.size() > 1) {
                throw new ConstraintViolationException("Query by unique id=" + descriptorId.toString()
                        + " returned " + results.size() + " instances. Expected 1!");
            }
            return results.iterator().next();
        } finally {
            ics.close();
        }
    }
    throw new IllegalStateException("Database not initialized!");
}

From source file:org.jasig.ssp.dao.PersonSearchDao.java

private void addBindParams(PersonSearchRequest personSearchRequest, Query query, Term currentTerm) {
    if (hasStudentId(personSearchRequest)) {
        final String wildcardedStudentIdOrNameTerm = new StringBuilder("%")
                .append(personSearchRequest.getSchoolId().toUpperCase()).append("%").toString();
        query.setString("studentIdOrName", wildcardedStudentIdOrNameTerm);
    }//from w  w w .ja  va2 s.c  o  m

    if (hasPlanExists(personSearchRequest)) {
        if (PersonSearchRequest.PLAN_EXISTS_ACTIVE.equals(personSearchRequest.getPlanExists())) {
            query.setInteger("planObjectStatus", ObjectStatus.ACTIVE.ordinal());
        } else if (PersonSearchRequest.PLAN_EXISTS_INACTIVE.equals(personSearchRequest.getPlanExists())) {
            query.setInteger("planObjectStatus", ObjectStatus.INACTIVE.ordinal());
        } else if (PersonSearchRequest.PLAN_EXISTS_NONE.equals(personSearchRequest.getPlanExists())) {
            // this is handled structurally (exists test)
        } else {
            query.setParameter("planObjectStatus", null);
        }
    }
    if (hasPlanStatus(personSearchRequest)) {
        PlanStatus param = null;
        if (PersonSearchRequest.PLAN_STATUS_ON_PLAN.equals(personSearchRequest.getPlanStatus())) {
            param = PlanStatus.ON;
        }
        if (PersonSearchRequest.PLAN_STATUS_OFF_PLAN.equals(personSearchRequest.getPlanStatus())) {
            param = PlanStatus.OFF;
        }
        if (PersonSearchRequest.PLAN_STATUS_ON_TRACK_SEQUENCE.equals(personSearchRequest.getPlanStatus())) {
            param = PlanStatus.ON_TRACK_SEQUENCE;
        }
        if (PersonSearchRequest.PLAN_STATUS_ON_TRACK_SUBSTITUTION.equals(personSearchRequest.getPlanStatus())) {
            param = PlanStatus.ON_TRACK_SUBSTITUTION;
        }
        query.setString("planStatus", param == null ? null : param.name());
    }

    if (hasGpaCriteria(personSearchRequest)) {
        if (personSearchRequest.getGpaEarnedMin() != null) {
            query.setBigDecimal("gpaEarnedMin", personSearchRequest.getGpaEarnedMin());
        }
        if (personSearchRequest.getGpaEarnedMax() != null) {
            query.setBigDecimal("gpaEarnedMax", personSearchRequest.getGpaEarnedMax());
        }
    }

    if (hasCoach(personSearchRequest) || hasMyCaseload(personSearchRequest)) {
        Person me = null;
        Person coach = null;
        if (hasMyCaseload(personSearchRequest)) {
            me = securityService.currentlyAuthenticatedUser().getPerson();
        }
        if (hasCoach(personSearchRequest)) {
            coach = personSearchRequest.getCoach();
        }

        UUID queryPersonId = null;
        Person compareTo = null;
        if (me != null) {
            queryPersonId = me.getId();
            compareTo = coach;
        } else if (coach != null) {
            queryPersonId = coach.getId();
            compareTo = me;
        }
        // If me and coach aren't the same, the query is non-sensical, so set the 'queryPerson' to null which
        // will effectively force the query to return no results.
        if (queryPersonId != null && compareTo != null) {
            queryPersonId = queryPersonId.equals(compareTo.getId()) ? queryPersonId : null;
        }
        query.setParameter("coachId", queryPersonId);
    }

    if (hasAnyWatchCriteria(personSearchRequest)) {
        Person me = null;
        Person watcher = null;
        if (hasMyWatchList(personSearchRequest)) {
            me = securityService.currentlyAuthenticatedUser().getPerson();
        }
        if (hasWatcher(personSearchRequest)) {
            watcher = personSearchRequest.getWatcher();
        }

        UUID queryPersonId = null;
        Person compareTo = null;
        if (me != null) {
            queryPersonId = me.getId();
            compareTo = watcher;
        } else if (watcher != null) {
            queryPersonId = watcher.getId();
            compareTo = me;
        }
        // If me and watcher aren't the same, the query is non-sensical, so set the 'queryPerson' to null which
        // will effectively force the query to return no results.
        if (queryPersonId != null && compareTo != null) {
            queryPersonId = queryPersonId.equals(compareTo.getId()) ? queryPersonId : null;
        }
        query.setParameter("watcherId", queryPersonId);
    }

    if (hasDeclaredMajor(personSearchRequest)) {
        query.setString("programCode", personSearchRequest.getDeclaredMajor());
    }

    if (hasHoursEarnedCriteria(personSearchRequest)) {
        if (personSearchRequest.getHoursEarnedMin() != null) {
            query.setBigDecimal("hoursEarnedMin", personSearchRequest.getHoursEarnedMin());
        }
        if (personSearchRequest.getHoursEarnedMax() != null) {
            query.setBigDecimal("hoursEarnedMax", personSearchRequest.getHoursEarnedMax());
        }
    }

    if (hasProgramStatus(personSearchRequest)) {
        query.setEntity("programStatus", personSearchRequest.getProgramStatus());
    }

    if (hasSpecialServiceGroup(personSearchRequest)) {
        query.setEntity("specialServiceGroup", personSearchRequest.getSpecialServiceGroup());
    }

    if (hasFinancialAidStatus(personSearchRequest)) {
        query.setString("sapStatusCode", personSearchRequest.getSapStatusCode());
    }

    if (hasCurrentlyRegistered(personSearchRequest)) {
        query.setString("currentTerm", currentTerm.getCode());
    }

    if (hasMyPlans(personSearchRequest)) {
        query.setEntity("owner", securityService.currentlyAuthenticatedUser().getPerson());
    }

    if (hasBirthDate(personSearchRequest)) {
        query.setDate("birthDate", personSearchRequest.getBirthDate());
    }

    query.setInteger("activeObjectStatus", ObjectStatus.ACTIVE.ordinal());
}

From source file:eu.dasish.annotation.backend.dao.impl.DBDispatcherImlp.java

@Override
public List<Number> getFilteredAnnotationIDs(UUID ownerId, String link, MatchMode matchMode, String text,
        Number inloggedPrincipalID, String accessMode, String namespace, String after, String before)
        throws NotInDataBaseException {

    Number ownerID;//from  w  w w.ja va 2  s . c om

    if (ownerId != null) {
        if (accessMode.equals("owner")) { // inloggedUser is the owner of the annotations
            if (!ownerId.equals(principalDao.getExternalID(inloggedPrincipalID))) {
                logger.info(
                        "The inlogged principal is demanded to be the owner of the annotations, however the expected owner is different and has the UUID "
                                + ownerId.toString());
                return new ArrayList<Number>();
            } else {
                ownerID = inloggedPrincipalID;
            }
        } else {
            ownerID = principalDao.getInternalID(ownerId);
        }

    } else {
        if (accessMode.equals("owner")) {
            ownerID = inloggedPrincipalID;
        } else {
            ownerID = null;
        }
    }

    //Filtering on the columns  of the annotation table 
    List<Number> annotationIDs = annotationDao.getFilteredAnnotationIDs(ownerID, text, namespace, after,
            before);

    // Filetring on accessMode, the junction table
    if (annotationIDs != null) {
        if (!annotationIDs.isEmpty()) {
            if (!accessMode.equals("owner")) {
                Access access = Access.fromValue(accessMode);
                if (access.equals(Access.NONE)) {
                    List<Number> annotationIDsfiletered = new ArrayList<Number>();
                    Access accessCurrent;
                    for (Number annotationID : annotationIDs) {
                        accessCurrent = annotationDao.getAccess(inloggedPrincipalID, annotationID);
                        if (accessCurrent.equals(Access.NONE)) {
                            annotationIDsfiletered.add(annotationID);
                        }
                    }
                    annotationIDs = annotationIDsfiletered; // yeaahhh I'm relying on garbage collector here                         
                } else {
                    List<Number> annotationIDsAccess = annotationDao
                            .getAnnotationIDsPermissionAtLeast(inloggedPrincipalID, access);
                    List<Number> annotationIDsPublic = annotationDao.getAnnotationIDsPublicAtLeast(access);
                    List<Number> annotationIDsOwned = annotationDao
                            .getFilteredAnnotationIDs(inloggedPrincipalID, text, namespace, after, before);
                    int check1 = this.addAllNoRepetitions(annotationIDsAccess, annotationIDsPublic);
                    int check2 = this.addAllNoRepetitions(annotationIDsAccess, annotationIDsOwned);
                    annotationIDs.retainAll(annotationIDsAccess);// intersection
                }
            }
        }

        // filtering on reference        
        return this.filterAnnotationIDsOnReference(annotationIDs, link, matchMode);
    }

    return annotationIDs;

}

From source file:org.jasig.ssp.dao.DirectoryPersonSearchDao.java

private Map<String, Object> getBindParams(PersonSearchRequest personSearchRequest, Term currentTerm) {
    HashMap<String, Object> params = new HashMap<String, Object>();
    if (hasSchoolId(personSearchRequest)) {
        params.put("schoolId", personSearchRequest.getSchoolId().trim().toUpperCase());
    }//  w w w  .j ava2  s.  c  om

    if (hasFirstName(personSearchRequest)) {
        params.put("firstName", personSearchRequest.getFirstName().trim().toUpperCase() + "%");
    }

    if (hasLastName(personSearchRequest)) {
        params.put("lastName", personSearchRequest.getLastName().trim().toUpperCase() + "%");
    }

    if (hasPlanExists(personSearchRequest)) {
        // otherwise the conditional is handled structurally (exists test)
        if (PersonSearchRequest.PLAN_EXISTS_ACTIVE.equals(personSearchRequest.getPlanExists())) {
            params.put("planObjectStatus", ObjectStatus.ACTIVE);
        } else if (PersonSearchRequest.PLAN_EXISTS_INACTIVE.equals(personSearchRequest.getPlanExists())) {
            params.put("planObjectStatus", ObjectStatus.INACTIVE);
        } else if (PersonSearchRequest.PLAN_EXISTS_NONE.equals(personSearchRequest.getPlanExists())) {
            // this is handled structurally (exists test)
        } else {
            params.put("planObjectStatus", null);
        }
    }
    if (hasPlanStatus(personSearchRequest)) {
        PlanStatus param = null;
        if (PersonSearchRequest.PLAN_STATUS_ON_PLAN.equals(personSearchRequest.getPlanStatus())) {
            param = PlanStatus.ON;
        }
        if (PersonSearchRequest.PLAN_STATUS_OFF_PLAN.equals(personSearchRequest.getPlanStatus())) {
            param = PlanStatus.OFF;
        }
        if (PersonSearchRequest.PLAN_STATUS_ON_TRACK_SEQUENCE.equals(personSearchRequest.getPlanStatus())) {
            param = PlanStatus.ON_TRACK_SEQUENCE;
        }
        if (PersonSearchRequest.PLAN_STATUS_ON_TRACK_SUBSTITUTION.equals(personSearchRequest.getPlanStatus())) {
            param = PlanStatus.ON_TRACK_SUBSTITUTION;
        }
        params.put("planStatus", param);
    }

    if (hasGpaCriteria(personSearchRequest)) {
        if (personSearchRequest.getGpaEarnedMin() != null) {
            params.put("gpaEarnedMin", personSearchRequest.getGpaEarnedMin());
        }
        if (personSearchRequest.getGpaEarnedMax() != null) {
            params.put("gpaEarnedMax", personSearchRequest.getGpaEarnedMax());
        }
    }

    if (hasCoach(personSearchRequest) || hasMyCaseload(personSearchRequest)) {
        Person me = null;
        Person coach = null;
        if (hasMyCaseload(personSearchRequest)) {
            me = securityService.currentlyAuthenticatedUser().getPerson();
        }
        if (hasCoach(personSearchRequest)) {
            coach = personSearchRequest.getCoach();
        }

        UUID queryPersonId = null;
        Person compareTo = null;
        if (me != null) {
            queryPersonId = me.getId();
            compareTo = coach;
        } else if (coach != null) {
            queryPersonId = coach.getId();
            compareTo = me;
        }
        // If me and coach aren't the same, the query is non-sensical, so set the 'queryPersonId' to null which
        // will effectively force the query to return no results.
        if (queryPersonId != null && compareTo != null) {
            queryPersonId = queryPersonId.equals(compareTo.getId()) ? queryPersonId : null;
        }
        params.put("coachId", queryPersonId);
    }

    if (hasAnyWatchCriteria(personSearchRequest)) {
        Person me = null;
        Person watcher = null;
        if (hasMyWatchList(personSearchRequest)) {
            me = securityService.currentlyAuthenticatedUser().getPerson();
        }
        if (hasWatcher(personSearchRequest)) {
            watcher = personSearchRequest.getWatcher();
        }

        UUID queryPersonId = null;
        Person compareTo = null;
        if (me != null) {
            queryPersonId = me.getId();
            compareTo = watcher;
        } else if (watcher != null) {
            queryPersonId = watcher.getId();
            compareTo = me;
        }
        // If me and watcher aren't the same, the query is non-sensical, so set the 'queryPersonId' to null which
        // will effectively force the query to return no results.
        if (queryPersonId != null && compareTo != null) {
            queryPersonId = queryPersonId.equals(compareTo.getId()) ? queryPersonId : null;
        }
        params.put("watcherId", queryPersonId);
    }

    if (hasDeclaredMajor(personSearchRequest)) {
        params.put("programCode", personSearchRequest.getDeclaredMajor());
    }

    if (hasHoursEarnedCriteria(personSearchRequest)) {
        if (personSearchRequest.getHoursEarnedMin() != null) {
            params.put("hoursEarnedMin", personSearchRequest.getHoursEarnedMin());
        }
        if (personSearchRequest.getHoursEarnedMax() != null) {
            params.put("hoursEarnedMax", personSearchRequest.getHoursEarnedMax());
        }
    }

    if (hasProgramStatus(personSearchRequest)) {
        params.put("programStatusName", personSearchRequest.getProgramStatus().getName());
    }

    if (hasSpecialServiceGroup(personSearchRequest)) {
        params.put("specialServiceGroup", personSearchRequest.getSpecialServiceGroup());
    }

    if (hasFinancialAidStatus(personSearchRequest)) {
        params.put("sapStatusCode", personSearchRequest.getSapStatusCode());
    }

    if (hasMyPlans(personSearchRequest)) {
        params.put("owner", securityService.currentlyAuthenticatedUser().getPerson());
    }

    if (hasBirthDate(personSearchRequest)) {
        params.put("birthDate", personSearchRequest.getBirthDate());
    }

    if (requiresObjectStatus(personSearchRequest)) {
        params.put("personObjectStatus", ObjectStatus.ACTIVE);
    }

    if (hasActualStartTerm(personSearchRequest)) {
        params.put("actualStartTerm", personSearchRequest.getActualStartTerm());
    }

    return params;
}

From source file:net.creativeparkour.GameManager.java

static List<Joueur> getJoueurs(UUID map) {
    List<Joueur> joueursMap = new ArrayList<Joueur>();
    for (int i = 0; i < joueurs.size(); i++) {
        if (map.equals(joueurs.get(i).getMap()))
            joueursMap.add(joueurs.get(i));
    }/*ww w  .  j a va2s. c  o  m*/
    return joueursMap;
}

From source file:org.lealone.cluster.service.StorageService.java

/**
 * Handle node move to normal state. That is, node is entering token ring and participating
 * in reads./*from  ww  w. j av a2s. co m*/
 *
 * @param endpoint node
 */
private void handleStateNormal(final InetAddress endpoint) {
    Collection<Token> tokens;

    tokens = getTokensFor(endpoint);

    Set<Token> tokensToUpdateInTokenMetaData = new HashSet<>();
    Set<Token> tokensToUpdateInClusterMetaData = new HashSet<>();
    Set<Token> localTokensToRemove = new HashSet<>();
    Set<InetAddress> endpointsToRemove = new HashSet<>();

    if (logger.isDebugEnabled())
        logger.debug("Node {} state normal, token {}", endpoint, tokens);

    if (tokenMetaData.isMember(endpoint))
        logger.info("Node {} state jump to normal", endpoint);

    updatePeerInfo(endpoint);
    // Order Matters, TM.updateHostID() should be called before TM.updateNormalToken(), (see Cassandra-4300).
    if (Gossiper.instance.usesHostId(endpoint)) {
        UUID hostId = Gossiper.instance.getHostId(endpoint);
        InetAddress existing = tokenMetaData.getEndpointForHostId(hostId);
        if (DatabaseDescriptor.isReplacing()
                && Gossiper.instance.getEndpointStateForEndpoint(DatabaseDescriptor.getReplaceAddress()) != null
                && (hostId.equals(Gossiper.instance.getHostId(DatabaseDescriptor.getReplaceAddress()))))
            logger.warn("Not updating token metadata for {} because I am replacing it", endpoint);
        else {
            if (existing != null && !existing.equals(endpoint)) {
                if (existing.equals(Utils.getBroadcastAddress())) {
                    logger.warn("Not updating host ID {} for {} because it's mine", hostId, endpoint);
                    tokenMetaData.removeEndpoint(endpoint);
                    endpointsToRemove.add(endpoint);
                } else if (Gossiper.instance.compareEndpointStartup(endpoint, existing) > 0) {
                    logger.warn("Host ID collision for {} between {} and {}; {} is the new owner", hostId,
                            existing, endpoint, endpoint);
                    tokenMetaData.removeEndpoint(existing);
                    endpointsToRemove.add(existing);
                    tokenMetaData.updateHostId(hostId, endpoint);
                } else {
                    logger.warn("Host ID collision for {} between {} and {}; ignored {}", hostId, existing,
                            endpoint, endpoint);
                    tokenMetaData.removeEndpoint(endpoint);
                    endpointsToRemove.add(endpoint);
                }
            } else
                tokenMetaData.updateHostId(hostId, endpoint);
        }
    }

    for (final Token token : tokens) {
        // we don't want to update if this node is responsible for the token
        // and it has a later startup time than endpoint.
        InetAddress currentOwner = tokenMetaData.getEndpoint(token);
        if (currentOwner == null) {
            logger.debug("New node {} at token {}", endpoint, token);
            tokensToUpdateInTokenMetaData.add(token);
            tokensToUpdateInClusterMetaData.add(token);
        } else if (endpoint.equals(currentOwner)) {
            // set state back to normal, since the node may have tried to leave, but failed and is now back up
            tokensToUpdateInTokenMetaData.add(token);
            tokensToUpdateInClusterMetaData.add(token);
        } else if (Gossiper.instance.compareEndpointStartup(endpoint, currentOwner) > 0) {
            tokensToUpdateInTokenMetaData.add(token);
            tokensToUpdateInClusterMetaData.add(token);

            // currentOwner is no longer current, endpoint is. Keep track of these moves, because when
            // a host no longer has any tokens, we'll want to remove it.
            Multimap<InetAddress, Token> epToTokenCopy = tokenMetaData.getEndpointToTokenMapForReading();
            epToTokenCopy.get(currentOwner).remove(token);
            if (epToTokenCopy.get(currentOwner).size() < 1)
                endpointsToRemove.add(currentOwner);

            logger.info(String.format("Nodes %s and %s have the same token %s.  %s is the new owner", endpoint,
                    currentOwner, token, endpoint));
        } else {
            logger.info(String.format("Nodes %s and %s have the same token %s.  Ignoring %s", endpoint,
                    currentOwner, token, endpoint));
        }
    }

    tokenMetaData.updateNormalTokens(tokensToUpdateInTokenMetaData, endpoint);
    for (InetAddress ep : endpointsToRemove) {
        removeEndpoint(ep);
        if (DatabaseDescriptor.isReplacing() && DatabaseDescriptor.getReplaceAddress().equals(ep))
            Gossiper.instance.replacementQuarantine(ep); // quarantine locally longer than normally; see
                                                         // Cassandra-8260
    }
    if (!tokensToUpdateInClusterMetaData.isEmpty())
        ClusterMetaData.updateTokens(endpoint, tokensToUpdateInClusterMetaData);
    if (!localTokensToRemove.isEmpty())
        ClusterMetaData.updateLocalTokens(Collections.<Token>emptyList(), localTokensToRemove);

    if (tokenMetaData.isMoving(endpoint)) // if endpoint was moving to a new token
    {
        tokenMetaData.removeFromMoving(endpoint);
        for (IEndpointLifecycleSubscriber subscriber : lifecycleSubscribers)
            subscriber.onMove(endpoint);
    } else {
        for (IEndpointLifecycleSubscriber subscriber : lifecycleSubscribers)
            subscriber.onJoinCluster(endpoint);
    }
}

From source file:org.efaps.admin.datamodel.Type.java

/**
 * {@inheritDoc}/*  w  ww .j  av a  2 s  .co m*/
 */
@Override
protected void setLinkProperty(final UUID _linkTypeUUID, final long _toId, final UUID _toTypeUUID,
        final String _toName) throws EFapsException {
    if (_linkTypeUUID.equals(CIAdminDataModel.Type2Store.uuid)) {
        this.storeId = _toId;
    } else if (_linkTypeUUID.equals(CIAdminDataModel.TypeEventIsAllowedFor.uuid)) {
        this.allowedEventTypes.add(_toId);
    }
    super.setLinkProperty(_linkTypeUUID, _toId, _toTypeUUID, _toName);
}

From source file:net.creativeparkour.GameManager.java

static void modifierMap(Joueur j, UUID id) {
    if (id != null) {
        CPMap m = getMap(id);//www  . ja  va2  s  .  c om
        // Ejection des joueurs qui jouent et qui ne sont pas celui qui modifie
        for (int i = 0; i < joueurs.size(); i++) {
            if (!joueurs.get(i).equals(j) && id.equals(joueurs.get(i).getMap())) {
                joueurs.get(i).quitter(true, false);
            }
        }
        m.modifier(j);
    }
}

From source file:net.creativeparkour.GameManager.java

static void supprimerMap(UUID uuid, Player p) {
    if (uuid != null) {
        CPMap m = getMap(uuid);/*from ww w.j  av a  2 s .  c  o m*/
        String n = m.getName();
        if (n == null || n.isEmpty())
            n = "unnamed";
        for (int i = 0; i < joueurs.size(); i++) {
            if (uuid.equals(joueurs.get(i).getMap())) {
                joueurs.get(i).quitter(true, false);

                if (p == null || !joueurs.get(i).getPlayer().equals(p))
                    joueurs.get(i).getPlayer().sendMessage(Config.prefix() + ChatColor.YELLOW
                            + Langues.getMessage("commands.delete deleted").replace("%map", n));
            }
        }
        if (p != null)
            p.sendMessage(Config.prefix() + ChatColor.YELLOW
                    + Langues.getMessage("commands.delete deleted").replace("%map", n));
        m.supprimer();

        synchroWeb();
    }
}

From source file:org.cloudfoundry.client.lib.CloudFoundryClient.java

private UUID getRouteGuid(String host, UUID domainGuid) {
    String urlPath = API_BASE + "/routes?inline-relations-depth=0&q=host:" + host;

    UUID routeGuid = null;//from w w  w  .ja v a  2s  . co m
    try {
        List<JSONObject> ja = ResponseObject.getResources(urlPath, token);
        for (JSONObject resource : ja) {
            JSONObject entity = resource.getJSONObject(ENTITY);
            JSONObject metadata = resource.getJSONObject(METADATA);
            UUID routeSpace = UUID.fromString(entity.getString("space_guid"));
            UUID routeDomain = UUID.fromString(entity.getString("domain_guid"));
            if (sessionSpace.getMeta().getGuid().equals(routeSpace) && domainGuid.equals(routeDomain)) {
                routeGuid = new Meta(metadata).getGuid();
            }
        }
    } catch (Throwable t) {
        t.printStackTrace();
    }
    return routeGuid;
}