Skip to content

Commit

Permalink
Crowdin Connector - Meeds-io/MIPs#121 (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
AzmiTouil authored May 31, 2024
2 parents 1cee91c + aeac56c commit ddf061a
Show file tree
Hide file tree
Showing 73 changed files with 6,575 additions and 26 deletions.
5 changes: 4 additions & 1 deletion gamification-crowdin-services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<artifactId>gamification-crowdin-service</artifactId>
<packaging>jar</packaging>
<name>Meeds:: Gamification Crowdin - Service</name>
<properties>
<exo.test.coverage.ratio>0.28</exo.test.coverage.ratio>
</properties>
<dependencies>
<dependency>
<groupId>org.exoplatform.social</groupId>
Expand All @@ -46,6 +49,6 @@
</dependency>
</dependencies>
<build>
<finalName>gamification-crowdin-service</finalName>
<finalName>${project.artifactId}</finalName>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.gamification.crowdin.dao;

import io.meeds.gamification.crowdin.entity.WebhookEntity;
import org.springframework.data.jpa.repository.JpaRepository;

public interface WebHookDAO extends JpaRepository<WebhookEntity, Long> {

WebhookEntity findWebhookEntityByProjectId(long projectId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.gamification.crowdin.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import jakarta.persistence.*;
import lombok.Data;
import org.exoplatform.commons.utils.StringListConverter;

@Entity(name = "CrowdinWebhooks")
@Table(name = "CROWDIN_WEBHOOKS")
@Data
public class WebhookEntity implements Serializable {

private static final long serialVersionUID = 2607146513663056421L;

@Id
@SequenceGenerator(name = "SEQ_CROWDIN_WEBHOOKS_ID", sequenceName = "SEQ_CROWDIN_WEBHOOKS_ID", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_CROWDIN_WEBHOOKS_ID")
@Column(name = "ID")
private Long id;

@Column(name = "WEBHOOK_ID")
private Long webhookId;

@Column(name = "PROJECT_ID", nullable = false)
private Long projectId;

@Column(name = "PROJECT_NAME", nullable = false)
private String projectName;

@Convert(converter = StringListConverter.class)
@Column(name = "TRIGGERS", nullable = false)
private List<String> triggers;

@Column(name = "ENABLED", nullable = false)
private Boolean enabled;

@Column(name = "WATCHED_DATE", nullable = false)
private Date watchedDate;

@Column(name = "WATCHED_BY", nullable = false)
private Long watchedBy;

@Column(name = "UPDATED_DATE", nullable = false)
private Date updatedDate;

@Column(name = "REFRESH_DATE", nullable = false)
private Date refreshDate;

@Column(name = "SECRET", nullable = false)
private String secret;

@Column(name = "TOKEN", nullable = false)
private String token;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.gamification.crowdin.exception;

public class CrowdinConnectionException extends Exception {

private static final long serialVersionUID = -2437500058122638710L;

public CrowdinConnectionException(String e) {
super(e);
}

public CrowdinConnectionException(String message, Exception e) {
super(message, e);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.gamification.crowdin.model;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
public class Event {

String name;

String sender;

String receiver;

String objectId;

String objectType;

String projectId;

String languageId;

boolean mustBeHuman;

String directoryId;

boolean isCancelling;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.gamification.crowdin.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RemoteDirectory {

private long id;

private long projectId;

private String path;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.gamification.crowdin.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RemoteLanguage {

private String id;

private String name;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.gamification.crowdin.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RemoteProject implements Cloneable {

private long id;

private String identifier;

private String name;

private String description;

private String avatarUrl;

private List<RemoteLanguage> languages;

@Override
public RemoteProject clone() { // NOSONAR
return new RemoteProject(id, identifier, name, description, avatarUrl, languages);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 Meeds Association [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.meeds.gamification.crowdin.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class WebHook implements Cloneable {

private long id;

private long webhookId;

private long projectId;

private String projectName;

private List<String> triggers;

private Boolean enabled;

private String watchedDate;

private String watchedBy;

private String updatedDate;

private String refreshDate;

private String token;

private String secret;

public WebHook clone() { // NOSONAR
return new WebHook(id,
webhookId,
projectId,
projectName,
triggers,
enabled,
watchedDate,
watchedBy,
updatedDate,
refreshDate,
token,
secret);
}

}
Loading

0 comments on commit ddf061a

Please sign in to comment.