Skip to content

Commit

Permalink
#21626 Container Resource (#21455)
Browse files Browse the repository at this point in the history
* #2142 adding first draft

* #21432 optimizing the get link

* #21432 optimizing the get link2

* #21432 adding postman test

* #21432 adding template test

* #21432 first draft container

* adding unpublish

* #21432 unpublish container

* #21432 added save new container endpoint

* #21432 adding container bring back + curl test

* #21432 adding container bring back + curl test

* #21432 adding the methods for all containers operations

* #21432 adding first curl test for containers

* #21432 adding container publish/unpublish

* #21432 more container enhancements

* #21432 adding publish and unpublish for file container

* #21432 adding the archive functionality

* #21432 adding changes for retrieving archive file container

* #21432 adding the unarchive function

* #21432 added delete container

* #21432 clean up

* #21432 test and final changes to the container resource

* #21432 adding some fixes to the container curl test

* #21432 adding more curl test per feedback

* #21432 fixing curl test

* #21432 fixing curl test part 2

* #21432 finally fixed the curl test for containers

* #21432 fixing the curl test

* #21432 changes over the curl test

* #21432 adding a change to remove the container/test folder is exists and run the test from fresh

* #21432 adding more curl test

* #21432 adding PR feedback
  • Loading branch information
jdotcms authored May 13, 2022
1 parent 66c7fb3 commit ce8cf80
Show file tree
Hide file tree
Showing 12 changed files with 5,114 additions and 108 deletions.
1,314 changes: 1,314 additions & 0 deletions dotCMS/src/curl-test/BringBack.postman_collection.json

Large diffs are not rendered by default.

2,493 changes: 2,493 additions & 0 deletions dotCMS/src/curl-test/Containers.postman_collection.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions dotCMS/src/curl-test/resources/containertest/container.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$dotJSON.put("title", "Test Container")
$dotJSON.put("max_contentlets", 25)
$dotJSON.put("notes", "Test Container")
$dotJSON.put("useDefaultLayout", "*")
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
package com.dotcms.rest.api.v1.container;

import com.dotcms.rest.api.Validated;
import com.dotmarketing.beans.ContainerStructure;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

import java.util.List;

/**
* Form to create a Container
* @author jsanca
*/
@JsonDeserialize(builder = ContainerForm.Builder.class)
public class ContainerForm extends Validated {

private final String identifier;
private final String title;
// description
private final String friendlyName;
/** nullable persistent field */
private final int maxContentlets;
/** nullable persistent field */
private final String code;
private final String notes;
private final String preLoop;
private final String postLoop;
private final boolean showOnMenu;
private final int sortOrder;
private final String sortContentletsBy;
private final String structureInode;
private final List<ContainerStructure> containerStructures;
private final String owner; // dotcms 472
private final String hostId;
private final boolean staticify;
private final boolean useDiv;
private final boolean dynamic;

private ContainerForm(final ContainerForm.Builder builder) {

this.identifier = builder.identifier;
this.title = builder. title;
this.friendlyName = builder.friendlyName;
this.maxContentlets = builder.maxContentlets;
this.code = builder.code;
this.notes = builder.notes;
this.preLoop = builder.preLoop;
this.postLoop = builder.postLoop;
this.showOnMenu = builder.showOnMenu;
this.sortOrder = builder.sortOrder;
this.sortContentletsBy = builder.sortContentletsBy;
this.structureInode = builder.structureInode;
this.containerStructures = builder.containerStructures;
this.owner = builder.owner;
this.hostId = builder.hostId;
this.staticify = builder.staticify;
this.useDiv = builder.useDiv;
this.dynamic = builder.dynamic;
}

public String getIdentifier() {
return identifier;
}

public String getTitle() {
return title;
}

public String getFriendlyName() {
return friendlyName;
}

public int getMaxContentlets() {
return maxContentlets;
}

public String getCode() {
return code;
}

public String getNotes() {
return notes;
}

public String getPreLoop() {
return preLoop;
}

public String getPostLoop() {
return postLoop;
}

public boolean isShowOnMenu() {
return showOnMenu;
}

public int getSortOrder() {
return sortOrder;
}

public String getSortContentletsBy() {
return sortContentletsBy;
}

public String getStructureInode() {
return structureInode;
}

public List<ContainerStructure> getContainerStructures() {
return containerStructures;
}

public String getOwner() {
return owner;
}

public String getHostId() {
return hostId;
}

public boolean isStaticify() {
return staticify;
}

public boolean isUseDiv() {
return useDiv;
}

public boolean isDynamic() {
return dynamic;
}

public static final class Builder {


@JsonProperty
private String identifier;

@JsonProperty
private String title;

// description
@JsonProperty
private String friendlyName;

/** nullable persistent field */
@JsonProperty
private int maxContentlets;

/** nullable persistent field */
@JsonProperty
private String code;

@JsonProperty
private String notes;

@JsonProperty
private String preLoop;

@JsonProperty
private String postLoop;

@JsonProperty
private boolean showOnMenu;

@JsonProperty
private int sortOrder;

@JsonProperty
private String sortContentletsBy;

@JsonProperty
private String structureInode;

@JsonProperty
private List<ContainerStructure> containerStructures;

@JsonProperty
private String owner; // dotcms 472


@JsonProperty
private String hostId;

// todo: what is that?
private boolean staticify;
private boolean useDiv;
private boolean dynamic;

public ContainerForm.Builder identifier (final String identifier) {
this.identifier = identifier;
return this;
}

public ContainerForm.Builder title (final String title) {
this.title = title;
return this;
}

public ContainerForm.Builder showOnMenu (final boolean showOnMenu) {
this.showOnMenu = showOnMenu;
return this;
}

public ContainerForm.Builder friendlyName (final String friendlyName) {
this.friendlyName = friendlyName;
return this;
}

public ContainerForm.Builder maxContentlets (final int maxContentlets) {
this.maxContentlets = maxContentlets;
return this;
}

public ContainerForm.Builder code (final String code) {
this.code = code;
return this;
}
public ContainerForm.Builder notes (final String notes) {
this.notes = notes;
return this;
}

public ContainerForm.Builder sortContentletsBy (final String showOnMenu) {
this.sortContentletsBy = sortContentletsBy;
return this;
}

public ContainerForm.Builder structureInode (final String structureInode) {
this.structureInode = structureInode;
return this;
}

public ContainerForm.Builder preLoop (final String preLoop) {
this.preLoop = preLoop;
return this;
}

public ContainerForm.Builder postLoop (final String postLoop) {
this.postLoop = postLoop;
return this;
}

public ContainerForm.Builder containerStructures (final List<ContainerStructure> containerStructures) {
this.containerStructures = containerStructures;
return this;
}

public ContainerForm.Builder sortOrder (final int sortOrder) {
this.sortOrder = sortOrder;
return this;
}

public ContainerForm.Builder owner (final String owner) {
this.owner = owner;
return this;
}

public ContainerForm.Builder hostId (final String hostId) {
this.hostId = hostId;
return this;
}

public ContainerForm build() {

return new ContainerForm(this);
}
}
}
Loading

0 comments on commit ce8cf80

Please sign in to comment.