This repository has been archived by the owner on Sep 21, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rafa Hernandez <rhernandez@teclib.com>
- Loading branch information
Showing
4 changed files
with
149 additions
and
2 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
app/src/main/java/org/flyve/mdm/agent/data/database/MDMLogData.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,55 @@ | ||
/* | ||
* Copyright Teclib. All rights reserved. | ||
* | ||
* This file is part of flyve-mdm-android | ||
* | ||
* flyve-mdm-android is a subproject of Flyve MDM. Flyve MDM is a mobile | ||
* device management software. | ||
* | ||
* Flyve MDM is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 3 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* Flyve MDM 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 General Public License for more details. | ||
* ------------------------------------------------------------------------------ | ||
* @author @rafaelje | ||
* @copyright Copyright Teclib. All rights reserved. | ||
* @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html | ||
* @link https://github.com/flyve-mdm/flyve-mdm-android | ||
* @link https://flyve-mdm.com | ||
* ------------------------------------------------------------------------------ | ||
*/ | ||
|
||
package org.flyve.mdm.agent.data.database; | ||
|
||
import android.content.Context; | ||
|
||
import org.flyve.mdm.agent.data.database.entity.MDMLog; | ||
import org.flyve.mdm.agent.data.database.setup.AppDataBase; | ||
|
||
public class MDMLogData { | ||
|
||
private AppDataBase dataBase; | ||
|
||
public MDMLogData(Context context) { | ||
dataBase = AppDataBase.getAppDatabase(context); | ||
} | ||
|
||
public MDMLog[] getAllFiles() { | ||
return dataBase.MDMLogDao().loadAll(); | ||
} | ||
|
||
public void deleteAll() { | ||
dataBase.MDMLogDao().deleteAll(); | ||
} | ||
|
||
public void addLog(String message) { | ||
MDMLog log = new MDMLog(); | ||
log.description = message; | ||
dataBase.MDMLogDao().insert(log); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
app/src/main/java/org/flyve/mdm/agent/data/database/dao/MDMLogDao.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,47 @@ | ||
/* | ||
* Copyright Teclib. All rights reserved. | ||
* | ||
* Flyve MDM is a mobile device management software. | ||
* | ||
* Flyve MDM is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 3 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* Flyve MDM 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 General Public License for more details. | ||
* ------------------------------------------------------------------------------ | ||
* @author Rafael Hernandez | ||
* @copyright Copyright Teclib. All rights reserved. | ||
* @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html | ||
* @link https://github.com/flyve-mdm/android-mdm-agent | ||
* @link https://flyve-mdm.com | ||
* ------------------------------------------------------------------------------ | ||
*/ | ||
|
||
package org.flyve.mdm.agent.data.database.dao; | ||
|
||
import android.arch.persistence.room.Dao; | ||
import android.arch.persistence.room.Insert; | ||
import android.arch.persistence.room.Query; | ||
import android.arch.persistence.room.Update; | ||
|
||
import org.flyve.mdm.agent.data.database.entity.MDMLog; | ||
|
||
@Dao | ||
public interface MDMLogDao { | ||
|
||
@Insert | ||
void insert(MDMLog... log); | ||
|
||
@Update | ||
void update(MDMLog... log); | ||
|
||
@Query("SELECT * FROM log") | ||
MDMLog[] loadAll(); | ||
|
||
@Query("DELETE FROM log") | ||
void deleteAll(); | ||
} |
42 changes: 42 additions & 0 deletions
42
app/src/main/java/org/flyve/mdm/agent/data/database/entity/MDMLog.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,42 @@ | ||
/* | ||
* Copyright Teclib. All rights reserved. | ||
* | ||
* Flyve MDM is a mobile device management software. | ||
* | ||
* Flyve MDM is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 3 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* Flyve MDM 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 General Public License for more details. | ||
* ------------------------------------------------------------------------------ | ||
* @author Rafael Hernandez | ||
* @copyright Copyright Teclib. All rights reserved. | ||
* @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html | ||
* @link https://github.com/flyve-mdm/android-mdm-agent | ||
* @link https://flyve-mdm.com | ||
* ------------------------------------------------------------------------------ | ||
*/ | ||
|
||
package org.flyve.mdm.agent.data.database.entity; | ||
|
||
import android.arch.persistence.room.ColumnInfo; | ||
import android.arch.persistence.room.Entity; | ||
import android.arch.persistence.room.PrimaryKey; | ||
|
||
@Entity (tableName = "log") | ||
public class MDMLog { | ||
|
||
@PrimaryKey (autoGenerate = true) | ||
@ColumnInfo (name = "id") | ||
public int id; | ||
|
||
@ColumnInfo (name = "description") | ||
public String description; | ||
|
||
@ColumnInfo (name = "type") | ||
public String type; | ||
} |
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