org.smartdeveloperhub.harvesters.scm.testing.enhancer.Activity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scm-harvester-testing Show documentation
Show all versions of scm-harvester-testing Show documentation
Standalone GitLab Enhancer Testing implementation for carrying out integration tests
The newest version!
/**
* #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
* This file is part of the Smart Developer Hub Project:
* http://www.smartdeveloperhub.org/
*
* Center for Open Middleware
* http://www.centeropenmiddleware.com/
* #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
* Copyright (C) 2015-2016 Center for Open Middleware.
* #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
* 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.
* #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
* Artifact : org.smartdeveloperhub.harvesters.scm:scm-harvester-testing:0.3.0
* Bundle : scm-harvester-testing-0.3.0.jar
* #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
*/
package org.smartdeveloperhub.harvesters.scm.testing.enhancer;
import java.util.UUID;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
Activity.ID,
Activity.TIMESTAMP,
Activity.ACTION,
Activity.DESCRIPTION,
Activity.ENTITY,
Activity.TARGET_ID,
Activity.TARGET_LOCATION,
Activity.REPRESENTATION,
})
public final class Activity {
static final String ID = "id";
static final String TIMESTAMP = "timestamp";
static final String ACTION = "action";
static final String ENTITY = "entity";
static final String TARGET_ID = "targetId";
static final String DESCRIPTION = "description";
static final String TARGET_LOCATION = "targetLocation";
static final String REPRESENTATION = "representation";
public enum Action {
LOG,
CREATED,
UPDATED,
DELETED,
}
@JsonProperty(Activity.ID)
private UUID id;
@JsonProperty(Activity.TIMESTAMP)
private long timestamp;
@JsonProperty(Activity.ACTION)
private Action action;
@JsonProperty(Activity.ENTITY)
private State.Entity entity;
@JsonProperty(Activity.TARGET_ID)
private T targetId;
@JsonProperty(Activity.DESCRIPTION)
private String description;
@JsonProperty(Activity.TARGET_LOCATION)
private String targetLocation;
@JsonProperty(Activity.REPRESENTATION)
private Object representation;
/**
* @return the id
*/
@JsonProperty(ID)
public UUID getId() {
return this.id;
}
/**
* @param id the id to set
*/
@JsonProperty(ID)
public void setId(final UUID id) {
this.id = id;
}
/**
* @return the timestamp
*/
@JsonProperty(Activity.TIMESTAMP)
public long getTimestamp() {
return this.timestamp;
}
/**
* @param timestamp the timestamp to set
*/
@JsonProperty(Activity.TIMESTAMP)
public void setTimestamp(final long timestamp) {
this.timestamp = timestamp;
}
/**
* @return the action
*/
@JsonProperty(Activity.ACTION)
public Action getAction() {
return this.action;
}
/**
* @param action the action to set
*/
@JsonProperty(Activity.ACTION)
public void setAction(final Action action) {
this.action = action;
}
/**
* @return the entity
*/
@JsonProperty(Activity.ENTITY)
public State.Entity getEntity() {
return this.entity;
}
/**
* @param entity the entity to set
*/
@JsonProperty(Activity.ENTITY)
public void setEntity(final State.Entity entity) {
this.entity = entity;
}
/**
* @return the targetId
*/
@JsonProperty(Activity.TARGET_ID)
public T getTargetId() {
return this.targetId;
}
/**
* @param targetId the targetId to set
*/
@JsonProperty(Activity.TARGET_ID)
public void setTargetId(final T targetId) {
this.targetId = targetId;
}
/**
* @return the message
*/
@JsonProperty(Activity.DESCRIPTION)
public String getDescription() {
return this.description;
}
/**
* @param description the message to set
*/
@JsonProperty(Activity.DESCRIPTION)
public void setDescription(final String description) {
this.description = description;
}
/**
* @return the targetLocation
*/
@JsonProperty(Activity.TARGET_LOCATION)
public String getTargetLocation() {
return this.targetLocation;
}
/**
* @param targetLocation the targetLocation to set
*/
@JsonProperty(Activity.TARGET_LOCATION)
public void setTargetLocation(final String targetLocation) {
this.targetLocation = targetLocation;
}
/**
* @return the representation
*/
@JsonProperty(Activity.REPRESENTATION)
public Object getRepresentation() {
return this.representation;
}
/**
* @param representation the representation to set
*/
@JsonProperty(Activity.REPRESENTATION)
public void setRepresentation(final Object representation) {
this.representation = representation;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Activity build;
private Builder() {
this.build=new Activity();
}
public Builder action(final Action action) {
this.build.setAction(action);
return this;
}
public Builder entity(final State.Entity entity) {
this.build.setEntity(entity);
return this;
}
public Builder description(final String format, final Object... args) {
this.build.setDescription(String.format(format,args));
return this;
}
public Builder targetId(final T id) {
this.build.setTargetId(id);
return this;
}
public Builder targetLocation(final String targetLocation) {
this.build.setTargetLocation(targetLocation);
return this;
}
public Builder representation(final Object representation) {
this.build.setRepresentation(representation);
return this;
}
public Activity build() {
final Activity result=this.build;
this.build=new Activity();
result.setId(UUID.randomUUID());
result.setTimestamp(System.currentTimeMillis());
return result;
}
}
}