Coverage Summary for Class: SQLPasswordStrings (com.acciente.oacc.sql.internal.persister)
| Class | Class, % | Method, % | Line, % | 
|---|---|---|---|
| SQLPasswordStrings | 100% (1/ 1) | 100% (2/ 2) | 100% (8/ 8) | 
1 /*
2  * Copyright 2009-2018, Acciente LLC
3  *
4  * Acciente LLC licenses this file to you under the
5  * Apache License, Version 2.0 (the "License"); you
6  * may not use this file except in compliance with the
7  * License. You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in
12  * writing, software distributed under the License is
13  * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
14  * OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing
16  * permissions and limitations under the License.
17  */
18 package com.acciente.oacc.sql.internal.persister;
19 
20 import java.io.Serializable;
21 
22 public class SQLPasswordStrings implements Serializable {
23    private static final long serialVersionUID = 1L;
24 
25    // SQL string constants
26 
27    // ResourcePassword
28    public final String SQL_findInResourcePassword_Password_BY_ResourceID;
29    public final String SQL_createInResourcePassword_WITH_ResourceID_Password;
30    public final String SQL_updateInResourcePassword_Password_BY_ResourceID;
31    public final String SQL_removeInResourcePassword_BY_ResourceID;
32 
33    public static SQLPasswordStrings getSQLPasswordStrings(String schemaName) {
34       return new SQLPasswordStrings(schemaName);
35    }
36 
37    private SQLPasswordStrings(String schemaName) {
38       final String schemaNameAndTablePrefix = schemaName != null ? schemaName + ".OAC_" : "OAC_";
39 
40       // GrantDomainCreatePermissionSys
41       SQL_findInResourcePassword_Password_BY_ResourceID
42             = "SELECT Password FROM "
43             + schemaNameAndTablePrefix
44             + "ResourcePassword WHERE ResourceId = ?";
45 
46       SQL_createInResourcePassword_WITH_ResourceID_Password
47             = "INSERT INTO "
48             + schemaNameAndTablePrefix
49             + "ResourcePassword ( ResourceId, Password ) VALUES ( ?, ? )";
50 
51       SQL_updateInResourcePassword_Password_BY_ResourceID
52             = "UPDATE " + schemaNameAndTablePrefix + "ResourcePassword SET Password = ? WHERE ResourceId = ?";
53 
54       SQL_removeInResourcePassword_BY_ResourceID
55             = "DELETE FROM " + schemaNameAndTablePrefix + "ResourcePassword WHERE ResourceId = ?";
56    }
57 }