Skip to content

Commit

Permalink
Merge Space Templates Layout - Meeds-io/MIPs#165 (#997)
Browse files Browse the repository at this point in the history
  • Loading branch information
boubaker authored Nov 4, 2024
2 parents 9d50c53 + cccb3fb commit e674416
Show file tree
Hide file tree
Showing 236 changed files with 4,183 additions and 8,014 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,18 @@

/**
* Saves some settings linked to a Context.
*
* @LevelAPI Experimental
*/

public class Context implements Cloneable, Serializable {

private static final long serialVersionUID = -3753327207819586801L;

/**
* GLOBAL: Settings should impact all users in the underlying scope.
*
* @LevelAPI Experimental
*/
public static final Context GLOBAL = new Context("GLOBAL", "GLOBAL");

/**
* USER: Each user should be able to save his own settings.
*
* @LevelAPI Experimental
*/
public static final Context USER = new Context("USER", null);

Expand All @@ -55,15 +51,10 @@ public Context(String name, String id) {
* Creates a context with a specified Id.
*
* @param id The Id that is displayed as username.
* @LevelAPI Experimental
*/
public Context id(String id) {
Context result = null;
try {
result = (Context) this.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
result = this.clone();
result.id = id;
return result;
}
Expand All @@ -73,7 +64,6 @@ public Context id(String id) {
*
* @return Returns "null" if the context is GLOBAL or user Id if the context
* is USER.
* @LevelAPI Experimental
*/
public String getId() {
if (id == null && USER.getName().equals(getName())) {
Expand Down Expand Up @@ -109,4 +99,9 @@ public int hashCode() {
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
}

@Override
public Context clone() { // NOSONAR
return new Context(name, id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,59 +20,59 @@

/**
* Saves some settings linked to a scope.
*
* @LevelAPI Experimental
*/
public class Scope implements Cloneable, Serializable {

private static final long serialVersionUID = 4408914199911160397L;

/**
* Settings of portlets or gadgets.
*
* @LevelAPI Experimental
*/
public static final Scope WINDOWS = new Scope("WINDOWS", null);
public static final Scope WINDOWS = new Scope("WINDOWS", null);

/**
* Settings of pages.
*
* @LevelAPI Experimental
*/
public static final Scope PAGE = new Scope("PAGE", null);
public static final Scope PAGE = new Scope("PAGE", null);

/**
* Settings of spaces.
*
* @LevelAPI Experimental
*/
public static final Scope SPACE = new Scope("SPACE", null);
public static final Scope SPACE = new Scope("SPACE", null);

/**
* Settings of sites.
*
* @LevelAPI Experimental
*/
public static final Scope SITE = new Scope("SITE", null);
public static final Scope SITE = new Scope("SITE", null);

/**
* Settings of the entire portal (and all its sites).
*
* @LevelAPI Experimental
*/
public static final Scope PORTAL = new Scope("PORTAL", null);
public static final Scope PORTAL = new Scope("PORTAL", null);

/**
* Settings of an application, like Forum, Content, or Social.
*
* @LevelAPI Experimental
*/
public static final Scope APPLICATION = new Scope("APPLICATION", null);
public static final Scope APPLICATION = new Scope("APPLICATION", null);

/**
* Settings of the whole eXo Platform (all sites and portals).
*
* @LevelAPI Experimental
*/
public static final Scope GLOBAL = new Scope("GLOBAL", null);
public static final Scope GLOBAL = new Scope("GLOBAL", null);

private String id;

Expand All @@ -84,12 +84,7 @@ public Scope(String name, String id) {
}

public Scope id(String id) {
Scope result = null;
try {
result = (Scope) this.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
Scope result = this.clone();
result.id = id;
return result;
}
Expand All @@ -104,8 +99,10 @@ public String getName() {

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;

Scope that = (Scope) o;
return that.hashCode() == this.hashCode();
Expand All @@ -117,4 +114,9 @@ public int hashCode() {
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
}

@Override
public Scope clone() { // NOSONAR
return new Scope(name, id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,28 @@

import java.io.Serializable;

import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;

/**
* Associates setting properties with a specified context (GLOBAL/USER).
* This is used to specify context of setting properties at the Context level when working with database and cache or dispatching the setting event.
* @LevelAPI Experimental
* Associates setting properties with a specified context (GLOBAL/USER). This is
* used to specify context of setting properties at the Context level when
* working with database and cache or dispatching the setting event.
*/
public class SettingContext implements Serializable {
private static final Log LOG = ExoLogger.getLogger(SettingContext.class);

private static final long serialVersionUID = 437625857263645213L;

/**
* Context of the setting object.
*/
protected Context context;

/**
* Path of the context.
*/
protected String contextPath;

/**
* Creates a SettingContext object with a specified context type.
*
* @param context The context type.
* @LevelAPI Experimental
*/
Expand All @@ -50,6 +48,7 @@ public SettingContext(Context context) {
this.context = context;
this.contextPath = Tools.buildContextPath(context);
}

/**
* Compares a specified object with the SettingContext for equality.
*/
Expand All @@ -62,8 +61,7 @@ public boolean equals(Object obj) {
return true;
}

if (obj instanceof SettingContext) {
SettingContext dest = (SettingContext) obj;
if (obj instanceof SettingContext dest) {
return this.getContextPath().equals(dest.getContextPath());
}
return false;
Expand All @@ -79,6 +77,7 @@ public int hashCode() {

/**
* Gets path of the SettingContext object.
*
* @return The setting context path.
* @LevelAPI Experimental
*/
Expand All @@ -88,6 +87,7 @@ public String getContextPath() {

/**
* Gets a context object associated with the SettingContext object.
*
* @return The context object.
* @LevelAPI Experimental
*/
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit e674416

Please sign in to comment.