Package com.logicaldoc.core.security.apikey

# Class ApiKey

java.lang.Object
com.logicaldoc.core.PersistentObject
com.logicaldoc.core.security.apikey.ApiKey

All Implemented Interfaces:
  `Serializable`

@Entity public class ApiKey extends PersistentObject
A secret key to use when connecting to the Webservices API

Since:
  8.9.4
Author:
  Marco Meschieri - LogicalDOC
See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class com.logicaldoc.core.PersistentObject

`DELETED_CODE_DEFAULT, DELETED_CODE_STRONG, id`

## Constructor Summary

Constructors
Constructor
Description
`ApiKey()`
`ApiKey(long userId, String name)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object obj)`
`String`
`getDecodedKey()`
`String`
`getKey()`
`String`
`getLabel()`
`Date`
`getLastUsed()`
`String`
`getName()`
`long`
`getUserId()`
`int`
`hashCode()`
`void`
`setDecodedKey(String decodedKey)`
Sets the key and encode it
`void`
`setKey(String key)`
`void`
`setLabel(String label)`
`void`
`setLastUsed(Date lastUsed)`
`void`
`setName(String name)`
`void`
`setUserId(long userId)`
`String`
`toString()`

### Methods inherited from class com.logicaldoc.core.PersistentObject

`getCreation, getDeleted, getId, getLastModified, getRecordVersion, getTenantId, setCreation, setDeleted, setId, setLastModified, setRecordVersion, setTenantId`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ApiKey

public ApiKey()

### ApiKey

public ApiKey(long userId, String name)

## Method Details

### getUserId

public long getUserId()

### getName

public String getName()

### getLastUsed

public Date getLastUsed()

### getKey

public String getKey()

### setUserId

public void setUserId(long userId)

### setName

public void setName(String name)

### setLastUsed

public void setLastUsed(Date lastUsed)

### setKey

public void setKey(String key)

### getDecodedKey

public String getDecodedKey()

### setDecodedKey

public void setDecodedKey(String decodedKey) throws NoSuchAlgorithmException
Sets the key and encode it

Parameters:
  `decodedKey` - The key in readable format
Throws:
  `NoSuchAlgorithmException` - Cripting error

### getLabel

public String getLabel()

### setLabel

public void setLabel(String label)

### toString

public String toString()

Overrides:
  `toString` in class `PersistentObject`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `PersistentObject`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `PersistentObject`