Skip to content
This repository has been archived by the owner on Jul 29, 2021. It is now read-only.

Commit

Permalink
feat: create default group for api and apps
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasGeraud committed Sep 5, 2017
1 parent a22aa1f commit ef333eb
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 0 deletions.
@@ -0,0 +1,39 @@
/**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.gravitee.repository.mongodb.management.internal.model;

/**
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com)
* @author GraviteeSource Team
*/
public class GroupEventRuleMongo {
private String event;

public String getEvent() {
return event;
}

public void setEvent(String event) {
this.event = event;
}

@Override
public String toString() {
return "GroupEventRule{" +
", event='" + event + '\'' +
"}";
}
}
Expand Up @@ -31,6 +31,7 @@ public class GroupMongo extends Auditable {
private String type;
private String name;
private List<String> administrators;
private List<GroupEventRuleMongo> eventRules;

public String getId() {
return id;
Expand All @@ -56,6 +57,14 @@ public void setName(String name) {
this.name = name;
}

public List<GroupEventRuleMongo> getEventRules() {
return eventRules;
}

public void setEventRules(List<GroupEventRuleMongo> eventRules) {
this.eventRules = eventRules;
}

public List<String> getAdministrators() {
return administrators;
}
Expand Down
Expand Up @@ -23,6 +23,8 @@

import org.dozer.DozerBeanMapper;
import org.dozer.MappingException;
import org.dozer.config.BeanContainer;
import org.dozer.util.DefaultClassLoader;

/**
* @author David BRASSELY (david.brassely at graviteesource.com)
Expand All @@ -32,6 +34,7 @@ public class GraviteeDozerMapper extends DozerBeanMapper implements GraviteeMapp

public GraviteeDozerMapper(){
super.addMapping(getClass().getResourceAsStream("/dozer.xml"));
BeanContainer.getInstance().setClassLoader(new RepositoryDozerClassLoader());
}

public <T> T map(Object source, Class<T> destinationClass) throws MappingException{
Expand Down
@@ -0,0 +1,51 @@
/**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.gravitee.repository.mongodb.management.mapper;

import org.apache.commons.lang3.ClassUtils;
import org.dozer.util.DozerClassLoader;
import org.dozer.util.MappingUtils;
import org.dozer.util.ResourceLoader;

import java.net.URL;

/**
* @author David BRASSELY (david.brassely at graviteesource.com)
* @author GraviteeSource Team
*/
public class RepositoryDozerClassLoader implements DozerClassLoader {

private final ResourceLoader resourceLoader = new ResourceLoader();
private final ClassLoader classLoader = this.getClass().getClassLoader();

public RepositoryDozerClassLoader() {}

public Class<?> loadClass(String className) {
Class result = null;

try {
result = ClassUtils.getClass(classLoader, className);
} catch (ClassNotFoundException var4) {
MappingUtils.throwMappingException(var4);
}

return result;
}

public URL loadResource(String uri) {
return this.resourceLoader.getResource(uri);
}
}

0 comments on commit ef333eb

Please sign in to comment.