use of com.google.api.services.cloudresourcemanager.v3.model.Project in project uPMT by coco35700.
the class Main method start.
public void start(Stage primaryStage) throws IOException {
loadProperties();
initProjects();
createBasicSchema();
/*if(!projects.isEmpty()){
currentProject = projects.getFirst();
//System.out.println(currentProject.getSchemaProjet());
}
else {
currentProject = new Projet("projetTMP", new Schema("SchemaTemporaire"));
}*/
currentProject = new Project("--emptyProject--", new Schema("SchemaTemporaire"));
this.primaryStage = primaryStage;
this.primaryStage.setTitle(_langBundle.getString("main_title"));
// Launching layouts
initRootLayout();
showLaunchingScreen();
}
use of com.google.api.services.cloudresourcemanager.v3.model.Project in project uPMT by coco35700.
the class Main method initProjects.
/**
* Method used to load all the projects
*/
private void initProjects() {
this.projects = new LinkedList<Project>();
LoadDataProjects dc = LoadDataProjects.instance();
dc.setProjets(projects);
if (Utils.checkRecovery()) {
this.mainViewController.alertRecovery();
}
Utils.loadProjects(projects, this);
}
use of com.google.api.services.cloudresourcemanager.v3.model.Project in project uPMT by coco35700.
the class Utils method loadProjects.
public static void loadProjects(LinkedList<Project> projects, Main main) {
HashSet<String> projectNames = loadProjectsNames();
if (projectNames.isEmpty()) {
// For debug purposes
// System.out.println("No projects to load");
} else {
System.out.println("Loading projects");
for (String s : projectNames) {
if (s.contains(Project.FORMAT)) {
// projects.add(Projet.load(s));
Project p = Project.loadData(s);
if (p == null) {
Alert alert = new Alert(AlertType.CONFIRMATION);
// alert.setTitle("Error, version conflict");
alert.setTitle(main._langBundle.getString("error_version"));
// alert.setHeaderText("Your saves are in conflict with this new version.");
alert.setHeaderText(main._langBundle.getString("error_version_text_alarm"));
// alert.setContentText("Please contact us in the github repository.");
alert.setContentText(main._langBundle.getString("error_version_text_contact"));
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
alert.close();
} else {
alert.close();
}
} else
projects.add(p);
}
}
}
}
use of com.google.api.services.cloudresourcemanager.v3.model.Project in project java-docs-samples by GoogleCloudPlatform.
the class TestPermissions method testPermissions.
// Tests if the caller has the listed permissions.
public static void testPermissions(String projectId) {
// projectId = "my-project-id"
CloudResourceManager service = null;
try {
service = createCloudResourceManagerService();
} catch (IOException | GeneralSecurityException e) {
System.out.println("Unable to initialize service: \n" + e.toString());
return;
}
List<String> permissionsList = Arrays.asList("resourcemanager.projects.get", "resourcemanager.projects.delete");
TestIamPermissionsRequest requestBody = new TestIamPermissionsRequest().setPermissions(permissionsList);
try {
TestIamPermissionsResponse testIamPermissionsResponse = service.projects().testIamPermissions(projectId, requestBody).execute();
System.out.println("Of the permissions listed in the request, the caller has the following: " + testIamPermissionsResponse.getPermissions().toString());
} catch (IOException e) {
System.out.println("Unable to test permissions: \n" + e.toString());
}
}
use of com.google.api.services.cloudresourcemanager.v3.model.Project in project java-docs-samples by GoogleCloudPlatform.
the class AddMember method addMember.
// Adds a member to a preexisting role.
public static void addMember(Policy policy) {
// policy = service.Projects.GetIAmPolicy(new GetIamPolicyRequest(), your-project-id).Execute();
String role = "roles/existing-role";
String member = "user:member-to-add@example.com";
List<Binding> bindings = policy.getBindings();
for (Binding b : bindings) {
if (b.getRole().equals(role)) {
b.getMembers().add(member);
System.out.println("Member " + member + " added to role " + role);
return;
}
}
System.out.println("Role not found in policy; member not added");
}
Aggregations