diff --git a/scm-core/src/main/java/sonia/scm/plugin/PluginInformation.java b/scm-core/src/main/java/sonia/scm/plugin/PluginInformation.java index de0a3ca1e9..99ad1e82e8 100644 --- a/scm-core/src/main/java/sonia/scm/plugin/PluginInformation.java +++ b/scm-core/src/main/java/sonia/scm/plugin/PluginInformation.java @@ -1,19 +1,19 @@ /** * Copyright (c) 2010, Sebastian Sdorra * All rights reserved. - * + *
* Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - * + *
* 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * 3. Neither the name of SCM-Manager; nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -24,13 +24,11 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + *
* http://bitbucket.org/sdorra/scm-manager
- *
*/
-
package sonia.scm.plugin;
//~--- non-JDK imports --------------------------------------------------------
@@ -39,6 +37,8 @@ import com.github.sdorra.ssp.PermissionObject;
import com.github.sdorra.ssp.StaticPermissions;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
+import lombok.Getter;
+import lombok.Setter;
import sonia.scm.Validateable;
import sonia.scm.util.Util;
@@ -46,43 +46,38 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
-import java.util.Map;
//~--- JDK imports ------------------------------------------------------------
/**
- *
* @author Sebastian Sdorra
*/
@StaticPermissions(
- value = "plugin",
- generatedClass = "PluginPermissions",
+ value = "plugin",
+ generatedClass = "PluginPermissions",
permissions = {},
- globalPermissions = { "read", "manage" },
+ globalPermissions = {"read", "manage"},
custom = true, customGlobal = true
)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "plugin-information")
-public class PluginInformation
- implements PermissionObject, Validateable, Cloneable, Serializable
-{
+@Getter
+@Setter
+public class PluginInformation implements PermissionObject, Validateable, Cloneable, Serializable {
- /** Field description */
private static final long serialVersionUID = 461382048865977206L;
- //~--- methods --------------------------------------------------------------
+ private String author;
+ private String category;
+ private PluginCondition condition;
+ private String description;
+ private String name;
+ private PluginState state;
+ private String version;
+ private String avatarUrl;
- /**
- * Method description
- *
- *
- * @return
- *
- * @since 1.11
- */
@Override
- public PluginInformation clone()
- {
+ public PluginInformation clone() {
PluginInformation clone = new PluginInformation();
clone.setName(name);
clone.setAuthor(author);
@@ -90,33 +85,22 @@ public class PluginInformation
clone.setDescription(description);
clone.setState(state);
clone.setVersion(version);
+ clone.setAvatarUrl(avatarUrl);
- if (condition != null)
- {
+ if (condition != null) {
clone.setCondition(condition.clone());
}
return clone;
}
- /**
- * Method description
- *
- *
- * @param obj
- *
- * @return
- */
@Override
- public boolean equals(Object obj)
- {
- if (obj == null)
- {
+ public boolean equals(Object obj) {
+ if (obj == null) {
return false;
}
- if (getClass() != obj.getClass())
- {
+ if (getClass() != obj.getClass()) {
return false;
}
@@ -125,276 +109,54 @@ public class PluginInformation
//J-
return
Objects.equal(author, other.author)
- && Objects.equal(category, other.category)
- && Objects.equal(condition, other.condition)
- && Objects.equal(description, other.description)
- && Objects.equal(name, other.name)
- && Objects.equal(state, other.state)
- && Objects.equal(version, other.version);
+ && Objects.equal(category, other.category)
+ && Objects.equal(condition, other.condition)
+ && Objects.equal(description, other.description)
+ && Objects.equal(name, other.name)
+ && Objects.equal(state, other.state)
+ && Objects.equal(version, other.version)
+ && Objects.equal(avatarUrl, other.avatarUrl);
//J+
}
- /**
- * Method description
- *
- *
- * @return
- */
@Override
- public int hashCode()
- {
+ public int hashCode() {
return Objects.hashCode(author, category, condition,
- description, name, state, version);
+ description, name, state, version, avatarUrl);
}
- /**
- * Method description
- *
- *
- * @return
- */
@Override
- public String toString()
- {
+ public String toString() {
//J-
return MoreObjects.toStringHelper(this)
- .add("author", author)
- .add("category", category)
- .add("condition", condition)
- .add("description", description)
- .add("name", name)
- .add("state", state)
- .add("version", version)
- .toString();
+ .add("author", author)
+ .add("category", category)
+ .add("condition", condition)
+ .add("description", description)
+ .add("name", name)
+ .add("state", state)
+ .add("version", version)
+ .add("avatarUrl", avatarUrl)
+ .toString();
//J+
}
- //~--- get methods ----------------------------------------------------------
-
- /**
- * Method description
- *
- *
- * @return
- */
- public String getAuthor()
- {
- return author;
- }
-
- /**
- * Method description
- *
- *
- * @return
- */
- public String getCategory()
- {
- return category;
- }
-
- /**
- * Method description
- *
- *
- * @return
- */
- public PluginCondition getCondition()
- {
- return condition;
- }
-
- /**
- * Method description
- *
- *
- * @return
- */
- public String getDescription()
- {
- return description;
- }
-
-
- /**
- * Method description
- *
- *
- * @return
- */
@Override
- public String getId()
- {
+ public String getId() {
return getName(true);
}
- /**
- * Method description
- *
- *
- * @param withVersion
- *
- * @return
- * @since 1.21
- */
- public String getName(boolean withVersion)
- {
+ public String getName(boolean withVersion) {
StringBuilder id = new StringBuilder(name);
- if (withVersion)
- {
+ if (withVersion) {
id.append(":").append(version);
}
-
return id.toString();
}
- /**
- * Method description
- *
- *
- * @return
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Method description
- *
- *
- * @return
- */
- public PluginState getState()
- {
- return state;
- }
-
- /**
- * Method description
- *
- *
- * @return
- */
- public String getVersion()
- {
- return version;
- }
-
- /**
- * Method description
- *
- *
- * @return
- */
@Override
- public boolean isValid()
- {
+ public boolean isValid() {
return Util.isNotEmpty(name) && Util.isNotEmpty(version);
}
-
- //~--- set methods ----------------------------------------------------------
-
- /**
- * Method description
- *
- *
- * @param author
- */
- public void setAuthor(String author)
- {
- this.author = author;
- }
-
- /**
- * Method description
- *
- *
- * @param category
- */
- public void setCategory(String category)
- {
- this.category = category;
- }
-
- /**
- * Method description
- *
- *
- * @param condition
- */
- public void setCondition(PluginCondition condition)
- {
- this.condition = condition;
- }
-
- /**
- * Method description
- *
- *
- * @param description
- */
- public void setDescription(String description)
- {
- this.description = description;
- }
-
-
- /**
- * Method description
- *
- *
- * @param name
- */
- public void setName(String name)
- {
- this.name = name;
- }
-
- /**
- * Method description
- *
- *
- * @param state
- */
- public void setState(PluginState state)
- {
- this.state = state;
- }
-
- /**
- * Method description
- *
- *
- * @param version
- */
- public void setVersion(String version)
- {
- this.version = version;
- }
-
- //~--- fields ---------------------------------------------------------------
-
- /** Field description */
- private String author;
-
- /** Field description */
- private String category;
-
- /** Field description */
- private PluginCondition condition;
-
- /** Field description */
- private String description;
-
- /** Field description */
- private String name;
-
- /** Field description */
- private PluginState state;
-
- /** Field description */
- private String version;
-
}
diff --git a/scm-ui-components/packages/ui-types/src/Plugin.js b/scm-ui-components/packages/ui-types/src/Plugin.js
index bb9c5e7d88..72e4908a54 100644
--- a/scm-ui-components/packages/ui-types/src/Plugin.js
+++ b/scm-ui-components/packages/ui-types/src/Plugin.js
@@ -1,11 +1,12 @@
//@flow
-import type { Collection, Links } from "./hal";
+import type {Collection, Links} from "./hal";
export type Plugin = {
name: string,
type: string,
version: string,
author: string,
+ avatarUrl: string,
description?: string,
_links: Links
};
diff --git a/scm-ui/src/admin/plugins/components/PluginAvatar.js b/scm-ui/src/admin/plugins/components/PluginAvatar.js
index 10408f14bd..42a1fd732b 100644
--- a/scm-ui/src/admin/plugins/components/PluginAvatar.js
+++ b/scm-ui/src/admin/plugins/components/PluginAvatar.js
@@ -1,8 +1,8 @@
//@flow
import React from "react";
-import { ExtensionPoint } from "@scm-manager/ui-extensions";
-import type { Plugin } from "@scm-manager/ui-types";
-import { Image } from "@scm-manager/ui-components";
+import {ExtensionPoint} from "@scm-manager/ui-extensions";
+import type {Plugin} from "@scm-manager/ui-types";
+import {Image} from "@scm-manager/ui-components";
type Props = {
plugin: Plugin
@@ -14,7 +14,7 @@ export default class PluginAvatar extends React.Component