Skip to content

Commit

Permalink
Merge pull request #53 from baloise/master
Browse files Browse the repository at this point in the history
7.0.2
  • Loading branch information
Tiliavir authored Nov 19, 2020
2 parents 470f447 + e2fa2bf commit 9d584cb
Show file tree
Hide file tree
Showing 36 changed files with 1,352 additions and 1,226 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/src/test/resources/signature-test.ser

/.settings
/.classpath
/.project
/target

.idea
*.iml
*.iml
6 changes: 3 additions & 3 deletions README.RELEASE.MD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- check fixed issues are assigned to milestone : https://github.com/baloise/digital-signature/milestones
- check fixed issues are assigned to milestone: https://github.com/baloise/digital-signature/milestones
- increase version in POM
- mvn clean package
- `mvn clean package`
- merge onto release branch
- set tag
- push and wait for https://travis-ci.org/baloise/digital-signature/branches to succeed
- create a version in marketplace https://marketplace.atlassian.com/manage/plugins/com.baloise.confluence.digital-signature/versions and upload obr ( from https://github.com/baloise/digital-signature/tree/gh-pages/release )
- create a version in marketplace https://marketplace.atlassian.com/manage/plugins/com.baloise.confluence.digital-signature/versions and upload obr (from https://github.com/baloise/digital-signature/tree/gh-pages/release)
26 changes: 18 additions & 8 deletions development.txt → development.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
Install
# Install
https://www.atlassian.com/software/confluence/download-archives

Apache Commons FileUpload Bundle
- Apache Commons FileUpload Bundle
http://central.maven.org/maven2/commons-fileupload/commons-fileupload/1.3/commons-fileupload-1.3.jar
Atlassian PDK Install Plugin
- Atlassian PDK Install Plugin
http://maven-us.nuxeo.org/nexus/content/repositories/public/com/atlassian/pdkinstall/pdkinstall-plugin/0.6/pdkinstall-plugin-0.6.jar

License
## License
https://my.atlassian.com/products/index

Run
# Run
```shell script
set CATALINA_HOME=C:\Users\Public\dev\atlas\Confluence
set JPDA_ADDRESS=4444
set JPDA_TRANSPORT=dt_socket
%CATALINA_HOME%\bin\catalina.bat jpda start
```

http://127.0.0.1:8090/
```shell script
atlas-install-plugin -p 8090 --context-path / --plugin-key com.baloise.confluence.digital-signature
```

or uncomment the atlassian-pdk configuration in pom.xml and use
mvn package confluence:install

-------------------

Pure Maven setup ( not for the faint of heart, starup is slow on my box)
Pure Maven setup (not for the faint of heart, startup is slow on my box)
you will be able to remote debug on port 5005

```shell script
mvn confluence:debug -Dproduct.version=7.4.0
```

To redeploy use
```shell script
mvn package confluence:install -Dproduct.version=7.4.0
```

As smtp server use
https://mailtrap.io/
As smtp server use `https://mailtrap.io/`
8 changes: 3 additions & 5 deletions docs/privacy-policy.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
We do not transfer or store any data outside your Atlassian product.

We have no access to any data your stored within your Atlassian product.

You data is yours - no strings attached.
- We do not transfer or store any data outside your Atlassian product.
- We have no access to any data you stored within your Atlassian product.
- Your data is yours - no strings attached.
2 changes: 1 addition & 1 deletion icon/CREDITS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Icon made by http://www.flaticon.com/authors/freepik
Icon made by http://www.flaticon.com/authors/freepik
14 changes: 12 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.baloise.confluence</groupId>
<artifactId>digital-signature</artifactId>
<version>7.0.1</version>
<version>7.0.2</version>
<organization>
<name>Baloise</name>
<url>http://www.baloise.ch/</url>
Expand Down Expand Up @@ -37,7 +37,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -111,6 +111,15 @@

<build>
<plugins>
<!--
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>atlassian-pdk</artifactId>
<configuration>
<serverUrl>http://localhost:8090/</serverUrl>
</configuration>
</plugin>
-->
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>confluence-maven-plugin</artifactId>
Expand All @@ -120,6 +129,7 @@
<productVersion>${confluence.version}</productVersion>
<productDataVersion>${confluence.data.version}</productDataVersion>
<enableQuickReload>false</enableQuickReload>
<extractDependencies>false</extractDependencies>
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<!-- Add package to export here -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,76 +1,69 @@
package com.baloise.confluence.digitalsignature;

import static java.lang.String.format;

