-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Valentin BAIZEAU
authored and
Valentin BAIZEAU
committed
Jul 4, 2019
1 parent
04cd43c
commit 6753db1
Showing
13 changed files
with
196 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...sync-api/src/main/java/org/piwigo/remotesync/legacy/PwgSessionGetStatusRequestLegacy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2014 Matthieu Helleboid. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the GNU Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | ||
* | ||
* Contributors: | ||
* Matthieu Helleboid - initial API and implementation | ||
******************************************************************************/ | ||
package org.piwigo.remotesync.legacy; | ||
|
||
import org.piwigo.remotesync.api.request.AbstractRequest; | ||
|
||
/** | ||
Gets information about the current session. Also provides a token useable with admin methods. | ||
**/ | ||
@org.piwigo.remotesync.generator.Generated | ||
public class PwgSessionGetStatusRequestLegacy extends AbstractRequest<PwgSessionGetStatusResponseLegacy> { | ||
|
||
public PwgSessionGetStatusRequestLegacy() { | ||
} | ||
|
||
public boolean isNeedPwgToken() { | ||
return false; | ||
} | ||
|
||
public boolean isAdminOnly() { | ||
return false; | ||
}; | ||
|
||
public boolean isPostOnly() { | ||
return false; | ||
}; | ||
|
||
public String getWSMethodName() { | ||
return "pwg.session.getStatus"; | ||
} | ||
|
||
public Class<PwgSessionGetStatusResponseLegacy> getReturnType() { | ||
return PwgSessionGetStatusResponseLegacy.class; | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...ync-api/src/main/java/org/piwigo/remotesync/legacy/PwgSessionGetStatusResponseLegacy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2014 Matthieu Helleboid. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the GNU Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | ||
* | ||
* Contributors: | ||
* Matthieu Helleboid - initial API and implementation | ||
******************************************************************************/ | ||
package org.piwigo.remotesync.legacy; | ||
|
||
|
||
import org.piwigo.remotesync.api.Constants; | ||
import org.piwigo.remotesync.api.response.BasicResponse; | ||
import org.simpleframework.xml.Element; | ||
|
||
public class PwgSessionGetStatusResponseLegacy extends BasicResponse { | ||
@Element | ||
public String username; | ||
|
||
@Element | ||
public String status; | ||
|
||
@Element | ||
public String theme; | ||
|
||
@Element | ||
public String language; | ||
|
||
@Element | ||
public String pwg_token; | ||
|
||
@Element | ||
public String charset; | ||
|
||
@Element | ||
public String current_datetime; | ||
|
||
@Element(required=false) | ||
public String version; | ||
|
||
@Element(required=false) | ||
public String upload_file_types; | ||
|
||
@Element(required=false) | ||
public String upload_form_chunk_size; | ||
|
||
public boolean isAdmin() { | ||
return Constants.UserType.admin.toString().equals(status) || Constants.UserType.webmaster.toString().equals(status); | ||
} | ||
|
||
public boolean isGuest() { | ||
return Constants.UserType.guest.toString().equals(status); | ||
} | ||
|
||
public boolean isLogged() { | ||
return !isGuest(); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
remotesync-api/src/main/java/org/piwigo/remotesync/legacy/VersionParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2014 Matthieu Helleboid. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the GNU Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | ||
* | ||
* Contributors: | ||
* Matthieu Helleboid - initial API and implementation | ||
******************************************************************************/ | ||
package org.piwigo.remotesync.legacy; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
public class VersionParser | ||
{ | ||
|
||
private int major; | ||
private int minor; | ||
private int build; | ||
|
||
public void parseVersion(String version) | ||
{ | ||
String[] parts = version.split(Pattern.quote(".")); | ||
|
||
major = Integer.parseInt(parts[0]); | ||
minor = Integer.parseInt(parts[1]); | ||
build = Integer.parseInt(parts[2]); | ||
} | ||
|
||
public int getMajorVersion() | ||
{ | ||
return (major); | ||
} | ||
|
||
public int getMinorVersion() | ||
{ | ||
return (minor); | ||
} | ||
|
||
public int getBuildVersion() | ||
{ | ||
return (build); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters