Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.trywildcard.pair.exception.CardBuilderException;
import com.trywildcard.pair.extraction.MetaTagExtractor;
import com.trywildcard.pair.extraction.MetaTagModel;
import com.trywildcard.pair.model.action.Action;
import com.trywildcard.pair.model.creator.Creator;
import com.trywildcard.pair.util.CardSerializer;
import com.trywildcard.pair.validation.ValidationTool;
Expand All @@ -28,10 +29,12 @@ public abstract class AbstractCard implements Card {

private Creator creator;

/* List of definable actions that are available for this card */
private List<Action> actions;

@JsonIgnore
protected MetaTagModel metaTagModel;


@JsonIgnore
protected ValidationTool v = new ValidationTool();

Expand All @@ -53,6 +56,13 @@ public void setKeywords(List<String> keywords) throws CardBuilderException {
}
}

public void setActions(List<Action> actions) throws CardBuilderException {
boolean isValid = v.optional(v.notNullOrEmpty(actions), "Actions cannot be null.");
if (isValid) {
this.actions = actions;
}
}

protected void webUrl(String webUrl) throws CardBuilderException {
boolean isValid = v.required(v.notNullOrEmpty(webUrl), "Must specify a card webUrl.");
if (isValid) {
Expand Down Expand Up @@ -119,6 +129,8 @@ public String getAppLinkAndroid() {

public Creator getCreator() { return creator; }

public List<Action> getActions() { return actions; }

/**
* Serialize fields in the Wildcard card format.
* @return the string representation of this card.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.trywildcard.pair.model.action;

import java.net.URL;
import java.util.List;

/**
* Created by karthiksenthil on 2/25/15.
*/
public interface Action {

public String getName();

public ActionType getMethod();

public URL getUrl();

public List<String> getRequiredParameters();

public List<String> getOptionalParameters();

public enum ActionType {
GET, POST, DELETE
}

}