SFDC: 調べ物のベースプチアプリ
前提:Account にカスタム項目 TextItem01, TextItem02, TextItem03 を TEXT(40) で追加すること。
Apex
public class WhitespaceInvestigateController { public Account acnt { get; private set; } public WhitespaceInvestigateController() { List<Account> acnts = Database.query( 'SELECT Id, TextItem01__c, TextItem02__c, TextItem03__c FROM Account ORDER BY LastModifiedDate DESC LIMIT 1'); acnt = acnts[0]; ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'on load: TextItem01__c:['+acnt.TextItem01__c+'], TextItem02__c:['+acnt.TextItem02__c+'], TextItem03__c:['+acnt.TextItem03__c+'].')); } public PageReference save() { ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'before save: TextItem01__c:['+acnt.TextItem01__c+'], TextItem02__c:['+acnt.TextItem02__c+'], TextItem03__c:['+acnt.TextItem03__c+'].')); update acnt; ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, 'after save: TextItem01__c:['+acnt.TextItem01__c+'], TextItem02__c:['+acnt.TextItem02__c+'], TextItem03__c:['+acnt.TextItem03__c+'].')); return null; } }
Visualforce
<apex:page controller="WhitespaceInvestigateController"> <apex:form > <apex:pageBlock title="ホワイトスペース調査ページ"> <apex:pageMessages /> <apex:pageblockSection > <apex:inputfield value="{!acnt.TextItem01__c}" /> <apex:inputtext value="{!acnt.TextItem02__c}" /> <apex:inputtextarea value="{!acnt.TextItem03__c}" /> </apex:pageblockSection> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save" /> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
TypeScript のインストール
sudo npm install -g typescript
Ubuntu 16.04 に Node.js をインストール
apt ラインに追加
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
Node.js のインストール
sudo apt-get install nodejs
ビルドツールの念押しインストール
sudo apt-get install -y build-essential
いがぴょんの日記v3 に移行
※このコンテンツの最新版はここにあります。
いがぴょんの日記は、 github に移行して「いがぴょんの日記v3」にバージョンアップしました。
Java アプリの jar 利用の依存ファイルを target/lib に複写する
アプリで jar を使いたくなった時には、依存関係というのを指定すると追加することができますが、このファイルを target/lib に複写するための方法をメモします。
<plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <phase>install</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> </configuration> </execution> </executions> </plugin>
Java アプリに jar 利用の依存関係を追加する
アプリで jar を使いたくなった時には、依存関係というのを指定すると追加することができます。
<dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency>
Java アプリのコンパイルバージョンを指定する
コンパイル時のコンパイラバージョン指定方法をメモします。現時点では Java のバイナリレベルは 1.6 で止めてしまうのが頭の良い選択と考えています。以下を
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.0</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin>