Skip to content

Instantly share code, notes, and snippets.

Oliver Severin Mulelid-Tynes olivermt

  • Microsoft / OMT Tech AS
  • Hamar, Norway
Block or report user

Report or block olivermt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:872596
Map<String, Integer> listDistinctGrossDepEnv() {
HibernateCriteriaBuilder builder = OutcropSection.createCriteria()
Collection results = builder.list {
// Not binding to a bean
resultTransformer(AliasToEntityMapResultTransformer.INSTANCE)
projections {
groupProperty("grossDepositionalEnvironment", "keyName")
depositionalEnvironment {
subEnvironment {
count("architecturalElement", "countValue")
View gist:872957
import no.cipr.safari.model.OutcropSection
def c = OutcropSection.createCriteria()
def result = c.list {
eq("grossDepositionalEnvironment", "*")
}
View gist:873003
List<Outcrop> listTouchedOutcrops(String grossDepEnv, String depEnv = null, String subDepEnv = null, String archiEleType = null, String basinType = null, String climate = null) {
def c = Outcrop.createCriteria()
def result = c.list {
section {
eq("grossDepositionalEnvironment", grossDepEnv)
depositionalSetting {
basinType ? eq("basinType", basinType) : null
climate ? eq("paleoClimate", climate) : null
View gist:874515
package no.cipr.safari.model
import grails.converters.XML
class SearchController {
def transient modelSearchService
def transient depositionalSearchService
def index = {
def distinct = modelSearchService.listDistinctGrossDepEnv()//works just fine
View gist:875803
Map<String, Integer>listDistinctGeometries(query) {
HibernateCriteriaBuilder builder = OutcropSection.createCriteria()
def types = [min: "minGeometry", max: "maxGeometry", avg: "avgGeometry"]
def result = [:]
types.each {
def archiElementCount = builder.get {
query.modern ? isNotNull("modernDepositionalSetting") : isNotNull("depositionalSetting")
eq("grossDepositionalEnvironment", query.grossDepEnv)
depositionalSetting {
if(query.basinType) 'in'("basinType", query.basinType)
View gist:892526
try{
user.bnetUrl = params.bnetUrl
userService.updateRank(user)
user.save(flush:true)
}
catch(InvalidBnetUrlException e) {
flash.message = e.message
render(view: "seedError")
return
}
View gist:919100
changeSet(author: "oliver (generated)", id: "1302702919266-23") {
dropForeignKeyConstraint(constraintName: "FK375DF2F9A2DB3C5A", baseTableName: "sec_user")
dropIndex(indexName: "FK375DF2F9A2DB3C5A", tableName: "sec_user")
renameColumn(oldColumnName: "rank_info_id", newColumnName: "rank_infoeu_id", columnDataType: "bigint NULL", tableName: "sec_user")
createIndex(indexName: "FK375DF2F9A2DB3C5A", tableName: "sec_user") {
column(name: "rank_infoeu_id")
}
addForeignKeyConstraint(baseColumnNames: "rank_infoeu_id", baseTableName: "sec_user", constraintName: "FK375DF2F9A2DB3C5A", deferrable: "false", initiallyDeferred: "false", referencedColumnNames: "id", referencedTableName: "rank_info", referencesUniqueColumn: "false")
}
View gist:919113
Map<String, Integer>listDistinctDepositionalEnvironments(query) {
HibernateCriteriaBuilder builder = OutcropSection.createCriteria()
Collection results = builder.list {
resultTransformer(AliasToEntityMapResultTransformer.INSTANCE)
query.modern ? isNotNull("modernDepositionalSetting") : isNotNull("depositionalSetting")
eq("grossDepositionalEnvironment", query.grossDepEnv)
depositionalSetting {
if(query.basinType) 'in'("basinType", query.basinType)
if(query.paleoClimate)'in'("paleoClimate", query.paleoClimate)
}
View gist:919157
package no.cipr.safari.model
enum DataSetScaleEnum {
SYSTEM_SCALE('system scale'),
DEPOSITIONAL_ELEMENTS_SCALE('depositional elements scale'),
ARCHITECTURAL_ELEMENTS_SCALE('architectural elements scale'),
FACIES_SCALE('facies scale'),
UNKNOWN('unknown'),
View gist:1080332
//in my config file
require_once(SITE_DIR . '/class/ClassAutoLoader.php');
$loader = new ClassAutoLoader();
//the autoloader
<?php
class ClassAutoloader {
public function __construct() {
You can’t perform that action at this time.