Search in sources :

Example 1 with EntityDAOIF

use of com.runwaysdk.dataaccess.EntityDAOIF in project geoprism-registry by terraframe.

the class Organization method getGeoObjectTypes.

/**
 * Return a map of {@link GeoObjectType} codes and labels for this
 * {@link Organization}.
 *
 * @return a map of {@link GeoObjectType} codes and labels for this
 *         {@link Organization}.
 */
public Map<String, ServerGeoObjectType> getGeoObjectTypes() {
    // For performance, get all of the universals defined
    List<? extends EntityDAOIF> universalList = ObjectCache.getCachedEntityDAOs(Universal.CLASS);
    Map<String, ServerGeoObjectType> typeCodeMap = new HashMap<String, ServerGeoObjectType>();
    for (EntityDAOIF entityDAOIF : universalList) {
        Universal universal = (Universal) BusinessFacade.get(entityDAOIF);
        // Check to see if the universal is owned by the organization role.
        String ownerId = universal.getOwnerOid();
        Roles organizationRole = this.getRole();
        if (ownerId.equals(organizationRole.getOid())) {
            ServerGeoObjectType type = ServerGeoObjectType.get(universal);
            typeCodeMap.put(type.getCode(), type);
        }
    }
    return typeCodeMap;
}
Also used : Universal(com.runwaysdk.system.gis.geo.Universal) HashMap(java.util.HashMap) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) EntityDAOIF(com.runwaysdk.dataaccess.EntityDAOIF) Roles(com.runwaysdk.system.Roles)

Example 2 with EntityDAOIF

use of com.runwaysdk.dataaccess.EntityDAOIF in project geoprism-registry by terraframe.

the class Organization method getOrganizationsFromCache.

/**
 * Returns all of the organizations as {@link Organization} objects from the
 * cache unsorted instead of fetching from the database.
 *
 * @return
 */
public static List<Organization> getOrganizationsFromCache() {
    // For performance, get all of the universals defined
    List<? extends EntityDAOIF> organizationDAOs = ObjectCache.getCachedEntityDAOs(Organization.CLASS);
    List<Organization> organizationList = new LinkedList<Organization>();
    for (EntityDAOIF entityDAOIF : organizationDAOs) {
        Organization organization = (Organization) BusinessFacade.get(entityDAOIF);
        organizationList.add(organization);
    }
    return organizationList;
}
Also used : EntityDAOIF(com.runwaysdk.dataaccess.EntityDAOIF) LinkedList(java.util.LinkedList)

Aggregations

EntityDAOIF (com.runwaysdk.dataaccess.EntityDAOIF)2 Roles (com.runwaysdk.system.Roles)1 Universal (com.runwaysdk.system.gis.geo.Universal)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)1