Transform an organization from database model to client/server model

@param dbOrganization DbOrganization
@return Organization
481729
public Organization getOrganization(final DbOrganization dbOrganization) {
        final Organization organization = DataModelFactory.createOrganization(dbOrganization.getName());
        organization.getCorporateGroupIdPrefixes().addAll(dbOrganization.getCorporateGroupIdPrefixes());

        return organization;
    }
333133
public function findOrganizationPage($organizationId, $pageId)
    {
        list($response) = $this->findOrganizationPageWithHttpInfo($organizationId, $pageId);
        return $response;
    }
160189
public static AuditEntryBean organizationCreated(OrganizationBean bean, ISecurityContext securityContext) {
        AuditEntryBean entry = newEntry(bean.getId(), AuditEntityType.Organization, securityContext);
        entry.setEntityId(null);
        entry.setEntityVersion(null);
        entry.setWhat(AuditEntryType.Create);
        return entry;
    }
337377
public static AnnotationDto transformToDto(Annotation annotation) {
        if (annotation == null) {
            throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
        }

        AnnotationDto result = createDtoObject(AnnotationDto.class, annotation);

        return result;
    }
1190176
public static List<DashboardDto> transformToDto(List<Dashboard> dashboards) {
        if (dashboards == null) {
            throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
        }

        List<DashboardDto> result = new ArrayList<DashboardDto>();

        for (Dashboard dashboard : dashboards) {
            result.add(transformToDto(dashboard));
        }
        return result;
    }
516545
public function getOrganizations()
    {
        $sql = "SELECT gor_id_organization, gor_name
                    FROM gems__organizations
                    WHERE gor_active = 1
                    ORDER BY gor_name";

        try {
            $organizations = $this->_getSelectPairsCached(__FUNCTION__, $sql, null, 'organizations', 'natsort');
        } catch (\Exception $exc) {
            // Intentional fallthrough when no db present
            $organizations = array();
        }

        return $organizations;
    }
1042323
static OrganizationSettings getOrganizationSettings(OrganizationName organizationName) {
    try (SecurityCenterClient client = SecurityCenterClient.create()) {
      // Start setting up a request to get OrganizationSettings for.
      // OrganizationName organizationName = OrganizationName.of(/*organizationId=*/"123234324");
      GetOrganizationSettingsRequest.Builder request =
          GetOrganizationSettingsRequest.newBuilder()
              .setName(organizationName.toString() + "/organizationSettings");

      // Call the API.
      OrganizationSettings response = client.getOrganizationSettings(request.build());

      System.out.println("Organization Settings:");
      System.out.println(response);
      return response;
    } catch (IOException e) {
      throw new RuntimeException("Couldn't create client.", e);
    }
  }
372035
public SpatialReferenceSystem queryForOrganizationCoordsysId(
			String organization, long organizationCoordsysId)
			throws SQLException {
		SpatialReferenceSystem srs = null;

		QueryBuilder<SpatialReferenceSystem, Long> qb = queryBuilder();
		qb.where().like(SpatialReferenceSystem.COLUMN_ORGANIZATION,
				organization);
		qb.where().eq(SpatialReferenceSystem.COLUMN_ORGANIZATION_COORDSYS_ID,
				organizationCoordsysId);
		PreparedQuery<SpatialReferenceSystem> preparedQuery = qb.prepare();

		List<SpatialReferenceSystem> results = query(preparedQuery);

		if (!results.isEmpty()) {
			if (results.size() > 1) {
				throw new SQLException("More than one "
						+ SpatialReferenceSystem.class.getSimpleName()
						+ " returned for Organization: " + organization
						+ ", Organization Coordsys Id: "
						+ organizationCoordsysId);
			}
			srs = results.get(0);
		}
		return srs;
	}
1008403
function getCurrentOrganization() {
    var fields = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        fields[_i - 0] = arguments[_i];
    }
    return getCurrentServer().organization;
}
828124
public static Entry organizationalUnit(String ou, Dn baseDn) {
        Dn dn = LdapUtils.concatDn(SchemaConstants.OU_ATTRIBUTE, ou, baseDn);
        Entry entry = new DefaultEntry(dn);
        try {
            entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, SchemaConstants.ORGANIZATIONAL_UNIT_OC);
            entry.add(SchemaConstants.OU_ATTRIBUTE, ou);
        } catch (LdapException e) {
            throw new LdapRuntimeException(e);
        }
        return entry;
    }
236691
protected Response migrateClientsOrganization(final String organizationSid, UriInfo info, MediaType responseType, UserIdentityContext userIdentityContext) {

        //First check if the account has the required permissions in general, this way we can fail fast and avoid expensive DAO operations
        permissionEvaluator.checkPermission("RestComm:Read:Organizations", userIdentityContext);
        Organization organization = null;

        if (!Sid.pattern.matcher(organizationSid).matches()) {
            return status(BAD_REQUEST).build();
        } else {
            try {
                if (!permissionEvaluator.isSuperAdmin(userIdentityContext)) {
                    return status(FORBIDDEN).build();
                } else {
                    organization = organizationsDao.getOrganization(new Sid(organizationSid));
                }
            } catch (Exception e) {
                return status(NOT_FOUND).build();
            }
        }

        if (organization == null) {
            return status(NOT_FOUND).build();
        } else {
            Response.ResponseBuilder ok = Response.ok();

            List<Client> clients = clientsDao.getClientsByOrg(organization.getSid());
            Map<String, String> migratedClients = clientPasswordHashingService.hashClientPassword(clients, organization.getDomainName());


            if (APPLICATION_XML_TYPE.equals(responseType)) {
                final RestCommResponse response = new RestCommResponse(migratedClients);
                return ok.type(APPLICATION_XML).entity(xstream.toXML(response)).build();
            } else if (APPLICATION_JSON_TYPE.equals(responseType)) {
                return ok.type(APPLICATION_JSON).entity(gson.toJson(migratedClients)).build();
            } else {
                return null;
            }
        }
    }
1135890
private static ModelNode createOperation(ServerIdentity identity) {
        // The server address
        final ModelNode address = new ModelNode();
        address.add(ModelDescriptionConstants.HOST, identity.getHostName());
        address.add(ModelDescriptionConstants.RUNNING_SERVER, identity.getServerName());
        //
        final ModelNode operation = OPERATION.clone();
        operation.get(ModelDescriptionConstants.OP_ADDR).set(address);
        return operation;
    }
1324018
public void setOrganizationalUnits(java.util.Collection<OrganizationalUnit> organizationalUnits) {
        if (organizationalUnits == null) {
            this.organizationalUnits = null;
            return;
        }

        this.organizationalUnits = new java.util.ArrayList<OrganizationalUnit>(organizationalUnits);
    }
1127581
public static Organization createOrganization(final String name){
        final Organization organization = new Organization();
        organization.setName(name);

        return organization;

    }
436053
def organization_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/organizations.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
851747
public static Entry organizationalUnit(Dn dn) {
        Entry entry = new DefaultEntry(dn);
        try {
            entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, SchemaConstants.ORGANIZATIONAL_UNIT_OC);
            entry.add(SchemaConstants.OU_ATTRIBUTE, dn.getRdn().getName());
        } catch (LdapException e) {
            throw new LdapRuntimeException(e);
        }
        return entry;
    }
1070689
public List<String> getCorporateGroupIds(final String organizationId) {
        final DbOrganization dbOrganization = getOrganization(organizationId);
        return dbOrganization.getCorporateGroupIdPrefixes();
    }