appData = $this->appDataFactory->get('dav');
}
public function setEnableDefaultContact($allow) {
if ($allow === 'yes' && !$this->defaultContactExists()) {
try {
$this->setCard();
} catch (\Exception $e) {
$this->logger->error('Could not create default contact', ['exception' => $e]);
return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
}
}
$this->config->setAppValue(Application::APP_ID, 'enableDefaultContact', $allow);
return new JSONResponse([], Http::STATUS_OK);
}
public function setDefaultContact(?string $contactData = null) {
if (!$this->config->getAppValue(Application::APP_ID, 'enableDefaultContact', 'no')) {
return new JSONResponse([], Http::STATUS_FORBIDDEN);
}
$this->setCard($contactData);
return new JSONResponse([], Http::STATUS_OK);
}
private function setCard(?string $cardData = null) {
try {
$folder = $this->appData->getFolder('defaultContact');
} catch (NotFoundException $e) {
$folder = $this->appData->newFolder('defaultContact');
}
if (is_null($cardData)) {
$cardData = file_get_contents(__DIR__ . '/../ExampleContentFiles/exampleContact.vcf');
}
if (!$cardData) {
throw new \Exception('Could not read exampleContact.vcf');
}
$file = (!$folder->fileExists('defaultContact.vcf')) ? $folder->newFile('defaultContact.vcf') : $folder->getFile('defaultContact.vcf');
$file->putContent($cardData);
}
private function defaultContactExists(): bool {
try {
$folder = $this->appData->getFolder('defaultContact');
} catch (NotFoundException $e) {
return false;
}
return $folder->fileExists('defaultContact.vcf');
}
}
plugin-3.5.0'>dependabot/maven/org.apache.maven.plugins-maven-javadoc-plugin-3.5.0
blob: 8c9001c89352f4d6a333149a59016f70f7aae704 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import java.lang.annotation.*;
public class ByteValueMatching {
public static void main(String[] args) { }
@Anno(bval=123) public void methodOne() {}
@Anno(bval=27) public void methodTwo() {}
}
@interface Anno {
byte bval();
}
aspect X {
before(): execution(@Anno(bval=123) * *(..)) {}
}
|