Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
manos committed Jun 20, 2017
1 parent ee2953a commit 395e21d
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 15 deletions.
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,11 @@

<dependencyManagement>
<dependencies>

<dependency>
<groupId>net._01001111</groupId>
<artifactId>jlorem</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ public final void onUserCreatedListener(EntityCreatedEvent<User> event) {
this.onUserCreated(event);
}

/**
* Creates a space for the new user
* @param event
*/
protected void onUserCreated(EntityCreatedEvent<User> event) {

User user = event.getModel();
Expand All @@ -115,6 +119,7 @@ protected void onUserCreated(EntityCreatedEvent<User> event) {
if (StringUtils.isBlank(description)) {
description = "Space for " + name;
}

Space space = new Space.Builder()
.owner(user)
.name(name)
Expand All @@ -141,7 +146,7 @@ public void onMembershipCreated(EntityCreatedEvent<Membership> event) {
Enum predicate = SpaceActivity.BECAME_MEMBER_OF;
MessageResource objectMessageResource = BaseContextInfo.from(context);

createLog(context, user, context, predicate, objectMessageResource);
createLog(model , user, context, predicate, objectMessageResource);

}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
*
* Restdude
* -------------------------------------------------------------------
*
* Copyright © 2005 Manos Batsis (manosbatsis gmail)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.restdude.domain.cases.model;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.validation.constraints.NotNull;

import com.restdude.mdd.model.AbstractPersistableHierarchicalModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
* Represents a retreivable resource with id, name, title and description.
*/
@MappedSuperclass
public class AbstractPersistableResourceModel extends AbstractPersistableHierarchicalModel<BaseContext> {

@NotNull
@Column(name = "title", nullable = false, unique = true)
@Getter @Setter
@ApiModelProperty(value = "Short description, up to a handful of words", required = true)
private String title;

@NotNull
@Column(name = "description", length = 500, nullable = false)
@Getter @Setter
@ApiModelProperty(value = "Regular Description text, i.e. a paragraph", required = true)
private String description;

public AbstractPersistableResourceModel(String name) {
super(name);
}

public AbstractPersistableResourceModel() {
super();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,12 @@
@ModelResource(pathFragment = BaseContext.API_PATH_FRAGMENT,
apiDescription = "Contexts management")
@ApiModel(description = BaseContext.API_MODEL_DESCRIPTION)
public class BaseContext extends AbstractPersistableHierarchicalModel<BaseContext> implements IBaseContext<User, Membership, MembershipRequest> {
public class BaseContext extends AbstractPersistableResourceModel implements IBaseContext<User, Membership, MembershipRequest> {

public static final String API_PATH_FRAGMENT = "contexts";
public static final String API_MODEL_DESCRIPTION = "A model representing a context, such as an organization, team, or process type.";

@NotNull
@Column(name = "title", nullable = false, unique = true)
@Getter @Setter
@ApiModelProperty(value = "Short description, up to a handful of words", required = true)
private String title;

@NotNull
@Column(name = "description", length = 500, nullable = false)
@Getter @Setter
@ApiModelProperty(value = "Regular Description text, i.e. a paragraph", required = true)
private String description;

@FilePersistence(maxWidth = 130, maxHeight = 130)
@FilePersistencePreview(maxWidth = 100, maxHeight = 100)
Expand Down Expand Up @@ -149,8 +139,8 @@ public BaseContext() {

public BaseContext(String name, String title, String description, String avatarUrl, String bannerUrl, ContextVisibilityType visibility, User owner, Set<Membership> memberships, List<MembershipRequest> membershipRequests) {
super(name);
this.title = title;
this.description = description;
this.setTitle(title);
this.setDescription(description);
this.avatarUrl = avatarUrl;
this.bannerUrl = bannerUrl;
this.visibility = visibility;
Expand Down
4 changes: 4 additions & 0 deletions restdude-mdd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
</build>

<dependencies>
<dependency>
<groupId>net._01001111</groupId>
<artifactId>jlorem</artifactId>
</dependency>
<dependency>
<groupId>com.restdude</groupId>
<artifactId>restdude-api</artifactId>
Expand Down

0 comments on commit 395e21d

Please sign in to comment.