import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;

import com.atlassian.sal.api.user.UserManager;
import com.atlassian.sal.api.user.UserProfile;
import com.baloise.confluence.digitalsignature.sal.DummyProfile;

import java.util.*;
import java.util.Map.Entry;
import java.util.function.Function;

import static java.lang.String.format;

public class ContextHelper {
public Object getOrderedSignatures(Signature signature) {
Comparator<Entry<String, Date>> comparator = new Comparator<Entry<String, Date>>() {
@Override
public int compare(Entry<String, Date> s1, Entry<String, Date> s2) {
int ret = s1.getValue().compareTo(s2.getValue());
return ret == 0 ? s1.getKey().compareTo(s2.getKey()) : ret;
}
};
SortedSet<Entry<String, Date>> ret = new TreeSet<Map.Entry<String,Date>>(comparator);
ret.addAll(signature.getSignatures().entrySet());
return ret;
}
public <K,V> Map<K,V> union(Map<K,V> ...maps) {
Map<K,V> union = new HashMap<K,V>();
for (Map<K, V> map : maps) {
union.putAll(map);
}
return union;
}

public <K> Set<K> union(Set<K> ...sets) {
Set<K> union = new HashSet<K>();
for (Set<K> set : sets) {
union.addAll(set);
}
return union;
}

public Map<String, UserProfile> getProfiles(UserManager userManager, Set<String> userNames) {
Map<String, UserProfile> ret = new HashMap<String, UserProfile>();
if(Signature.isPetitionMode(userNames)) return ret;
for (String userName : userNames) {
ret.put(userName, getProfileNotNull(userManager, userName));
}
return ret;
}
public UserProfile getProfileNotNull(UserManager userManager, String userName) {
UserProfile profile = userManager.getUserProfile(userName);
return profile == null ? new DummyProfile(userName) : profile;
}

public SortedSet<UserProfile> getOrderedProfiles(UserManager userManager, Set<String> userNames) {
SortedSet<UserProfile> ret = new TreeSet<UserProfile>(new UserProfileByName());
if(Signature.isPetitionMode(userNames)) return ret;
for (String userName : userNames) {
ret.add(getProfileNotNull(userManager, userName));
}
return ret;
}
public String mailTo(UserProfile profile) {
return format("%s<%s>", profile.getFullName().trim(), profile.getEmail().trim());
}
public boolean hasEmail(UserProfile profile) {
return profile != null && profile.getEmail() != null && !profile.getEmail().trim().isEmpty();
}

public Object getOrderedSignatures(Signature signature) {
SortedSet<Entry<String, Date>> ret = new TreeSet<>(Comparator.comparing((Function<Entry<String, Date>, Date>) Entry::getValue)
.thenComparing(Entry::getKey));
ret.addAll(signature.getSignatures().entrySet());
return ret;
}

@SafeVarargs
public final <K, V> Map<K, V> union(Map<K, V>... maps) {
Map<K, V> union = new HashMap<>();
for (Map<K, V> map : maps) {
union.putAll(map);
}
return union;
}

@SafeVarargs
public final <K> Set<K> union(Set<K>... sets) {
Set<K> union = new HashSet<>();
for (Set<K> set : sets) {
union.addAll(set);
}
return union;
}

public Map<String, UserProfile> getProfiles(UserManager userManager, Set<String> userNames) {
Map<String, UserProfile> ret = new HashMap<>();
if (Signature.isPetitionMode(userNames)) return ret;
for (String userName : userNames) {
ret.put(userName, getProfileNotNull(userManager, userName));
}
return ret;
}

public UserProfile getProfileNotNull(UserManager userManager, String userName) {
UserProfile profile = userManager.getUserProfile(userName);
return profile == null ? new DummyProfile(userName) : profile;
}

public SortedSet<UserProfile> getOrderedProfiles(UserManager userManager, Set<String> userNames) {
SortedSet<UserProfile> ret = new TreeSet<>(new UserProfileByName());
if (Signature.isPetitionMode(userNames)) return ret;
for (String userName : userNames) {
ret.add(getProfileNotNull(userManager, userName));
}
return ret;
}

public String mailTo(UserProfile profile) {
return format("%s<%s>", profile.getFullName().trim(), profile.getEmail().trim());
}

public boolean hasEmail(UserProfile profile) {
return profile != null && profile.getEmail() != null && !profile.getEmail().trim().isEmpty();
}
}
Loading

0 comments on commit 9d584cb

Please sign in to comment.